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.

172 lines
5.2 KiB

  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
  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 = f"/work/cetin/LHCb/reco_tuner/data_matching/sample4_data/resolutions_and_effs_{decay}_EFilter.root"
  36. options.input_type = "ROOT"
  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 = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  51. options.dddb_tag = "dddb-20210617"
  52. options.conddb_tag = "sim-20210617-vc-md100"
  53. options.simulation = True
  54. options.output_level = 3
  55. def run_tracking_resolution():
  56. tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  57. fitted_forward_tracks = PrKalmanFilter(
  58. Input=tracks["Forward"]["Pr"],
  59. MaxChi2=2.8,
  60. MaxChi2PreOutlierRemoval=20,
  61. HitsVP=make_VeloClusterTrackingSIMD_hits(),
  62. HitsUT=make_PrStorePrUTHits_hits(),
  63. HitsFT=make_PrStoreSciFiHits_hits(),
  64. ReferenceExtrapolator=TrackMasterExtrapolator(
  65. MaterialLocator=get_global_materiallocator(),
  66. ),
  67. InputUniqueIDGenerator=make_unique_id_generator(),
  68. ).OutputTracks
  69. links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
  70. links_to_forward = make_links_tracks_mcparticles(
  71. InputTracks=tracks["Forward"],
  72. LinksToLHCbIDs=links_to_lhcbids,
  73. )
  74. links_to_match = make_links_tracks_mcparticles(
  75. InputTracks=tracks["Match"],
  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(tracks["Forward"], suffix="Forward")
  87. res_checker_best_long = check_track_resolution(
  88. tracks["BestLong"],
  89. suffix="BestLong",
  90. )
  91. res_checker_best_forward = check_track_resolution(
  92. dict(v1=fitted_forward_tracks),
  93. suffix="BestForward",
  94. )
  95. res_checker_seed = check_track_resolution(
  96. tracks["Seed"],
  97. suffix="Seed",
  98. )
  99. eff_checker_forward = check_tracking_efficiency(
  100. "Forward",
  101. tracks["Forward"],
  102. links_to_forward,
  103. links_to_lhcbids,
  104. get_mc_categories("Forward"),
  105. get_hit_type_mask("Forward"),
  106. )
  107. eff_checker_match = check_tracking_efficiency(
  108. "Match",
  109. tracks["Match"],
  110. links_to_match,
  111. links_to_lhcbids,
  112. get_mc_categories("Match"),
  113. get_hit_type_mask("Match"),
  114. )
  115. eff_checker_best_long = check_tracking_efficiency(
  116. "BestLong",
  117. tracks["BestLong"],
  118. links_to_best,
  119. links_to_lhcbids,
  120. get_mc_categories("BestLong"),
  121. get_hit_type_mask("BestLong"),
  122. )
  123. eff_checker_seed = check_tracking_efficiency(
  124. "Seed",
  125. tracks["Seed"],
  126. links_to_seed,
  127. links_to_lhcbids,
  128. get_mc_categories("Seed"),
  129. get_hit_type_mask("Seed"),
  130. )
  131. # types_and_locations_for_checkers = {
  132. # "Forward": tracks["Forward"],
  133. # "Seed": tracks["Seed"],
  134. # "Match": tracks["Match"],
  135. # }
  136. # data = []
  137. # data += get_track_checkers(types_and_locations_for_checkers)
  138. data = [
  139. res_checker_forward,
  140. res_checker_best_long,
  141. res_checker_best_forward,
  142. res_checker_seed,
  143. eff_checker_forward,
  144. eff_checker_match,
  145. eff_checker_best_long,
  146. eff_checker_seed,
  147. ]
  148. return Reconstruction("run_tracking_debug", data, [require_gec()])
  149. run_reconstruction(options, run_tracking_resolution)