 |
Belle II Software
release-05-01-25
|
1 #include <tracking/trackFindingCDC/mclookup/CDCMCCloneLookUp.h>
3 #include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
4 #include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
5 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
6 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
9 using namespace TrackFindingCDC;
18 std::vector<CDCTrack>& cdcTracks)
23 std::map<const ITrackType, std::vector<CDCTrack*>> mapMCTrackIDToCDCTracks;
25 for (
CDCTrack& cdcTrack : cdcTracks) {
28 ITrackType mcTrackID = cdcMCTrackLookUp.
getMCTrackId(ptrCDCTrack);
31 if (mcTrackID != INVALID_ITRACK) {
32 mapMCTrackIDToCDCTracks[mcTrackID].push_back(ptrCDCTrack);
35 return mapMCTrackIDToCDCTracks;
41 auto hitIsCorrect = [
this, &mcTrackID](
const CDCRecoHit3D & recoHit) {
44 return std::count_if(begin(*ptrCDCTrack), end(*ptrCDCTrack), hitIsCorrect);
55 if (firstNLoopsTrack1 == firstNLoopsTrack2) {
59 const bool firstTrackBetter = nCorrectHitsTrack1 > nCorrectHitsTrack2;
60 return firstTrackBetter;
62 const bool firstTrackBetter = (firstNLoopsTrack1 < firstNLoopsTrack2);
63 return firstTrackBetter;
73 *(std::min_element(begin(matchedTrackPtrs), end(matchedTrackPtrs), compareCDCTracks));
75 return ptrNonCloneTrack;
87 for (
const CDCTrack& cdcTrack : cdcTracks) {
88 const CDCTrack* ptrCDCTrack = &cdcTrack;
93 std::map<const ITrackType, std::vector<CDCTrack*>> matchedCDCTracksByMCID =
96 for (
auto& mcIDAndCDCTracks : matchedCDCTracksByMCID) {
98 std::vector<CDCTrack*>& matchedTrackPtrs = mcIDAndCDCTracks.second;
100 if (matchedTrackPtrs.size() == 1) {
104 for (
const CDCTrack* ptrCDCTrack : matchedTrackPtrs) {
115 const CDCTrack* ptrCDCTrack = &cdcTrack;
118 if (cdcMCTrackLookUp.
getMCTrackId(ptrCDCTrack) == INVALID_ITRACK) {
Class representing a three dimensional reconstructed hit.
Class representing a sequence of three dimensional reconstructed hits.
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.
unsigned int getNumberOfCorrectHits(const CDCTrack *ptrCDCTrack) const
Get number of hits in track that are correctly matched.
std::map< const CDCTrack *, bool > m_cdcTrackIsCloneMap
Map of track pointers to isClone indicator from MCTruth-based assumption.
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 ...
void fill(std::vector< CDCTrack > &cdcTracks)
fill with all cdcTracks in an event
ITrackType getMCTrackId(const CDCHit *ptrHit) const
Returns the track id for the hit.
const CDCMCHitLookUp & m_CDCMCHitLookUp
Reference to a CDCMCHitLookUp instance, assigned in the constructor of this functor.
static const CDCMCTrackLookUp & getInstance()
Getter for the singletone instance.
Abstract base class for different kinds of events.
Interface class to the Monte Carlo information for individual hits.
Class providing information whether a PR CDC track is the best match or a clone.
bool operator()(const CDCTrack *ptrCDCTrack1, const CDCTrack *ptrCDCTrack2) const
Compare both CDC tracks to get the better matched one.
Functor which which decides which of two tracks to declare as best match.
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
CDCTrack * findBestMatchedTrack(std::vector< CDCTrack * > matchedTrackPtrs)
Helper function which takes a vector of pointers to CDCTracks which are matched to the same MC partic...
static CDCMCCloneLookUp & getInstance()
Getter for the singletone instance.
void clear()
Clear eventwise lookup tables.
Specialisation of the lookup for the truth values of reconstructed tracks.
const CDCMCTrackLookUp & m_CDCMCTrackLookUp
Reference to a CDCMCTrackLookUp instance, assigned in the constructor of this functor.
bool isTrackClone(const CDCTrack &cdcTrack)
getter for information from m_cdcTrackIsCloneMap