Belle II Software  release-05-02-19
TrackMatchLookUp.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost, Thomas Hauth *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <mdst/dataobjects/MCParticle.h>
13 #include <mdst/dataobjects/TrackFitResult.h>
14 
15 #include <tracking/dataobjects/RecoTrack.h>
16 
17 namespace Belle2 {
35  class TrackMatchLookUp {
36 
37  public:
41  enum class MCToPRMatchInfo { c_Invalid, c_Matched, c_Merged, c_Missing };
42 
46  enum class PRToMCMatchInfo { c_Invalid, c_Matched, c_Clone, c_Background, c_Ghost };
47 
48  public:
57  explicit TrackMatchLookUp(const std::string& mcRecoTrackStoreArrayName,
58  const std::string& prRecoTrackStoreArrayName = "");
59 
60  private:
65  MCToPRMatchInfo extractMCToPRMatchInfo(const RecoTrack& mcRecoTrack,
66  const RecoTrack* prRecoTrack,
67  const float& efficiency) const;
68 
73  PRToMCMatchInfo extractPRToMCMatchInfo(const RecoTrack& prRecoTrack,
74  const RecoTrack* mcRecoTrack,
75  const float& purity) const;
76 
77  public:
82  const RecoTrack* getMatchedMCRecoTrack(const RecoTrack& prRecoTrack) const;
83 
88  const RecoTrack* getMatchedPRRecoTrack(const RecoTrack& mcRecoTrack) const;
89 
90  public:
99  float getMatchedPurity(const RecoTrack& recoTrack) const;
100 
109  float getMatchedEfficiency(const RecoTrack& recoTrack) const;
110 
111  public:
115  MCToPRMatchInfo getMCToPRMatchInfo(const RecoTrack& mcRecoTrack) const
116  {
117  float efficiency = NAN;
118  const RecoTrack* prRecoTrack = getRelatedPRRecoTrack(mcRecoTrack, efficiency);
119  return extractMCToPRMatchInfo(mcRecoTrack, prRecoTrack, efficiency);
120  }
121 
125  bool isMatchedPRRecoTrack(const RecoTrack& prRecoTrack) const
126  {
127  return getPRToMCMatchInfo(prRecoTrack) == PRToMCMatchInfo::c_Matched;
128  }
129 
133  bool isClonePRRecoTrack(const RecoTrack& prRecoTrack) const
134  {
135  return getPRToMCMatchInfo(prRecoTrack) == PRToMCMatchInfo::c_Clone;
136  }
137 
141  bool isBackgroundPRRecoTrack(const RecoTrack& prRecoTrack) const
142  {
143  return getPRToMCMatchInfo(prRecoTrack) == PRToMCMatchInfo::c_Background;
144  }
145 
150  bool isGhostPRRecoTrack(const RecoTrack& prRecoTrack) const
151  {
152  return getPRToMCMatchInfo(prRecoTrack) == PRToMCMatchInfo::c_Ghost;
153  }
154 
155  public:
159  PRToMCMatchInfo getPRToMCMatchInfo(const RecoTrack& prRecoTrack) const
160  {
161  float purity = NAN;
162  const RecoTrack* mcRecoTrack = getRelatedMCRecoTrack(prRecoTrack, purity);
163  return extractPRToMCMatchInfo(prRecoTrack, mcRecoTrack, purity);
164  }
165 
169  bool isMatchedMCRecoTrack(const RecoTrack& mcRecoTrack) const
170  {
171  return getMCToPRMatchInfo(mcRecoTrack) == MCToPRMatchInfo::c_Matched;
172  }
173 
177  bool isMergedMCRecoTrack(const RecoTrack& mcRecoTrack) const
178  {
179  return getMCToPRMatchInfo(mcRecoTrack) == MCToPRMatchInfo::c_Merged;
180  }
181 
185  bool isMissingMCRecoTrack(const RecoTrack& mcRecoTrack) const
186  {
187  return getMCToPRMatchInfo(mcRecoTrack) == MCToPRMatchInfo::c_Missing;
188  }
189 
190  public:
201  const MCParticle* getRelatedMCParticle(const RecoTrack& recoTrack) const;
202 
215  const TrackFitResult*
216  getRelatedTrackFitResult(const RecoTrack& prRecoTrack,
217  Const::ChargedStable chargedStable = Const::pion) const;
218 
223  const RecoTrack* getRelatedMCRecoTrack(const RecoTrack& prRecoTrack) const;
224 
229  const RecoTrack* getRelatedPRRecoTrack(const RecoTrack& mcRecoTrack) const;
230 
231  public:
243  float getRelatedPurity(const RecoTrack& prRecoTrack) const;
244 
256  float getRelatedEfficiency(const RecoTrack& mcRecoTrack) const;
257 
262  const RecoTrack* getRelatedMCRecoTrack(const RecoTrack& prRecoTrack, float& purity) const;
263 
268  const RecoTrack* getRelatedPRRecoTrack(const RecoTrack& mcRecoTrack, float& efficiency) const;
269 
270  public:
274  bool isMCRecoTrack(const RecoTrack& recoTrack) const;
275 
279  bool isPRRecoTrack(const RecoTrack& recoTrack) const;
280 
281  public:
285  const std::string& getMCTracksStoreArrayName() const
286  {
288  }
289 
293  const std::string& getPRTracksStoreArrayName() const
294  {
296  }
297 
298  private:
300  std::string m_mcTracksStoreArrayName;
301 
303  std::string m_prTracksStoreArrayName;
304  };
306 }
Belle2::TrackMatchLookUp::PRToMCMatchInfo
PRToMCMatchInfo
Matching categories for the pattern recognition tracks.
Definition: TrackMatchLookUp.h:54
Belle2::TrackMatchLookUp::getRelatedEfficiency
float getRelatedEfficiency(const RecoTrack &mcRecoTrack) const
Getter for the absolute value of the efficiency that is stored in the efficiency relation from Monte ...
Definition: TrackMatchLookUp.cc:152
Belle2::TrackMatchLookUp::extractPRToMCMatchInfo
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...
Definition: TrackMatchLookUp.cc:91
Belle2::TrackMatchLookUp::MCToPRMatchInfo
MCToPRMatchInfo
Matching categories for the Monte Carlo tracks.
Definition: TrackMatchLookUp.h:49
Belle2::TrackMatchLookUp::isMatchedPRRecoTrack
bool isMatchedPRRecoTrack(const RecoTrack &prRecoTrack) const
Checks, if the pattern recognition track was matched to a Monte Carlo track.
Definition: TrackMatchLookUp.h:133
Belle2::TrackMatchLookUp::TrackMatchLookUp
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...
Definition: TrackMatchLookUp.cc:20
Belle2::TrackMatchLookUp::getPRTracksStoreArrayName
const std::string & getPRTracksStoreArrayName() const
Getter for the name of the StoreArray of the pattern recognition tracks.
Definition: TrackMatchLookUp.h:301
Belle2::TrackMatchLookUp::isBackgroundPRRecoTrack
bool isBackgroundPRRecoTrack(const RecoTrack &prRecoTrack) const
Checks, if the pattern recognition track is mostly made from background hits.
Definition: TrackMatchLookUp.h:149
Belle2::TrackFindingCDC::NForwardBackward::c_Invalid
@ c_Invalid
Constant for an invalid information.
Definition: EForwardBackward.h:47
Belle2::TrackMatchLookUp::getPRToMCMatchInfo
PRToMCMatchInfo getPRToMCMatchInfo(const RecoTrack &prRecoTrack) const
Gets the matching category of pattern recognition track.
Definition: TrackMatchLookUp.h:167
Belle2::TrackMatchLookUp::getMatchedMCRecoTrack
const RecoTrack * getMatchedMCRecoTrack(const RecoTrack &prRecoTrack) const
Looks up the matched Monte Carlo track for the given pattern recognition track.
Definition: TrackMatchLookUp.cc:160
Belle2::TrackFitResult
Values of the result of a track fit with a given particle hypothesis.
Definition: TrackFitResult.h:59
Belle2::TrackMatchLookUp::getRelatedPRRecoTrack
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.
Definition: TrackMatchLookUp.cc:138
Belle2::TrackMatchLookUp::isMissingMCRecoTrack
bool isMissingMCRecoTrack(const RecoTrack &mcRecoTrack) const
Checks, if the Monte Carlo Track has no corresponding pattern recognition track.
Definition: TrackMatchLookUp.h:193
Belle2::TrackMatchLookUp::getMCTracksStoreArrayName
const std::string & getMCTracksStoreArrayName() const
Getter for the name of the StoreArray of the Monte Carlo tracks.
Definition: TrackMatchLookUp.h:293
Belle2::TrackMatchLookUp::getMatchedPRRecoTrack
const RecoTrack * getMatchedPRRecoTrack(const RecoTrack &mcRecoTrack) const
Looks up the matched pattern recognition track for the given Monte Carlo track.
Definition: TrackMatchLookUp.cc:174
Belle2::TrackMatchLookUp::getMatchedEfficiency
float getMatchedEfficiency(const RecoTrack &recoTrack) const
Get the hit efficiency of the matched track.
Definition: TrackMatchLookUp.cc:210
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::Const::pion
static const ChargedStable pion
charged pion particle
Definition: Const.h:535
Belle2::TrackMatchLookUp::extractMCToPRMatchInfo
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...
Definition: TrackMatchLookUp.cc:71
Belle2::TrackMatchLookUp::m_mcTracksStoreArrayName
std::string m_mcTracksStoreArrayName
Name of the StoreArray of Monte Carlo tracks.
Definition: TrackMatchLookUp.h:308
Belle2::TrackMatchLookUp::getMatchedPurity
float getMatchedPurity(const RecoTrack &recoTrack) const
Get the hit purity of the matched track.
Definition: TrackMatchLookUp.cc:188
Belle2::TrackMatchLookUp::isClonePRRecoTrack
bool isClonePRRecoTrack(const RecoTrack &prRecoTrack) const
Checks, if the pattern recognition track is a clone of an other pattern recognition track.
Definition: TrackMatchLookUp.h:141
Belle2::TrackMatchLookUp::isMatchedMCRecoTrack
bool isMatchedMCRecoTrack(const RecoTrack &mcRecoTrack) const
Checks, if the Monte Carlo Track was matched to a pattern recognition track.
Definition: TrackMatchLookUp.h:177
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackMatchLookUp::getRelatedMCRecoTrack
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.
Definition: TrackMatchLookUp.cc:119
Belle2::TrackMatchLookUp::getMCToPRMatchInfo
MCToPRMatchInfo getMCToPRMatchInfo(const RecoTrack &mcRecoTrack) const
Gets the matching category of Monte Carlo track.
Definition: TrackMatchLookUp.h:123
Belle2::TrackMatchLookUp::getRelatedMCParticle
const MCParticle * getRelatedMCParticle(const RecoTrack &recoTrack) const
Looks for a relation of the given track to a Monte Carlo particle.
Definition: TrackMatchLookUp.cc:114
Belle2::TrackMatchLookUp::m_prTracksStoreArrayName
std::string m_prTracksStoreArrayName
Name of the StoreArray of Pattern recognition tracks.
Definition: TrackMatchLookUp.h:311
Belle2::TrackMatchLookUp::getRelatedPurity
float getRelatedPurity(const RecoTrack &prRecoTrack) const
Getter for the absolute value of the purity that is stored in the purity relation from pattern recogn...
Definition: TrackMatchLookUp.cc:144
Belle2::TrackMatchLookUp::isMergedMCRecoTrack
bool isMergedMCRecoTrack(const RecoTrack &mcRecoTrack) const
Checks, if the Monte Carlo Track has been merged into another pattern recognition track.
Definition: TrackMatchLookUp.h:185
Belle2::Const::ChargedStable
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:465
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:43
Belle2::TrackMatchLookUp::getRelatedTrackFitResult
const TrackFitResult * getRelatedTrackFitResult(const RecoTrack &prRecoTrack, Const::ChargedStable chargedStable=Const::pion) const
Looks up the TrackFitResult of a pattern recognition track.
Definition: TrackMatchLookUp.cc:125
Belle2::TrackMatchLookUp::isGhostPRRecoTrack
bool isGhostPRRecoTrack(const RecoTrack &prRecoTrack) const
Checks, if the pattern recognition track has contributions of different Monte Carlo tracks and/or bac...
Definition: TrackMatchLookUp.h:158
Belle2::TrackMatchLookUp::isMCRecoTrack
bool isMCRecoTrack(const RecoTrack &recoTrack) const
Checks if the given track is in the Monte Carlo track StoreArray.
Definition: TrackMatchLookUp.cc:30
Belle2::TrackMatchLookUp::isPRRecoTrack
bool isPRRecoTrack(const RecoTrack &recoTrack) const
Checks if the given track is in the pattern recognition StoreArray.
Definition: TrackMatchLookUp.cc:35