Belle II Software  release-06-02-00
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', 'theta', 'ndf',], non_expert_parameters=['p_{t}'], make_hist=True, weights=None)
 
def profiles_by_pr_parameters (self, xs, quantity_name, unit=None, parameter_names=['Seed tan #lambda', 'Seed #phi', 'Seed #theta'], make_hist=True)
 
def profiles_by_parameters_base (self, xs, quantity_name, parameter_names, profile_parameters, unit, make_hist, non_expert_parameters=[], weights=None)
 

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
 
 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_tan_lambdas
 list of PR-track seed tan(lambda) values
 
 pr_seed_phi
 list of PR-track seed phi values
 
 pr_seed_theta
 list of PR-track seed theta 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_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_theta
 direction of the track in theta
 
 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 375 of file module.py.

375  def examine_mc_tracks(self):
376  """Looks at the individual Monte Carlo tracks and store information about them"""
377 
378  trackMatchLookUp = self.trackMatchLookUp
379 
380  # Analyse from the Monte Carlo reference side
381  mcTrackCands = Belle2.PyStoreArray(self.mcTrackCandidatesColumnName)
382  mcParticles = Belle2.PyStoreArray('MCParticles')
383  if not mcTrackCands:
384  return
385 
386  multiplicity = mcTrackCands.getEntries()
387 
388  for mcTrackCand in mcTrackCands:
389  is_matched = trackMatchLookUp.isMatchedMCRecoTrack(mcTrackCand)
390 
391  hit_efficiency = trackMatchLookUp.getRelatedEfficiency(mcTrackCand)
392  if math.isnan(hit_efficiency):
393  hit_efficiency = 0
394 
395  mcParticle = trackMatchLookUp.getRelatedMCParticle(mcTrackCand)
396  mcHelix = getHelixFromMCParticle(mcParticle)
397 
398  # fill the FilterProperties will all properties on this track
399  # gathered so far
400  filterProperties = FilterProperties(mcParticle=mcParticle,
401  mcParticles=mcParticles)
402 
403  if not self.track_filter_object.doesMcPass(filterProperties):
404  continue
405 
406  momentum = mcParticle.getMomentum()
407  pt = momentum.Perp()
408  tan_lambda = np.divide(1.0, math.tan(momentum.Theta())) # Avoid zero division exception
409  d0 = mcHelix.getD0()
410  det_hit_ids = get_det_hit_ids(mcTrackCand)
411  ndf = calc_ndf_from_det_hit_ids(det_hit_ids)
412 
413  self.mc_matches.append(is_matched)
414  self.mc_primaries.append(is_primary(mcParticle))
415  self.mc_hit_efficiencies.append(hit_efficiency)
416  self.mc_pts.append(pt)
417  self.mc_d0s.append(d0)
418  self.mc_tan_lambdas.append(tan_lambda)
419  self.mc_multiplicities.append(multiplicity)
420  self.mc_theta.append(momentum.Theta())
421  self.mc_phi.append(momentum.Phi())
422  self.mc_ndf.append(ndf)
423 
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:56

◆ examine_pr_tracks()

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

Definition at line 258 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',             'theta',             'ndf',         ],
  non_expert_parameters = ['p_{t}'],
  make_hist = True,
  weights = None 
)
inherited
Create profile histograms by MC-track parameters

Definition at line 633 of file module.py.

◆ profiles_by_parameters_base()

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

Definition at line 707 of file module.py.

◆ profiles_by_pr_parameters()

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

Definition at line 679 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 184 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 166 of file module.py.


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