ATLAS Offline Software
TruthParticle_v1.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2024 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 template struct DataVector_detail::DVLEltBaseInit< xAOD::TruthParticle_v1>;
24 
25 namespace 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 
58  int barcode() const;
60  void setBarcode( int value );
61 
64  int id() const;
65 
67  int status() const;
69  void setStatus( int value );
70 
72 
75 
77  bool hasProdVtx() const;
79  const TruthVertex_v1* prodVtx() const;
80 
82  inline const TruthVertex_v1* production_vertex() const { return prodVtx();}
83 
88 
90  bool hasDecayVtx() const;
92  const TruthVertex_v1* decayVtx() const;
93 
95  inline const TruthVertex_v1* end_vertex() const { return decayVtx();}
96 
101 
103 
106 
108  size_t nParents() const;
109 
111  const TruthParticle_v1* parent( size_t i = 0 ) const;
112 
114  size_t nChildren() const;
115 
117  const TruthParticle_v1* child( size_t i = 0 ) 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 
160  GenVecFourMom_t genvecP4() const;
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 
213  bool isCharged() const;
215  bool isNeutral() const;
216 
218  bool isPhoton() const;
220  bool isLepton() const;
226  bool isMuon() const;
228  bool isTau() const;
231 
233  bool isHadron() const;
235  bool isMeson() const;
237  bool isBaryon() const;
238 
242  bool hasCharm() const;
244  bool hasBottom() const;
245 
252 
259 
266 
282 
289 
291  bool isQuark() const;
293  bool isParton() const;
295  bool isTop() const;
297  bool isW() const;
299  bool isZ() const;
301  bool isHiggs() const;
307  bool isBSM() const;
309  bool isGenStable() const;
310 
312 
315 
317  enum PolParam {
318  polarizationPhi = 0,
319  polarizationTheta = 1
320  };
321 
334  bool polarizationParameter( float& value, PolParam parameter ) const;
335 
348  bool setPolarizationParameter( float value, PolParam parameter );
349 
360  float polarizationParameter( PolParam parameter ) const;
361 
367  struct Polarization {
368 
372  : phi( -1.0 ), theta( -1.0 ) {}
373 
375  bool valid() const {
376  return ( ( phi > 0.0 ) && ( theta > 0.0 ) );
377  }
378 
379  float phi;
380  float theta;
381 
382  }; // struct Polarization
383 
390  Polarization polarization() const;
391 
393 
395  void toPersistent();
396 
397  }; // class TruthParticle_v1
398 
399  inline std::ostream& operator<<(std::ostream& os, const TruthParticle_v1* p) {
400  if (!p) { os << "Prt: Empty particle" << std::endl; return os;}
401  os << "Prt: id=";
402  os << p->id() << " pdg_id=";
403  os << p->pdg_id() << " (px,py,pz,e)=";
404  os << p->px() << ",";
405  os << p->py() << ",";
406  os << p->pz() << ",";
407  os << p->e() << ";(pt,eta,phi)=";
408  os << p->pt() << ",";
409  os << p->eta() << ",";
410  os << p->phi() << "; status=";
411  os << p->status();
412  /* os << std::endl; AV:Not clear if we need a new line here */
413  return os;
414  }
415 } // namespace xAOD
416 
417 #endif // XAODTRUTH_VERSIONS_TRUTHPARTICLE_V1_H
TruthParticleContainerFwd.h
isStrangeMeson
bool isStrangeMeson(const T &p)
Definition: AtlasPID.h:514
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
xAOD::TruthParticle_v1::setStatus
void setStatus(int value)
Set status code.
isBottomMeson
bool isBottomMeson(const T &p)
Definition: AtlasPID.h:516
TruthVertexContainerFwd.h
xAOD::TruthParticle_v1::absPdgId
int absPdgId() const
Absolute PDG ID code (often useful)
xAOD::TruthParticle_v1::Polarization::Polarization
Polarization()
Constructor to set (invalid) defaults.
Definition: TruthParticle_v1.h:371
test_pyathena.px
px
Definition: test_pyathena.py:18
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
isHeavyHadron
bool isHeavyHadron(const T &p)
Definition: AtlasPID.h:506
IParticle.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
isBottomBaryon
bool isBottomBaryon(const T &p)
Definition: AtlasPID.h:532
HepMC::polarization
Polarization polarization(const T &a)
Definition: Polarization.h:47
xAOD::TruthParticle_v1::production_vertex
const TruthVertex_v1 * production_vertex() const
The production vertex of this particle.
Definition: TruthParticle_v1.h:82
ObjectType
ObjectType
Definition: BaseObject.h:11
hasCharm
bool hasCharm(const T &p)
Definition: AtlasPID.h:501
isBSM
bool isBSM(const T &p)
Definition: AtlasPID.h:224
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
isGenSpecific
bool isGenSpecific(const T &p)
Definition: AtlasPID.h:228
xAOD::TruthParticle_v1::setBarcode
void setBarcode(int value)
Set barcode.
isMeson
bool isMeson(const T &p)
Definition: AtlasPID.h:219
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
threeCharge
double threeCharge(const T &p)
Definition: AtlasPID.h:544
xAOD::TruthParticle_v1::Polarization::valid
bool valid() const
Check if the stored values are valid.
Definition: TruthParticle_v1.h:375
isCharmMeson
bool isCharmMeson(const T &p)
Definition: AtlasPID.h:515
hasBottom
bool hasBottom(const T &p)
Definition: AtlasPID.h:502
isNeutrino
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
Definition: AtlasPID.h:161
test_pyathena.pt
pt
Definition: test_pyathena.py:11
isResonance
bool isResonance(const T &p)
Definition: AtlasPID.h:202
athena.value
value
Definition: athena.py:124
isParton
bool isParton(const T &p)
Definition: AtlasPID.h:611
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
isHeavyBaryon
bool isHeavyBaryon(const T &p)
Definition: AtlasPID.h:529
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
isLightBaryon
bool isLightBaryon(const T &p)
Definition: AtlasPID.h:528
xAOD::TruthParticle_v1::GenVecFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
Base 4 Momentum type for TruthParticle.
Definition: TruthParticle_v1.h:157
xAOD::TruthParticle_v1::pdg_id
int pdg_id() const
PDG ID code.
Definition: TruthParticle_v1.h:52
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
isBottomHadron
bool isBottomHadron(const T &p)
Definition: AtlasPID.h:509
MC::isGenStable
bool isGenStable(const T &p)
Determine if the particle is stable at the generator (not det-sim) level,.
Definition: HepMCHelpers.h:54
isLightMeson
bool isLightMeson(const T &p)
Definition: AtlasPID.h:512
isHiggs
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
Definition: AtlasPID.h:199
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:69
isQuark
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to dot...
Definition: AtlasPID.h:122
xAOD::operator<<
std::ostream & operator<<(std::ostream &os, const TruthParticle_v1 *p)
Definition: TruthParticle_v1.h:399
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
isLightHadron
bool isLightHadron(const T &p)
Definition: AtlasPID.h:505
ObjectType.h
xAOD::TruthParticle_v1::prodVtxLink
const ElementLink< TruthVertexContainer > & prodVtxLink() const
The production vertex link of this particle.
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::EgammaHelpers::isElectron
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Definition: EgammaxAODHelpers.cxx:12
isZ
bool isZ(const T &p)
Definition: AtlasPID.h:173
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
isCharmBaryon
bool isCharmBaryon(const T &p)
Definition: AtlasPID.h:531
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
test_pyathena.parent
parent
Definition: test_pyathena.py:15
isNeutral
bool isNeutral(const T &p)
Definition: AtlasPID.h:546
hasStrange
bool hasStrange(const T &p)
Definition: AtlasPID.h:500
xAOD::TruthParticle_v1::barcode
int barcode() const
Barcode.
xAODType
Definition: ObjectType.h:13
isChLepton
bool isChLepton(const T &p)
APID: the fourth generation leptons are leptons.
Definition: AtlasPID.h:148
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
xAOD::TruthParticle_v1::decayVtxLink
const ElementLink< TruthVertexContainer > & decayVtxLink() const
The decay vertex link of this particle.
isTau
bool isTau(const T &p)
Definition: AtlasPID.h:157
xAOD::TruthParticle_v1::Polarization::phi
float phi
Polarization in ( )
Definition: TruthParticle_v1.h:379
xAOD::TruthParticle_v1::decayVtx
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
Amg::py
@ py
Definition: GeoPrimitives.h:39
xAOD::TruthParticle_v1::setPdgId
void setPdgId(int pid)
Set PDG ID code.
isStrangeHadron
bool isStrangeHadron(const T &p)
Definition: AtlasPID.h:507
isHadron
bool isHadron(const T &p)
Definition: AtlasPID.h:218
charge
double charge(const T &p)
Definition: AtlasPID.h:538
isBaryon
bool isBaryon(const T &p)
Definition: AtlasPID.h:220
xAOD::TruthParticle_v1::PolParam
PolParam
Polarization parameter types.
Definition: TruthParticle_v1.h:317
xAOD::TruthParticle_v1::id
int id() const
Unique ID.
isW
bool isW(const T &p)
Definition: AtlasPID.h:176
xAOD::TruthParticle_v1::status
int status() const
Status code.
isCharged
bool isCharged(const T &p)
Definition: AtlasPID.h:545
isTop
bool isTop(const T &p)
Definition: AtlasPID.h:135
xAOD::TruthParticle_v1::end_vertex
const TruthVertex_v1 * end_vertex() const
The decay vertex of this particle.
Definition: TruthParticle_v1.h:95
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::EgammaHelpers::isPhoton
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
Definition: EgammaxAODHelpers.cxx:21
isLepton
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
Definition: AtlasPID.h:139
isCharmHadron
bool isCharmHadron(const T &p)
Definition: AtlasPID.h:508
xAOD::TruthParticle_v1::setDecayVtxLink
void setDecayVtxLink(const ElementLink< TruthVertexContainer > &link)
Set the decay vertex of the particle.
xAOD::TruthParticle_v1::setProdVtxLink
void setProdVtxLink(const ElementLink< TruthVertexContainer > &link)
Set the production vertex of the particle.
isHeavyMeson
bool isHeavyMeson(const T &p)
Definition: AtlasPID.h:513
isStrangeBaryon
bool isStrangeBaryon(const T &p)
Definition: AtlasPID.h:530
xAOD::TruthParticle_v1::Polarization
Single container for full polarization information.
Definition: TruthParticle_v1.h:367
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
ROOT
Definition: ViewVectorBaseStreamer.cxx:43
xAOD::TruthParticle_v1::Polarization::theta
float theta
Polarization in ( )
Definition: TruthParticle_v1.h:380
isMuon
bool isMuon(const T &p)
Definition: AtlasPID.h:154