Belle II Software  release-08-01-10
QualityEstimatorMC Class Reference

Class implementing the algorithm used for the MC based quality estimation. More...

#include <QualityEstimatorMC.h>

Inheritance diagram for QualityEstimatorMC:
Collaboration diagram for QualityEstimatorMC:

Public Types

typedef int MCRecoTrackIndex
 typedef for MCRecoTrackIndex
 
typedef unsigned int NMatches
 typedef for counter of number of matches
 
typedef std::pair< MCRecoTrackIndex, NMatchesMatchInfo
 typedef for MatchInfo
 

Public Member Functions

 QualityEstimatorMC (const std::string &mcRecoTracksStoreArrayName="MCRecoTracks", bool strictQualityIndicator=true, bool mva_target=false)
 Constructor. More...
 
virtual double estimateQuality (std::vector< SpacePoint const * > const &measurements) final
 Performing MC based quality estimation. More...
 
virtual QualityEstimationResults estimateQualityAndProperties (std::vector< SpacePoint const * > const &measurements) override final
 additionally return momentum_truth if it is a perfect match to a single MCRecoTrack
 
void setClustersNames (const std::string &svdClustersName, const std::string &pxdClustersName)
 Setter for StoreArray names of SVD and PXD clusters, if those are not set by the user it will be tried to read them from the MCRecoTracks StoreArray. More...
 
void forceUpdateClusterNames ()
 Setter to force the class to update its cluster names. More...
 
void setMagneticFieldStrength (double magneticFieldZ=1.5)
 Setter for z component of magnetic field. More...
 

Protected Member Functions

MatchInfo getBestMatchToMCClusters (std::vector< SpacePoint const * > const &measurements)
 Get MCRecoTrack index of best matching tracks and number of matched MC clusters which can be matched to the given track candidate. More...
 
double calculateQualityIndicator (unsigned int nClusters, MatchInfo &match)
 Calculate MC qualityIndicator based on MatchInfo of best matched MCRecoTrack. More...
 
double calcPt (double const radius) const
 Returns a value for the transverse momentum in GeV calculated from a provided radius. More...
 

Protected Attributes

bool m_strictQualityIndicator
 If true only SPTCs containing SVDClusters corresponding to a single MCRecoTrack get a QI != 0. More...
 
bool m_mva_target
 If true the SPTCs containing all the SVDCluster of the corresponding MCRecoTrack and no other SVDCluster receive a Quality Index larger than one. More...
 
std::string m_mcRecoTracksStoreArrayName
 MCRecoTracks StoreArray name.
 
std::string m_svdClustersName = ""
 SVD clusters StoreArray name.
 
std::string m_pxdClustersName = ""
 PXD clusters StoreArray name.
 
bool m_clusterNamesNeedSetting
 if true cluster names need to be set, either by calling setClustersNames or read from MCRecoTracks at first call More...
 
MatchInfo m_match
 stores the current match for optional return values
 
StoreArray< RecoTrackm_mcRecoTracks
 the storeArray for RecoTracks as member
 
double m_magneticFieldZ = 1.5
 Member storing the z component of the magnetic field.
 
QualityEstimationResults m_results
 Result of the quality estimation This is stored as a member variable, because some values may be calculated by 'estimateQuality' anyways. More...
 

Detailed Description

Class implementing the algorithm used for the MC based quality estimation.

Definition at line 22 of file QualityEstimatorMC.h.

Constructor & Destructor Documentation

◆ QualityEstimatorMC()

QualityEstimatorMC ( const std::string &  mcRecoTracksStoreArrayName = "MCRecoTracks",
bool  strictQualityIndicator = true,
bool  mva_target = false 
)
inline

Constructor.

Parameters
mcRecoTracksStoreArrayName: Name of the MCRecoTracks StoreArray
strictQualityIndicator: boolean whether to perform strict estimation
mva_target: Boolean whether to perform quality estimation for MVA QE training. This overwrites the strictQualityIndicator option!

Definition at line 35 of file QualityEstimatorMC.h.

36  :
37  QualityEstimatorBase(), m_strictQualityIndicator(strictQualityIndicator), m_mva_target(mva_target),
38  m_mcRecoTracksStoreArrayName(mcRecoTracksStoreArrayName)
39  {
41  };
bool m_strictQualityIndicator
If true only SPTCs containing SVDClusters corresponding to a single MCRecoTrack get a QI !...
StoreArray< RecoTrack > m_mcRecoTracks
the storeArray for RecoTracks as member
bool m_mva_target
If true the SPTCs containing all the SVDCluster of the corresponding MCRecoTrack and no other SVDClus...
std::string m_mcRecoTracksStoreArrayName
MCRecoTracks StoreArray name.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.

Member Function Documentation

◆ calcPt()

double calcPt ( double const  radius) const
inlineprotectedinherited

Returns a value for the transverse momentum in GeV calculated from a provided radius.

Utilizing m_magneticFieldZ and hard coded speed of light

Definition at line 80 of file QualityEstimatorBase.h.

◆ calculateQualityIndicator()

double calculateQualityIndicator ( unsigned int  nClusters,
MatchInfo match 
)
protected

Calculate MC qualityIndicator based on MatchInfo of best matched MCRecoTrack.

Parameters
nClusters: number of clusters of the track candidate
match: MatchInfo for the best match
Returns
qualityIndicator

Definition at line 66 of file QualityEstimatorMC.cc.

67 {
68  double qualityIndicator = 0;
69  if (m_mva_target) {
70  if (nClusters == m_mcRecoTracks[match.first]->getNumberOfSVDHits()) {
71  qualityIndicator = 1 - (1. / nClusters);
72  }
73  } else if (m_strictQualityIndicator) {
74  if (nClusters == match.second) {
75  qualityIndicator = 1 - (1. / nClusters);
76  }
77  } else {
78  int nRecoTrackClusters = m_mcRecoTracks[match.first]->getNumberOfSVDHits();
79  qualityIndicator = std::pow(match.second, 3) / (nRecoTrackClusters * nClusters * nClusters);
80  }
81  return qualityIndicator;
82 }

◆ estimateQuality()

double estimateQuality ( std::vector< SpacePoint const * > const &  measurements)
finalvirtual

Performing MC based quality estimation.

Parameters
measurements: SPs of the track candidate to be evaluate
Returns
quality indicator value

Implements QualityEstimatorBase.

Definition at line 14 of file QualityEstimatorMC.cc.

◆ forceUpdateClusterNames()

void forceUpdateClusterNames ( )
inline

Setter to force the class to update its cluster names.

The cluster names have to be set either by calling setClustersNames or will be automatically read from first entry of MCRecoTracks when calling one of the functions doing the estimation for the first time

Definition at line 67 of file QualityEstimatorMC.h.

◆ getBestMatchToMCClusters()

QualityEstimatorMC::MatchInfo getBestMatchToMCClusters ( std::vector< SpacePoint const * > const &  measurements)
protected

Get MCRecoTrack index of best matching tracks and number of matched MC clusters which can be matched to the given track candidate.

Parameters
measurements: SPs to be evaluated
Returns
MatchInfo containing the ID of the best matching MCRecoTracks and number of matched clusters

Definition at line 24 of file QualityEstimatorMC.cc.

◆ setClustersNames()

void setClustersNames ( const std::string &  svdClustersName,
const std::string &  pxdClustersName 
)
inline

Setter for StoreArray names of SVD and PXD clusters, if those are not set by the user it will be tried to read them from the MCRecoTracks StoreArray.

Parameters
svdClustersName: SVD cluster StoreArray name
pxdClustersName: PXD cluster StoreArray name

Definition at line 56 of file QualityEstimatorMC.h.

◆ setMagneticFieldStrength()

void setMagneticFieldStrength ( double  magneticFieldZ = 1.5)
inlineinherited

Setter for z component of magnetic field.

Parameters
magneticFieldZ: value to set it to

Definition at line 53 of file QualityEstimatorBase.h.

Member Data Documentation

◆ m_clusterNamesNeedSetting

bool m_clusterNamesNeedSetting
protected
Initial value:
=
true

if true cluster names need to be set, either by calling setClustersNames or read from MCRecoTracks at first call

Definition at line 100 of file QualityEstimatorMC.h.

◆ m_mva_target

bool m_mva_target
protected

If true the SPTCs containing all the SVDCluster of the corresponding MCRecoTrack and no other SVDCluster receive a Quality Index larger than one.

To be used for MVA QE training if both high hit purity and hit efficiency is desired.

Definition at line 94 of file QualityEstimatorMC.h.

◆ m_results

QualityEstimationResults m_results
protectedinherited

Result of the quality estimation This is stored as a member variable, because some values may be calculated by 'estimateQuality' anyways.

Therefore they don't need to be calculated explicitly in 'estimateQualityAndProperties'.

Definition at line 90 of file QualityEstimatorBase.h.

◆ m_strictQualityIndicator

bool m_strictQualityIndicator
protected

If true only SPTCs containing SVDClusters corresponding to a single MCRecoTrack get a QI != 0.

If a SVDCluster corresponds to several MCRecoTracks it is still valid as long as the correct MCRecoTrack is one of them.

Definition at line 88 of file QualityEstimatorMC.h.


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