8 #include <tracking/mcMatcher/TrackMatchLookUp.h>
10 #include <mdst/dataobjects/Track.h>
12 #include <framework/datastore/DataStore.h>
13 #include <framework/logging/Logger.h>
18 TrackMatchLookUp::TrackMatchLookUp(
const std::string& mcRecoTrackStoreArrayName,
19 const std::string& prRecoTrackStoreArrayName)
24 B2WARNING(
"Pattern recognition and Monte Carlo track StoreArray are the same.");
42 std::pair<RecoTrack*, float> mcRecoTrackAndWeight =
44 const RecoTrack* mcRecoTrack = mcRecoTrackAndWeight.first;
46 purity = mcRecoTrackAndWeight.second;
57 std::pair<RecoTrack*, float> prRecoTrackAndWeight =
59 const RecoTrack* prRecoTrack = prRecoTrackAndWeight.first;
61 efficiency = prRecoTrackAndWeight.second;
71 const float& efficiency)
const
73 if (not prRecoTrack)
return MCToPRMatchInfo::c_Missing;
74 if (std::isnan(efficiency))
return MCToPRMatchInfo::c_Invalid;
81 if (roundTripMCRecoTrack == &mcRecoTrack) {
82 return MCToPRMatchInfo::c_Matched;
84 return MCToPRMatchInfo::c_Merged;
91 const float& purity __attribute__((unused)))
const
96 if (matchingStatus == RecoTrack::MatchingStatus::c_ghost) {
97 return PRToMCMatchInfo::c_Ghost;
98 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_background) {
99 return PRToMCMatchInfo::c_Background;
100 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_clone) {
101 if (not mcRecoTrack) B2WARNING(
"Clone with no related Monte Carlo RecoTrack");
102 return PRToMCMatchInfo::c_Clone;
103 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_matched) {
104 if (not mcRecoTrack) B2WARNING(
"Match with no related Monte Carlo RecoTrack");
105 return PRToMCMatchInfo::c_Matched;
106 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_undefined) {
107 return PRToMCMatchInfo::c_Invalid;
109 return PRToMCMatchInfo::c_Invalid;
147 return std::fabs(purity);
153 float efficiency = NAN;
155 return std::fabs(efficiency);
176 float efficiency = NAN;
189 const RecoTrack& mcRecoTrack = recoTrack;
198 const RecoTrack& prRecoTrack = recoTrack;
211 const RecoTrack& prRecoTrack = recoTrack;
220 const RecoTrack& mcRecoTrack = recoTrack;
Provides a type-safe way to pass members of the chargedStableSet set.
In the store you can park objects that have to be accessed by various modules.
A Class to store the Monte Carlo particle information.
This is the Reconstruction Event-Data Model Track.
MatchingStatus
Enum for the matching status of this reco track (set by the matching modules in the tracking package)...
MatchingStatus getMatchingStatus() const
Return the matching status set by the TrackMatcher module.
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
std::pair< TO *, float > getRelatedToWithWeight(const std::string &name="", const std::string &namedRelation="") const
Get first related object & weight of relation pointing to an array.
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
Values of the result of a track fit with a given particle hypothesis.
PRToMCMatchInfo extractPRToMCMatchInfo(const RecoTrack &prRecoTrack, const RecoTrack *mcRecoTrack, const float &purity) const
Helper function to assume the correct matching category for the pattern recognition tracks from the i...
float getMatchedPurity(const RecoTrack &recoTrack) const
Get the hit purity of the matched track.
const TrackFitResult * getRelatedTrackFitResult(const RecoTrack &prRecoTrack, Const::ChargedStable chargedStable=Const::pion) const
Looks up the TrackFitResult of a pattern recognition track.
const RecoTrack * getRelatedMCRecoTrack(const RecoTrack &prRecoTrack) const
Looks for a related Monte Carlo track for the given pattern recognition track and return it if found.
MCToPRMatchInfo
Matching categories for the Monte Carlo tracks.
float getRelatedPurity(const RecoTrack &prRecoTrack) const
Getter for the absolute value of the purity that is stored in the purity relation from pattern recogn...
const MCParticle * getRelatedMCParticle(const RecoTrack &recoTrack) const
Looks for a relation of the given track to a Monte Carlo particle.
bool isPRRecoTrack(const RecoTrack &recoTrack) const
Checks if the given track is in the pattern recognition StoreArray.
std::string m_prTracksStoreArrayName
Name of the StoreArray of Pattern recognition tracks.
const RecoTrack * getMatchedMCRecoTrack(const RecoTrack &prRecoTrack) const
Looks up the matched Monte Carlo track for the given pattern recognition track.
const std::string & getMCTracksStoreArrayName() const
Getter for the name of the StoreArray of the Monte Carlo tracks.
const std::string & getPRTracksStoreArrayName() const
Getter for the name of the StoreArray of the pattern recognition tracks.
bool isMCRecoTrack(const RecoTrack &recoTrack) const
Checks if the given track is in the Monte Carlo track StoreArray.
const RecoTrack * getMatchedPRRecoTrack(const RecoTrack &mcRecoTrack) const
Looks up the matched pattern recognition track for the given Monte Carlo track.
std::string m_mcTracksStoreArrayName
Name of the StoreArray of Monte Carlo tracks.
const RecoTrack * getRelatedPRRecoTrack(const RecoTrack &mcRecoTrack) const
Looks for a related pattern recognition track for the given Monte Carlo track and return it if found.
float getMatchedEfficiency(const RecoTrack &recoTrack) const
Get the hit efficiency of the matched track.
float getRelatedEfficiency(const RecoTrack &mcRecoTrack) const
Getter for the absolute value of the efficiency that is stored in the efficiency relation from Monte ...
MCToPRMatchInfo extractMCToPRMatchInfo(const RecoTrack &mcRecoTrack, const RecoTrack *prRecoTrack, const float &efficiency) const
Helper function to assume the correct matching category for the Monte Carlo tracks from the informati...
PRToMCMatchInfo
Matching categories for the pattern recognition tracks.
Class that bundles various TrackFitResults.
const TrackFitResult * getTrackFitResult(const Const::ChargedStable &chargedStable) const
Access to TrackFitResults.
Abstract base class for different kinds of events.