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
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')
69 Harvester module to extract useful information from VXD-CDC track merging.
76 HarvestingModule.__init__(self, foreach=
"MCParticles", output_file_name=
"../VxdCdcValidationHarvested.root")
85 def pick(self, mc_particle):
86 """Select the MCParticle if it is related to an MCRecoTrack"""
89 mc_track = mc_particle.getRelatedFrom(
"MCRecoTracks")
95 def peel(self, mc_particle):
97 Extract the information.
102 mc_track = mc_particle.getRelatedFrom(
"MCRecoTracks")
104 mc_nhits = mc_track.getNumberOfTotalHits()
105 mc_pt = mc_particle.getMomentum().Rho()
106 mc_theta = mc_particle.getMomentum().Theta()
116 this_best_track_merged = self.
mc_track_matcher.getRelatedPRRecoTrack(mc_track)
124 if this_best_track_merged:
125 if this_best_track_cdc:
126 cdc_hits = this_best_track_cdc.getNumberOfTotalHits()
127 if this_best_track_vxd:
128 vxd_hits = this_best_track_vxd.getNumberOfTotalHits()
130 merged_hits = vxd_hits + cdc_hits
131 good_merge = merged_hits == this_best_track_merged.getNumberOfTotalHits()
135 "MC_THETA": mc_theta,
136 "MC_NHITS": mc_nhits,
137 "PR_NHITS": merged_hits,
138 "PR_CDC_NHITS": cdc_hits,
139 "PR_VXD_NHITS": vxd_hits,
140 "GOOD_MERGE": good_merge
148if __name__ ==
'__main__':
152 print(
"This validation deactivated and thus basf2 is not executed.\n"
153 "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
mc_track_matcher
matcher used for the final MCTrack list