ATLAS Offline Software
Loading...
Searching...
No Matches
TauConstituent.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
18
19
20PanTau::TauConstituent::TauConstituent(const TLorentzVector& itsMomentum,
21 int itsCharge,
22 const std::vector<int>& itsType,
23 double itsBDTValue,
24 const xAOD::PFO* itsPFO) :
25 IParticle(),
26 m_p4(itsMomentum),
27 m_TypeFlags(itsType),
28 m_BDTValue(itsBDTValue),
29 m_Charge(itsCharge),
30 m_PFO(itsPFO),
31 m_Shots(),
33{
34}
35
36
38
39= default;
40
41
43{
44 //delete the shot constituents
45 for(unsigned int iShot=0; iShot<m_Shots.size(); iShot++) {
46 PanTau::TauConstituent* curConst = m_Shots[iShot];
47 delete curConst;
48 }
49}
50
51
53{
54 if (this!=&tauConst){
55
56 if (!this->container() && !this->hasStore() ) {
58 }
59 this->IParticle::operator=( tauConst );
60 this->m_p4 = tauConst.m_p4;
61 m_TypeFlags = tauConst.m_TypeFlags;
62 m_BDTValue = tauConst.m_BDTValue;
63 m_Charge = tauConst.m_Charge;
64 m_PFO = tauConst.m_PFO;
65 m_Shots = tauConst.m_Shots;
67 }
68 return *this;
69}
70
71
73 static const Accessor< float > acc( "pt" );
74 return acc( *this );
75}
76
78 static const Accessor<float > acc( "eta" );
79 return acc( *this );
80}
81
83 static const Accessor< float > acc( "phi" );
84 return acc( *this );
85}
86
88 static const Accessor< float> acc( "m" );
89 return acc( *this );
90}
91
93 return p4().E();
94}
95
97 return p4().Rapidity();
98}
99
103
104void PanTau::TauConstituent::setP4(float pt, float eta, float phi, float m){
105 static const Accessor< float > acc1( "pt" );
106 acc1( *this ) = pt;
107 static const Accessor< float > acc2( "eta" );
108 acc2( *this ) = eta;
109 static const Accessor< float > acc3( "phi" );
110 acc3( *this ) = phi;
111 static const Accessor< float > acc4( "m" );
112 acc4( *this ) = m;
113 //Need to recalculate m_p4
114 m_p4.SetPtEtaPhiM( pt, eta, phi, m);
115}
116
118 static const Accessor< float > acc( "pt" );
119 acc( *this ) = pt;
120 //Need to recalculate m_p4
121 m_p4.SetPtEtaPhiM( pt, eta(), phi(), m());
122}
123
125 static const Accessor< float > acc( "eta" );
126 acc( *this ) = eta;
127 //Need to recalculate m_p4
128 m_p4.SetPtEtaPhiM( pt(), eta, phi(), m());
129}
130
132 static const Accessor< float > acc( "phi" );
133 acc( *this ) = phi;
134 //Need to recalculate m_p4
135 m_p4.SetPtEtaPhiM( pt(), eta(), phi, m());
136}
137
139 static const Accessor< float > acc( "m" );
140 acc( *this ) = m;
141 //Need to recalculate m_p4
142 m_p4.SetPtEtaPhiM( pt(), eta(), phi(), m);
143}
144
145
149
150
152 unsigned int typeIndex = (unsigned int)aType;
153 m_TypeFlags.at(typeIndex) = 0;
154}
155
156
157//the static getTypeName which does a translation
159 switch(aType) {
160 case PanTau::TauConstituent::t_Charged: return "Charged";
161 case PanTau::TauConstituent::t_Neutral: return "Neutral";
162 case PanTau::TauConstituent::t_Pi0Neut: return "Pi0Neut";
163 case PanTau::TauConstituent::t_NoType: return "All";
164 default: return "UnkownType";
165 }
166}
167
168
169bool PanTau::TauConstituent::isNeutralType(int tauConstituentType) {
171 switch(type) {
172 case PanTau::TauConstituent::t_Neutral: return true;
173 case PanTau::TauConstituent::t_Pi0Neut: return true;
174 default: return false;
175 }
176 return false;
177}
178
179//the non static getType name, which returns
180std::vector<std::string> PanTau::TauConstituent::getTypeName() const {
181 std::vector<std::string> res;
182 for(unsigned int iType=0; iType<TauConstituent::t_nTypes; iType++) {
183 if(m_TypeFlags[iType] == 1) {
185 res.push_back( TauConstituent::getTypeName(curType) );
186 }
187 }
188 return res;
189}
190
191
193 std::string res;
194 for(unsigned int iType=0; iType<m_TypeFlags.size(); iType++) {
195 if(m_TypeFlags[iType] == 1) {
197 }
198 }
199 return res;
200}
201
202
204 return m_BDTValue;
205}
206
207
208const std::vector<int>& PanTau::TauConstituent::getTypeFlags() const {
209 return m_TypeFlags;
210}
211
212
214 if(theType >= static_cast<int>(TauConstituent::t_nTypes)) {
215 return false;
216 }
217 if(m_TypeFlags.at( static_cast<int>(theType)) == 1) return true;
218 return false;
219}
220
221
223 return m_Charge;
224}
225
226
228 return m_PFO;
229}
230
231
233 if(shot != nullptr) m_Shots.push_back(shot);
234}
235
236
237const std::vector<PanTau::TauConstituent*>& PanTau::TauConstituent::getShots() const {
238 return m_Shots;
239}
240
241
243 return m_Shots.size();
244}
245
246
248 m_nPhotonsInShot = nPhotons;
249}
250
251
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
std::pair< std::vector< unsigned int >, bool > res
Input object for PanTau.
const xAOD::PFO * m_PFO
void setM(float m)
set the Mass
std::vector< std::string > getTypeName() const
const std::vector< TauConstituent * > & getShots() const
virtual double pt() const
The transverse momentum ( ) of the particle.
void addShot(TauConstituent *shot)
unsigned int getNShots() const
virtual double eta() const
The pseudorapidity ( ) of the particle.
static double DefaultCharge()
virtual double phi() const
The azimuthal angle ( ) of the particle.
TauConstituent & operator=(const TauConstituent &tauConst)
Assignment operator.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
static bool isNeutralType(int tauConstituentType)
std::vector< TauConstituent * > m_Shots
void setPt(float pt)
set the Pt
virtual FourMom_t p4() const
The full 4-momentum of the particle as a TLorentzVector.
void setEta(float eta)
set the eta
const xAOD::PFO * getPFO() const
FourMom_t m_p4
4-momentum object
std::string getTypeNameString() const
std::vector< int > m_TypeFlags
void setPhi(float phi)
set the phi
virtual double e() const
The total energy of the particle.
bool isOfType(TauConstituent::Type aType) const
TauConstituent()
Default Constructor for POOL.
virtual ~TauConstituent()
Destructor.
void setP4(float pt, float eta, float phi, float m)
set the 4-vec
const std::vector< int > & getTypeFlags() const
static double DefaultBDTValue()
Type
Type enumeration to specify type of this tau constituent.
virtual double rapidity() const
The true rapidity (y) of the particle.
virtual xAOD::Type::ObjectType type() const
The type of the object as a simple enumeration, remains pure virtual in e/gamma.
virtual double m() const
The invariant mass of the particle.
void setNPhotonsInShot(int nPhotons)
void removeTypeFlag(TauConstituent::Type aType)
static std::string getTypeName(PanTau::TauConstituent::Type aType)
void makePrivateStore()
Create a new (empty) private store for this object.
bool hasStore() const
Return true if this object has an associated store.
const SG::AuxVectorData * container() const
Return the container holding this element.
IParticle()=default
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition ObjectType.h:32
@ ParticleFlow
The object is a particle-flow object.
Definition ObjectType.h:41
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17