Belle II Software  release-08-01-10
ExpertTrackingValidationModule Class Reference
Inheritance diagram for ExpertTrackingValidationModule:
Collaboration diagram for ExpertTrackingValidationModule:

Public Member Functions

def __init__ (self, name, contact, fit=False, pulls=False, resolution=False, output_file_name=None, track_filter_object=AlwaysPassFilter(), plot_name_postfix='', plot_title_postfix='', exclude_profile_mc_parameter='', exclude_profile_pr_parameter='', use_expert_folder=True, trackCandidatesColumnName='RecoTracks', mcTrackCandidatesColumnName='MCRecoTracks', cdcHitsColumnName='CDCHits', write_tables=False)
 
def initialize (self)
 
def event (self)
 
def examine_hits_in_event (self)
 
def terminate (self)
 
def examine_pr_tracks (self)
 
def examine_mc_tracks (self)
 
def profiles_by_mc_parameters (self, xs, quantity_name, unit=None, parameter_names=['d_0', 'p_t', 'tan_lambda', 'multiplicity', 'phi', 'ndf',], make_hist=True, weights=None, is_asymmetry=False)
 
def profiles_by_pr_parameters (self, xs, quantity_name, unit=None, parameter_names=['Seed_p_t', 'Seed tan #lambda', 'Seed #phi'], make_hist=True)
 
def profiles_by_parameters_base (self, xs, quantity_name, parameter_names, profile_parameters, unit, make_hist, weights=None, is_asymmetry=False)
 

Public Attributes

 cdcHitsColumnname
 cached name of the CDCHits StoreArray
 
 write_tables
 cached value of the flag to write the validation figures of merit
 
 number_of_total_hits
 number of all hits
 
 number_of_mc_hits
 number of hits on MC track
 
 number_of_pr_hits
 number of hits on pattern reconstructed tracks
 
 is_hit_found
 list of flags for [not-]found hits
 
 is_hit_matched
 list of flags for [not-]matched hits
 
 mc_missing
 list of flags where MCRecoTrack is [not] missing MCTrackCand
 
 ratio_hits_in_mc_tracks_and_not_in_pr_tracks
 list of fraction of number of hits in MC track but not in PR track
 
 ratio_hits_in_mc_tracks_and_in_pr_tracks
 list of fraction of number of hits in MC track and in PR track
 
 ratio_hits_in_missing_mc_tracks_and_in_pr_tracks
 list of fraction of number of hits in missing MC track and in PR track
 
 ratio_hits_in_mc_tracks_and_in_fake_pr_tracks
 list of fraction of number of hits in MC track and in fake PR track
 
 ratio_hits_in_mc_tracks_and_in_good_pr_tracks
 list of fraction of number of hits in MC track and in good PR track
 
 mc_is_primary
 list of flags indicating that the MC track is [not] a primary MCParticle
 
 mc_number_of_hits
 list of the number of MCTrackCandHits on the MC track
 
 number_of_connected_tracks
 This is the number of mcTrackCands sharing a hit with the track cand.
 
 number_of_wrong_hits
 This number gives information about the "badness" of the fake.
 
 pr_number_of_hits
 list of the number of pattern-reconstructed hits
 
 pr_number_of_matched_hits
 list of the number of pattern-reconstructed hits matched to MC track
 
 validation_name
 cached value of the tracking-validation name
 
 contact
 cached value of the contact person name
 
 fit
 cached value of the track fit
 
 pulls
 cached values of the track-fit pulls
 
 resolution
 cached value of the resolution
 
 output_file_name
 cached value of the output ROOT TFile
 
 track_filter_object
 cached value of the track-filter object
 
 plot_name_postfix
 cached value of the suffix appended to the plot names
 
 plot_title_postfix
 cached value of the suffix appended to the plot titles
 
 exclude_profile_pr_parameter
 cached list of perigee parameters excluded from PR side plots
 
 exclude_profile_mc_parameter
 cached list of perigee parameters excluded from MC side plots
 
 use_expert_folder
 cached flag to use the "expert" folder for the pull and residual plots
 
 trackCandidatesColumnName
 cached name of the RecoTracks StoreArray
 
 mcTrackCandidatesColumnName
 cached name of the MCRecoTracks StoreArray
 
 non_expert_parameters
 list of parameters that determines which plots (all with corresponding x-axis) are marked as shifter plots
 
 resolution_pt_binning
 default binning used for resolution plots over pt
 
 referenceFileName
 If this variable is set the code will open the file with same name as the file created here and will read the binning from the TH1/TProfile with same name as the one created here. More...
 
 trackMatchLookUp
 Track-match object that examines relation information from MCMatcherTracksModule.
 
 pr_clones_and_matches
 Use deques in favour of lists to prevent repeated memory allocation of cost O(n) More...
 
 pr_matches
 list of PR-track matches
 
 pr_fakes
 list of PR-track fakes
 
 pr_seed_pt
 list of PR-track seed pt values
 
 pr_seed_tan_lambdas
 list of PR-track seed tan(lambda) values
 
 pr_seed_phi
 list of PR-track seed phi values
 
 pr_omega_truths
 list of PR-track seed omega-truth values
 
 pr_omega_estimates
 list of PR-track seed omega-estimate values
 
 pr_omega_variances
 list of PR-track seed omega-variance values
 
 pr_tan_lambda_truths
 list of PR-track seed tan(lambda)-truth values
 
 pr_tan_lambda_estimates
 list of PR-track seed tan(lambda)-estimate values
 
 pr_tan_lambda_variances
 list of PR-track seed tan(lambda)-variance values
 
 pr_d0_truths
 list of PR-track seed d0-truth values
 
 pr_d0_estimates
 list of PR-track seed d0-estimate values
 
 pr_d0_variances
 list of PR-track seed d0-variance values
 
 pr_z0_truths
 list of PR-track seed z0-truth values
 
 pr_z0_estimates
 list of PR-track seed z0-estimate values
 
 pr_pt_truths
 list of PR-track seed pt-truth values
 
 pr_pt_estimates
 list of PR-track seed pt-estimate values
 
 pr_bining_pt
 list of PR-track binning values
 
 mc_matches
 list of MC-track matches
 
 mc_charge_matches
 list of MC-track matches, including matched charge
 
 mc_charge_asymmetry
 list of MC-track matches charge asymmetry
 
 mc_charge_asymmetry_weights
 list of MC-track matches charge asymmetry weights
 
 mc_primaries
 list of MC-track primaries
 
 mc_d0s
 list of MC-track d0 values
 
 mc_tan_lambdas
 list of MC-track tan(lambda) values
 
 mc_phi
 direction of the track in phi
 
 mc_pts
 list of MC-track pt values
 
 mc_hit_efficiencies
 list of MC-track hit efficiencies
 
 mc_multiplicities
 list of MC-track multiplicities
 
 mc_ndf
 list of MC-track number of degrees of freedom
 

Detailed Description

Module to collect more matching information about the found particles and to generate validation
plots and figures of merit on the performance of track finding. This module gives information on the
number of hits etc. 

Definition at line 40 of file hit_module.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  contact,
  fit = False,
  pulls = False,
  resolution = False,
  output_file_name = None,
  track_filter_object = AlwaysPassFilter(),
  plot_name_postfix = '',
  plot_title_postfix = '',
  exclude_profile_mc_parameter = '',
  exclude_profile_pr_parameter = '',
  use_expert_folder = True,
  trackCandidatesColumnName = 'RecoTracks',
  mcTrackCandidatesColumnName = 'MCRecoTracks',
  cdcHitsColumnName = 'CDCHits',
  write_tables = False 
)
Constructor

Definition at line 46 of file hit_module.py.

63  write_tables=False):
64  """Constructor"""
65 
66  TrackingValidationModule.__init__(
67  self,
68  name,
69  contact,
70  fit,
71  pulls,
72  resolution,
73  output_file_name,
74  track_filter_object,
75  plot_name_postfix,
76  plot_title_postfix,
77  exclude_profile_mc_parameter,
78  exclude_profile_pr_parameter,
79  use_expert_folder,
80  trackCandidatesColumnName,
81  mcTrackCandidatesColumnName)
82 
83 
84  self.cdcHitsColumnname = cdcHitsColumnName
85 
86  self.write_tables = write_tables
87 

Member Function Documentation

◆ event()

def event (   self)
Event method

Reimplemented from TrackingValidationModule.

Definition at line 137 of file hit_module.py.

◆ examine_hits_in_event()

def examine_hits_in_event (   self)
Classify all of the hits in the event according to the parent track(s)

Definition at line 143 of file hit_module.py.

◆ examine_mc_tracks()

def examine_mc_tracks (   self)
inherited
Looks at the individual Monte Carlo tracks and store information about them

Definition at line 382 of file module.py.

382  def examine_mc_tracks(self):
383  """Looks at the individual Monte Carlo tracks and store information about them"""
384 
385  trackMatchLookUp = self.trackMatchLookUp
386 
387  # Analyse from the Monte Carlo reference side
388  mcTrackCands = Belle2.PyStoreArray(self.mcTrackCandidatesColumnName)
389  mcParticles = Belle2.PyStoreArray('MCParticles')
390  if not mcTrackCands:
391  return
392 
393  multiplicity = mcTrackCands.getEntries()
394  multiplicity_primaries = multiplicity
395 
396  # measure the charge asymmetry
397  n_matched_plus = 0
398  n_matched_minus = 0
399 
400  for mcTrackCand in mcTrackCands:
401  is_matched = trackMatchLookUp.isAnyChargeMatchedMCRecoTrack(mcTrackCand)
402 
403  relatedPRtrackCand = trackMatchLookUp.getRelatedPRRecoTrack(mcTrackCand)
404  if relatedPRtrackCand:
405  is_chargeMatched = trackMatchLookUp.isChargeMatched(relatedPRtrackCand)
406  else:
407  is_chargeMatched = False
408 
409  if is_chargeMatched:
410  if mcTrackCand.getChargeSeed() > 0:
411  n_matched_plus += 1
412  else:
413  n_matched_minus += 1
414 
415  hit_efficiency = trackMatchLookUp.getRelatedEfficiency(mcTrackCand)
416  if math.isnan(hit_efficiency):
417  hit_efficiency = 0
418 
419  mcParticle = trackMatchLookUp.getRelatedMCParticle(mcTrackCand)
420  mcHelix = getHelixFromMCParticle(mcParticle)
421 
422  # fill the FilterProperties will all properties on this track
423  # gathered so far
424  filterProperties = FilterProperties(mcParticle=mcParticle,
425  mcParticles=mcParticles)
426 
427  if not self.track_filter_object.doesMcPass(filterProperties):
428  continue
429 
430  momentum = mcParticle.getMomentum()
431  pt = momentum.Rho()
432  tan_lambda = np.divide(1.0, math.tan(momentum.Theta())) # Avoid zero division exception
433  d0 = mcHelix.getD0()
434  det_hit_ids = get_det_hit_ids(mcTrackCand)
435  ndf = calc_ndf_from_det_hit_ids(det_hit_ids)
436 
437  self.mc_matches.append(is_matched)
438  self.mc_charge_matches.append(is_chargeMatched and is_matched)
439  self.mc_primaries.append(is_primary(mcParticle))
440  self.mc_hit_efficiencies.append(hit_efficiency)
441  self.mc_pts.append(pt)
442  self.mc_d0s.append(d0)
443  self.mc_tan_lambdas.append(tan_lambda)
444  self.mc_multiplicities.append(multiplicity)
445  self.mc_phi.append(momentum.Phi())
446  self.mc_ndf.append(ndf)
447  if not is_primary(mcParticle):
448  multiplicity_primaries -= 1
449 
450  charge_asymmetry = (n_matched_plus - n_matched_minus)/(n_matched_plus +
451  n_matched_minus) if (n_matched_plus + n_matched_minus) != 0 else 0
452  for mcTrackCand in mcTrackCands:
453  if is_primary(mcParticle):
454  self.mc_charge_asymmetry.append(charge_asymmetry)
455  self.mc_charge_asymmetry_weights.append(1./multiplicity_primaries)
456  else:
457  self.mc_charge_asymmetry.append(0)
458  self.mc_charge_asymmetry_weights.append(0)
459 
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72

◆ examine_pr_tracks()

def examine_pr_tracks (   self)
inherited
Looks at the individual pattern reconstructed tracks and store information about them

Definition at line 265 of file module.py.

◆ initialize()

def initialize (   self)
Receive signal at the start of event processing

Reimplemented from TrackingValidationModule.

Definition at line 88 of file hit_module.py.

◆ profiles_by_mc_parameters()

def profiles_by_mc_parameters (   self,
  xs,
  quantity_name,
  unit = None,
  parameter_names = [             'd_0',             'p_t',             'tan_lambda',             'multiplicity',             'phi',             'ndf',         ],
  make_hist = True,
  weights = None,
  is_asymmetry = False 
)
inherited
Create profile histograms by MC-track parameters

Definition at line 710 of file module.py.

◆ profiles_by_parameters_base()

def profiles_by_parameters_base (   self,
  xs,
  quantity_name,
  parameter_names,
  profile_parameters,
  unit,
  make_hist,
  weights = None,
  is_asymmetry = False 
)
inherited
Create profile histograms for generic parameters

Definition at line 782 of file module.py.

◆ profiles_by_pr_parameters()

def profiles_by_pr_parameters (   self,
  xs,
  quantity_name,
  unit = None,
  parameter_names = ['Seed_p_t', 'Seed tan #lambda', 'Seed #phi'],
  make_hist = True 
)
inherited
Create profile histograms by PR-track parameters

Definition at line 754 of file module.py.

◆ terminate()

def terminate (   self)
Receive signal at the end of event processing

Reimplemented from TrackingValidationModule.

Definition at line 308 of file hit_module.py.

Member Data Documentation

◆ pr_clones_and_matches

pr_clones_and_matches
inherited

Use deques in favour of lists to prevent repeated memory allocation of cost O(n)

list of PR-track clones and matches

Definition at line 187 of file module.py.

◆ referenceFileName

referenceFileName
inherited

If this variable is set the code will open the file with same name as the file created here and will read the binning from the TH1/TProfile with same name as the one created here.

If you do not want this feature either remove the corresponding root files from the validation directory (this will trigger the default behaviour) or set the environmental variable DO_NOT_READ_BINNING

Definition at line 169 of file module.py.


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