ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticle_v1.h
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef XAODTRUTH_VERSIONS_TRUTHPARTICLE_V1_H
8#define XAODTRUTH_VERSIONS_TRUTHPARTICLE_V1_H
9
10// EDM include(s):
11#include "AthLinks/ElementLink.h"
12
13// xAOD include(s):
14#include "xAODBase/IParticle.h"
15#include "xAODBase/ObjectType.h"
16
17// Local include(s):
19
20// ROOT include(s):
21#include "Math/Vector4D.h"
23template struct DataVector_detail::DVLEltBaseInit< xAOD::TruthParticle_v1>;
24
25namespace xAOD {
26
37 class TruthParticle_v1 : public IParticle {
38
39 public:
42
45
47 void setPdgId( int pid );
49 int pdgId() const;
50
52 inline int pdg_id() const { return pdgId();}
54 int absPdgId() const;
55
57 int uid() const;
59 void setUid( int value );
60
62 int status() const;
64 void setStatus( int value );
65
67
70
72 bool hasProdVtx() const;
74 const TruthVertex_v1* prodVtx() const;
75
77 inline const TruthVertex_v1* production_vertex() const { return prodVtx();}
78
83
85 bool hasDecayVtx() const;
87 const TruthVertex_v1* decayVtx() const;
88
90 inline const TruthVertex_v1* end_vertex() const { return decayVtx();}
91
96
98
101
103 size_t nParents() const;
104
106 const TruthParticle_v1* parent( size_t i) const;
107
108 [[deprecated("Please select a specific parent index in your code!")]]
109 const TruthParticle_v1* parent() const {
110 return parent(0);
111 }
112
114 size_t nChildren() const;
115
117 const TruthParticle_v1* child( size_t i) const;
118
122
124
126
129
131 virtual double pt() const override final;
133 virtual double eta() const override final;
135 virtual double phi() const override final;
140 virtual double m() const override final;
142 virtual double e() const override final;
144 virtual double rapidity() const override final;
145
148
154 virtual FourMom_t p4() const override final;
155
157 typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > GenVecFourMom_t;
158
161
163 virtual Type::ObjectType type() const override final;
164
166
169
172 double abseta() const;
175 double absrapidity() const;
176
178 float px() const;
180 void setPx( float value );
181
183 float py() const;
185 void setPy( float value );
186
188 float pz() const;
190 void setPz( float value );
191
193 void setE( float value );
194
196 void setM( float value );
197
199
206
208 double charge() const;
211
216
226 bool isMuon() const;
228 bool isTau() const;
231
238
245
252
259
266
282
289
295 bool isTop() const;
297 bool isW() const;
299 bool isZ() const;
307 bool isBSM() const;
309 bool isGenStable() const;
311 bool isStable() const;
314
316
319
325
338 bool polarizationParameter( float& value, PolParam parameter ) const;
339
352 bool setPolarizationParameter( float value, PolParam parameter );
353
364 float polarizationParameter( PolParam parameter ) const;
365
372
376 : phi( -1.0 ), theta( -1.0 ) {}
377
379 bool valid() const {
380 return ( ( phi > 0.0 ) && ( theta > 0.0 ) );
381 }
382
383 float phi;
384 float theta;
385
386 }; // struct Polarization
387
395
397
399 void toPersistent();
400
401 }; // class TruthParticle_v1
402
403 inline std::ostream& operator<<(std::ostream& os, const TruthParticle_v1* p) {
404 if (!p) { os << "Prt: Empty particle" << std::endl; return os;}
405 os << "Prt: uid=";
406 os << p->uid() << " pdg_id=";
407 os << p->pdg_id() << " (px,py,pz,e)=";
408 os << p->px() << ",";
409 os << p->py() << ",";
410 os << p->pz() << ",";
411 os << p->e() << ";(pt,eta,phi)=";
412 os << p->pt() << ",";
413 os << p->eta() << ",";
414 os << p->phi() << "; status=";
415 os << p->status();
416 /* os << std::endl; AV:Not clear if we need a new line here */
417 return os;
418 }
419} // namespace xAOD
420
421#endif // XAODTRUTH_VERSIONS_TRUTHPARTICLE_V1_H
Scalar eta() const
pseudorapidity method
ObjectType
Definition BaseObject.h:11
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
IParticle()=default
Class describing a truth particle in the MC record.
void setPy(float value)
Set the y component of the particle's momentum.
bool isNeutrino() const
Whether the particle is a neutrino (or antineutrino).
bool isSimulationParticle() const
Check if this particle was produced during the simulation.
bool isLightBaryon() const
Determine if the PID is that of a light flavour (not b or c) baryon.
int status() const
Status code.
double abseta() const
The absolute pseudorapidity ( ) of the particle.
bool isResonance() const
Check if this particle is a resonant state.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
bool isBottomHadron() const
Determine if the PID is that of a b-hadron.
bool isStrangeMeson() const
Determine if the PID is that of a strange meson.
bool isStrangeHadron() const
Determine if the PID is that of a strange hadron.
bool hasStrange() const
Whether the particle contains a strange quark (or antiquark).
int threeCharge() const
3 x the physical charge (so it can be an int for quarks)
double absrapidity() const
The true absolute rapidity ( ) of the particle.
void setUid(int value)
Set unique ID.
virtual double rapidity() const override final
The true rapidity ( ) of the particle.
void toPersistent()
Function making sure that the object is ready for persistification.
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector form.
bool isHadron() const
Whether the particle is a hadron.
void setM(float value)
Also store the mass.
bool isLightMeson() const
Determine if the PID is that of a light flavour (not b or c) meson.
bool isBSM() const
Check if this is a BSM particle.
bool isStrangeBaryon() const
Determine if the PID is that of a strange baryon.
virtual double m() const override final
The mass of the particle.
bool hasBottom() const
Whether the particle contains a bottom quark (or antiquark).
bool isBottomBaryon() const
Determine if the PID is that of a b-baryon.
void setE(float value)
Set the energy of the particle.
bool isStable() const
Check if this is a stable particle (generator or simulation produced).
bool isQuark() const
Check if this particle is a quark.
bool isMeson() const
Whether the particle is a meson.
int pdgId() const
PDG ID code.
const ElementLink< TruthVertexContainer > & decayVtxLink() const
The decay vertex link of this particle.
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
bool isBaryon() const
Whether the particle is a baryon.
int pdg_id() const
PDG ID code.
bool isCharged() const
Whether the particle is electrically charged.
TruthParticle_v1()
Default constructor.
bool isHeavyBaryon() const
Determine if the PID is that of a heavy flavour (b or c) baryon.
bool isGenSpecific() const
Check if this is a generator specific (non-physical) particle.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Polarization polarization() const
Retrieve a full Polarization with a single call.
int absPdgId() const
Absolute PDG ID code (often useful).
bool isCharmMeson() const
Determine if the PID is that of a c-meson.
bool hasCharm() const
Whether the particle contains a charm quark (or antiquark).
bool isBottomMeson() const
Determine if the PID is that of a b-meson.
void setPz(float value)
Set the z component of the particle's momentum.
bool isChLepton() const
Whether the particle is a charged lepton.
bool hasProdVtx() const
Check for a production vertex on this particle.
virtual Type::ObjectType type() const override final
The type of the object as a simple enumeration.
float px() const
The x component of the particle's momentum.
bool hasDecayVtx() const
Check for a decay vertex on this particle.
bool isTop() const
Check if this particle is a top quark.
virtual double e() const override final
The total energy of the particle.
bool isLepton() const
Whether the particle is a lepton.
bool isW() const
Check if this particle is a W boson.
bool isNeutral() const
Whether the particle is electrically neutral.
bool isGenStable() const
Check if this is generator stable particle.
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
Base 4 Momentum type for TruthParticle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
void setDecayVtxLink(const ElementLink< TruthVertexContainer > &link)
Set the decay vertex of the particle.
float py() const
The y component of the particle's momentum.
double charge() const
Physical charge.
bool isHeavyMeson() const
Determine if the PID is that of a heavy flavour (b or c) meson.
void setStatus(int value)
Set status code.
size_t nParents() const
Number of parents of this particle.
bool isCharmBaryon() const
Determine if the PID is that of a c-baryon.
const TruthParticle_v1 * parent() const
int uid() const
Unique ID.
bool isElectron() const
Whether the particle is an electron (or positron).
bool isLightHadron() const
Determine if the PID is that of a light flavour (not b or c) hadron.
void setPdgId(int pid)
Set PDG ID code.
void setPx(float value)
Set the x component of the particle's momentum.
bool isParton() const
Check if this particle is a parton.
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
float pz() const
The z component of the particle's momentum.
bool isZ() const
Check if this particle is a Z boson.
const TruthVertex_v1 * end_vertex() const
The decay vertex of this particle.
PolParam
Polarization parameter types.
@ polarizationPhi
Polarization in ( ).
@ polarizationTheta
Polarization in ( ).
bool isPhoton() const
Whether the particle is a photon.
const ElementLink< TruthVertexContainer > & prodVtxLink() const
The production vertex link of this particle.
const TruthVertex_v1 * production_vertex() const
The production vertex of this particle.
bool isTau() const
Whether the particle is a tau (or antitau).
bool isMuon() const
Whether the particle is a muon (or antimuon).
bool isHeavyHadron() const
Determine if the PID is that of a heavy flavour (b or c) hadron.
bool isHiggs() const
Check if this particle is a Higgs boson.
void setProdVtxLink(const ElementLink< TruthVertexContainer > &link)
Set the production vertex of the particle.
bool isCharmHadron() const
Determine if the PID is that of a c-hadron.
Class describing a truth vertex in the MC record.
Selection rules: declare transient members.
Definition DataVector.h:581
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setRcore setEtHad setFside pt
Single container for full polarization information.
Polarization()
Constructor to set (invalid) defaults.
bool valid() const
Check if the stored values are valid.