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 const std::string& prRecoTrackStoreArrayName)
23 B2WARNING(
"Pattern recognition and Monte Carlo track StoreArray are the same.");
40 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(prRecoTrack));
41 std::pair<RecoTrack*, float> mcRecoTrackAndWeight =
43 const RecoTrack* mcRecoTrack = mcRecoTrackAndWeight.first;
45 purity = mcRecoTrackAndWeight.second;
55 B2ASSERT(
"This RecoTrack isn't a MC RecoTrack as it is supposed to be.",
isMCRecoTrack(mcRecoTrack));
56 std::pair<RecoTrack*, float> prRecoTrackAndWeight =
58 const RecoTrack* prRecoTrack = prRecoTrackAndWeight.first;
60 efficiency = prRecoTrackAndWeight.second;
70 const float& efficiency)
const
72 if (not prRecoTrack)
return MCToPRMatchInfo::c_missing;
73 if (std::isnan(efficiency))
return MCToPRMatchInfo::c_undefined;
74 B2ASSERT(
"This RecoTrack isn't a MC RecoTrack as it is supposed to be.",
isMCRecoTrack(mcRecoTrack));
75 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(*prRecoTrack));
82 if (roundTripMCRecoTrack == &mcRecoTrack) {
83 if (wrongCharge)
return MCToPRMatchInfo::c_matchedWrongCharge;
84 else return MCToPRMatchInfo::c_matched;
86 if (wrongCharge)
return MCToPRMatchInfo::c_mergedWrongCharge;
87 else return MCToPRMatchInfo::c_merged;
94 const float& purity __attribute__((unused)))
const
96 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(prRecoTrack));
99 if (matchingStatus == RecoTrack::MatchingStatus::c_ghost) {
100 return PRToMCMatchInfo::c_ghost;
101 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_background) {
102 return PRToMCMatchInfo::c_background;
103 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_clone) {
104 if (not mcRecoTrack) B2WARNING(
"Clone with no related Monte Carlo RecoTrack");
105 return PRToMCMatchInfo::c_clone;
106 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_cloneWrongCharge) {
107 if (not mcRecoTrack) B2WARNING(
"Clone with no related Monte Carlo RecoTrack");
108 return PRToMCMatchInfo::c_cloneWrongCharge;
109 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_matched) {
110 if (not mcRecoTrack) B2WARNING(
"Match with no related Monte Carlo RecoTrack");
111 return PRToMCMatchInfo::c_matched;
112 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_matchedWrongCharge) {
113 if (not mcRecoTrack) B2WARNING(
"Match with no related Monte Carlo RecoTrack");
114 return PRToMCMatchInfo::c_matchedWrongCharge;
115 }
else if (matchingStatus == RecoTrack::MatchingStatus::c_undefined) {
116 return PRToMCMatchInfo::c_undefined;
118 return PRToMCMatchInfo::c_undefined;
128 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(prRecoTrack));
135 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(prRecoTrack));
147 B2ASSERT(
"This RecoTrack isn't a MC RecoTrack as it is supposed to be.",
isMCRecoTrack(mcRecoTrack));
153 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(prRecoTrack));
156 return std::fabs(purity);
161 B2ASSERT(
"This RecoTrack isn't a MC RecoTrack as it is supposed to be.",
isMCRecoTrack(mcRecoTrack));
162 float efficiency = NAN;
164 return std::fabs(efficiency);
170 B2ASSERT(
"This RecoTrack isn't a PR RecoTrack as it is supposed to be.",
isPRRecoTrack(prRecoTrack));
185 B2ASSERT(
"This RecoTrack isn't a MC RecoTrack as it is supposed to be.",
isMCRecoTrack(mcRecoTrack));
187 float efficiency = NAN;
201 const RecoTrack& mcRecoTrack = recoTrack;
210 const RecoTrack& prRecoTrack = recoTrack;
223 const RecoTrack& prRecoTrack = recoTrack;
232 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.
float getCharge() const
Return the particle charge defined in TDatabasePDG.
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.
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
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.
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.
const RecoTrack * getAnyChargeMatchedMCRecoTrack(const RecoTrack &prRecoTrack) const
Check whether any matched MC RecoTracks for the given prRecoTrack, independent of whether both patter...
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 std::string & getMCTracksStoreArrayName() const
Getter for the name of the StoreArray of the Monte Carlo tracks.
bool isChargeMatched(const RecoTrack &recoTrack) const
Checks if the recoTrack charge is correctly assigned.
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 * getAnyChargeMatchedPRRecoTrack(const RecoTrack &mcRecoTrack) const
Check whether any matched PR RecoTracks for the given mcRecoTrack, independent of whether both patter...
const RecoTrack * getMCRecoTrackWithStatus(const RecoTrack &prRecoTrack, const PRToMCMatchInfo matchingStatus=PRToMCMatchInfo::c_matched) const
Looks up the matched Monte Carlo track with the PRToMCMatchInfo matchingStatus for the given pattern ...
const RecoTrack * getPRRecoTrackWithStatus(const RecoTrack &mcRecoTrack, const MCToPRMatchInfo matchingStatus=MCToPRMatchInfo::c_matched) const
Looks up the matched pattern recognition track with the MCToPRMatchInfo matchingStatus for the given ...
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.
TrackMatchLookUp(const std::string &mcRecoTrackStoreArrayName, const std::string &prRecoTrackStoreArrayName="")
Constructor taking the names of the StoreArrays containing the Monte Carlo tracks and the pattern rec...
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
Default Access to TrackFitResults.
Abstract base class for different kinds of events.