Belle II Software development
CompareCDCTracks Struct Reference

Functor which which decides which of two tracks to declare as best match. More...

#include <CDCMCCloneLookUp.h>

Public Member Functions

 operator FunctorTag ()
 marker function for the isFunctor test
 
 CompareCDCTracks (const CDCMCTrackLookUp &cdcMCTrackLookUp, const CDCMCHitLookUp &cdcMCHitLookUp)
 Constructor of the CDC track comparer to get the better match, taking references to MC lookup singletons.
 
bool operator() (const CDCTrack *ptrCDCTrack1, const CDCTrack *ptrCDCTrack2) const
 Compare both CDC tracks to get the better matched one.
 

Private Member Functions

unsigned int getNumberOfCorrectHits (const CDCTrack *ptrCDCTrack) const
 Get number of hits in track that are correctly matched.
 

Private Attributes

const CDCMCTrackLookUpm_CDCMCTrackLookUp
 Reference to a CDCMCTrackLookUp instance, assigned in the constructor of this functor.
 
const CDCMCHitLookUpm_CDCMCHitLookUp
 Reference to a CDCMCHitLookUp instance, assigned in the constructor of this functor.
 

Detailed Description

Functor which which decides which of two tracks to declare as best match.

Definition at line 76 of file CDCMCCloneLookUp.h.

Constructor & Destructor Documentation

◆ CompareCDCTracks()

CompareCDCTracks ( const CDCMCTrackLookUp cdcMCTrackLookUp,
const CDCMCHitLookUp cdcMCHitLookUp 
)
inline

Constructor of the CDC track comparer to get the better match, taking references to MC lookup singletons.

Definition at line 82 of file CDCMCCloneLookUp.h.

84 : m_CDCMCTrackLookUp(cdcMCTrackLookUp)
85 , m_CDCMCHitLookUp(cdcMCHitLookUp) {};
const CDCMCHitLookUp & m_CDCMCHitLookUp
Reference to a CDCMCHitLookUp instance, assigned in the constructor of this functor.
const CDCMCTrackLookUp & m_CDCMCTrackLookUp
Reference to a CDCMCTrackLookUp instance, assigned in the constructor of this functor.

Member Function Documentation

◆ getNumberOfCorrectHits()

unsigned int getNumberOfCorrectHits ( const CDCTrack ptrCDCTrack) const
private

Get number of hits in track that are correctly matched.

Definition at line 45 of file CDCMCCloneLookUp.cc.

46{
47 ITrackType mcTrackID = m_CDCMCTrackLookUp.getMCTrackId(ptrCDCTrack);
48 auto hitIsCorrect = [this, &mcTrackID](const CDCRecoHit3D & recoHit) {
49 return m_CDCMCHitLookUp.getMCTrackId(recoHit.getWireHit().getHit()) == mcTrackID;
50 };
51 return std::count_if(begin(*ptrCDCTrack), end(*ptrCDCTrack), hitIsCorrect);
52}
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52

◆ operator()()

bool operator() ( const CDCTrack ptrCDCTrack1,
const CDCTrack ptrCDCTrack2 
) const

Compare both CDC tracks to get the better matched one.

Functor definition of comparison function for findBestMatchedTrack.

Returns true if track1 has a lower loop number at the first hit than track1. If both tracks have the same loop number, return true if track1 has larger number of matched hits.

Definition at line 55 of file CDCMCCloneLookUp.cc.

56{
57 Index firstNLoopsTrack1 = m_CDCMCTrackLookUp.getFirstNLoops(ptrCDCTrack1);
58 Index firstNLoopsTrack2 = m_CDCMCTrackLookUp.getFirstNLoops(ptrCDCTrack2);
59
60 // Look for track with smallest NLoops of first hit.
61 // If it is equal, use track with the larger number of correct hits.
62 if (firstNLoopsTrack1 == firstNLoopsTrack2) {
63 const unsigned int nCorrectHitsTrack1 = getNumberOfCorrectHits(ptrCDCTrack1);
64 const unsigned int nCorrectHitsTrack2 = getNumberOfCorrectHits(ptrCDCTrack2);
65
66 const bool firstTrackBetter = nCorrectHitsTrack1 > nCorrectHitsTrack2;
67 return firstTrackBetter;
68 }
69 const bool firstTrackBetter = (firstNLoopsTrack1 < firstNLoopsTrack2);
70 return firstTrackBetter;
71}
Index getFirstNLoops(const ACDCHitCollection *ptrHits) const
Getter for number of loops till the first hit the collection of hits which has the Monte Carlo track ...
unsigned int getNumberOfCorrectHits(const CDCTrack *ptrCDCTrack) const
Get number of hits in track that are correctly matched.

Member Data Documentation

◆ m_CDCMCHitLookUp

const CDCMCHitLookUp& m_CDCMCHitLookUp
private

Reference to a CDCMCHitLookUp instance, assigned in the constructor of this functor.

Definition at line 102 of file CDCMCCloneLookUp.h.

◆ m_CDCMCTrackLookUp

const CDCMCTrackLookUp& m_CDCMCTrackLookUp
private

Reference to a CDCMCTrackLookUp instance, assigned in the constructor of this functor.

Definition at line 100 of file CDCMCCloneLookUp.h.


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