ATLAS Offline Software
Loading...
Searching...
No Matches
JetConstituentVector.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef XAODJET_JETCONSTITUENTSVECTOR_H
8#define XAODJET_JETCONSTITUENTSVECTOR_H
38// 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
53namespace xAOD {
54
62 public:
64
65
66 JetConstituent(const IParticle* part=0) : xAOD::JetFourMom_t(), m_part(part){}
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
106
107 };
108
109
118
119 public:
120
121 class iterator {
122 public:
124 typedef std::vector< ElementLink< IParticleContainer > >::const_iterator ELiterator;
125
127
129 iterator operator++(int);
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
@ Phi
Definition RPCdef.h:8
@ Eta
Definition RPCdef.h:8
iterator(ELiterator it, JetConstitScale s)
JetConstituentVector(const ELvector *elv, JetConstitScale s)
JetConstituent(const IParticle *part=0)
Class providing the definition of the 4-vector interface.
TLorentzVector FourMom_t
Definition of the 4-momentum type.
iterator(ELiterator it, JetConstitScale s)
bool operator==(const iterator &other) const
std::vector< ElementLink< IParticleContainer > >::const_iterator ELiterator
bool operator!=(const iterator &other) const
const std::vector< ElementLink< IParticleContainer > > * m_elVector
JetConstituentVector(const ELvector *elv, JetConstitScale s)
iterator begin() const
iterator on the first constituent
size_t size() const
number of constituents
std::vector< ElementLink< IParticleContainer > > ELvector
JetConstituent operator[](size_t i) const
Constituent proxy at position i.
std::vector< const IParticle * > asIParticleVector() const
vector of pointer to the underlying IParticles.
JetConstituent front() const
first constituent proxy
bool isValid() const
Check if element links are valid.
JetConstituent back() const
last constituent proxy
iterator end() const
iterator after the last constituent
bool empty() const
true if vector is empty()
std::vector< JetConstituent > asSTLVector()
Returns this vector as a std::vector Provided for convenience when dealing with the JetConstituentVec...
JetConstituent at(size_t i) const
Constituent proxy at position i.
4-vector of jet constituent at the scale used during jet finding.
double rapidity() const
The true rapidity (y) of the particle.
double eta() const
The pseudorapidity ( ) of the particle.
double m() const
The invariant mass of the particle.
JetConstituent(const IParticle *part=0)
double phi() const
The azimuthal angle ( ) of the particle.
Type::ObjectType type() const
The full 4-momentum of the particle.
const JetConstituent * operator->() const
operator-> allows to use JetConstituentVector with same syntax as vector<IParticle*>
const T & auxdata(const std::string &name, const std::string &clsname="") const
Access the underlying IParticle's aux data.
const IParticle * rawConstituent() const
Access the real underlying IParticle.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
double e() const
The total energy of the particle.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
JetConstituentVector::iterator iterator
JetConstitScale
Definition JetTypes.h:20
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17