ATLAS Offline Software
TrigInDetTrackTruthMap.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 /**************************************************************************
7  **
8  ** File: TrigInDetTrackTruthMap.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: RG - 19 Jun 06 - changed the class to deal with persistency
18  ** it now behaves a bit like a:
19  ** map<ElementLink to TrigInDetTrack, TrigInDetTrackTruth>
20  **
21  **************************************************************************/
22 #ifndef TRIGINDETTRACK_TRUTH_MAP_H
23 #define TRIGINDETTRACK_TRUTH_MAP_H
24 
25 #include "AthenaKernel/CLASS_DEF.h"
26 
28 #include "AthLinks/ElementLinkVector.h"
29 
33 #include "AtlasHepMC/GenParticle.h"
34 
35 #include <iostream>
36 
37 
39 
40 
41  public:
42 
45  m_elink_vec(0),
46  m_truth_vec(0)
47  { };
48 
49  // Destructor
50  virtual ~TrigInDetTrackTruthMap() { };
51 
52 
54  void addMatch(const TrigInDetTrackCollection* trkColl,
55  unsigned int trk_indx,
56  TrigInDetTrackTruth& p_trk_tru);
57 
59  // returns true if truth association exists for track
60  bool hasTruth(const TrigInDetTrack* p_trig_trk) const;
61 
62  // returns the track truth association object
63  const TrigInDetTrackTruth* truth(const TrigInDetTrack* p_trig_trk) const;
64 
65  // to make the map more useful: return the link to GenParticle which better
66  // matches this track according to number of common hits
67  const HepMcParticleLink* bestMatchSi(const TrigInDetTrack* p_trig_trk) const;
68  const HepMcParticleLink* bestMatchTRT(const TrigInDetTrack* p_trig_trk) const;
69 
70  // return number of hits for best match
71  int bestMatchSiHits(const TrigInDetTrack* p_trig_trk) const;
72  int bestMatchTRTHits(const TrigInDetTrack* p_trig_trk) const;
73 
74  void print() const;
75 
76  size_t size() const;
77  const TrigInDetTrackTruth* truthi (size_t i) const;
79  const TrigInDetTrack* tracki (size_t i) const;
80 
81  private:
82  friend class TrigInDetTrackTruthMapCnv_p1;
83  friend class TrigInDetTrackTruthMap_old_cnv;
84 
85  // used to be map for fast lookup, but changed to use ElemLink as key
86  // std::vector< ElementLink< DataVector<TrigInDetTrack> > > m_elink_vec;
87  //std::vector< ElementLink< TrigInDetTrackCollection > > m_elink_vec;
89  std::vector< TrigInDetTrackTruth > m_truth_vec;
90 };
91 
92 CLASS_DEF( TrigInDetTrackTruthMap , 78130186 , 1 )
93 #endif
TrigInDetTrackTruthMap::print
void print() const
Definition: TrigInDetTrackTruthMap.cxx:153
TrigInDetTrackTruthMap::addMatch
void addMatch(const TrigInDetTrackCollection *trkColl, unsigned int trk_indx, TrigInDetTrackTruth &p_trk_tru)
accessors to fill map
Definition: TrigInDetTrackTruthMap.cxx:32
TrigInDetTrackCollection
Definition: TrigInDetTrackCollection.h:13
TrigInDetTrackTruthMap::trackiLink
const ElementLink< TrigInDetTrackCollection > trackiLink(size_t i) const
Definition: TrigInDetTrackTruthMap.cxx:258
TrigInDetTrackCollection.h
ElementLinkVector< TrigInDetTrackCollection >
TrigInDetTrackTruthMap::tracki
const TrigInDetTrack * tracki(size_t i) const
Definition: TrigInDetTrackTruthMap.cxx:251
GenParticle.h
TrigInDetTrack
Definition: TrigInDetTrack.h:34
TrigInDetTrackTruthMap::TrigInDetTrackTruthMap
TrigInDetTrackTruthMap()
Constructors: POOL needs default constructor.
Definition: TrigInDetTrackTruthMap.h:59
TrigInDetTrackTruthMap::bestMatchTRT
const HepMcParticleLink * bestMatchTRT(const TrigInDetTrack *p_trig_trk) const
Definition: TrigInDetTrackTruthMap.cxx:134
TrigInDetTrackTruthMap::~TrigInDetTrackTruthMap
virtual ~TrigInDetTrackTruthMap()
Definition: TrigInDetTrackTruthMap.h:65
TrigInDetTrackTruthMap::hasTruth
bool hasTruth(const TrigInDetTrack *p_trig_trk) const
methods to get truth-match objects
Definition: TrigInDetTrackTruthMap.cxx:58
TrigInDetTrack.h
TrigInDetTrackTruthMap::size
size_t size() const
Definition: TrigInDetTrackTruthMap.cxx:237
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigInDetTrackTruth.h
TrigInDetTrackTruthMap
Definition: TrigInDetTrackTruthMap.h:38
TrigInDetTrackTruthMapCnv_p1
Definition: TrigInDetTrackTruthMapCnv_p1.h:30
TrigInDetTrackTruthMap::m_elink_vec
ElementLinkVector< TrigInDetTrackCollection > m_elink_vec
Definition: TrigInDetTrackTruthMap.h:103
TrigInDetTrackTruthMap_old_cnv
Definition: TrigInDetTrackTruthMap_old_cnv.h:20
TrigInDetTrackTruth
Definition: TrigInDetTrackTruth.h:36
TrigInDetTrackTruthMap::bestMatchSi
const HepMcParticleLink * bestMatchSi(const TrigInDetTrack *p_trig_trk) const
Definition: TrigInDetTrackTruthMap.cxx:114
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
TrigInDetTrackTruthMap::m_truth_vec
std::vector< TrigInDetTrackTruth > m_truth_vec
Definition: TrigInDetTrackTruthMap.h:104
TrigInDetTrackTruthMap::bestMatchSiHits
int bestMatchSiHits(const TrigInDetTrack *p_trig_trk) const
Definition: TrigInDetTrackTruthMap.cxx:123
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
TrigInDetTrackTruthMap::truthi
const TrigInDetTrackTruth * truthi(size_t i) const
Definition: TrigInDetTrackTruthMap.cxx:244
TrigInDetTrackTruthMap::truth
const TrigInDetTrackTruth * truth(const TrigInDetTrack *p_trig_trk) const
Definition: TrigInDetTrackTruthMap.cxx:82
CLASS_DEF.h
macros to associate a CLID to a type
TrigInDetTrackTruthMap::bestMatchTRTHits
int bestMatchTRTHits(const TrigInDetTrack *p_trig_trk) const
Definition: TrigInDetTrackTruthMap.cxx:143