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.

134 lines
5.0 KiB

10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
8 months ago
8 months ago
8 months ago
10 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 = "B"
  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 == "test":
  44. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  45. options.conddb_tag = "sim-20210617-vc-md100"
  46. options.dddb_tag = "dddb-20210617"
  47. options.simulation = True
  48. options.input_type = "ROOT"
  49. options.ntuple_file = (
  50. f"data/tracking_losses_ntuple_{decay}_rad_length_endVelo2endUT.root"
  51. )
  52. def run_tracking_losses():
  53. links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
  54. hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  55. vp_hits = make_VeloClusterTrackingSIMD_hits()
  56. ut_hits = make_PrStorePrUTHits_hits()
  57. ft_hits = make_PrStoreSciFiHits_hits()
  58. fitted_match_tracks = make_PrKalmanFilter_tracks( # fitted_forward_tracks
  59. input_tracks=hlt2_tracks["Match"]["Pr"], # Forward
  60. hits_vp=vp_hits,
  61. hits_ut=ut_hits,
  62. hits_ft=ft_hits,
  63. )
  64. # add MCLinking to the (fitted) V1 tracks
  65. links_to_velo_tracks = PrTrackAssociator(
  66. SingleContainer=hlt2_tracks["Velo"]["v1"],
  67. LinkerLocationID=links_to_hits,
  68. MCParticleLocation=mc_unpackers()["MCParticles"],
  69. MCVerticesInput=mc_unpackers()["MCVertices"],
  70. ).OutputLocation
  71. links_to_long_tracks = PrTrackAssociator(
  72. SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
  73. LinkerLocationID=links_to_hits,
  74. MCParticleLocation=mc_unpackers()["MCParticles"],
  75. MCVerticesInput=mc_unpackers()["MCVertices"],
  76. ).OutputLocation
  77. with PrTrackAssociator.bind(FractionOK=0.5):
  78. loose_links_to_long_tracks = PrTrackAssociator(
  79. SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
  80. LinkerLocationID=links_to_hits,
  81. MCParticleLocation=mc_unpackers()["MCParticles"],
  82. MCVerticesInput=mc_unpackers()["MCVertices"],
  83. ).OutputLocation
  84. links_to_fitted_tracks = PrTrackAssociator(
  85. SingleContainer=fitted_match_tracks, # fitted_forward_tracks
  86. LinkerLocationID=links_to_hits,
  87. MCParticleLocation=mc_unpackers()["MCParticles"],
  88. MCVerticesInput=mc_unpackers()["MCVertices"],
  89. ).OutputLocation
  90. tracking_losses = PrDebugTrackingLosses(
  91. name="PrDebugTrackingLosses",
  92. TrackType="Long",
  93. StudyTracks=hlt2_tracks["Match"]["v1"], # Forward
  94. VeloTracks=hlt2_tracks["Velo"]["v1"],
  95. MCParticles=mc_unpackers()["MCParticles"],
  96. MCVPHits=mc_unpackers()["MCVPHits"],
  97. MCUTHits=mc_unpackers()["MCUTHits"],
  98. MCFTHits=mc_unpackers()["MCFTHits"],
  99. VeloTrackLinks=links_to_velo_tracks,
  100. TrackLinks=links_to_long_tracks,
  101. LooseTrackLinks=loose_links_to_long_tracks,
  102. FittedTrackLinks=links_to_fitted_tracks,
  103. # LHCbIDLinks=links_to_hits,
  104. IdealStateCreator=make_default_IdealStateCreator(),
  105. TrackInfo=make_data_with_FetchDataFromFile(
  106. "/Event/MC/TrackInfo",
  107. "LHCb::MCProperty", # force_type="LHCb::MCProperty" for lb-stack only
  108. ),
  109. )
  110. data = [tracking_losses]
  111. return Reconstruction("run_tracking_losses", data)
  112. run_reconstruction(options, run_tracking_losses)