ATLAS Offline Software
TrigInDetTrackTruth.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 /**************************************************************************
7  **
8  ** File: TrigInDetTrackTruth.h
9  **
10  ** Description: - Stores a vector of pointers to GenParticles which match
11  ** a TrigInDetTrack and associated matching quality
12  ** quantities (nr of common hits only for now)
13  **
14  ** Author: R.Goncalo
15  **
16  ** Created: Sat Jan 18 19:55:56 GMT 2006
17  ** Modified:
18  **
19  **
20  **
21  **************************************************************************/
22 #ifndef TRIGINDETTRACK_TRUTH_H
23 #define TRIGINDETTRACK_TRUTH_H
24 
25 #include "AthenaKernel/CLASS_DEF.h"
26 
29 
30 #include "AtlasHepMC/GenParticle.h"
31 #include "AtlasHepMC/GenVertex.h"
33 
34 #include <iostream>
35 
37 
38  public:
39 
43  { };
44 
48  {
49  // add this particle to the vector
50  m_true_part_vec.push_back(p_tru_part);
51 
52  // add number of hits
53  m_nr_common_hits.push_back( hits );
54 
55  // set the best match index (only 1 match so far)
59  };
60 
61  // Destructor
62  virtual ~TrigInDetTrackTruth() { };
63 
64  // accessors: to add links to GenParticles to object and get
65  // index if already filled; addMatch returns index of new entry
67  int index(HepMcParticleLink&) const;
68 
69  // to get quantities
70  const HepMcParticleLink* bestMatch() const;
71  const HepMcParticleLink* bestSiMatch() const;
72  const HepMcParticleLink* bestTRTMatch() const;
73  const HepMcParticleLink* truthMatch(unsigned int i) const;
74  unsigned int nrMatches() const;
75  unsigned int nrCommonHits(unsigned int i) const;
76  unsigned int nrCommonSiHits(unsigned int i) const;
77  unsigned int nrCommonTRTHits(unsigned int i) const;
78  unsigned int nrCommonHitsBestSi() const;
79  unsigned int nrCommonHitsBestTRT() const;
80 
81  // to handle mother-daughter relationships within matching particles
82  int updateFamilyTree();
83  const std::vector< std::pair<unsigned int, unsigned int> >& getFamilyTree() const;
84  bool motherInChain(unsigned int) const;
85  int motherIndexInChain(unsigned int) const;
86  bool daughtersInChain(unsigned int) const;
87  std::vector<unsigned int> daughterIndicesInChain(unsigned int) const;
88 
89  private:
90  friend class TrigInDetTrackTruthCnv_p1;
91  friend class TrigInDetTrackTruthCnv_p1_test;
92 
93  // reference best match quantities
97 
98  // vector of HepMcParticleLink pointers and matching quantities
99  std::vector<HepMcParticleLink> m_true_part_vec;
100  std::vector<TrigIDHitStats> m_nr_common_hits;
101  // vector<pair<int,int>> to act as bidirectional map "mother index <-> daughter index"
102  // where the indices refer to the GenPaticle positions in m_true_part_vec vector
103  std::vector< std::pair<unsigned int, unsigned int> > m_family_tree;
104 
105 
106 };
107 
108 CLASS_DEF( TrigInDetTrackTruth , 243330893 , 1 )
109 #endif
TrigInDetTrackTruth::getFamilyTree
const std::vector< std::pair< unsigned int, unsigned int > > & getFamilyTree() const
returns copy of family tree "map"
Definition: TrigInDetTrackTruth.cxx:250
TrigInDetTrackTruth::m_best_match_hits
int m_best_match_hits
Definition: TrigInDetTrackTruth.h:109
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
TrigInDetTrackTruth::nrCommonHitsBestTRT
unsigned int nrCommonHitsBestTRT() const
returns total number of common hits from best match true particle and TrigInDetTrack
Definition: TrigInDetTrackTruth.cxx:237
TrigInDetTrackTruth::m_true_part_vec
std::vector< HepMcParticleLink > m_true_part_vec
Definition: TrigInDetTrackTruth.h:114
GenVertex.h
TrigInDetTrackTruth::index
int index(HepMcParticleLink &) const
method to find if a given HepMcParticleLink already exists in "map" and, if so, what is its index; if...
Definition: TrigInDetTrackTruth.cxx:74
TrigIDHitStats.h
TrigInDetTrackTruth::bestSiMatch
const HepMcParticleLink * bestSiMatch() const
returns best match according to the number of hits
Definition: TrigInDetTrackTruth.cxx:190
TrigInDetTrackTruthCnv_p1
Definition: TrigInDetTrackTruthCnv_p1.h:34
TrigInDetTrackTruth::m_family_tree
std::vector< std::pair< unsigned int, unsigned int > > m_family_tree
Definition: TrigInDetTrackTruth.h:118
TrigInDetTrackTruth::m_best_Si_match_hits
int m_best_Si_match_hits
Definition: TrigInDetTrackTruth.h:110
TrigIDHitStats
Definition: TrigIDHitStats.h:18
TrigInDetTrackTruth::bestMatch
const HepMcParticleLink * bestMatch() const
returns best match according to the number of hits
Definition: TrigInDetTrackTruth.cxx:184
TrigInDetTrackTruth::nrCommonTRTHits
unsigned int nrCommonTRTHits(unsigned int i) const
returns number of common hits from true particle i and TrigInDetTrack
Definition: TrigInDetTrackTruth.cxx:224
GenParticle.h
TrigInDetTrackTruth::truthMatch
const HepMcParticleLink * truthMatch(unsigned int i) const
returns matching true particle number i
Definition: TrigInDetTrackTruth.cxx:202
TrigInDetTrack.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigInDetTrackTruth::nrCommonHitsBestSi
unsigned int nrCommonHitsBestSi() const
returns total number of common hits from best match true particle and TrigInDetTrack
Definition: TrigInDetTrackTruth.cxx:231
TrigInDetTrackTruth
Definition: TrigInDetTrackTruth.h:36
TrigInDetTrackTruth::TrigInDetTrackTruthCnv_p1_test
friend class TrigInDetTrackTruthCnv_p1_test
Definition: TrigInDetTrackTruth.h:106
TrigInDetTrackTruth::m_nr_common_hits
std::vector< TrigIDHitStats > m_nr_common_hits
Definition: TrigInDetTrackTruth.h:115
TrigInDetTrackTruth::daughtersInChain
bool daughtersInChain(unsigned int) const
given index of a GenParticle which matches the track returns true if it has stable a daughter which a...
Definition: TrigInDetTrackTruth.cxx:296
TrigInDetTrackTruth::nrCommonSiHits
unsigned int nrCommonSiHits(unsigned int i) const
returns number of common hits from true particle i and TrigInDetTrack
Definition: TrigInDetTrackTruth.cxx:217
TrigInDetTrackTruth::m_best_TRT_match_hits
int m_best_TRT_match_hits
Definition: TrigInDetTrackTruth.h:111
TrigInDetTrackTruth::bestTRTMatch
const HepMcParticleLink * bestTRTMatch() const
returns best match according to the number of hits
Definition: TrigInDetTrackTruth.cxx:196
TrigInDetTrackTruth::addMatch
int addMatch(HepMcParticleLink p_tru_part, TrigIDHitStats hits)
accessor to fill object: returns index of new entry in vectors
Definition: TrigInDetTrackTruth.cxx:34
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TrigInDetTrackTruth::~TrigInDetTrackTruth
virtual ~TrigInDetTrackTruth()
Definition: TrigInDetTrackTruth.h:77
TrigInDetTrackTruth::daughterIndicesInChain
std::vector< unsigned int > daughterIndicesInChain(unsigned int) const
given index of a GenParticle which matches the track returns vector with indices of its daughters,...
Definition: TrigInDetTrackTruth.cxx:277
TrigInDetTrackTruth::nrMatches
unsigned int nrMatches() const
returns number of matching particles
Definition: TrigInDetTrackTruth.cxx:244
TrigInDetTrackTruth::motherIndexInChain
int motherIndexInChain(unsigned int) const
given index of a GenParticle which matches the track returns index of its mother,...
Definition: TrigInDetTrackTruth.cxx:257
TrigInDetTrackTruth::motherInChain
bool motherInChain(unsigned int) const
given index of a GenParticle which matches the track returns true if its mother also matches the trac...
Definition: TrigInDetTrackTruth.cxx:271
TrigInDetTrackTruth::updateFamilyTree
int updateFamilyTree()
accessor to fill family tree: for each HepMcParticleLink in the internal vector of HepMC::GenParticle...
Definition: TrigInDetTrackTruth.cxx:95
TrigInDetTrackTruth::TrigInDetTrackTruth
TrigInDetTrackTruth()
Constructors: POOL needs default constructor.
Definition: TrigInDetTrackTruth.h:56
CLASS_DEF.h
macros to associate a CLID to a type
TrigInDetTrackTruth::nrCommonHits
unsigned int nrCommonHits(unsigned int i) const
returns number of common hits from true particle i and TrigInDetTrack
Definition: TrigInDetTrackTruth.cxx:210