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.

121 lines
3.6 KiB

10 months ago
  1. """
  2. This set of options is used for reconstruction development purposes,
  3. and assumes that the input contains MCHits (i.e. is of `Exended`
  4. DST/digi type).
  5. """
  6. # flake8: noqaq
  7. from Moore import options, run_reconstruction
  8. from Moore.config import Reconstruction
  9. from PyConf.Algorithms import PrKalmanFilter
  10. from PyConf.Tools import TrackMasterExtrapolator
  11. from RecoConf.mc_checking import (
  12. check_track_resolution,
  13. check_tracking_efficiency,
  14. get_mc_categories,
  15. get_hit_type_mask,
  16. make_links_lhcbids_mcparticles_tracking_system,
  17. make_links_tracks_mcparticles,
  18. )
  19. from RecoConf.core_algorithms import make_unique_id_generator
  20. from RecoConf.hlt2_tracking import make_hlt2_tracks
  21. from RecoConf.hlt1_tracking import (
  22. make_VeloClusterTrackingSIMD_hits,
  23. make_PrStorePrUTHits_hits,
  24. make_PrStoreSciFiHits_hits,
  25. get_global_materiallocator,
  26. )
  27. # sample = "Bd2KstEE_MD"
  28. # sample = "Bd2KstEE_MU"
  29. # sample = "Bs2JpsiPhi_MD"
  30. # sample = "Bs2JpsiPhi_MU"
  31. sample = "Bs2PhiPhi_MD"
  32. # sample = "Bs2PhiPhi_MU"
  33. stack = ""
  34. options.evt_max = 5000
  35. options.first_evt = 0 if stack else 5000
  36. options.ntuple_file = f"data/resolutions_and_effs_{sample}{stack}.root"
  37. options.input_type = "ROOT"
  38. options.set_input_and_conds_from_testfiledb(f"upgrade_sim10_Up08_Digi15_{sample}")
  39. def run_tracking_resolution():
  40. tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  41. fitted_forward_tracks = PrKalmanFilter(
  42. Input=tracks["Forward"]["Pr"],
  43. MaxChi2=2.8,
  44. MaxChi2PreOutlierRemoval=20,
  45. HitsVP=make_VeloClusterTrackingSIMD_hits(),
  46. HitsUT=make_PrStorePrUTHits_hits(),
  47. HitsFT=make_PrStoreSciFiHits_hits(),
  48. ReferenceExtrapolator=TrackMasterExtrapolator(
  49. MaterialLocator=get_global_materiallocator(),
  50. ),
  51. InputUniqueIDGenerator=make_unique_id_generator(),
  52. ).OutputTracks
  53. links_to_lhcbids = make_links_lhcbids_mcparticles_tracking_system()
  54. links_to_forward = make_links_tracks_mcparticles(
  55. InputTracks=tracks["Forward"],
  56. LinksToLHCbIDs=links_to_lhcbids,
  57. )
  58. links_to_match = make_links_tracks_mcparticles(
  59. InputTracks=tracks["Match"],
  60. LinksToLHCbIDs=links_to_lhcbids,
  61. )
  62. links_to_best = make_links_tracks_mcparticles(
  63. InputTracks=tracks["BestLong"],
  64. LinksToLHCbIDs=links_to_lhcbids,
  65. )
  66. res_checker_forward = check_track_resolution(tracks["Forward"], suffix="Forward")
  67. res_checker_best_long = check_track_resolution(
  68. tracks["BestLong"],
  69. suffix="BestLong",
  70. )
  71. res_checker_best_forward = check_track_resolution(
  72. dict(v1=fitted_forward_tracks),
  73. suffix="BestForward",
  74. )
  75. eff_checker_forward = check_tracking_efficiency(
  76. "Forward",
  77. tracks["Forward"],
  78. links_to_forward,
  79. links_to_lhcbids,
  80. get_mc_categories("Forward"),
  81. get_hit_type_mask("Forward"),
  82. )
  83. eff_checker_match = check_tracking_efficiency(
  84. "Match",
  85. tracks["Match"],
  86. links_to_match,
  87. links_to_lhcbids,
  88. get_mc_categories("Match"),
  89. get_hit_type_mask("Match"),
  90. )
  91. eff_checker_best_long = check_tracking_efficiency(
  92. "BestLong",
  93. tracks["BestLong"],
  94. links_to_best,
  95. links_to_lhcbids,
  96. get_mc_categories("BestLong"),
  97. get_hit_type_mask("BestLong"),
  98. )
  99. data = [
  100. res_checker_forward,
  101. res_checker_best_long,
  102. res_checker_best_forward,
  103. eff_checker_forward,
  104. eff_checker_match,
  105. eff_checker_best_long,
  106. ]
  107. return Reconstruction("run_tracking_debug", data)
  108. run_reconstruction(options, run_tracking_resolution)