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) {
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) {
Class providing information whether a PR CDC track is the best match or a clone.
bool isTrackClone(const CDCTrack &cdcTrack)
getter for information from m_cdcTrackIsCloneMap
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.
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 ...
Interface class to the Monte Carlo information for individual hits.
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
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.