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.

138 lines
5.1 KiB

10 months ago
7 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
7 months ago
7 months ago
10 months ago
9 months ago
9 months ago
10 months ago
7 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 RecoConf.event_filters import require_gec
  28. from PyConf.Algorithms import PrTrackAssociator, PrDebugTrackingLosses
  29. from PyConf.application import make_data_with_FetchDataFromFile
  30. import glob
  31. """
  32. run with
  33. Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/get_tracking_losses.py
  34. tested by mc_matching_example.py
  35. """
  36. decay = "BJpsi"
  37. options.evt_max = -1
  38. if decay == "B":
  39. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  40. elif decay == "BJpsi":
  41. options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
  42. elif decay == "D":
  43. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  44. elif decay == "test2":
  45. options.input_files = [
  46. "/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
  47. ]
  48. elif decay == "test":
  49. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  50. options.conddb_tag = "sim-20210617-vc-md100"
  51. options.dddb_tag = "dddb-20210617"
  52. options.simulation = True
  53. options.input_type = "ROOT"
  54. options.ntuple_file = (
  55. f"/work/cetin/LHCb/reco_tuner/data/tracking_losses_ntuple_{decay}_NewParamsM.root"
  56. )
  57. def run_tracking_losses():
  58. links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
  59. hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
  60. vp_hits = make_VeloClusterTrackingSIMD_hits()
  61. ut_hits = make_PrStorePrUTHits_hits()
  62. ft_hits = make_PrStoreSciFiHits_hits()
  63. fitted_match_tracks = make_PrKalmanFilter_tracks( # fitted_forward_tracks
  64. input_tracks=hlt2_tracks["Match"]["Pr"], # Forward
  65. hits_vp=vp_hits,
  66. hits_ut=ut_hits,
  67. hits_ft=ft_hits,
  68. )
  69. # add MCLinking to the (fitted) V1 tracks
  70. links_to_velo_tracks = PrTrackAssociator(
  71. SingleContainer=hlt2_tracks["Velo"]["v1"],
  72. LinkerLocationID=links_to_hits,
  73. MCParticleLocation=mc_unpackers()["MCParticles"],
  74. MCVerticesInput=mc_unpackers()["MCVertices"],
  75. ).OutputLocation
  76. links_to_long_tracks = PrTrackAssociator(
  77. SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
  78. LinkerLocationID=links_to_hits,
  79. MCParticleLocation=mc_unpackers()["MCParticles"],
  80. MCVerticesInput=mc_unpackers()["MCVertices"],
  81. ).OutputLocation
  82. with PrTrackAssociator.bind(FractionOK=0.5):
  83. loose_links_to_long_tracks = PrTrackAssociator(
  84. SingleContainer=hlt2_tracks["Match"]["v1"], # Forward
  85. LinkerLocationID=links_to_hits,
  86. MCParticleLocation=mc_unpackers()["MCParticles"],
  87. MCVerticesInput=mc_unpackers()["MCVertices"],
  88. ).OutputLocation
  89. links_to_fitted_tracks = PrTrackAssociator(
  90. SingleContainer=fitted_match_tracks, # fitted_forward_tracks
  91. LinkerLocationID=links_to_hits,
  92. MCParticleLocation=mc_unpackers()["MCParticles"],
  93. MCVerticesInput=mc_unpackers()["MCVertices"],
  94. ).OutputLocation
  95. tracking_losses = PrDebugTrackingLosses(
  96. name="PrDebugTrackingLosses",
  97. TrackType="Long",
  98. StudyTracks=hlt2_tracks["Match"]["v1"], # Forward
  99. VeloTracks=hlt2_tracks["Velo"]["v1"],
  100. MCParticles=mc_unpackers()["MCParticles"],
  101. MCVPHits=mc_unpackers()["MCVPHits"],
  102. MCUTHits=mc_unpackers()["MCUTHits"],
  103. MCFTHits=mc_unpackers()["MCFTHits"],
  104. VeloTrackLinks=links_to_velo_tracks,
  105. TrackLinks=links_to_long_tracks,
  106. LooseTrackLinks=loose_links_to_long_tracks,
  107. FittedTrackLinks=links_to_fitted_tracks,
  108. # LHCbIDLinks=links_to_hits,
  109. IdealStateCreator=make_default_IdealStateCreator(),
  110. TrackInfo=make_data_with_FetchDataFromFile(
  111. "/Event/MC/TrackInfo",
  112. "LHCb::MCProperty",
  113. ),
  114. )
  115. data = [tracking_losses]
  116. return Reconstruction("run_tracking_losses", data, [require_gec()])
  117. run_reconstruction(options, run_tracking_losses)