8#include <tracking/trackFindingCDC/filters/track/BestMatchedTruthVarSet.h>
10#include <tracking/trackFindingCDC/mclookup/CDCMCHitLookUp.h>
11#include <tracking/trackFindingCDC/mclookup/CDCMCTrackLookUp.h>
12#include <tracking/trackFindingCDC/mclookup/CDCMCManager.h>
13#include <tracking/trackFindingCDC/mclookup/CDCMCCloneLookUp.h>
15#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
16#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
19using namespace TrackFindingCDC;
35 if (not ptrCDCTrack)
return false;
42 ITrackType trackMCMatch = mcTrackLookUp.
getMCTrackId(ptrCDCTrack);
43 bool trackIsFake =
false;
45 unsigned int numberOfCorrectHits = 0;
48 bool trackHasMinimalMatchPurity = (trackMCMatch != INVALID_ITRACK);
50 if (not trackHasMinimalMatchPurity) {
54 auto hitIsCorrect = [&hitLookUp, &trackMCMatch](
const CDCRecoHit3D & recoHit) {
55 return hitLookUp.
getMCTrackId(recoHit.getWireHit().getHit()) == trackMCMatch;
57 numberOfCorrectHits = std::count_if(begin(*ptrCDCTrack), end(*ptrCDCTrack), hitIsCorrect);
59 const double purity = (double)numberOfCorrectHits / ptrCDCTrack->size();
67 bool trackIsClone = cloneLookUp.
isTrackClone(*ptrCDCTrack);
68 bool matchedNotClone = (not trackIsClone) and (not trackIsFake);
69 var<
named(
"truth")>() = matchedNotClone;
70 var<
named(
"truth_track_is_fake")>() = trackIsFake;
71 var<
named(
"truth_track_is_matched")>() = not trackIsFake;
72 var<
named(
"truth_matched_hits")>() = numberOfCorrectHits;
73 var<
named(
"truth_track_is_clone")>() = trackIsClone;
76 var<
named(
"truth_MCTrackID")>() = trackMCMatch;
void initialize() final
Require the Monte Carlo truth information at initialisation.
void beginEvent() final
Prepare the Monte Carlo truth information at start of the event.
StoreObjPtr< EventMetaData > m_eventMetaData
Pointer to the store array object with the EventMetaData.
bool extract(const CDCTrack *ptrCDCTrack) override
Generate and assign the contained variables.
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
static CDCMCCloneLookUp & getInstance()
Getter for the singletone instance.
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.
void requireTruthInformation()
Require the MC information store arrays.
void fill()
Fill Monte Carlo look up maps from the DataStore.
static CDCMCManager & getInstance()
Getter for the singleton 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.
void initialize() override
Receive and dispatch signal before the start of the event processing.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
static constexpr int named(const char *name)
Getter for the index from the name.
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Abstract base class for different kinds of events.