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.

185 lines
5.6 KiB

10 months ago
8 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. # flake8: noqa
  2. """
  3. This set of options is used for reconstruction development purposes,
  4. and assumes that the input contains MCHits (i.e. is of `Exended`
  5. DST/digi type).
  6. author: Furkan Cetin
  7. date: 10/2023
  8. Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_resolution_and_eff_data.py | tee /work/cetin/LHCb/reco_tuner/efficiencies/logs/effs_B_baseline.log
  9. """
  10. from Moore import options, run_reconstruction
  11. from Moore.config import Reconstruction
  12. from PyConf.Algorithms import PrKalmanFilter
  13. from PyConf.Tools import TrackMasterExtrapolator
  14. from RecoConf.event_filters import require_gec
  15. import glob
  16. from RecoConf.mc_checking import (
  17. check_track_resolution,
  18. check_tracking_efficiency,
  19. get_mc_categories,
  20. get_hit_type_mask,
  21. make_links_lhcbids_mcparticles_tracking_system,
  22. make_links_tracks_mcparticles,
  23. get_track_checkers,
  24. )
  25. from RecoConf.core_algorithms import make_unique_id_generator
  26. from RecoConf.hlt2_tracking import make_hlt2_tracks
  27. from RecoConf.hlt1_tracking import (
  28. make_VeloClusterTrackingSIMD_hits,
  29. make_PrStorePrUTHits_hits,
  30. make_PrStoreSciFiHits_hits,
  31. get_global_materiallocator,
  32. )
  33. decay = "testJpsi"
  34. options.evt_max = -1
  35. options.ntuple_file = (
  36. f"/work/cetin/LHCb/reco_tuner/efficiencies/effs_{decay}_EDef_yCorrNoCut.root"
  37. )
  38. options.input_type = "ROOT"
  39. if decay == "B":
  40. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  41. elif decay == "BJpsi":
  42. options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
  43. elif decay == "D":
  44. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  45. elif decay == "testJpsi":
  46. options.input_files = [
  47. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi",
  48. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000059_1.xdigi",
  49. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000020_1.xdigi",
  50. ]
  51. elif decay == "test":
  52. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  53. options.dddb_tag = "dddb-20210617"
  54. options.conddb_tag = "sim-20210617-vc-md100"
  55. options.simulation = True
  56. options.output_level = 3
  57. def run_tracking_resolution():
  58. tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  59. # fitted_forward_tracks = PrKalmanFilter(
  60. # Input=tracks["Forward"]["Pr"],
  61. # MaxChi2=2.8,
  62. # MaxChi2PreOutlierRemoval=20,
  63. # HitsVP=make_VeloClusterTrackingSIMD_hits(),
  64. # HitsUT=make_PrStorePrUTHits_hits(),
  65. # HitsFT=make_PrStoreSciFiHits_hits(),
  66. # ReferenceExtrapolator=TrackMasterExtrapolator(
  67. # MaterialLocator=get_global_materiallocator(),
  68. # ),
  69. # InputUniqueIDGenerator=make_unique_id_generator(),
  70. # ).OutputTracks
  71. links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
  72. links_to_forward = make_links_tracks_mcparticles(
  73. InputTracks=tracks["Forward"],
  74. LinksToLHCbIDs=links_to_lhcbids,
  75. )
  76. links_to_match = make_links_tracks_mcparticles(
  77. InputTracks=tracks["Match"],
  78. LinksToLHCbIDs=links_to_lhcbids,
  79. )
  80. links_to_best = make_links_tracks_mcparticles(
  81. InputTracks=tracks["BestLong"],
  82. LinksToLHCbIDs=links_to_lhcbids,
  83. )
  84. links_to_seed = make_links_tracks_mcparticles(
  85. InputTracks=tracks["Seed"],
  86. LinksToLHCbIDs=links_to_lhcbids,
  87. )
  88. links_to_velo = make_links_tracks_mcparticles(
  89. InputTracks=tracks["Velo"],
  90. LinksToLHCbIDs=links_to_lhcbids,
  91. )
  92. # res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
  93. # res_checker_best_long = check_track_resolution(
  94. # tracks["BestLong"],
  95. # suffix="BestLong",
  96. # )
  97. # res_checker_best_forward = check_track_resolution(
  98. # dict(v1=fitted_forward_tracks),
  99. # suffix="BestForward",
  100. # )
  101. # res_checker_seed = check_track_resolution(
  102. # tracks["Seed"],
  103. # suffix="Seed",
  104. # )
  105. eff_checker_forward = check_tracking_efficiency(
  106. "Forward",
  107. tracks["Forward"],
  108. links_to_forward,
  109. links_to_lhcbids,
  110. get_mc_categories("Forward"),
  111. get_hit_type_mask("Forward"),
  112. )
  113. eff_checker_match = check_tracking_efficiency(
  114. "Match",
  115. tracks["Match"],
  116. links_to_match,
  117. links_to_lhcbids,
  118. get_mc_categories("Match"),
  119. get_hit_type_mask("Match"),
  120. )
  121. eff_checker_best_long = check_tracking_efficiency(
  122. "BestLong",
  123. tracks["BestLong"],
  124. links_to_best,
  125. links_to_lhcbids,
  126. get_mc_categories("BestLong"),
  127. get_hit_type_mask("BestLong"),
  128. )
  129. eff_checker_seed = check_tracking_efficiency(
  130. "Seed",
  131. tracks["Seed"],
  132. links_to_seed,
  133. links_to_lhcbids,
  134. get_mc_categories("Seed"),
  135. get_hit_type_mask("Seed"),
  136. )
  137. eff_checker_velo = check_tracking_efficiency(
  138. "Velo",
  139. tracks["Velo"],
  140. links_to_velo,
  141. links_to_lhcbids,
  142. get_mc_categories("Velo"),
  143. get_hit_type_mask("Velo"),
  144. )
  145. # types_and_locations_for_checkers = {
  146. # "Forward": tracks["Forward"],
  147. # "Seed": tracks["Seed"],
  148. # "Match": tracks["Match"],
  149. # }
  150. # data = []
  151. # data += get_track_checkers(types_and_locations_for_checkers)
  152. data = [
  153. # res_checker_forward,
  154. # res_checker_best_long,
  155. # res_checker_best_forward,
  156. # res_checker_seed,
  157. eff_checker_forward,
  158. eff_checker_match,
  159. eff_checker_best_long,
  160. eff_checker_seed,
  161. eff_checker_velo,
  162. ]
  163. return Reconstruction("run_tracking_debug", data, [require_gec()])
  164. run_reconstruction(options, run_tracking_resolution)