Belle II Software development
FitHarvester Class Reference
Inheritance diagram for FitHarvester:

Public Member Functions

def __init__ (self, output_file_name, queue)
 
def pick (self, track_fit_result)
 
def peel (self, track_fit_result)
 

Public Attributes

 data_store
 access the DataStore singletion
 

Static Public Attributes

refiners save_tree = refiners.SaveTreeRefiner()
 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

Collect dE/dX and the correct p of each VXD hit associated with the fitted tracks. 

Definition at line 338 of file harvester.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  output_file_name,
  queue 
)
Constructor

Definition at line 341 of file harvester.py.

341 def __init__(self, output_file_name, queue):
342 """Constructor"""
343 QueueHarvester.__init__(self, queue, foreach="TrackFitResults", output_file_name=output_file_name)
344
345 self.data_store = Belle2.DataStore.Instance()
346
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54

Member Function Documentation

◆ peel()

def peel (   self,
  track_fit_result 
)
Aggregate the track-fit information associated with a TrackFitResult

Definition at line 358 of file harvester.py.

358 def peel(self, track_fit_result):
359 """Aggregate the track-fit information associated with a TrackFitResult"""
360 mc_track_cand = track_fit_result.getRelationsFrom("TrackCands")[0]
361 mc_particle = self.data_store.getRelated(mc_track_cand, "MCParticles")
362
363 fit_momentum = track_fit_result.getMomentum()
364 true_momentum = mc_particle.getMomentum()
365
366 related_reco_track = track_fit_result.getRelated("GF2Tracks")
367 cardinal_rep = related_reco_track.getCardinalRep()
368 kalman_fit_state = related_reco_track.getKalmanFitStatus()
369
370 number_of_measurements_in_total = 0
371 number_of_measurements_with_smaller_weight = 0
372
373 number_of_momentum_measurements_in_total = 0
374 number_of_momentum_measurements_with_smaller_weight = 0
375
376 for track_point_ID in range(related_reco_track.getNumPointsWithMeasurement()):
377 track_point = related_reco_track.getPointWithMeasurement(track_point_ID)
378
379 is_momentum_measurement = track_point.getRawMeasurement().__class__.__name__ == "genfit::PlanarMomentumMeasurement"
380
381 if is_momentum_measurement:
382 number_of_momentum_measurements_in_total += 1
383
384 if track_point.hasFitterInfo(cardinal_rep):
385 fitter_info = track_point.getFitterInfo(cardinal_rep)
386 num_measurements = fitter_info.getNumMeasurements()
387
388 for measurement_id in range(num_measurements):
389 number_of_measurements_in_total += 1
390 weight = fitter_info.getMeasurementOnPlane(measurement_id).getWeight()
391 if weight != 1:
392 number_of_measurements_with_smaller_weight += 1
393
394 if is_momentum_measurement:
395 number_of_momentum_measurements_with_smaller_weight += 1
396
397 return dict(fit_momentum_x=fit_momentum.X(),
398 fit_momentum_y=fit_momentum.Y(),
399 fit_momentum_z=fit_momentum.Z(),
400 p_value=kalman_fit_state.getForwardPVal(),
401 backward_p_value=kalman_fit_state.getBackwardPVal(),
402 true_momentum_x=true_momentum.X(),
403 true_momentum_y=true_momentum.Y(),
404 true_momentum_z=true_momentum.Z(),
405 number_of_measurements_in_total=number_of_measurements_in_total,
406 number_of_measurements_with_smaller_weight=number_of_measurements_with_smaller_weight,
407 number_of_momentum_measurements_in_total=number_of_momentum_measurements_in_total,
408 number_of_momentum_measurements_with_smaller_weight=number_of_momentum_measurements_with_smaller_weight)
409

◆ pick()

def pick (   self,
  track_fit_result 
)
Select a TrackFitResult if it is associated with exactly one MCParticle

Definition at line 347 of file harvester.py.

347 def pick(self, track_fit_result):
348 """Select a TrackFitResult if it is associated with exactly one MCParticle"""
349 mc_track_cands = track_fit_result.getRelationsFrom("TrackCands")
350 if len(mc_track_cands) != 1:
351 return False
352
353 mc_track_cand = mc_track_cands[0]
354 mc_particles = self.data_store.getRelationsFromObj(mc_track_cand, "MCParticles")
355
356 return len(mc_particles) == 1
357

Member Data Documentation

◆ data_store

data_store

access the DataStore singletion

Definition at line 345 of file harvester.py.

◆ save_tree

refiners save_tree = refiners.SaveTreeRefiner()
static

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 412 of file harvester.py.


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