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-2026 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"
23
24namespace xAOD {
25
36 class TruthParticle_v1 : public IParticle {
37
38 public:
41
44
46 void setPdgId( int pid );
48 int pdgId() const;
49
51 inline int pdg_id() const { return pdgId();}
53 int absPdgId() const;
54
56 int uid() const;
58 void setUid( int value );
59
61 int status() const;
63 void setStatus( int value );
64
66
69
71 bool hasProdVtx() const;
73 const TruthVertex_v1* prodVtx() const;
74
76 inline const TruthVertex_v1* production_vertex() const { return prodVtx();}
77
82
84 bool hasDecayVtx() const;
86 const TruthVertex_v1* decayVtx() const;
87
89 inline const TruthVertex_v1* end_vertex() const { return decayVtx();}
90
95
97
100
102 size_t nParents() const;
103
105 const TruthParticle_v1* parent( size_t i) const;
106
107 [[deprecated("Please select a specific parent index in your code!")]]
108 const TruthParticle_v1* parent() const {
109 return parent(0);
110 }
111
113 size_t nChildren() const;
114
116 const TruthParticle_v1* child( size_t i) const;
117
121
123
125
128
130 virtual double pt() const override final;
132 virtual double eta() const override final;
134 virtual double phi() const override final;
139 virtual double m() const override final;
141 virtual double e() const override final;
143 virtual double rapidity() const override final;
144
147
153 virtual FourMom_t p4() const override final;
154
156 typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > GenVecFourMom_t;
157
160
162 virtual Type::ObjectType type() const override final;
163
165
168
171 double abseta() const;
174 double absrapidity() const;
175
177 float px() const;
179 void setPx( float value );
180
182 float py() const;
184 void setPy( float value );
185
187 float pz() const;
189 void setPz( float value );
190
192 void setE( float value );
193
195 void setM( float value );
196
198
205
207 double charge() const;
210
215
225 bool isMuon() const;
227 bool isTau() const;
230
237
244
251
258
265
281
288
294 bool isTop() const;
296 bool isW() const;
298 bool isZ() const;
306 bool isBSM() const;
308 bool isGenStable() const;
310 bool isStable() const;
313
315
318
324
337 bool polarizationParameter( float& value, PolParam parameter ) const;
338
351 bool setPolarizationParameter( float value, PolParam parameter );
352
363 float polarizationParameter( PolParam parameter ) const;
364
371
375 : phi( -1.0 ), theta( -1.0 ) {}
376
378 bool valid() const {
379 return ( ( phi > 0.0 ) && ( theta > 0.0 ) );
380 }
381
382 float phi;
383 float theta;
384
385 }; // struct Polarization
386
394
396
398 void toPersistent();
399
400 }; // class TruthParticle_v1
401
402 inline std::ostream& operator<<(std::ostream& os, const TruthParticle_v1* p) {
403 if (!p) { os << "Prt: Empty particle" << std::endl; return os;}
404 os << "Prt: uid=";
405 os << p->uid() << " pdg_id=";
406 os << p->pdg_id() << " (px,py,pz,e)=";
407 os << p->px() << ",";
408 os << p->py() << ",";
409 os << p->pz() << ",";
410 os << p->e() << ";(pt,eta,phi)=";
411 os << p->pt() << ",";
412 os << p->eta() << ",";
413 os << p->phi() << "; status=";
414 os << p->status();
415 /* os << std::endl; AV:Not clear if we need a new line here */
416 return os;
417 }
418} // namespace xAOD
420
421#endif // XAODTRUTH_VERSIONS_TRUTHPARTICLE_V1_H
Scalar eta() const
pseudorapidity method
ObjectType
Definition BaseObject.h:11
#define DATAVECTOR_BASE_FIN(T, B)
Used to finish up a forward declaration.
Definition DataVector.h:796
Class providing the definition of the 4-vector interface.
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.
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.
bool setPolarizationParameter(float value, PolParam parameter)
Set method for polarization parameter values.
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.
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.
bool polarizationParameter(float &value, PolParam parameter) const
Accessor for polarization parameters.
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:583
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TruthParticle_v1 TruthParticle
Typedef to implementation.
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
Single container for full polarization information.
Polarization()
Constructor to set (invalid) defaults.
bool valid() const
Check if the stored values are valid.