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.

135 lines
5.0 KiB

10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
9 months ago
10 months ago
  1. ###############################################################################
  2. # (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration #
  3. # #
  4. # This software is distributed under the terms of the GNU General Public #
  5. # Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
  6. # #
  7. # In applying this licence, CERN does not waive the privileges and immunities #
  8. # granted to it by virtue of its status as an Intergovernmental Organization #
  9. # or submit itself to any jurisdiction. #
  10. ###############################################################################
  11. # flake8: noqa
  12. from Moore import options, run_reconstruction
  13. from Moore.config import Reconstruction
  14. from RecoConf.data_from_file import mc_unpackers
  15. from RecoConf.hlt1_tracking import make_VeloClusterTrackingSIMD_hits
  16. from RecoConf.hlt2_tracking import (
  17. make_hlt2_tracks,
  18. make_PrKalmanFilter_tracks,
  19. make_PrStorePrUTHits_hits,
  20. make_PrStoreSciFiHits_hits,
  21. )
  22. from RecoConf.mc_checking import (
  23. make_links_lhcbids_mcparticles_tracking_system,
  24. make_links_tracks_mcparticles,
  25. make_default_IdealStateCreator,
  26. )
  27. from PyConf.Algorithms import PrTrackAssociator, PrDebugTrackingLosses
  28. from PyConf.application import make_data_with_FetchDataFromFile
  29. import glob
  30. """
  31. run with
  32. Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_tracking_losses.py
  33. tested by mc_matching_example.py
  34. """
  35. decay = "test"
  36. options.evt_max = -1
  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 == "test2":
  44. options.input_files = [
  45. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
  46. ]
  47. elif decay == "test":
  48. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  49. options.conddb_tag = "sim-20210617-vc-md100"
  50. options.dddb_tag = "dddb-20210617"
  51. options.simulation = True
  52. options.input_type = "ROOT"
  53. options.ntuple_file = f"data/tracking_losses_ntuple_{decay}_endVelo2endT.root"
  54. def run_tracking_losses():
  55. links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
  56. hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  57. vp_hits = make_VeloClusterTrackingSIMD_hits()
  58. ut_hits = make_PrStorePrUTHits_hits()
  59. ft_hits = make_PrStoreSciFiHits_hits()
  60. fitted_match_tracks = make_PrKalmanFilter_tracks( # fitted_forward_tracks
  61. input_tracks=hlt2_tracks["Match"]["Pr"], # Forward
  62. hits_vp=vp_hits,
  63. hits_ut=ut_hits,
  64. hits_ft=ft_hits,
  65. )
  66. # add MCLinking to the (fitted) V1 tracks
  67. links_to_velo_tracks = PrTrackAssociator(
  68. SingleContainer=hlt2_tracks["Velo"]["v1"],
  69. LinkerLocationID=links_to_hits,
  70. MCParticleLocation=mc_unpackers()["MCParticles"],
  71. MCVerticesInput=mc_unpackers()["MCVertices"],
  72. ).OutputLocation
  73. links_to_long_tracks = PrTrackAssociator(
  74. SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
  75. LinkerLocationID=links_to_hits,
  76. MCParticleLocation=mc_unpackers()["MCParticles"],
  77. MCVerticesInput=mc_unpackers()["MCVertices"],
  78. ).OutputLocation
  79. with PrTrackAssociator.bind(FractionOK=0.5):
  80. loose_links_to_long_tracks = PrTrackAssociator(
  81. SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
  82. LinkerLocationID=links_to_hits,
  83. MCParticleLocation=mc_unpackers()["MCParticles"],
  84. MCVerticesInput=mc_unpackers()["MCVertices"],
  85. ).OutputLocation
  86. links_to_fitted_tracks = PrTrackAssociator(
  87. SingleContainer=fitted_match_tracks, # fitted_forward_tracks
  88. LinkerLocationID=links_to_hits,
  89. MCParticleLocation=mc_unpackers()["MCParticles"],
  90. MCVerticesInput=mc_unpackers()["MCVertices"],
  91. ).OutputLocation
  92. tracking_losses = PrDebugTrackingLosses(
  93. name="PrDebugTrackingLosses",
  94. TrackType="Long",
  95. StudyTracks=hlt2_tracks["Match"]["v1"], # Forward
  96. VeloTracks=hlt2_tracks["Velo"]["v1"],
  97. MCParticles=mc_unpackers()["MCParticles"],
  98. MCVPHits=mc_unpackers()["MCVPHits"],
  99. MCUTHits=mc_unpackers()["MCUTHits"],
  100. MCFTHits=mc_unpackers()["MCFTHits"],
  101. VeloTrackLinks=links_to_velo_tracks,
  102. TrackLinks=links_to_long_tracks,
  103. LooseTrackLinks=loose_links_to_long_tracks,
  104. FittedTrackLinks=links_to_fitted_tracks,
  105. # LHCbIDLinks=links_to_hits,
  106. IdealStateCreator=make_default_IdealStateCreator(),
  107. TrackInfo=make_data_with_FetchDataFromFile(
  108. "/Event/MC/TrackInfo",
  109. "LHCb::MCProperty",
  110. ),
  111. )
  112. data = [tracking_losses]
  113. return Reconstruction("run_tracking_losses", data)
  114. run_reconstruction(options, run_tracking_losses)