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
109 size_t nChildren() const;
110
112 const TruthParticle_v1* child( size_t i) const;
113
117
119
121
124
126 virtual double pt() const override final;
128 virtual double eta() const override final;
130 virtual double phi() const override final;
135 virtual double m() const override final;
137 virtual double e() const override final;
139 virtual double rapidity() const override final;
140
143
149 virtual FourMom_t p4() const override final;
150
152 typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > GenVecFourMom_t;
153
156
158 virtual Type::ObjectType type() const override final;
159
161
164
167 double abseta() const;
170 double absrapidity() const;
171
173 float px() const;
175 void setPx( float value );
176
178 float py() const;
180 void setPy( float value );
181
183 float pz() const;
185 void setPz( float value );
186
188 void setE( float value );
189
191 void setM( float value );
192
194
201
203 double charge() const;
206
211
221 bool isMuon() const;
223 bool isTau() const;
226
233
240
247
254
261
277
284
290 bool isTop() const;
292 bool isW() const;
294 bool isZ() const;
302 bool isBSM() const;
304 bool isGenStable() const;
306 bool isStable() const;
309
311
314
320
333 bool polarizationParameter( float& value, PolParam parameter ) const;
334
347 bool setPolarizationParameter( float value, PolParam parameter );
348
359 float polarizationParameter( PolParam parameter ) const;
360
367
371 : phi( -1.0 ), theta( -1.0 ) {}
372
374 bool valid() const {
375 return ( ( phi > 0.0 ) && ( theta > 0.0 ) );
376 }
377
378 float phi;
379 float theta;
380
381 }; // struct Polarization
382
390
392
394 void toPersistent();
395
396 }; // class TruthParticle_v1
397
398 inline std::ostream& operator<<(std::ostream& os, const TruthParticle_v1* p) {
399 if (!p) { os << "Prt: Empty particle" << std::endl; return os;}
400 os << "Prt: uid=";
401 os << p->uid() << " pdg_id=";
402 os << p->pdg_id() << " (px,py,pz,e)=";
403 os << p->px() << ",";
404 os << p->py() << ",";
405 os << p->pz() << ",";
406 os << p->e() << ";(pt,eta,phi)=";
407 os << p->pt() << ",";
408 os << p->eta() << ",";
409 os << p->phi() << "; status=";
410 os << p->status();
411 /* os << std::endl; AV:Not clear if we need a new line here */
412 return os;
413 }
414} // namespace xAOD
415
416#endif // XAODTRUTH_VERSIONS_TRUTHPARTICLE_V1_H
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.
const TruthParticle_v1 * child(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
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.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
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.
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.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
void setPdgId(int pid)
Set PDG ID code.
void setPx(float value)
Set the x component of the particle's momentum.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
size_t nChildren() const
Number of children of this particle.
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.
Single container for full polarization information.
Polarization()
Constructor to set (invalid) defaults.
bool valid() const
Check if the stored values are valid.