ATLAS Offline Software
Loading...
Searching...
No Matches
TruthEtIsolations.h
Go to the documentation of this file.
1
2
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
18
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
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,
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
216std::ostream&
217operator<<( std::ostream& out, const TruthEtIsolations& etIsols );
218
220// Inline methods:
222
223inline std::size_t TruthEtIsolations::size() const
224{ return m_etIsolations.size(); }
225
226inline bool
227TruthEtIsolations::hasEtIsol( const int bc ) const
228{
229 return m_etIsolations.end() != m_etIsolations.find( bc );
230}
231
232inline const TruthEtIsolations::EtIsol_t*
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
241inline
242double
244 const TruthParticleParameters::ConeSize idx ) const
245{
246 return (*etIsolations(bc))[idx];
247}
248
251
254
255
256#endif //> MCPARTICLEEVENT_TRUTHETISOLATIONS_H
std::ostream & operator<<(std::ostream &out, const TruthEtIsolations &etIsols)
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
container which holds isolation informations for a given HepMC::GenParticle (labelled by barcode) for...
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.
std::unordered_map< int, EtIsol_t > EtIsolMap_t
The map of barcode-to-Et isolations.
TruthEtIsolations()
Default constructor.
static const EtIsol_t m_dfltEtIsols
The default Et isolation energy which is being returned when I don't know what to return.
std::size_t size() const
Return the number of HepMC::GenParticle for which Et isolations have been stored into this TruthEtIso...
bool hasEtIsol(const HepMC::ConstGenParticlePtr &genParticle) const
Return true if this TruthEtIsolations container holds Et isolations for that HepMC::GenParticle.
std::size_t genEventIdx() const
Return the index in the McEventCollection container holding the HepMC::GenEvent from which the Et iso...
~TruthEtIsolations()
Default destructor:
friend class TruthEtIsolationsCnv_p1
ElementLink< McEventCollection > GenEventLink_t
A (persistent) link to a HepMC::GenEvent.
EtIsolMap_t::const_iterator const_iterator
The iterator over the map of barcode-to-Et-isolations.
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...
const_iterator end() const
Const iterator over the barcodes of the HepMC::GenParticle for which we have Et isolations computed.
const_iterator begin() const
Const iterator over the barcodes of the HepMC::GenParticle for which we have Et isolations computed.
const std::string & genEventName() const
Return the name (ie: the StoreGate key) of the McEventCollection holding the HepMC::GenEvent from whi...
GenEventLink_t m_genEvtLink
ElementLink to the HepMC::GenEvent from which the Et isolations have been (or will be) computed
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.
McAod::EtIsolations EtIsol_t
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
EtIsolMap_t m_etIsolations
Holds transverse energy isolations for different isolation cones The key of this map is the barcode o...
TruthEtIsolations & operator=(const TruthEtIsolations &rhs)
Assignment operator.
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38
std::array< double, TruthParticleParameters::NbrOfCones > EtIsolations
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
ConeSize
Enum for Cone size indexes (for isolation)