You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.3 KiB

  1. # flake8: noqa
  2. from Moore import options, run_reconstruction
  3. from RecoConf.hlt2_tracking import (
  4. make_hlt2_tracks,
  5. get_default_out_track_types_for_light_reco,
  6. get_global_ut_hits_tool,
  7. )
  8. from RecoConf.hlt1_tracking import make_all_pvs
  9. from RecoConf.event_filters import require_gec
  10. from RecoConf.mc_checking import (
  11. get_track_checkers,
  12. get_fitted_tracks_checkers,
  13. check_tracking_efficiency,
  14. make_links_lhcbids_mcparticles_tracking_system,
  15. make_links_tracks_mcparticles,
  16. get_mc_categories,
  17. get_hit_type_mask,
  18. )
  19. from Moore.config import Reconstruction
  20. from PyConf.Algorithms import (
  21. PrMatchNN,
  22. fromPrMatchTracksV1Tracks,
  23. PrTrackAssociator,
  24. )
  25. from PyConf.Tools import PrMCDebugForwardTool, PrMCDebugMatchToolNN
  26. from PyConf.application import make_data_with_FetchDataFromFile
  27. from RecoConf.data_from_file import mc_unpackers
  28. import Functors as F
  29. import glob
  30. decay = "BJpsi"
  31. options.evt_max = -1
  32. # options.ntuple_file = f"/work/cetin/LHCb/reco_tuner/efficiencies/electrons/best_effs_{decay}_Selection.root"
  33. # options.ntuple_file = f"data/best_effs_{decay}.root"
  34. options.ntuple_file = (
  35. f"/work/cetin/LHCb/reco_tuner/efficiencies/effs_{decay}_baseline_Selection.root"
  36. )
  37. if decay == "B":
  38. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  39. elif decay == "BJpsi":
  40. options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
  41. elif decay == "D":
  42. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  43. elif decay == "testJpsi":
  44. options.input_files = [
  45. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi",
  46. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000059_1.xdigi",
  47. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000020_1.xdigi",
  48. ]
  49. elif decay == "test":
  50. options.input_files = [
  51. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
  52. ]
  53. options.input_type = "ROOT"
  54. options.dddb_tag = "dddb-20210617"
  55. options.conddb_tag = "sim-20210617-vc-md100"
  56. options.simulation = True
  57. def standalone_hlt2_fastest_reco():
  58. links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
  59. hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  60. links_to_velo_tracks = PrTrackAssociator(
  61. SingleContainer=hlt2_tracks["Velo"]["v1"],
  62. LinkerLocationID=links_to_hits,
  63. MCParticleLocation=mc_unpackers()["MCParticles"],
  64. MCVerticesInput=mc_unpackers()["MCVertices"],
  65. ).OutputLocation
  66. links_to_seed_tracks = PrTrackAssociator(
  67. SingleContainer=hlt2_tracks["Seed"]["v1"],
  68. LinkerLocationID=links_to_hits,
  69. MCParticleLocation=mc_unpackers()["MCParticles"],
  70. MCVerticesInput=mc_unpackers()["MCVertices"],
  71. ).OutputLocation
  72. matching_params = dict(
  73. MaxdDist=0.1,
  74. MinMatchNN=0.215,
  75. PerfectTSelection=1.0,
  76. PerfectVeloSelection=1.0,
  77. # MinZMag=5100,
  78. # MaxZMag=5700,
  79. matchDebugOutput=0.0,
  80. )
  81. match_tracks = {}
  82. match_tracks["Pr"] = PrMatchNN(
  83. VeloInput=hlt2_tracks["Velo"]["Pr"],
  84. SeedInput=hlt2_tracks["Seed"]["Pr"],
  85. MatchDebugToolName=PrMCDebugMatchToolNN(
  86. VeloTracks=hlt2_tracks["Velo"]["v1"],
  87. SeedTracks=hlt2_tracks["Seed"]["v1"],
  88. VeloTrackLinks=links_to_velo_tracks,
  89. SeedTrackLinks=links_to_seed_tracks,
  90. TrackInfo=make_data_with_FetchDataFromFile(
  91. "/Event/MC/TrackInfo", "LHCb::MCProperty"
  92. ),
  93. MCParticles=mc_unpackers()["MCParticles"],
  94. ),
  95. AddUTHitsToolName=get_global_ut_hits_tool(),
  96. **matching_params,
  97. ).MatchOutput
  98. match_tracks["v1"] = fromPrMatchTracksV1Tracks(
  99. InputTracksLocation=match_tracks["Pr"],
  100. VeloTracksLocation=hlt2_tracks["Velo"]["v1"],
  101. SeedTracksLocation=hlt2_tracks["Seed"]["v1"],
  102. ).OutputTracksLocation
  103. data = [] # [match_tracks["Pr"]]
  104. # data = []
  105. types_and_locations_for_checkers = {
  106. "Velo": hlt2_tracks["Velo"],
  107. "Seed": hlt2_tracks["Seed"],
  108. "Match": match_tracks, # hlt2_tracks["Match"],
  109. }
  110. data += get_track_checkers(types_and_locations_for_checkers)
  111. # data += get_fitted_tracks_checkers(best_tracks)
  112. return Reconstruction("hlt2_reco", data, [require_gec()])
  113. run_reconstruction(options, standalone_hlt2_fastest_reco)