ATLAS Offline Software
TruthEtIsolations.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // TruthEtIsolations.h
8 // Header file for class TruthEtIsolations
9 // Author : Sebastien Binet : April 2007
11 #ifndef MCPARTICLEEVENT_TRUTHETISOLATIONS_H
12 #define MCPARTICLEEVENT_TRUTHETISOLATIONS_H
13 
19 // STL includes
20 #include <vector>
21 #include <iosfwd>
22 #include <string>
23 #include <stdexcept>
24 #include <unordered_map>
25 
26 // Gaudi includes
27 
28 #include "AthLinks/ElementLink.h"
29 
30 // GeneratorObjects includes
32 
33 // McParticleEvent includes
35 
36 // Forward declaration
37 class McEventCollection;
38 
40 {
41 
43  // Public typedefs:
45  public:
46 
49 
53 
55  typedef std::unordered_map<int,EtIsol_t> EtIsolMap_t;
56 
58  typedef EtIsolMap_t::const_iterator const_iterator;
59 
61  // Public methods:
63  public:
64 
68 
72 
78  TruthEtIsolations( const GenEventLink_t& genEvtLink );
79 
85  TruthEtIsolations( const std::string& genEvtName,
86  const std::size_t genEvtIdx );
87 
91 
95 
97  // Const methods:
99 
105  const std::string& genEventName() const;
106 
111  std::size_t genEventIdx() const;
112 
117  std::size_t size() const;
118 
123  bool hasEtIsol( const HepMC::ConstGenParticlePtr& genParticle ) const;
124 
129  bool hasEtIsol( const int genParticleBarcode ) const;
130 
134  const EtIsol_t* etIsolations(const HepMC::ConstGenParticlePtr& genParticle ) const;
135 
139  const EtIsol_t* etIsolations( const int genParticleBarcode ) const;
140 
147  double etIsol( const HepMC::ConstGenParticlePtr& genParticle,
148  const TruthParticleParameters::ConeSize coneIdx ) const;
149 
156  double etIsol( const int genParticleBarcode,
157  const TruthParticleParameters::ConeSize coneIdx ) const;
158 
162  const_iterator begin() const;
163 
167  const_iterator end() const;
168 
170  // Non-const methods:
172 
173  // Set functions
174 
178  void setEtIsol( const HepMC::ConstGenParticlePtr& genParticle,
179  const TruthParticleParameters::ConeSize coneIdx,
180  const double etIsol );
181 
184  void setEtIsol( const HepMC::ConstGenParticlePtr& genParticle,
185  const std::vector<double>& etIsols );
186 
189  void setEtIsol( const HepMC::ConstGenParticlePtr& genParticle,
190  const EtIsol_t& etIsols );
191 
193  // Protected data:
195  protected:
197 
201 
206 
210  static const EtIsol_t m_dfltEtIsols;
211 };
212 
214 // I/O functions
216 std::ostream&
217 operator<<( std::ostream& out, const TruthEtIsolations& etIsols );
218 
220 // Inline methods:
222 
223 inline std::size_t TruthEtIsolations::size() const
224 { return m_etIsolations.size(); }
225 
226 inline bool
227 TruthEtIsolations::hasEtIsol( const int bc ) const
228 {
229  return m_etIsolations.end() != m_etIsolations.find( bc );
230 }
231 
232 inline const TruthEtIsolations::EtIsol_t*
233 TruthEtIsolations::etIsolations( const int bc ) const
234 {
235  const EtIsolMap_t::const_iterator i = m_etIsolations.find( bc );
236  return ( m_etIsolations.end() == i )
237  ? 0
238  : &i->second;
239 }
240 
241 inline
242 double
245 {
246  return (*etIsolations(bc))[idx];
247 }
248 
250 { return m_etIsolations.begin(); }
251 
253 { return m_etIsolations.end(); }
254 
255 
256 #endif //> MCPARTICLEEVENT_TRUTHETISOLATIONS_H
TruthEtIsolations::EtIsolMap_t
std::unordered_map< int, EtIsol_t > EtIsolMap_t
The map of barcode-to-Et isolations.
Definition: TruthEtIsolations.h:55
TruthEtIsolations::m_genEvtLink
GenEventLink_t m_genEvtLink
ElementLink to the HepMC::GenEvent from which the Et isolations have been (or will be) computed
Definition: TruthEtIsolations.h:200
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TruthEtIsolations::~TruthEtIsolations
~TruthEtIsolations()
Default destructor:
Definition: TruthEtIsolations.cxx:80
TruthEtIsolations::EtIsol_t
McAod::EtIsolations EtIsol_t
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
Definition: TruthEtIsolations.h:52
TruthEtIsolations::genEventIdx
std::size_t genEventIdx() const
Return the index in the McEventCollection container holding the HepMC::GenEvent from which the Et iso...
Definition: TruthEtIsolations.cxx:92
TruthEtIsolations::setEtIsol
void setEtIsol(const HepMC::ConstGenParticlePtr &genParticle, const TruthParticleParameters::ConeSize coneIdx, const double etIsol)
Set the transverse energy isolation of a HepMC::GenParticle for a given Cone size.
Definition: TruthEtIsolations.cxx:127
TruthEtIsolations::m_etIsolations
EtIsolMap_t m_etIsolations
Holds transverse energy isolations for different isolation cones The key of this map is the barcode o...
Definition: TruthEtIsolations.h:205
TruthParticleParameters::ConeSize
ConeSize
Enum for Cone size indexes (for isolation)
Definition: TruthParticleParamDefs.h:20
TruthEtIsolations::genEventName
const std::string & genEventName() const
Return the name (ie: the StoreGate key) of the McEventCollection holding the HepMC::GenEvent from whi...
Definition: TruthEtIsolations.cxx:87
TruthEtIsolations::hasEtIsol
bool hasEtIsol(const HepMC::ConstGenParticlePtr &genParticle) const
Return true if this TruthEtIsolations container holds Et isolations for that HepMC::GenParticle.
Definition: TruthEtIsolations.cxx:98
McAod::EtIsolations
std::array< double, TruthParticleParameters::NbrOfCones > EtIsolations
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
Definition: TruthParticleParamDefs.h:60
TruthEtIsolations::etIsol
double etIsol(const HepMC::ConstGenParticlePtr &genParticle, const TruthParticleParameters::ConeSize coneIdx) const
Return the transverse energy in a given cone size of isolation, for a given HepMC::GenParticle.
Definition: TruthEtIsolations.cxx:114
TruthEtIsolations::operator=
TruthEtIsolations & operator=(const TruthEtIsolations &rhs)
Assignment operator.
Definition: TruthEtIsolations.cxx:68
McEventCollection.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
TruthEtIsolations::m_dfltEtIsols
static const EtIsol_t m_dfltEtIsols
The default Et isolation energy which is being returned when I don't know what to return.
Definition: TruthEtIsolations.h:210
TruthEtIsolations::size
std::size_t size() const
Return the number of HepMC::GenParticle for which Et isolations have been stored into this TruthEtIso...
Definition: TruthEtIsolations.h:223
TruthParticleParamDefs.h
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
TruthEtIsolations::const_iterator
EtIsolMap_t::const_iterator const_iterator
The iterator over the map of barcode-to-Et-isolations.
Definition: TruthEtIsolations.h:58
TruthEtIsolations::TruthEtIsolations
TruthEtIsolations()
Default constructor.
Definition: TruthEtIsolations.cxx:45
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
TruthEtIsolations::begin
const_iterator begin() const
Const iterator over the barcodes of the HepMC::GenParticle for which we have Et isolations computed.
Definition: TruthEtIsolations.h:249
TruthEtIsolations
Definition: TruthEtIsolations.h:40
TruthEtIsolations::etIsolations
const EtIsol_t * etIsolations(const HepMC::ConstGenParticlePtr &genParticle) const
Return the transverse energies for all cone sizes of isolation, for a given HepMC::GenParticle's barc...
Definition: TruthEtIsolations.cxx:106
TruthEtIsolations::end
const_iterator end() const
Const iterator over the barcodes of the HepMC::GenParticle for which we have Et isolations computed.
Definition: TruthEtIsolations.h:252
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TruthEtIsolations::GenEventLink_t
ElementLink< McEventCollection > GenEventLink_t
A (persistent) link to a HepMC::GenEvent.
Definition: TruthEtIsolations.h:48
operator<<
std::ostream & operator<<(std::ostream &out, const TruthEtIsolations &etIsols)
Definition: TruthEtIsolations.cxx:157
TruthEtIsolationsCnv_p1
Definition: TruthEtIsolationsCnv_p1.h:32