8#include <tracking/trackFindingCDC/mclookup/CDCMCCloneLookUp.h>
10#include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
11#include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
12#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
16using namespace TrackFindingCDC;
25 std::vector<CDCTrack>& cdcTracks)
30 std::map<const ITrackType, std::vector<CDCTrack*>> mapMCTrackIDToCDCTracks;
32 for (
CDCTrack& cdcTrack : cdcTracks) {
35 ITrackType mcTrackID = cdcMCTrackLookUp.
getMCTrackId(ptrCDCTrack);
38 if (mcTrackID != INVALID_ITRACK) {
39 mapMCTrackIDToCDCTracks[mcTrackID].push_back(ptrCDCTrack);
42 return mapMCTrackIDToCDCTracks;
48 auto hitIsCorrect = [
this, &mcTrackID](
const CDCRecoHit3D & recoHit) {
49 return m_CDCMCHitLookUp.getMCTrackId(recoHit.getWireHit().getHit()) == mcTrackID;
51 return std::count_if(begin(*ptrCDCTrack), end(*ptrCDCTrack), hitIsCorrect);
62 if (firstNLoopsTrack1 == firstNLoopsTrack2) {
66 const bool firstTrackBetter = nCorrectHitsTrack1 > nCorrectHitsTrack2;
67 return firstTrackBetter;
69 const bool firstTrackBetter = (firstNLoopsTrack1 < firstNLoopsTrack2);
70 return firstTrackBetter;
80 *(std::min_element(begin(matchedTrackPtrs), end(matchedTrackPtrs), compareCDCTracks));
82 return ptrNonCloneTrack;
94 for (
const CDCTrack& cdcTrack : cdcTracks) {
95 const CDCTrack* ptrCDCTrack = &cdcTrack;
100 std::map<const ITrackType, std::vector<CDCTrack*>> matchedCDCTracksByMCID =
103 for (
auto& mcIDAndCDCTracks : matchedCDCTracksByMCID) {
105 std::vector<CDCTrack*>& matchedTrackPtrs = mcIDAndCDCTracks.second;
107 if (matchedTrackPtrs.size() == 1) {
111 for (
const CDCTrack* ptrCDCTrack : matchedTrackPtrs) {
122 const CDCTrack* ptrCDCTrack = &cdcTrack;
125 if (cdcMCTrackLookUp.
getMCTrackId(ptrCDCTrack) == INVALID_ITRACK) {
bool isTrackClone(const CDCTrack &cdcTrack)
getter for information from m_cdcTrackIsCloneMap
CDCMCCloneLookUp(CDCMCCloneLookUp &)=delete
Singleton: Delete copy constructor and assignment operator.
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.
static CDCMCCloneLookUp & getInstance()
Getter for the singletone instance.
std::map< const CDCTrack *, bool > m_cdcTrackIsCloneMap
Map of track pointers to isClone indicator from MCTruth-based assumption.
void clear()
Clear eventwise lookup tables.
CDCTrack * findBestMatchedTrack(std::vector< CDCTrack * > matchedTrackPtrs)
Helper function which takes a vector of pointers to CDCTracks which are matched to the same MC partic...
void fill(std::vector< CDCTrack > &cdcTracks)
fill with all cdcTracks in an event
ITrackType getMCTrackId(const ACDCHitCollection *ptrHits) const
Getter for the Monte Carlo track id matched to this collection of hits.
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.
Class representing a three dimensional reconstructed hit.
Class representing a sequence of three dimensional reconstructed hits.
Abstract base class for different kinds of events.
Functor which which decides which of two tracks to declare as best match.
bool operator()(const CDCTrack *ptrCDCTrack1, const CDCTrack *ptrCDCTrack2) const
Compare both CDC tracks to get the better matched one.
unsigned int getNumberOfCorrectHits(const CDCTrack *ptrCDCTrack) const
Get number of hits in track that are correctly matched.
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.