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.

143 lines
4.8 KiB

10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
  1. # flake8: noqaq
  2. """
  3. NOT IMPLEMENTED YET
  4. Moore/run gaudirun.py /work/cetin/LHCb/reco_tuner/moore_options/residual_get_ghost_data.py
  5. """
  6. from Moore import options, run_reconstruction
  7. from Moore.config import Reconstruction
  8. from PyConf.Algorithms import (
  9. PrForwardTrackingVelo,
  10. PrForwardTracking,
  11. PrTrackAssociator,
  12. PrMatchNN,
  13. )
  14. from PyConf.application import make_data_with_FetchDataFromFile
  15. from PyConf.Tools import PrMCDebugForwardTool, PrMCDebugMatchToolNN
  16. from RecoConf.data_from_file import mc_unpackers
  17. from RecoConf.hlt1_tracking import make_hlt1_tracks, make_PrStoreSciFiHits_hits
  18. from RecoConf.hlt2_tracking import get_global_ut_hits_tool, make_PrHybridSeeding_tracks
  19. from RecoConf.mc_checking import make_links_lhcbids_mcparticles_tracking_system
  20. import glob
  21. options.evt_max = -1
  22. decay = "B" # D, B
  23. options.ntuple_file = f"data/ghost_data_{decay}.root"
  24. options.input_type = "ROOT"
  25. if decay == "B":
  26. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
  27. elif decay == "D":
  28. options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
  29. elif decay == "test":
  30. options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
  31. elif decay == "both":
  32. options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi") + glob.glob(
  33. "/auto/data/guenther/Dst_D0ee/*.xdigi"
  34. )
  35. options.dddb_tag = "dddb-20210617"
  36. options.conddb_tag = "sim-20210617-vc-md100"
  37. options.simulation = True
  38. def run_tracking_debug():
  39. links_to_hits = make_links_lhcbids_mcparticles_tracking_system()
  40. hlt1_tracks = make_hlt1_tracks()
  41. seed_tracks = make_PrHybridSeeding_tracks()
  42. # add MCLinking to the (fitted) V1 tracks
  43. links_to_velo_tracks = PrTrackAssociator(
  44. SingleContainer=hlt1_tracks["Velo"]["v1"],
  45. LinkerLocationID=links_to_hits,
  46. MCParticleLocation=mc_unpackers()["MCParticles"],
  47. MCVerticesInput=mc_unpackers()["MCVertices"],
  48. ).OutputLocation
  49. links_to_upstream_tracks = PrTrackAssociator(
  50. SingleContainer=hlt1_tracks["Upstream"]["v1"],
  51. LinkerLocationID=links_to_hits,
  52. MCParticleLocation=mc_unpackers()["MCParticles"],
  53. MCVerticesInput=mc_unpackers()["MCVertices"],
  54. ).OutputLocation
  55. links_to_seed_tracks = PrTrackAssociator(
  56. SingleContainer=seed_tracks["v1"],
  57. LinkerLocationID=links_to_hits,
  58. MCParticleLocation=mc_unpackers()["MCParticles"],
  59. MCVerticesInput=mc_unpackers()["MCVertices"],
  60. ).OutputLocation
  61. # be more robust against imperfect data
  62. loose_forward_params = dict(
  63. MaxChi2PerDoF=16,
  64. MaxChi2XProjection=30,
  65. MaxChi2PerDoFFinal=8,
  66. MaxChi2Stereo=8,
  67. MaxChi2StereoAdd=8,
  68. )
  69. forward_debug = PrForwardTrackingVelo(
  70. InputTracks=hlt1_tracks["Velo"]["Pr"],
  71. SciFiHits=make_PrStoreSciFiHits_hits(),
  72. AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
  73. DebugTool=PrMCDebugForwardTool(
  74. InputTracks=hlt1_tracks["Velo"]["v1"],
  75. InputTrackLinks=links_to_velo_tracks,
  76. MCParticles=mc_unpackers()["MCParticles"],
  77. SciFiHitLinks=links_to_hits,
  78. SciFiHits=make_PrStoreSciFiHits_hits(),
  79. TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
  80. ),
  81. **loose_forward_params,
  82. )
  83. forward_ut_debug = PrForwardTracking(
  84. SciFiHits=make_PrStoreSciFiHits_hits(),
  85. InputTracks=hlt1_tracks["Upstream"]["Pr"],
  86. AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
  87. DebugTool=PrMCDebugForwardTool(
  88. InputTracks=hlt1_tracks["Upstream"]["v1"],
  89. InputTrackLinks=links_to_upstream_tracks,
  90. MCParticles=mc_unpackers()["MCParticles"],
  91. SciFiHitLinks=links_to_hits,
  92. SciFiHits=make_PrStoreSciFiHits_hits(),
  93. TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
  94. ),
  95. **loose_forward_params,
  96. )
  97. loose_matching_params = dict(
  98. MaxMatchChi2=30.0,
  99. MaxDistX=500,
  100. MaxDistY=500,
  101. MaxDSlope=1.5,
  102. MinMatchNN=0.45, # NN response cut value
  103. )
  104. match_debug = PrMatchNN(
  105. VeloInput=hlt1_tracks["Velo"]["Pr"],
  106. SeedInput=seed_tracks["Pr"],
  107. MatchDebugToolName=PrMCDebugMatchToolNN(
  108. VeloTracks=hlt1_tracks["Velo"]["v1"],
  109. SeedTracks=seed_tracks["v1"],
  110. VeloTrackLinks=links_to_velo_tracks,
  111. SeedTrackLinks=links_to_seed_tracks,
  112. TrackInfo=make_data_with_FetchDataFromFile("/Event/MC/TrackInfo"),
  113. MCParticles=mc_unpackers()["MCParticles"],
  114. ),
  115. AddUTHitsToolName=get_global_ut_hits_tool(enable=True),
  116. **loose_matching_params,
  117. ).MatchOutput
  118. data = [forward_debug, forward_ut_debug, match_debug]
  119. return Reconstruction("run_tracking_debug", data)
  120. run_reconstruction(options, run_tracking_debug)