Belle II Software development
CDCMCCloneLookUp Class Reference

Class providing information whether a PR CDC track is the best match or a clone. More...

#include <CDCMCCloneLookUp.h>

Public Member Functions

 CDCMCCloneLookUp (CDCMCCloneLookUp &)=delete
 Singleton: Delete copy constructor and assignment operator.
 
CDCMCCloneLookUpoperator= (const CDCMCCloneLookUp &)=delete
 Operator =.
 
void fill (std::vector< CDCTrack > &cdcTracks)
 fill with all cdcTracks in an event
 
void clear ()
 Clear eventwise lookup tables.
 
bool isTrackClone (const CDCTrack &cdcTrack)
 getter for information from m_cdcTrackIsCloneMap
 

Static Public Member Functions

static CDCMCCloneLookUpgetInstance ()
 Getter for the singletone instance.
 

Private Member Functions

 CDCMCCloneLookUp ()=default
 Singleton: Default ctor only available to getInstance method.
 
std::map< const ITrackType, std::vector< CDCTrack * > > getMatchedCDCTracksByMCID (std::vector< CDCTrack > &cdcTracks)
 Helper function which returns a map of MCTrackIDs to vectors of CDTrack pointers.
 
CDCTrackfindBestMatchedTrack (std::vector< CDCTrack * > matchedTrackPtrs)
 Helper function which takes a vector of pointers to CDCTracks which are matched to the same MC particle.
 

Private Attributes

std::map< const CDCTrack *, bool > m_cdcTrackIsCloneMap
 Map of track pointers to isClone indicator from MCTruth-based assumption.
 

Detailed Description

Class providing information whether a PR CDC track is the best match or a clone.

In contrast to all other MC lookup classes, it requires the information of all tracks in an event to decide which are clones. Therofore, it has to be filled once with a CDCTrack vector before being used.

The definition of which track is a better match and thus which to classify * as a clone is encoded in the separate functor CompareCDCTracks.

Definition at line 35 of file CDCMCCloneLookUp.h.

Member Function Documentation

◆ clear()

void clear ( )

Clear eventwise lookup tables.

Definition at line 85 of file CDCMCCloneLookUp.cc.

86{
88}
std::map< const CDCTrack *, bool > m_cdcTrackIsCloneMap
Map of track pointers to isClone indicator from MCTruth-based assumption.

◆ fill()

void fill ( std::vector< CDCTrack > &  cdcTracks)

fill with all cdcTracks in an event

Fill LookUp Table which stores information, which tracks are clones from curlers.

per default, set all tracks to "not clone"

get lookup table of MC track IDs to vectors of CDC track pointers

Vector of track pointers which are mapped to this mcTrackID

Definition at line 91 of file CDCMCCloneLookUp.cc.

92{
94 for (const CDCTrack& cdcTrack : cdcTracks) {
95 const CDCTrack* ptrCDCTrack = &cdcTrack;
96 m_cdcTrackIsCloneMap[ptrCDCTrack] = false; // not clone
97 }
98
100 std::map<const ITrackType, std::vector<CDCTrack*>> matchedCDCTracksByMCID =
101 getMatchedCDCTracksByMCID(cdcTracks);
102
103 for (auto& mcIDAndCDCTracks : matchedCDCTracksByMCID) {
105 std::vector<CDCTrack*>& matchedTrackPtrs = mcIDAndCDCTracks.second;
106
107 if (matchedTrackPtrs.size() == 1) { // only one matching track
108 m_cdcTrackIsCloneMap[matchedTrackPtrs.at(0)] = false; // not clone
109
110 } else { // multiple matching tracks
111 for (const CDCTrack* ptrCDCTrack : matchedTrackPtrs) {
112 m_cdcTrackIsCloneMap[ptrCDCTrack] = true; // default that all are clones
113 }
114 const CDCTrack* ptrNonCloneTrack = findBestMatchedTrack(matchedTrackPtrs);
115 m_cdcTrackIsCloneMap[ptrNonCloneTrack] = false; // not clone
116 }
117 }
118}
std::map< const ITrackType, std::vector< CDCTrack * > > getMatchedCDCTracksByMCID(std::vector< CDCTrack > &cdcTracks)
Helper function which returns a map of MCTrackIDs to vectors of CDTrack pointers.
CDCTrack * findBestMatchedTrack(std::vector< CDCTrack * > matchedTrackPtrs)
Helper function which takes a vector of pointers to CDCTracks which are matched to the same MC partic...
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41

◆ findBestMatchedTrack()

CDCTrack * findBestMatchedTrack ( std::vector< CDCTrack * >  matchedTrackPtrs)
private

Helper function which takes a vector of pointers to CDCTracks which are matched to the same MC particle.

Returns track ptr which is assumed to be not a clone.

Definition at line 73 of file CDCMCCloneLookUp.cc.

74{
75 const CDCMCTrackLookUp& cdcMCTrackLookUp = CDCMCTrackLookUp::getInstance();
76 const CDCMCHitLookUp& cdcMCHitLookUp = CDCMCHitLookUp::getInstance();
77
78 const CompareCDCTracks compareCDCTracks(cdcMCTrackLookUp, cdcMCHitLookUp);
79 CDCTrack* ptrNonCloneTrack =
80 *(std::min_element(begin(matchedTrackPtrs), end(matchedTrackPtrs), compareCDCTracks));
81
82 return ptrNonCloneTrack;
83}
Interface class to the Monte Carlo information for individual hits.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
Specialisation of the lookup for the truth values of reconstructed tracks.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
Functor which which decides which of two tracks to declare as best match.

◆ getInstance()

CDCMCCloneLookUp & getInstance ( )
static

Getter for the singletone instance.

Definition at line 18 of file CDCMCCloneLookUp.cc.

19{
20 static CDCMCCloneLookUp cloneInfo;
21 return cloneInfo;
22}
Class providing information whether a PR CDC track is the best match or a clone.

◆ getMatchedCDCTracksByMCID()

std::map< const ITrackType, std::vector< CDCTrack * > > getMatchedCDCTracksByMCID ( std::vector< CDCTrack > &  cdcTracks)
private

Helper function which returns a map of MCTrackIDs to vectors of CDTrack pointers.

Need that to find clone candidates: tracks with same MCTrackID

Definition at line 24 of file CDCMCCloneLookUp.cc.

26{
27 const CDCMCTrackLookUp& cdcMCTrackLookUp = CDCMCTrackLookUp::getInstance();
28
29 // Map of MCTrackIds to vectors of matching CDCTrack pointers
30 std::map<const ITrackType, std::vector<CDCTrack*>> mapMCTrackIDToCDCTracks;
31
32 for (CDCTrack& cdcTrack : cdcTracks) {
33 CDCTrack* ptrCDCTrack = &cdcTrack;
34
35 ITrackType mcTrackID = cdcMCTrackLookUp.getMCTrackId(ptrCDCTrack);
36
37 // only if matching MCTrack with 50% minimal purity was found
38 if (mcTrackID != INVALID_ITRACK) {
39 mapMCTrackIDToCDCTracks[mcTrackID].push_back(ptrCDCTrack);
40 }
41 }
42 return mapMCTrackIDToCDCTracks;
43}
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.

◆ isTrackClone()

bool isTrackClone ( const CDCTrack cdcTrack)

getter for information from m_cdcTrackIsCloneMap

Definition at line 120 of file CDCMCCloneLookUp.cc.

121{
122 const CDCTrack* ptrCDCTrack = &cdcTrack;
123
124 const CDCMCTrackLookUp& cdcMCTrackLookUp = CDCMCTrackLookUp::getInstance();
125 if (cdcMCTrackLookUp.getMCTrackId(ptrCDCTrack) == INVALID_ITRACK) {
126 return false; // track is not matched
127 } else {
128 return m_cdcTrackIsCloneMap.at(ptrCDCTrack);
129 }
130}

Member Data Documentation

◆ m_cdcTrackIsCloneMap

std::map<const CDCTrack*, bool> m_cdcTrackIsCloneMap
private

Map of track pointers to isClone indicator from MCTruth-based assumption.

Definition at line 72 of file CDCMCCloneLookUp.h.


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