Belle II Software development
SegmentFakeRatesModule Class Reference
Inheritance diagram for SegmentFakeRatesModule:
HarvestingModule

Public Member Functions

def __init__ (self, output_file_name, local_track_cands_store_array_name="LocalTrackCands", mc_track_cands_store_array_name="MCTrackCands", legendre_track_cand_store_array_name="LegendreTrackCands")
 
def prepare (self)
 
def peel (self, local_track_cand)
 

Public Attributes

 mc_track_cands_store_array_name
 cached name of the TrackCands StoreArray
 
 legendre_track_cand_store_array_name
 cached name of the Legendre TrackCands StoreArray
 
 mc_track_matcher_local
 function to match local tracks to MC tracks
 
 mc_track_matcher_legendre
 function to match Legendre tracks to MC tracks
 
 cdcHits
 cached CDCHits StoreArray
 

Static Public Attributes

refiners save_tree
 Refiners to be executed at the end of the harvesting / termination of the module Save a tree of all collected variables in a sub folder.
 

Detailed Description

Harvesting module to check for basic matching information of the found segments.
If you want to have matching information, please use the MC matcher module to make all possible
combinations between legendre, local and MC track candidates.
Also, the Segments must be transformed into GF track cands.

Definition at line 141 of file harvester.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  output_file_name,
  local_track_cands_store_array_name = "LocalTrackCands",
  mc_track_cands_store_array_name = "MCTrackCands",
  legendre_track_cand_store_array_name = "LegendreTrackCands" 
)
Initialize the harvesting module with
Arguments
---------
  output_file_name Name of the root file
  local_track_cands_store_array_name Name of the StoreArray for local track cands
  mc_track_cands_store_array_name Name of the StoreArray for MC track cands
  legendre_track_cand_store_array_name Name of the StoreArray for legendre track cands

Reimplemented from HarvestingModule.

Definition at line 150 of file harvester.py.

155 legendre_track_cand_store_array_name="LegendreTrackCands"):
156 """
157 Initialize the harvesting module with
158 Arguments
159 ---------
160 output_file_name Name of the root file
161 local_track_cands_store_array_name Name of the StoreArray for local track cands
162 mc_track_cands_store_array_name Name of the StoreArray for MC track cands
163 legendre_track_cand_store_array_name Name of the StoreArray for legendre track cands
164 """
165 super().__init__(
166 foreach=local_track_cands_store_array_name,
167 output_file_name=output_file_name)
168
169
170 self.mc_track_cands_store_array_name = mc_track_cands_store_array_name
171
172 self.legendre_track_cand_store_array_name = legendre_track_cand_store_array_name
173
174
175 self.mc_track_matcher_local = Belle2.TrackMatchLookUp(self.mc_track_cands_store_array_name, self.foreach)
176
177 self.mc_track_matcher_legendre = Belle2.TrackMatchLookUp(
178 self.mc_track_cands_store_array_name,
179 legendre_track_cand_store_array_name)
180
Class to provide convenient methods to look up matching information between pattern recognition and M...

Member Function Documentation

◆ peel()

def peel (   self,
  local_track_cand 
)
 Extract the information from the segments. 

Reimplemented from HarvestingModule.

Definition at line 187 of file harvester.py.

187 def peel(self, local_track_cand):
188 """ Extract the information from the segments. """
189 mc_track_matcher_local = self.mc_track_matcher_local
190 mc_track_matcher_legendre = self.mc_track_matcher_legendre
191
192 cdc_hits = self.cdcHits
193
194 is_background = mc_track_matcher_local.isBackgroundPRRecoTrack(local_track_cand)
195 is_ghost = mc_track_matcher_local.isGhostPRRecoTrack(local_track_cand)
196 is_matched = mc_track_matcher_local.isAnyChargeMatchedPRRecoTrack(local_track_cand)
197 is_clone = mc_track_matcher_local.isAnyChargeClonePRRecoTrack(local_track_cand)
198 is_clone_or_matched = is_matched or is_clone
199 hit_purity = abs(mc_track_matcher_local.getRelatedPurity(local_track_cand))
200
201 # Stereo Track?
202 first_cdc_hit_id = local_track_cand.getHitIDs(Belle2.Const.CDC)[0]
203 first_cdc_hit = cdc_hits[first_cdc_hit_id]
204 is_stereo = first_cdc_hit.getISuperLayer() % 2 == 1
205 superlayer_of_segment = first_cdc_hit.getISuperLayer()
206
207 has_partner = np.NaN
208 hit_purity_of_partner = np.NaN
209 hit_efficiency_of_partner = np.NaN
210 mc_track_pt = np.NaN
211 mc_track_dist = np.NaN
212 number_of_new_hits = local_track_cand.getNHits()
213 number_of_hits = local_track_cand.getNHits()
214 number_of_hits_in_same_superlayer = np.NaN
215 partner_has_stereo_information = np.NaN
216
217 if is_clone_or_matched:
218 related_mc_track_cand = mc_track_matcher_local.getRelatedMCRecoTrack(local_track_cand)
219 has_partner = (mc_track_matcher_legendre.isAnyChargeMatchedMCRecoTrack(related_mc_track_cand) or
220 mc_track_matcher_legendre.isAnyChargeMergedMCRecoTrack(related_mc_track_cand))
221 mc_track_pt = related_mc_track_cand.getMomSeed().Pt()
222 mc_track_dist = related_mc_track_cand.getPosSeed().Mag()
223 if has_partner:
224 partner_legendre_track_cand = mc_track_matcher_legendre.getRelatedPRRecoTrack(related_mc_track_cand)
225 hit_purity_of_partner = abs(mc_track_matcher_legendre.getRelatedPurity(partner_legendre_track_cand))
226 hit_efficiency_of_partner = abs(mc_track_matcher_legendre.getRelatedEfficiency(related_mc_track_cand))
227
228 # Count number of new hits
229 legendre_hits = set(list(partner_legendre_track_cand.getHitIDs()))
230 local_hits = set(list(local_track_cand.getHitIDs()))
231
232 local_hits_new = local_hits - legendre_hits
233 number_of_new_hits = len(local_hits_new)
234
235 # Count number of hits in this superlayer
236 partner_has_stereo_information = 0
237 number_of_hits_in_same_superlayer = 0
238 for cdc_hit_ID in legendre_hits:
239 cdc_hit = cdc_hits[cdc_hit_ID]
240 if cdc_hit.getISuperLayer() == superlayer_of_segment:
241 number_of_hits_in_same_superlayer += 1
242
243 if cdc_hit.getISuperLayer() % 2 == 1:
244 partner_has_stereo_information = 1
245
246 return dict(superlayer_of_segment=superlayer_of_segment,
247 mc_track_dist=mc_track_dist,
248 is_background=is_background,
249 is_ghost=is_ghost,
250 is_matched=is_matched,
251 is_clone=is_clone,
252 is_clone_or_matched=is_clone_or_matched,
253 is_stereo=is_stereo,
254 mc_track_pt=mc_track_pt,
255 hit_purity=hit_purity,
256 has_partner=has_partner,
257 hit_purity_of_partner=hit_purity_of_partner,
258 hit_efficiency_of_partner=hit_efficiency_of_partner,
259 number_of_new_hits=number_of_new_hits,
260 number_of_hits=number_of_hits,
261 number_of_hits_in_same_superlayer=number_of_hits_in_same_superlayer,
262 partner_has_stereo_information=partner_has_stereo_information)
263

◆ prepare()

def prepare (   self)
 Prepare the CDC lookup. 

Reimplemented from HarvestingModule.

Definition at line 181 of file harvester.py.

181 def prepare(self):
182 """ Prepare the CDC lookup. """
183
184 self.cdcHits = Belle2.PyStoreArray("CDCHits")
185 return HarvestingModule.prepare(self)
186
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72

Member Data Documentation

◆ cdcHits

cdcHits

cached CDCHits StoreArray

Definition at line 184 of file harvester.py.

◆ legendre_track_cand_store_array_name

legendre_track_cand_store_array_name

cached name of the Legendre TrackCands StoreArray

Definition at line 172 of file harvester.py.

◆ mc_track_cands_store_array_name

mc_track_cands_store_array_name

cached name of the TrackCands StoreArray

Definition at line 170 of file harvester.py.

◆ mc_track_matcher_legendre

mc_track_matcher_legendre

function to match Legendre tracks to MC tracks

Definition at line 177 of file harvester.py.

◆ mc_track_matcher_local

mc_track_matcher_local

function to match local tracks to MC tracks

Definition at line 175 of file harvester.py.

◆ save_tree

refiners save_tree
static
Initial value:
= refiners.save_tree(
)

Refiners to be executed at the end of the harvesting / termination of the module Save a tree of all collected variables in a sub folder.

Definition at line 266 of file harvester.py.


The documentation for this class was generated from the following file: