ATLAS Offline Software
JetConstituentVector.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAODJET_JETCONSTITUENTSVECTOR_H
8 #define XAODJET_JETCONSTITUENTSVECTOR_H
9 // use JetConstituentVector::asSTLVector().
42 
43 
44 // Core include(s):
45 #include "AthLinks/ElementLink.h"
46 
47 // xAOD include(s):
48 #include "xAODBase/IParticle.h"
50 
51 #include "xAODJet/JetTypes.h"
52 
53 namespace xAOD {
54 
62  public:
63  friend class JetConstituentVector;
64 
65 
67 
68  double pt() const { return Pt();}
70  double eta() const { return Eta();}
72  double phi() const { return Phi();}
74  double m() const { return M();}
76  double e() const { return E();}
78  double rapidity() const { return Rapidity();}
79 
82 
84  //
85  //const FourMom_t& p4() const { return FourMom_t(Px(), Py(), Pz(), E());}
86 
88 
89 
91  Type::ObjectType type() const { return m_part->type();}
92 
94  template< class T >
95  const T& auxdata( const std::string& name,
96  const std::string& clsname = "" ) const;
97 
99  const JetConstituent* operator->() const {return this;};
100 
102  const IParticle* rawConstituent() const { return m_part; }
103  protected:
104 
105  const IParticle * m_part;
106 
107  };
108 
109 
118 
119  public:
120 
121  class iterator {
122  public:
123  friend class JetConstituentVector;
124  typedef std::vector< ElementLink< IParticleContainer > >::const_iterator ELiterator;
125 
127 
128  iterator & operator++();
129  iterator operator++(int);
130  iterator & operator--();
131  iterator operator--(int);
132  bool operator==( const iterator & other) const;
133  bool operator!=( const iterator & other) const;
134 
135  const JetConstituent* operator*();
136  const JetConstituent* operator->();
137 
138  // for python, we alias operator++/--
139  void inc(){ this->operator++();}
140  void dec(){ this->operator--();}
141 
142 
143  protected:
144 
145 
146  void update4Mom();
147 
148  ELiterator m_index;
151 
153 
154  };
155 
157  typedef std::vector< ElementLink< IParticleContainer > > ELvector;
158 
160 
162  bool isValid() const;
163 
164 
166  bool empty() const ;
168  size_t size() const ;
169 
171  iterator begin() const ;
173  iterator end() const ;
174 
178  iterator end(JetConstitScale s) const ;
179 
180 
182  JetConstituent operator[](size_t i) const ;
184  JetConstituent at(size_t i) const ;
186  JetConstituent front() const ;
188  JetConstituent back() const ;
189 
192  std::vector<const IParticle*> asIParticleVector() const ;
193 
197  std::vector<JetConstituent> asSTLVector();
198 
199  protected:
200 
201  const std::vector< ElementLink< IParticleContainer > > * m_elVector;
203 
204  };
205 
206 // Hide the implementation of the template function(s) from gccxml:
207 #ifndef __GCCXML__
208 
209 
210  // use TT as the template parameter to avoid conflicts with LorentzVector::T() !
211  template<class TT> const TT& JetConstituent::auxdata( const std::string& name,
212  const std::string& clsname ) const {
213  return m_part->template auxdata<TT>(name, clsname);
214  }
215 
216 
217 #endif // not __GCCXML__
218 
219 } // namespace xAOD
220 
221 #endif
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
xAOD::JetConstituent::JetConstituent
JetConstituent(const IParticle *part=0)
Definition: JetConstituentVector.h:66
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
xAOD::JetConstituentVector::iterator::inc
void inc()
Definition: JetConstituentVector.h:139
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
xAOD::JetConstituentVector::at
JetConstituent at(size_t i) const
Constituent proxy at position i.
Definition: JetConstituentVector.cxx:111
IParticle.h
xAOD::JetConstituentVector::iterator::m_index
ELiterator m_index
Definition: JetConstituentVector.h:148
xAOD::JetConstituentVector::operator[]
JetConstituent operator[](size_t i) const
Constituent proxy at position i.
Definition: JetConstituentVector.cxx:109
xAOD::JetConstituentVector::iterator::dec
void dec()
Definition: JetConstituentVector.h:140
xAOD::JetConstituentVector::iterator::operator*
const JetConstituent * operator*()
Definition: JetConstituentVector.cxx:77
xAOD::JetConstituentVector::iterator::operator--
iterator & operator--()
Definition: JetConstituentVector.cxx:72
xAOD::JetConstituentVector::end
iterator end() const
iterator after the last constituent
Definition: JetConstituentVector.cxx:104
xAOD::JetConstituentVector::back
JetConstituent back() const
last constituent proxy
Definition: JetConstituentVector.cxx:120
xAOD::JetConstituentVector::iterator::operator==
bool operator==(const iterator &other) const
Definition: JetConstituentVector.cxx:74
skel.it
it
Definition: skel.GENtoEVGEN.py:423
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
xAOD::other
@ other
Definition: TrackingPrimitives.h:509
xAOD::JetConstituentVector::size
size_t size() const
number of constituents
Definition: JetConstituentVector.cxx:102
xAOD::JetConstituentVector::isValid
bool isValid() const
Check if element links are valid.
Definition: JetConstituentVector.cxx:92
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
Phi
@ Phi
Definition: RPCdef.h:8
xAOD::JetConstituentVector::m_elVector
const std::vector< ElementLink< IParticleContainer > > * m_elVector
Definition: JetConstituentVector.h:201
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
xAOD::JetConstituentVector::iterator::ELiterator
std::vector< ElementLink< IParticleContainer > >::const_iterator ELiterator
Definition: JetConstituentVector.h:124
xAOD::JetConstituentVector::empty
bool empty() const
true if vector is empty()
Definition: JetConstituentVector.cxx:101
xAOD::JetConstituent::phi
double phi() const
The azimuthal angle ( ) of the particle.
Definition: JetConstituentVector.h:72
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:68
xAOD::JetConstituent::m_part
const IParticle * m_part
Definition: JetConstituentVector.h:105
xAOD::JetConstituentVector::begin
iterator begin() const
iterator on the first constituent
Definition: JetConstituentVector.cxx:103
xAOD::JetConstituentVector::iterator::operator++
iterator & operator++()
Definition: JetConstituentVector.cxx:70
xAOD::JetConstituentVector::const_iterator
iterator const_iterator
Definition: JetConstituentVector.h:156
lumiFormat.i
int i
Definition: lumiFormat.py:92
xAOD::JetConstituent::operator->
const JetConstituent * operator->() const
operator-> allows to use JetConstituentVector with same syntax as vector<IParticle*>
Definition: JetConstituentVector.h:99
IParticleContainer.h
xAOD::JetConstituentVector::iterator::m_cachedMomIndex
ELiterator m_cachedMomIndex
Definition: JetConstituentVector.h:149
xAOD::JetConstituent::pt
double pt() const
Definition: JetConstituentVector.h:68
xAOD::JetConstituent::rawConstituent
const IParticle * rawConstituent() const
Access the real underlying IParticle.
Definition: JetConstituentVector.h:102
xAOD::JetConstituentVector::iterator::update4Mom
void update4Mom()
Definition: JetConstituentVector.cxx:81
xAOD::JetConstituentVector::iterator::m_4mom
JetConstituent m_4mom
Definition: JetConstituentVector.h:150
xAOD::JetConstituentVector::JetConstituentVector
JetConstituentVector(const ELvector *elv, JetConstitScale s)
Definition: JetConstituentVector.h:159
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
xAOD::JetConstituentVector::front
JetConstituent front() const
first constituent proxy
Definition: JetConstituentVector.cxx:118
xAOD::JetConstituent::type
Type::ObjectType type() const
The full 4-momentum of the particle.
Definition: JetConstituentVector.h:91
xAOD::JetConstitScale
JetConstitScale
Definition: JetTypes.h:20
xAOD::JetConstituentVector::ELvector
std::vector< ElementLink< IParticleContainer > > ELvector
Definition: JetConstituentVector.h:157
xAOD::JetConstituentVector::m_sigState
JetConstitScale m_sigState
Definition: JetConstituentVector.h:202
xAOD::JetConstituentVector::iterator::m_sigState
JetConstitScale m_sigState
Definition: JetConstituentVector.h:152
xAOD::JetConstituent::auxdata
const T & auxdata(const std::string &name, const std::string &clsname="") const
Access the underlying IParticle's aux data.
xAOD::JetConstituent::FourMom_t
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
Definition: JetConstituentVector.h:81
xAOD::JetConstituent::rapidity
double rapidity() const
The true rapidity (y) of the particle.
Definition: JetConstituentVector.h:78
xAOD::JetConstituentVector::asSTLVector
std::vector< JetConstituent > asSTLVector()
Returns this vector as a std::vector Provided for convenience when dealing with the JetConstituentVec...
Definition: JetConstituentVector.cxx:128
Prompt::Def::Pt
@ Pt
Definition: VarHolder.h:76
xAOD::JetConstituentVector::asIParticleVector
std::vector< const IParticle * > asIParticleVector() const
vector of pointer to the underlying IParticles.
Definition: JetConstituentVector.cxx:122
xAOD::JetConstituentVector::iterator::operator!=
bool operator!=(const iterator &other) const
Definition: JetConstituentVector.cxx:75
xAOD::JetConstituent::e
double e() const
The total energy of the particle.
Definition: JetConstituentVector.h:76
xAOD::JetConstituent
4-vector of jet constituent at the scale used during jet finding.
Definition: JetConstituentVector.h:61
xAOD::JetConstituentVector::iterator::iterator
iterator(ELiterator it, JetConstitScale s)
Definition: JetConstituentVector.h:126
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
xAOD::JetConstituentVector::iterator
Definition: JetConstituentVector.h:121
xAOD::JetConstituent::eta
double eta() const
The pseudorapidity ( ) of the particle.
Definition: JetConstituentVector.h:70
JetTypes.h
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition: ObjectType.h:32
Analysis::TT
@ TT
Definition: JpsiFinder.h:39
xAOD::JetConstituent::m
double m() const
The invariant mass of the particle.
Definition: JetConstituentVector.h:74
xAOD::JetConstituentVector::iterator::operator->
const JetConstituent * operator->()
Definition: JetConstituentVector.cxx:78
Eta
@ Eta
Definition: RPCdef.h:8
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35