12from ROOT
import Belle2
18 A small helper module to look for double assigned hits.
19 Prints a summary after execution
23 """Initialization signal at the start of the event processing"""
32 """Event method of the module"""
35 if track_store_vector:
37 wrapped_vector = track_store_vector.obj()
38 tracks = wrapped_vector.get()
42 for recoHit3D
in track:
43 if not recoHit3D.getWireHit().getAutomatonCell().hasTakenFlag():
46 for i, track
in enumerate(tracks):
48 for j, innerTrack
in enumerate(tracks):
51 for recoHit3D
in innerTrack:
52 recoHit3D.getWireHit().getAutomatonCell().setAssignedFlag()
54 for recoHit3D
in track:
56 if recoHit3D.getWireHit().getAutomatonCell().hasAssignedFlag():
58 recoHit3D.getWireHit().getAutomatonCell().setAssignedFlag()
60 for innerTrack
in tracks:
61 for recoHit3D
in innerTrack:
62 recoHit3D.getWireHit().getAutomatonCell().unsetAssignedFlag()
65 """Termination signal at the end of the event processing"""
72 """A small hit cleaner module to set the track information according to mc information.
73 This is surely
not for later usage but
for testing the genfitter module
88 """Initialization signal at the start of the event processing"""
95 """Event method of the module"""
101 cdc_hit_lookup.fill()
109 hitIDs = track.getHitIDs(Belle2.Const.CDC)
113 relation_track_particle = [0] * mc_particles.getEntries()
117 current_mc_track = cdc_hit_lookup.getMCTrackId(cdc_hits[i])
118 if 0 <= current_mc_track:
119 relation_track_particle[current_mc_track] += 1
121 should_belong_to_track = np.argmax(relation_track_particle)
123 deleted_hits = sum(relation_track_particle) - relation_track_particle[should_belong_to_track]
126 for i, hitID
in enumerate(hitIDs):
127 current_mc_track = cdc_hit_lookup.getMCTrackId(cdc_hits[hitID])
128 if current_mc_track == should_belong_to_track:
129 good_hits.append(hitID)
135 mc_track = mc_matcher_lookup.getAnyChargeMatchedMCRecoTrack(track)
140 mc_track.getChargeSeed())
142 sStartingPosition = mc_trajectory.calcArcLength2D(startingPosition)
143 zStartingPosition = mc_trajectory.getTrajectorySZ().mapSToZ(sStartingPosition)
154 track.setPdgCode(int(track.getChargeSeed() * 211))
158 track.setPdgCode(int(track.getChargeSeed() * 211))
161 """Termination signal at the end of the event processing"""
162 print(f
"Number of tracks in total: {int(self.number_of_tracks)}")
163 print(f
"Number of hits in total: {int(self.number_of_hits)}")
164 print(f
"Number of deleted hits: {int(self.number_of_deleted_hits)}")
166 print(f
"Number of deleted hits per track: {1.0 * self.number_of_deleted_hits / self.number_of_tracks:f}")
167 print(f
"Ratio of deleted hits: {100.0 * self.number_of_deleted_hits / self.number_of_hits:f}")
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.
Interface class to the Monte Carlo information for individual hits.
Particle full three dimensional trajectory.
A three dimensional vector.
Class to provide convenient methods to look up matching information between pattern recognition and M...
number_of_doubled_hits
counter for doubled CDC hits
number_of_total_hits
counter for total CDC hits
number_of_hits_with_wrong_flags
counter for CDC hits with wrong flags
number_of_deleted_hits
count the deleted hits
mc_matcher_lookup
function to match track candidatess to MC track candidates
cdc_hit_look_up
function to look up CDC MC hits
number_of_tracks
count the tracks
number_of_hits
count the hits