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< TrackingUtilities::CDCTrack > &cdcTracks)
 fill with all cdcTracks in an event
 
void clear ()
 Clear eventwise lookup tables.
 
bool isTrackClone (const TrackingUtilities::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< TrackingUtilities::CDCTrack * > > getMatchedCDCTracksByMCID (std::vector< TrackingUtilities::CDCTrack > &cdcTracks)
 Helper function which returns a map of MCTrackIDs to vectors of CDTrack pointers.
 
TrackingUtilities::CDCTrackfindBestMatchedTrack (std::vector< TrackingUtilities::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 TrackingUtilities::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 86 of file CDCMCCloneLookUp.cc.

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

◆ fill()

void fill ( std::vector< TrackingUtilities::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 92 of file CDCMCCloneLookUp.cc.

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

◆ findBestMatchedTrack()

CDCTrack * findBestMatchedTrack ( std::vector< TrackingUtilities::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 74 of file CDCMCCloneLookUp.cc.

75{
76 const CDCMCTrackLookUp& cdcMCTrackLookUp = CDCMCTrackLookUp::getInstance();
77 const CDCMCHitLookUp& cdcMCHitLookUp = CDCMCHitLookUp::getInstance();
78
79 const CompareCDCTracks compareCDCTracks(cdcMCTrackLookUp, cdcMCHitLookUp);
80 CDCTrack* ptrNonCloneTrack =
81 *(std::min_element(begin(matchedTrackPtrs), end(matchedTrackPtrs), compareCDCTracks));
82
83 return ptrNonCloneTrack;
84}
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.

◆ getInstance()

CDCMCCloneLookUp & getInstance ( )
static

Getter for the singletone instance.

Definition at line 19 of file CDCMCCloneLookUp.cc.

20{
21 static CDCMCCloneLookUp cloneInfo;
22 return cloneInfo;
23}
CDCMCCloneLookUp(CDCMCCloneLookUp &)=delete
Singleton: Delete copy constructor and assignment operator.

◆ getMatchedCDCTracksByMCID()

std::map< const ITrackType, std::vector< CDCTrack * > > getMatchedCDCTracksByMCID ( std::vector< TrackingUtilities::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 25 of file CDCMCCloneLookUp.cc.

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

◆ isTrackClone()

bool isTrackClone ( const TrackingUtilities::CDCTrack & cdcTrack)

getter for information from m_cdcTrackIsCloneMap

Definition at line 121 of file CDCMCCloneLookUp.cc.

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

Member Data Documentation

◆ m_cdcTrackIsCloneMap

std::map<const TrackingUtilities::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: