67 def peel(self, event_meta_data=None):
68 """Peel information from the event"""
69
70
71 track_match_look_up = self.track_match_look_up
76
77
78 if mc_particles:
79 n_mc_particles = mc_particles.getEntries()
80 else:
81 n_mc_particles = -1
82
83 if mc_reco_tracks:
84 n_mc_reco_tracks = mc_reco_tracks.getEntries()
85 else:
86 n_mc_reco_tracks = -1
87
88 n_reco_tracks = reco_tracks.getEntries()
89
90
91 all_mc_tracks_det_hit_ids = set()
92 n_matched_mc_reco_tracks = 0
93 n_matched_correct_charge_mc_reco_tracks = 0
94 n_matched_wrong_charge_mc_reco_tracks = 0
95 n_merged_mc_reco_tracks = 0
96 n_merged_correct_charge_mc_reco_tracks = 0
97 n_merged_wrong_charge_mc_reco_tracks = 0
98 n_missing_mc_reco_tracks = 0
99 for mc_reco_track in mc_reco_tracks:
100 mc_reco_track_det_hit_ids = utilities.get_det_hit_ids(mc_reco_track)
101 all_mc_tracks_det_hit_ids.update(mc_reco_track_det_hit_ids)
102
103 is_matched = track_match_look_up.isAnyChargeMatchedMCRecoTrack(mc_reco_track)
104 is_matched_correct_charge = track_match_look_up.isCorrectChargeMatchedMCRecoTrack(mc_reco_track)
105 is_matched_wrong_charge = track_match_look_up.isWrongChargeMatchedMCRecoTrack(mc_reco_track)
106 is_merged = track_match_look_up.isAnyChargeMergedMCRecoTrack(mc_reco_track)
107 is_merged_correct_charge = track_match_look_up.isCorrectChargeMergedMCRecoTrack(mc_reco_track)
108 is_merged_wrong_charge = track_match_look_up.isWrongChargeMergedMCRecoTrack(mc_reco_track)
109 is_missing = track_match_look_up.isMissingMCRecoTrack(mc_reco_track)
110
111 if is_matched:
112 n_matched_mc_reco_tracks += 1
113 if is_matched_correct_charge:
114 n_matched_correct_charge_mc_reco_tracks += 1
115 elif is_matched_wrong_charge:
116 n_matched_wrong_charge_mc_reco_tracks += 1
117 elif is_merged:
118 n_merged_mc_reco_tracks += 1
119 if is_merged_correct_charge:
120 n_merged_correct_charge_mc_reco_tracks += 1
121 elif is_merged_wrong_charge:
122 n_merged_wrong_charge_mc_reco_tracks += 1
123 elif is_missing:
124 n_missing_mc_reco_tracks += 1
125
126
127 n_matched_reco_tracks = 0
128 n_matched_correct_charge_reco_tracks = 0
129 n_matched_wrong_charge_reco_tracks = 0
130 n_clone_reco_tracks = 0
131 n_clone_correct_charge_reco_tracks = 0
132 n_clone_wrong_charge_reco_tracks = 0
133 n_background_reco_tracks = 0
134 n_ghost_reco_tracks = 0
135
136 all_tracks_det_hit_ids = set()
137 n_matched_hits = 0
138 for reco_track in reco_tracks:
139 is_matched = track_match_look_up.isAnyChargeMatchedPRRecoTrack(reco_track)
140 is_matched_correct_charge = track_match_look_up.isCorrectChargeMatchedPRRecoTrack(reco_track)
141 is_matched_wrong_charge = track_match_look_up.isWrongChargeMatchedPRRecoTrack(reco_track)
142 is_clone = track_match_look_up.isAnyChargeClonePRRecoTrack(reco_track)
143 is_clone_correct_charge = track_match_look_up.isCorrectChargeClonePRRecoTrack(reco_track)
144 is_clone_wrong_charge = track_match_look_up.isWrongChargeClonePRRecoTrack(reco_track)
145 is_background = track_match_look_up.isBackgroundPRRecoTrack(reco_track)
146 is_ghost = track_match_look_up.isGhostPRRecoTrack(reco_track)
147
148 if is_matched:
149 n_matched_reco_tracks += 1
150 if is_matched_correct_charge:
151 n_matched_correct_charge_reco_tracks += 1
152 elif is_matched_wrong_charge:
153 n_matched_wrong_charge_reco_tracks += 1
154 elif is_clone:
155 n_clone_reco_tracks += 1
156 if is_clone_correct_charge:
157 n_clone_correct_charge_reco_tracks += 1
158 elif is_clone_wrong_charge:
159 n_clone_wrong_charge_reco_tracks += 1
160 elif is_background:
161 n_background_reco_tracks += 1
162 elif is_ghost:
163 n_ghost_reco_tracks += 1
164
165 reco_track_det_hit_ids = utilities.get_det_hit_ids(reco_track)
166
167 all_tracks_det_hit_ids.update(reco_track_det_hit_ids)
168 if is_matched or is_clone:
169 mc_reco_track = self.track_match_look_up.getRelatedMCRecoTrack(reco_track)
170
171 mc_reco_track_det_hit_ids = utilities.get_det_hit_ids(mc_reco_track)
172 n_matched_hits += len(reco_track_det_hit_ids & mc_reco_track_det_hit_ids)
173
174 return dict(
175 n_mc_particles=n_mc_particles,
176 n_mc_reco_tracks=n_mc_reco_tracks,
177 n_reco_tracks=n_reco_tracks,
178
179 n_matched_mc_reco_tracks=n_matched_mc_reco_tracks,
180 n_matched_correct_charge_mc_reco_tracks=n_matched_correct_charge_mc_reco_tracks,
181 n_matched_wrong_charge_mc_reco_tracks=n_matched_wrong_charge_mc_reco_tracks,
182
183 n_merged_mc_reco_tracks=n_merged_mc_reco_tracks,
184 n_merged_correct_charge_mc_reco_tracks=n_merged_correct_charge_mc_reco_tracks,
185 n_merged_wrong_charge_mc_reco_tracks=n_merged_wrong_charge_mc_reco_tracks,
186
187 n_missing_mc_reco_tracks=n_missing_mc_reco_tracks,
188
189
190 n_matched_reco_tracks=n_matched_reco_tracks,
191 n_matched_correct_charge_reco_tracks=n_matched_correct_charge_reco_tracks,
192 n_matched_wrong_charge_reco_tracks=n_matched_wrong_charge_reco_tracks,
193 n_clone_reco_tracks=n_clone_reco_tracks,
194 n_clone_correct_charge_reco_tracks=n_clone_correct_charge_reco_tracks,
195 n_clone_wrong_charge_reco_tracks=n_clone_wrong_charge_reco_tracks,
196
197 n_background_reco_tracks=n_background_reco_tracks,
198 n_ghost_reco_tracks=n_ghost_reco_tracks,
199
200 n_cdc_hits=cdc_hits.getEntries(),
201 n_all_mc_track_hits=len(all_mc_tracks_det_hit_ids),
202 n_all_track_hits=len(all_tracks_det_hit_ids),
203 n_found_hits=len(all_mc_tracks_det_hit_ids & all_tracks_det_hit_ids),
204 n_matched_hits=n_matched_hits
205 )
206
A (simplified) python wrapper for StoreArray.