8#include <tracking/trackFindingCDC/mclookup/CDCMCCloneLookUp.h>
10#include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
11#include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
12#include <tracking/trackingUtilities/eventdata/tracks/CDCTrack.h>
13#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
16using namespace TrackFindingCDC;
17using namespace TrackingUtilities;
26 std::vector<CDCTrack>& cdcTracks)
31 std::map<const ITrackType, std::vector<CDCTrack*>> mapMCTrackIDToCDCTracks;
33 for (
CDCTrack& cdcTrack : cdcTracks) {
36 ITrackType mcTrackID = cdcMCTrackLookUp.
getMCTrackId(ptrCDCTrack);
39 if (mcTrackID != INVALID_ITRACK) {
40 mapMCTrackIDToCDCTracks[mcTrackID].push_back(ptrCDCTrack);
43 return mapMCTrackIDToCDCTracks;
49 auto hitIsCorrect = [
this, &mcTrackID](
const CDCRecoHit3D & recoHit) {
50 return m_CDCMCHitLookUp.getMCTrackId(recoHit.getWireHit().getHit()) == mcTrackID;
52 return std::count_if(begin(*ptrCDCTrack), end(*ptrCDCTrack), hitIsCorrect);
63 if (firstNLoopsTrack1 == firstNLoopsTrack2) {
67 const bool firstTrackBetter = nCorrectHitsTrack1 > nCorrectHitsTrack2;
68 return firstTrackBetter;
70 const bool firstTrackBetter = (firstNLoopsTrack1 < firstNLoopsTrack2);
71 return firstTrackBetter;
81 *(std::min_element(begin(matchedTrackPtrs), end(matchedTrackPtrs), compareCDCTracks));
83 return ptrNonCloneTrack;
95 for (
const CDCTrack& cdcTrack : cdcTracks) {
96 const CDCTrack* ptrCDCTrack = &cdcTrack;
101 std::map<const ITrackType, std::vector<CDCTrack*>> matchedCDCTracksByMCID =
104 for (
auto& mcIDAndCDCTracks : matchedCDCTracksByMCID) {
106 std::vector<CDCTrack*>& matchedTrackPtrs = mcIDAndCDCTracks.second;
108 if (matchedTrackPtrs.size() == 1) {
112 for (
const CDCTrack* ptrCDCTrack : matchedTrackPtrs) {
123 const CDCTrack* ptrCDCTrack = &cdcTrack;
126 if (cdcMCTrackLookUp.
getMCTrackId(ptrCDCTrack) == INVALID_ITRACK) {
std::map< const TrackingUtilities::CDCTrack *, bool > m_cdcTrackIsCloneMap
Map of track pointers to isClone indicator from MCTruth-based assumption.
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.
CDCMCCloneLookUp(CDCMCCloneLookUp &)=delete
Singleton: Delete copy constructor and assignment operator.
static CDCMCCloneLookUp & getInstance()
Getter for the singletone instance.
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...
bool isTrackClone(const TrackingUtilities::CDCTrack &cdcTrack)
getter for information from m_cdcTrackIsCloneMap
void fill(std::vector< TrackingUtilities::CDCTrack > &cdcTracks)
fill with all cdcTracks in an event
void clear()
Clear eventwise lookup tables.
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.
unsigned int getNumberOfCorrectHits(const TrackingUtilities::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.
bool operator()(const TrackingUtilities::CDCTrack *ptrCDCTrack1, const TrackingUtilities::CDCTrack *ptrCDCTrack2) const
Compare both CDC tracks to get the better matched one.