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.

168 lines
4.9 KiB

10 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
8 months ago
10 months ago
9 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 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
  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. 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. get_track_checkers,
  23. )
  24. from RecoConf.core_algorithms import make_unique_id_generator
  25. from RecoConf.hlt2_tracking import make_hlt2_tracks
  26. from RecoConf.hlt1_tracking import (
  27. make_VeloClusterTrackingSIMD_hits,
  28. make_PrStorePrUTHits_hits,
  29. make_PrStoreSciFiHits_hits,
  30. get_global_materiallocator,
  31. )
  32. decay = "test"
  33. options.evt_max = -1
  34. options.ntuple_file = f"data/resolutions_and_effs_{decay}_thesis.root"
  35. options.input_type = "ROOT"
  36. if decay == "B":
  37. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  38. elif decay == "BJpsi":
  39. options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
  40. elif decay == "D":
  41. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  42. elif decay == "test2":
  43. options.input_files = [
  44. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
  45. ]
  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. options.output_level = 3
  52. def run_tracking_resolution():
  53. tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  54. fitted_forward_tracks = PrKalmanFilter(
  55. Input=tracks["Forward"]["Pr"],
  56. MaxChi2=2.8,
  57. MaxChi2PreOutlierRemoval=20,
  58. HitsVP=make_VeloClusterTrackingSIMD_hits(),
  59. HitsUT=make_PrStorePrUTHits_hits(),
  60. HitsFT=make_PrStoreSciFiHits_hits(),
  61. ReferenceExtrapolator=TrackMasterExtrapolator(
  62. MaterialLocator=get_global_materiallocator(),
  63. ),
  64. InputUniqueIDGenerator=make_unique_id_generator(),
  65. ).OutputTracks
  66. links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
  67. links_to_forward = make_links_tracks_mcparticles(
  68. InputTracks=tracks["Forward"],
  69. LinksToLHCbIDs=links_to_lhcbids,
  70. )
  71. links_to_match = make_links_tracks_mcparticles(
  72. InputTracks=tracks["Match"],
  73. LinksToLHCbIDs=links_to_lhcbids,
  74. )
  75. links_to_best = make_links_tracks_mcparticles(
  76. InputTracks=tracks["BestLong"],
  77. LinksToLHCbIDs=links_to_lhcbids,
  78. )
  79. links_to_seed = make_links_tracks_mcparticles(
  80. InputTracks=tracks["Seed"],
  81. LinksToLHCbIDs=links_to_lhcbids,
  82. )
  83. res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
  84. res_checker_best_long = check_track_resolution(
  85. tracks["BestLong"],
  86. suffix="BestLong",
  87. )
  88. res_checker_best_forward = check_track_resolution(
  89. dict(v1=fitted_forward_tracks),
  90. suffix="BestForward",
  91. )
  92. res_checker_seed = check_track_resolution(
  93. tracks["Seed"],
  94. suffix="Seed",
  95. )
  96. eff_checker_forward = check_tracking_efficiency(
  97. "Forward",
  98. tracks["Forward"],
  99. links_to_forward,
  100. links_to_lhcbids,
  101. get_mc_categories("Forward"),
  102. get_hit_type_mask("Forward"),
  103. )
  104. eff_checker_match = check_tracking_efficiency(
  105. "Match",
  106. tracks["Match"],
  107. links_to_match,
  108. links_to_lhcbids,
  109. get_mc_categories("Match"),
  110. get_hit_type_mask("Match"),
  111. )
  112. eff_checker_best_long = check_tracking_efficiency(
  113. "BestLong",
  114. tracks["BestLong"],
  115. links_to_best,
  116. links_to_lhcbids,
  117. get_mc_categories("BestLong"),
  118. get_hit_type_mask("BestLong"),
  119. )
  120. eff_checker_seed = check_tracking_efficiency(
  121. "Seed",
  122. tracks["Seed"],
  123. links_to_seed,
  124. links_to_lhcbids,
  125. get_mc_categories("Seed"),
  126. get_hit_type_mask("Seed"),
  127. )
  128. # types_and_locations_for_checkers = {
  129. # "Forward": tracks["Forward"],
  130. # "Seed": tracks["Seed"],
  131. # "Match": tracks["Match"],
  132. # }
  133. # data = []
  134. # data += get_track_checkers(types_and_locations_for_checkers)
  135. data = [
  136. res_checker_forward,
  137. res_checker_best_long,
  138. res_checker_best_forward,
  139. res_checker_seed,
  140. eff_checker_forward,
  141. eff_checker_match,
  142. eff_checker_best_long,
  143. eff_checker_seed,
  144. ]
  145. return Reconstruction("run_tracking_debug", data)
  146. run_reconstruction(options, run_tracking_resolution)