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.

158 lines
4.6 KiB

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
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
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. )
  23. from RecoConf.core_algorithms import make_unique_id_generator
  24. from RecoConf.hlt2_tracking import make_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. decay = "B"
  32. options.evt_max = -1
  33. options.ntuple_file = f"data/resolutions_and_effs_{decay}_thesis.root"
  34. options.input_type = "ROOT"
  35. if decay == "B":
  36. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  37. elif decay == "BJpsi":
  38. options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
  39. elif decay == "D":
  40. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  41. elif decay == "test2":
  42. options.input_files = [
  43. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
  44. ]
  45. elif decay == "test":
  46. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  47. options.dddb_tag = "dddb-20210617"
  48. options.conddb_tag = "sim-20210617-vc-md100"
  49. options.simulation = True
  50. options.output_level = 3
  51. def run_tracking_resolution():
  52. tracks = make_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_best = make_links_tracks_mcparticles(
  75. InputTracks=tracks["BestLong"],
  76. LinksToLHCbIDs=links_to_lhcbids,
  77. )
  78. links_to_seed = make_links_tracks_mcparticles(
  79. InputTracks=tracks["Seed"],
  80. LinksToLHCbIDs=links_to_lhcbids,
  81. )
  82. res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
  83. res_checker_best_long = check_track_resolution(
  84. tracks["BestLong"],
  85. suffix="BestLong",
  86. )
  87. res_checker_best_forward = check_track_resolution(
  88. dict(v1=fitted_forward_tracks),
  89. suffix="BestForward",
  90. )
  91. res_checker_seed = check_track_resolution(
  92. tracks["Seed"],
  93. suffix="Seed",
  94. )
  95. eff_checker_forward = check_tracking_efficiency(
  96. "Forward",
  97. tracks["Forward"],
  98. links_to_forward,
  99. links_to_lhcbids,
  100. get_mc_categories("Forward"),
  101. get_hit_type_mask("Forward"),
  102. )
  103. eff_checker_match = check_tracking_efficiency(
  104. "Match",
  105. tracks["Match"],
  106. links_to_match,
  107. links_to_lhcbids,
  108. get_mc_categories("Match"),
  109. get_hit_type_mask("Match"),
  110. )
  111. eff_checker_best_long = check_tracking_efficiency(
  112. "BestLong",
  113. tracks["BestLong"],
  114. links_to_best,
  115. links_to_lhcbids,
  116. get_mc_categories("BestLong"),
  117. get_hit_type_mask("BestLong"),
  118. )
  119. eff_checker_seed = check_tracking_efficiency(
  120. "Seed",
  121. tracks["Seed"],
  122. links_to_seed,
  123. links_to_lhcbids,
  124. get_mc_categories("Seed"),
  125. get_hit_type_mask("Seed"),
  126. )
  127. data = [
  128. res_checker_forward,
  129. res_checker_best_long,
  130. res_checker_best_forward,
  131. res_checker_seed,
  132. eff_checker_forward,
  133. eff_checker_match,
  134. eff_checker_best_long,
  135. eff_checker_seed,
  136. ]
  137. return Reconstruction("run_tracking_debug", data)
  138. run_reconstruction(options, run_tracking_resolution)