13 <contact>software-tracking@belle2.org</contact>
14 <output>VxdCdcValidationHarvested.root</output>
15 <input>EvtGenSimNoBkg.root</input>
17 This script creates a sample for the validation of the simple CDC+SVD track merging algorithm without background.
23from ROOT
import Belle2
24from tracking
import add_tracking_reconstruction
33 Generate and reconstruct Generic BBar
34 and evaluate the merger performance
36 basf2.set_random_seed(1337)
37 path = basf2.create_path()
39 rootinput = basf2.register_module(
'RootInput')
40 rootinput.param(
'inputFileName',
"../EvtGenSimNoBkg.root")
41 path.add_module(rootinput)
42 path.add_module(
'Gearbox')
44 add_tracking_reconstruction(path, components=[
"CDC",
"SVD"], pruneTracks=
False, prune_temporary_tracks=
False)
49 mctrackmatcher_vxd = basf2.register_module(
'MCRecoTracksMatcher')
50 mctrackmatcher_vxd.param(
'mcRecoTracksStoreArrayName',
'MCRecoTracks')
51 mctrackmatcher_vxd.param(
'prRecoTracksStoreArrayName',
'SVDRecoTracks')
52 mctrackmatcher_vxd.param(
'UseCDCHits',
False)
53 path.add_module(mctrackmatcher_vxd)
56 mctrackmatcher_cdc = basf2.register_module(
'MCRecoTracksMatcher')
57 mctrackmatcher_cdc.param(
'mcRecoTracksStoreArrayName',
'MCRecoTracks')
58 mctrackmatcher_cdc.param(
'prRecoTracksStoreArrayName',
'CDCRecoTracks')
59 mctrackmatcher_cdc.param(
'UsePXDHits',
False)
60 mctrackmatcher_cdc.param(
'UseSVDHits',
False)
61 path.add_module(mctrackmatcher_cdc)
63 path.add_module(VxdCdcMergerHarvester())
65 path.add_module(
'Progress')
71 Harvester module to extract useful information from VXD-CDC track merging.
78 HarvestingModule.__init__(self, foreach=
"MCParticles", output_file_name=
"../VxdCdcValidationHarvested.root")
87 def pick(self, mc_particle):
88 """Select the MCParticle if it is related to an MCRecoTrack"""
91 mc_track = mc_particle.getRelatedFrom(
"MCRecoTracks")
97 def peel(self, mc_particle):
99 Extract the information.
104 mc_track = mc_particle.getRelatedFrom(
"MCRecoTracks")
106 mc_nhits = mc_track.getNumberOfTotalHits()
107 mc_pt = mc_particle.getMomentum().Rho()
108 mc_theta = mc_particle.getMomentum().Theta()
118 this_best_track_merged = self.
mc_track_matcher.getRelatedPRRecoTrack(mc_track)
126 if this_best_track_merged:
127 if this_best_track_cdc:
128 cdc_hits = this_best_track_cdc.getNumberOfTotalHits()
129 if this_best_track_vxd:
130 vxd_hits = this_best_track_vxd.getNumberOfTotalHits()
132 merged_hits = vxd_hits + cdc_hits
133 good_merge = merged_hits == this_best_track_merged.getNumberOfTotalHits()
137 "MC_THETA": mc_theta,
138 "MC_NHITS": mc_nhits,
139 "PR_NHITS": merged_hits,
140 "PR_CDC_NHITS": cdc_hits,
141 "PR_VXD_NHITS": vxd_hits,
142 "GOOD_MERGE": good_merge
150if __name__ ==
'__main__':
154 print(
"This validation deactivated and thus basf2 is not executed.\n"
155 "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