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

Class to provide convenient methods to look up matching information between pattern recognition and Monte Carlo tracks. More...

#include <TrackMatchLookUp.h>

Collaboration diagram for TrackMatchLookUp:

Public Types

enum class  MCToPRMatchInfo {
  c_undefined ,
  c_matched ,
  c_matchedWrongCharge ,
  c_merged ,
  c_mergedWrongCharge ,
  c_missing
}
 Matching categories for the Monte Carlo tracks. More...
 
enum class  PRToMCMatchInfo {
  c_undefined ,
  c_matched ,
  c_matchedWrongCharge ,
  c_clone ,
  c_cloneWrongCharge ,
  c_background ,
  c_ghost
}
 Matching categories for the pattern recognition tracks. More...
 

Public Member Functions

 TrackMatchLookUp (const std::string &mcRecoTrackStoreArrayName, const std::string &prRecoTrackStoreArrayName="")
 Constructor taking the names of the StoreArrays containing the Monte Carlo tracks and the pattern recognition tracks respectivelly. More...
 
const RecoTrackgetCorrectChargeMatchedMCRecoTrack (const RecoTrack &prRecoTrack) const
 Looks up the matched Monte Carlo track for the given pattern recognition track. More...
 
const RecoTrackgetWrongChargeMatchedMCRecoTrack (const RecoTrack &prRecoTrack) const
 Looks up the matched Monte Carlo track for the given pattern recognition track with the wrong charge. More...
 
const RecoTrackgetAnyChargeMatchedMCRecoTrack (const RecoTrack &prRecoTrack) const
 Check whether any matched MC RecoTracks for the given prRecoTrack, independent of whether both pattern and charge are matched correctly, or only the pattern is correct but the charge is wrong. More...
 
const RecoTrackgetCorrectChargeMatchedPRRecoTrack (const RecoTrack &mcRecoTrack) const
 Looks up the matched pattern recognition track for the given Monte Carlo track. More...
 
const RecoTrackgetWrongChargeMatchedPRRecoTrack (const RecoTrack &mcRecoTrack) const
 Looks up the matched pattern recognition track for the given Monte Carlo track. More...
 
const RecoTrackgetAnyChargeMatchedPRRecoTrack (const RecoTrack &mcRecoTrack) const
 Check whether any matched PR RecoTracks for the given mcRecoTrack, independent of whether both pattern and charge are matched correctly, or only the pattern is correct but the charge is wrong. More...
 
float getMatchedPurity (const RecoTrack &recoTrack) const
 Get the hit purity of the matched track. More...
 
float getMatchedEfficiency (const RecoTrack &recoTrack) const
 Get the hit efficiency of the matched track. More...
 
bool isChargeMatched (const RecoTrack &recoTrack) const
 Checks if the recoTrack charge is correctly assigned. More...
 
MCToPRMatchInfo getMCToPRMatchInfo (const RecoTrack &mcRecoTrack) const
 Gets the matching category of Monte Carlo track.
 
bool isCorrectChargeMatchedPRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track was matched to a Monte Carlo track with both hit pattern and charge being matched.
 
bool isWrongChargeMatchedPRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track was matched to a Monte Carlo track but with the wrong charge.
 
bool isAnyChargeMatchedPRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track was matched to a Monte Carlo track, independent of whether the charge is matched.
 
bool isCorrectChargeClonePRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track is a clone of an other pattern recognition track.
 
bool isWrongChargeClonePRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track is a clone of an other pattern recognition track, but with the wrong charge.
 
bool isAnyChargeClonePRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track is a clone of an other pattern recognition track, independent of whether the charge is correct.
 
bool isBackgroundPRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track is mostly made from background hits.
 
bool isGhostPRRecoTrack (const RecoTrack &prRecoTrack) const
 Checks, if the pattern recognition track has contributions of different Monte Carlo tracks and/or background hits, such that a match is not possible.
 
PRToMCMatchInfo getPRToMCMatchInfo (const RecoTrack &prRecoTrack) const
 Gets the matching category of pattern recognition track.
 
bool isCorrectChargeMatchedMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track was matched to a pattern recognition track based on the hit pattern and the correct charge.
 
bool isWrongChargeMatchedMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track was matched to a pattern recognition track based on the hit pattern, but was assigned the wrong charge.
 
bool isAnyChargeMatchedMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track was matched to a pattern recognition track independent of the charge.
 
bool isCorrectChargeMergedMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track has been merged into another pattern recognition track.
 
bool isWrongChargeMergedMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track has been merged into another pattern recognition track and with the wrong charge.
 
bool isAnyChargeMergedMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track has been merged into another pattern recognition track.
 
bool isMissingMCRecoTrack (const RecoTrack &mcRecoTrack) const
 Checks, if the Monte Carlo Track has no corresponding pattern recognition track.
 
const MCParticlegetRelatedMCParticle (const RecoTrack &recoTrack) const
 Looks for a relation of the given track to a Monte Carlo particle. More...
 
const TrackFitResultgetRelatedTrackFitResult (const RecoTrack &prRecoTrack, Const::ChargedStable chargedStable=Const::pion) const
 Looks up the TrackFitResult of a pattern recognition track. More...
 
const RecoTrackgetRelatedMCRecoTrack (const RecoTrack &prRecoTrack) const
 Looks for a related Monte Carlo track for the given pattern recognition track and return it if found. More...
 
const RecoTrackgetRelatedPRRecoTrack (const RecoTrack &mcRecoTrack) const
 Looks for a related pattern recognition track for the given Monte Carlo track and return it if found. More...
 
float getRelatedPurity (const RecoTrack &prRecoTrack) const
 Getter for the absolute value of the purity that is stored in the purity relation from pattern recognition tracks to Monte Carlo tracks. More...
 
float getRelatedEfficiency (const RecoTrack &mcRecoTrack) const
 Getter for the absolute value of the efficiency that is stored in the efficiency relation from Monte Carlo tracks to pattern recognition tracks. More...
 
const RecoTrackgetRelatedMCRecoTrack (const RecoTrack &prRecoTrack, float &purity) const
 Helper function looking for a related Monte Carlo track to the given pattern recognition track in the purity relation. More...
 
const RecoTrackgetRelatedPRRecoTrack (const RecoTrack &mcRecoTrack, float &efficiency) const
 Helper function looking for a related Monte Carlo track to the given pattern recognition track in the efficiency relation. More...
 
bool isMCRecoTrack (const RecoTrack &recoTrack) const
 Checks if the given track is in the Monte Carlo track StoreArray.
 
bool isPRRecoTrack (const RecoTrack &recoTrack) const
 Checks if the given track is in the pattern recognition StoreArray.
 
const std::string & getMCTracksStoreArrayName () const
 Getter for the name of the StoreArray of the Monte Carlo tracks.
 
const std::string & getPRTracksStoreArrayName () const
 Getter for the name of the StoreArray of the pattern recognition tracks.
 

Private Member Functions

MCToPRMatchInfo extractMCToPRMatchInfo (const RecoTrack &mcRecoTrack, const RecoTrack *prRecoTrack, const float &efficiency) const
 Helper function to assume the correct matching category for the Monte Carlo tracks from the information efficiency relation.
 
PRToMCMatchInfo extractPRToMCMatchInfo (const RecoTrack &prRecoTrack, const RecoTrack *mcRecoTrack, const float &purity) const
 Helper function to assume the correct matching category for the pattern recognition tracks from the information purity relation.
 
const RecoTrackgetMCRecoTrackWithStatus (const RecoTrack &prRecoTrack, const PRToMCMatchInfo matchingStatus=PRToMCMatchInfo::c_matched) const
 Looks up the matched Monte Carlo track with the PRToMCMatchInfo matchingStatus for the given pattern recognition track. More...
 
const RecoTrackgetPRRecoTrackWithStatus (const RecoTrack &mcRecoTrack, const MCToPRMatchInfo matchingStatus=MCToPRMatchInfo::c_matched) const
 Looks up the matched pattern recognition track with the MCToPRMatchInfo matchingStatus for the given Monte Carlo track. More...
 

Private Attributes

std::string m_mcTracksStoreArrayName
 Name of the StoreArray of Monte Carlo tracks.
 
std::string m_prTracksStoreArrayName
 Name of the StoreArray of Pattern recognition tracks.
 

Detailed Description

Class to provide convenient methods to look up matching information between pattern recognition and Monte Carlo tracks.

It provides a more user friendly look up interface into the relations that were generated by the MCTrackMatcherModule.

Instead of looking through the relations directly to find the matching information on your own the methods of this class exhibit a conceptual view on them.

This class is also accessible in python steering files.

Definition at line 33 of file TrackMatchLookUp.h.

Member Enumeration Documentation

◆ MCToPRMatchInfo

enum MCToPRMatchInfo
strong

Matching categories for the Monte Carlo tracks.

c_undefined, //until the matcher module sets it c_matched, // hit pattern and charge are both correct c_matchedWrongCharge, // hit pattern is correct, but the charge is wrong c_merged, //a clone with the correct charge c_mergedWrongCharge, //a clone with the wrong charge c_missing

Definition at line 45 of file TrackMatchLookUp.h.

45 { c_undefined, c_matched, c_matchedWrongCharge, c_merged, c_mergedWrongCharge, c_missing };

◆ PRToMCMatchInfo

enum PRToMCMatchInfo
strong

Matching categories for the pattern recognition tracks.

c_undefined, //until the matcher module sets it c_matched, // hit pattern and charge are both correct c_matchedWrongCharge, // hit pattern is correct, but the charge is wrong c_clone, //a clone with the correct charge c_cloneWrongCharge, //a clone with the wrong charge c_background, c_ghost

Definition at line 57 of file TrackMatchLookUp.h.

Constructor & Destructor Documentation

◆ TrackMatchLookUp()

TrackMatchLookUp ( const std::string &  mcRecoTrackStoreArrayName,
const std::string &  prRecoTrackStoreArrayName = "" 
)
explicit

Constructor taking the names of the StoreArrays containing the Monte Carlo tracks and the pattern recognition tracks respectivelly.

Only the name of StoreArray of the Monte Carlo reference tracks has to be given. The name of the StoreArray of the pattern recognition tracks to defaults to the standard name.

Definition at line 17 of file TrackMatchLookUp.cc.

19  : m_mcTracksStoreArrayName(DataStore::arrayName<RecoTrack>(mcRecoTrackStoreArrayName))
20  , m_prTracksStoreArrayName(DataStore::arrayName<RecoTrack>(prRecoTrackStoreArrayName))
21 {
23  B2WARNING("Pattern recognition and Monte Carlo track StoreArray are the same.");
24  }
25 }
std::string m_prTracksStoreArrayName
Name of the StoreArray of Pattern recognition tracks.
std::string m_mcTracksStoreArrayName
Name of the StoreArray of Monte Carlo tracks.

Member Function Documentation

◆ getAnyChargeMatchedMCRecoTrack()

const RecoTrack* getAnyChargeMatchedMCRecoTrack ( const RecoTrack prRecoTrack) const
inline

Check whether any matched MC RecoTracks for the given prRecoTrack, independent of whether both pattern and charge are matched correctly, or only the pattern is correct but the charge is wrong.

If no match exists at all, a nullptr is returned.

Definition at line 131 of file TrackMatchLookUp.h.

◆ getAnyChargeMatchedPRRecoTrack()

const RecoTrack* getAnyChargeMatchedPRRecoTrack ( const RecoTrack mcRecoTrack) const
inline

Check whether any matched PR RecoTracks for the given mcRecoTrack, independent of whether both pattern and charge are matched correctly, or only the pattern is correct but the charge is wrong.

If no match exists at all, a nullptr is returned.

Definition at line 165 of file TrackMatchLookUp.h.

◆ getCorrectChargeMatchedMCRecoTrack()

const RecoTrack* getCorrectChargeMatchedMCRecoTrack ( const RecoTrack prRecoTrack) const
inline

Looks up the matched Monte Carlo track for the given pattern recognition track.

If there is no match or the pattern recognition track is a clone, or the charge is wrong return nullptr.

Definition at line 110 of file TrackMatchLookUp.h.

◆ getCorrectChargeMatchedPRRecoTrack()

const RecoTrack* getCorrectChargeMatchedPRRecoTrack ( const RecoTrack mcRecoTrack) const
inline

Looks up the matched pattern recognition track for the given Monte Carlo track.

If there is no match or the Monte Carlo track is a over-merged, or the charge is wrong return nullptr.

Definition at line 145 of file TrackMatchLookUp.h.

◆ getMatchedEfficiency()

float getMatchedEfficiency ( const RecoTrack recoTrack) const

Get the hit efficiency of the matched track.

The given track can be both Monte Carlo track or pattern recognition track since the match is one to one relation. The returned efficiency is positive, hence the absolute value of the relation weight. If no exact match is assoziated with the track return NAN.

Definition at line 220 of file TrackMatchLookUp.cc.

◆ getMatchedPurity()

float getMatchedPurity ( const RecoTrack recoTrack) const

Get the hit purity of the matched track.

The given track can be both Monte Carlo track or pattern recognition track since the match is one to one relation. The returned purity is positive, hence the absolute value of the relation weight. If no exact match is associated with the track return NAN.

Definition at line 197 of file TrackMatchLookUp.cc.

◆ getMCRecoTrackWithStatus()

const RecoTrack * getMCRecoTrackWithStatus ( const RecoTrack prRecoTrack,
const PRToMCMatchInfo  matchingStatus = PRToMCMatchInfo::c_matched 
) const
private

Looks up the matched Monte Carlo track with the PRToMCMatchInfo matchingStatus for the given pattern recognition track.

If there is no match or the pattern recognition track is a clone return nullptr.

Definition at line 167 of file TrackMatchLookUp.cc.

◆ getPRRecoTrackWithStatus()

const RecoTrack * getPRRecoTrackWithStatus ( const RecoTrack mcRecoTrack,
const MCToPRMatchInfo  matchingStatus = MCToPRMatchInfo::c_matched 
) const
private

Looks up the matched pattern recognition track with the MCToPRMatchInfo matchingStatus for the given Monte Carlo track.

If there is no match or the Monte Carlo track return nullptr.

Definition at line 182 of file TrackMatchLookUp.cc.

◆ getRelatedEfficiency()

float getRelatedEfficiency ( const RecoTrack mcRecoTrack) const

Getter for the absolute value of the efficiency that is stored in the efficiency relation from Monte Carlo tracks to pattern recognition tracks.

The efficiency relation on the DataStore encodes some information about the match category in the sign of the efficiency. However user code is always interested in the absolute value of the efficiency but may forget apply an absolute value. Since the matching category can be found by other methods of this class, we only provide the absolute value here.

Definition at line 159 of file TrackMatchLookUp.cc.

◆ getRelatedMCParticle()

const MCParticle * getRelatedMCParticle ( const RecoTrack recoTrack) const

Looks for a relation of the given track to a Monte Carlo particle.

Returns nullptr if not found.

Works for both pattern recognition and Monte Carlo tracks.

Whether clones have a related MCParticle depends on the settings of the MCTrackMatcher module that filled the relations.

Definition at line 121 of file TrackMatchLookUp.cc.

◆ getRelatedMCRecoTrack() [1/2]

const RecoTrack * getRelatedMCRecoTrack ( const RecoTrack prRecoTrack) const

Looks for a related Monte Carlo track for the given pattern recognition track and return it if found.

Return nullptr if not found.

Definition at line 126 of file TrackMatchLookUp.cc.

◆ getRelatedMCRecoTrack() [2/2]

const RecoTrack * getRelatedMCRecoTrack ( const RecoTrack prRecoTrack,
float &  purity 
) const

Helper function looking for a related Monte Carlo track to the given pattern recognition track in the purity relation.

Also returns to found purity as output parameter.

Definition at line 38 of file TrackMatchLookUp.cc.

◆ getRelatedPRRecoTrack() [1/2]

const RecoTrack * getRelatedPRRecoTrack ( const RecoTrack mcRecoTrack) const

Looks for a related pattern recognition track for the given Monte Carlo track and return it if found.

Return nullptr if not found.

Definition at line 145 of file TrackMatchLookUp.cc.

◆ getRelatedPRRecoTrack() [2/2]

const RecoTrack * getRelatedPRRecoTrack ( const RecoTrack mcRecoTrack,
float &  efficiency 
) const

Helper function looking for a related Monte Carlo track to the given pattern recognition track in the efficiency relation.

Also returns to found efficiency as output parameter.

Definition at line 53 of file TrackMatchLookUp.cc.

◆ getRelatedPurity()

float getRelatedPurity ( const RecoTrack prRecoTrack) const

Getter for the absolute value of the purity that is stored in the purity relation from pattern recognition tracks to Monte Carlo tracks.

The purity relation on the DataStore encodes some information about the match category in the sign of the purity. However user code is always interested in the absolute value of the purity but may forget apply an absolute value. Since the matching category can be found by other methods of this class, we only provide the absolute value here.

Definition at line 151 of file TrackMatchLookUp.cc.

◆ getRelatedTrackFitResult()

const TrackFitResult * getRelatedTrackFitResult ( const RecoTrack prRecoTrack,
Const::ChargedStable  chargedStable = Const::pion 
) const

Looks up the TrackFitResult of a pattern recognition track.

Return nullptr if there is no related track fit result.

The relations are setup to be from the Belle2::Track to the RecoTrack.

Then the TrackFitResults stored within the Belle2::Tracks are retrieved and the one selected particle hypothesises given via chargedStable is returned.

The default is the Pion fit.

Definition at line 132 of file TrackMatchLookUp.cc.

◆ getWrongChargeMatchedMCRecoTrack()

const RecoTrack* getWrongChargeMatchedMCRecoTrack ( const RecoTrack prRecoTrack) const
inline

Looks up the matched Monte Carlo track for the given pattern recognition track with the wrong charge.

If there is no match or the pattern recognition track is a clone, or the charge is correct return nullptr.

Definition at line 121 of file TrackMatchLookUp.h.

◆ getWrongChargeMatchedPRRecoTrack()

const RecoTrack* getWrongChargeMatchedPRRecoTrack ( const RecoTrack mcRecoTrack) const
inline

Looks up the matched pattern recognition track for the given Monte Carlo track.

If there is no match or the Monte Carlo track is a over-merged or the charge is correct return nullptr.

Definition at line 155 of file TrackMatchLookUp.h.

◆ isChargeMatched()

bool isChargeMatched ( const RecoTrack recoTrack) const

Checks if the recoTrack charge is correctly assigned.

Returns NAN if the recoTrack is not matched. The given track can be both Monte Carlo track or pattern recognition track.

Definition at line 243 of file TrackMatchLookUp.cc.


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