13 <contact>software-tracking@belle2.org</contact>
14 <output>VxdCdcValidationHarvested.root</output>
15 <input>EvtGenSimNoBkg.root</input>
16 <description>This module generates events
for the V0 validation.</description>
21from ROOT import Belle2
22from tracking import add_tracking_reconstruction
23from tracking.harvest.harvesting import HarvestingModule
24from tracking.harvest import refiners
31 Generate and reconstruct Generic BBar
32 and evaluate the merger performance
34 basf2.set_random_seed(1337)
35 path = basf2.create_path()
37 rootinput = basf2.register_module('RootInput')
38 rootinput.param(
'inputFileName',
"../EvtGenSimNoBkg.root")
39 path.add_module(rootinput)
40 path.add_module(
'Gearbox')
42 add_tracking_reconstruction(path, components=[
"CDC",
"SVD"], pruneTracks=
False, prune_temporary_tracks=
False)
47 mctrackmatcher_vxd = basf2.register_module(
'MCRecoTracksMatcher')
48 mctrackmatcher_vxd.param(
'mcRecoTracksStoreArrayName',
'MCRecoTracks')
49 mctrackmatcher_vxd.param(
'prRecoTracksStoreArrayName',
'SVDRecoTracks')
50 mctrackmatcher_vxd.param(
'UseCDCHits',
False)
51 path.add_module(mctrackmatcher_vxd)
54 mctrackmatcher_cdc = basf2.register_module(
'MCRecoTracksMatcher')
55 mctrackmatcher_cdc.param(
'mcRecoTracksStoreArrayName',
'MCRecoTracks')
56 mctrackmatcher_cdc.param(
'prRecoTracksStoreArrayName',
'CDCRecoTracks')
57 mctrackmatcher_cdc.param(
'UsePXDHits',
False)
58 mctrackmatcher_cdc.param(
'UseSVDHits',
False)
59 path.add_module(mctrackmatcher_cdc)
61 path.add_module(VxdCdcMergerHarvester())
63 path.add_module(
'Progress')
65 print(basf2.statistics)
70 Harvester module to extract useful information from VXD-CDC track merging.
77 HarvestingModule.__init__(self, foreach="MCParticles", output_file_name=
"../VxdCdcValidationHarvested.root")
86 def pick(self, mc_particle):
87 """Select the MCParticle if it is related to an MCRecoTrack"""
90 mc_track = mc_particle.getRelatedFrom(
"MCRecoTracks")
96 def peel(self, mc_particle):
98 Extract the information.
103 mc_track = mc_particle.getRelatedFrom(
"MCRecoTracks")
105 mc_nhits = mc_track.getNumberOfTotalHits()
106 mc_pt = mc_particle.getMomentum().Rho()
107 mc_theta = mc_particle.getMomentum().Theta()
117 this_best_track_merged = self.
mc_track_matcher.getRelatedPRRecoTrack(mc_track)
125 if this_best_track_merged:
126 if this_best_track_cdc:
127 cdc_hits = this_best_track_cdc.getNumberOfTotalHits()
128 if this_best_track_vxd:
129 vxd_hits = this_best_track_vxd.getNumberOfTotalHits()
131 merged_hits = vxd_hits + cdc_hits
132 good_merge = merged_hits == this_best_track_merged.getNumberOfTotalHits()
136 "MC_THETA": mc_theta,
137 "MC_NHITS": mc_nhits,
138 "PR_NHITS": merged_hits,
139 "PR_CDC_NHITS": cdc_hits,
140 "PR_VXD_NHITS": vxd_hits,
141 "GOOD_MERGE": good_merge
146 save_tree = refiners.SaveTreeRefiner()
149if __name__ ==
'__main__':
153 print(
"This validation deactivated and thus basf2 is not executed.\n"
154 "If you want to run this validation, please set the 'ACTIVE' flag above to 'True'.\n"
Class to provide convenient methods to look up matching information between pattern recognition and M...
mc_track_matcher_vxd
matcher used for the MCTracks from the VXD
mc_track_matcher_cdc
matcher used for the MCTracks from the CDC
def pick(self, mc_particle)
def peel(self, mc_particle)
mc_track_matcher
matcher used for the final MCTrack list