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.

179 lines
5.1 KiB

10 months ago
10 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/residual_get_resolution_and_eff_data.py
  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. import glob
  15. from RecoConf.mc_checking import (
  16. check_track_resolution,
  17. check_tracking_efficiency,
  18. get_mc_categories,
  19. get_hit_type_mask,
  20. make_links_lhcbids_mcparticles_tracking_system,
  21. make_links_tracks_mcparticles,
  22. )
  23. from RecoConf.core_algorithms import make_unique_id_generator
  24. from RecoConf.hlt2_tracking import make_res_hlt2_tracks
  25. from RecoConf.hlt1_tracking import (
  26. make_VeloClusterTrackingSIMD_hits,
  27. make_PrStorePrUTHits_hits,
  28. make_PrStoreSciFiHits_hits,
  29. get_global_materiallocator,
  30. )
  31. # sample = "DstD0EE_MD"
  32. # sample = "Bd2KstEE_MD"
  33. # sample = "Bd2KstEE_MU"
  34. # sample = "Bs2JpsiPhi_MD"
  35. # sample = "Bs2JpsiPhi_MU"
  36. # sample = "Bs2PhiPhi_MD"
  37. # sample = "Bs2PhiPhi_MU"
  38. decay = "D"
  39. options.evt_max = -1
  40. options.ntuple_file = f"data/resolutions_and_effs_{decay}_with_electron_weights_as_residual_mergedmatch.root"
  41. options.input_type = "ROOT"
  42. if decay == "B":
  43. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  44. elif decay == "D":
  45. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  46. elif decay == "test":
  47. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  48. options.dddb_tag = "dddb-20210617"
  49. options.conddb_tag = "sim-20210617-vc-md100"
  50. options.simulation = True
  51. def run_tracking_resolution():
  52. tracks = make_res_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  53. fitted_forward_tracks = PrKalmanFilter(
  54. Input=tracks["Forward"]["Pr"],
  55. MaxChi2=2.8,
  56. MaxChi2PreOutlierRemoval=20,
  57. HitsVP=make_VeloClusterTrackingSIMD_hits(),
  58. HitsUT=make_PrStorePrUTHits_hits(),
  59. HitsFT=make_PrStoreSciFiHits_hits(),
  60. ReferenceExtrapolator=TrackMasterExtrapolator(
  61. MaterialLocator=get_global_materiallocator(),
  62. ),
  63. InputUniqueIDGenerator=make_unique_id_generator(),
  64. ).OutputTracks
  65. links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
  66. links_to_forward = make_links_tracks_mcparticles(
  67. InputTracks=tracks["Forward"],
  68. LinksToLHCbIDs=links_to_lhcbids,
  69. )
  70. links_to_match = make_links_tracks_mcparticles(
  71. InputTracks=tracks["Match"],
  72. LinksToLHCbIDs=links_to_lhcbids,
  73. )
  74. links_to_mergedmatch = make_links_tracks_mcparticles(
  75. InputTracks=tracks["MergedMatch"],
  76. LinksToLHCbIDs=links_to_lhcbids,
  77. )
  78. links_to_best = make_links_tracks_mcparticles(
  79. InputTracks=tracks["BestLong"],
  80. LinksToLHCbIDs=links_to_lhcbids,
  81. )
  82. links_to_seed = make_links_tracks_mcparticles(
  83. InputTracks=tracks["Seed"],
  84. LinksToLHCbIDs=links_to_lhcbids,
  85. )
  86. res_checker_forward = check_track_resolution(
  87. tracks["Forward"],
  88. suffix="Forward",
  89. )
  90. res_checker_best_long = check_track_resolution(
  91. tracks["BestLong"],
  92. suffix="BestLong",
  93. )
  94. res_checker_best_forward = check_track_resolution(
  95. dict(v1=fitted_forward_tracks),
  96. suffix="BestForward",
  97. )
  98. res_checker_seed = check_track_resolution(
  99. tracks["Seed"],
  100. suffix="Seed",
  101. )
  102. eff_checker_forward = check_tracking_efficiency(
  103. "Forward",
  104. tracks["Forward"],
  105. links_to_forward,
  106. links_to_lhcbids,
  107. get_mc_categories("Forward"),
  108. get_hit_type_mask("Forward"),
  109. )
  110. eff_checker_match = check_tracking_efficiency(
  111. "DefaultMatch",
  112. tracks["Match"],
  113. links_to_match,
  114. links_to_lhcbids,
  115. get_mc_categories("Match"),
  116. get_hit_type_mask("Match"),
  117. )
  118. eff_checker_mergedmatch = check_tracking_efficiency(
  119. "Match",
  120. tracks["MergedMatch"],
  121. links_to_mergedmatch,
  122. links_to_lhcbids,
  123. get_mc_categories("Match"),
  124. get_hit_type_mask("Match"),
  125. )
  126. eff_checker_best_long = check_tracking_efficiency(
  127. "BestLong",
  128. tracks["BestLong"],
  129. links_to_best,
  130. links_to_lhcbids,
  131. get_mc_categories("BestLong"),
  132. get_hit_type_mask("BestLong"),
  133. )
  134. eff_checker_seed = check_tracking_efficiency(
  135. "Seed",
  136. tracks["Seed"],
  137. links_to_seed,
  138. links_to_lhcbids,
  139. get_mc_categories("Seed"),
  140. get_hit_type_mask("Seed"),
  141. )
  142. data = [
  143. res_checker_forward,
  144. res_checker_best_long,
  145. res_checker_best_forward,
  146. res_checker_seed,
  147. eff_checker_forward,
  148. eff_checker_match,
  149. eff_checker_mergedmatch,
  150. eff_checker_best_long,
  151. eff_checker_seed,
  152. ]
  153. return Reconstruction("run_tracking_debug", data)
  154. run_reconstruction(options, run_tracking_resolution)