ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::Particle_v1 Class Reference

Description of a generic particle. More...

#include <Particle_v1.h>

Inheritance diagram for xAOD::Particle_v1:
Collaboration diagram for xAOD::Particle_v1:

Public Member Functions

 Particle_v1 ()
 Default constructor.
void toPersistent ()
 Function preparing the object to be persistified.
Functions implementing additional 4-momentum properties
double px () const
 Get the px momentum component of the particle.
double py () const
 Get the py momentum component of the particle.
double pz () const
 Get the pz momentum component of the particle.
double et () const
 The transverse energy ( \(e_T\)) of the particle.
void setP4 (const FourMom_t &vec)
 Set the 4-vec.
void setPxPyPzE (double px, double py, double pz, double e)
 Set the 4-vec.
void setPx (double px)
 Set the x-component of the momentum.
void setPy (double py)
 Set the y-component of the momentum.
void setPz (double pz)
 Set the z-component of the momentum.
void setE (double e)
 Set the energy.
Functions implementing other particly-type properties
bool hasCharge () const
 Check if this particle has its charge set.
float charge () const
 Return the electric charge.
void setCharge (float charge)
 Set the electric charge.
bool hasPdgId () const
 Check if this particle has its charge set.
int pdgId () const
 Return the PDG identifier.
void setPdgId (int pdgID)
 Set the PDG identifier.
Functions for getting and setting user properties
template<class T>
XAOD_AUXDATA_DEPRECATED T & auxdata (const std::string &name, const std::string &clsname="")
 Fetch an aux data variable, as a non-const reference.
template<class T>
XAOD_AUXDATA_DEPRECATED const T & auxdata (const std::string &name, const std::string &clsname="") const
 Fetch an aux data variable, as a const reference.
template<class T>
XAOD_AUXDATA_DEPRECATED bool isAvailable (const std::string &name, const std::string &clsname="") const
 Check if a user property is available for reading or not.
template<class T>
XAOD_AUXDATA_DEPRECATED bool isAvailableWritable (const std::string &name, const std::string &clsname="") const
 Check if a user property is available for writing or not.

Functions implementing the xAOD::IParticle interface

Copy constructor

typedef IParticle::FourMom_t FourMom_t
 Definition of the 4-momentum type.
typedef ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
 Base 4 Momentum type (GenVector).
virtual double pt () const
 The transverse momentum ( \(p_T\)) of the particle.
virtual double eta () const
 The pseudorapidity ( \(\eta\)) of the particle.
virtual double phi () const
 The azimuthal angle ( \(\phi\)) of the particle.
virtual double m () const
 The invariant mass of the particle.
virtual double e () const
 The total energy of the particle.
virtual double rapidity () const
 The true rapidity (y) of the particle.
virtual FourMom_t p4 () const
 The full 4-momentum of the particle.
GenVecFourMom_t genvecP4 () const
 The full 4-momentum of the particle : GenVector form.
virtual Type::ObjectType type () const
 The type of the object as a simple enumeration.

Detailed Description

Description of a generic particle.

Author
Karsten Koeneke karst.nosp@m.en.k.nosp@m.oenek.nosp@m.e@ce.nosp@m.rn.ch
Revision
637086
Date
2014-12-19 17:02:19 +0100 (Fri, 19 Dec 2014)

Definition at line 31 of file Particle_v1.h.

Member Typedef Documentation

◆ FourMom_t

Definition of the 4-momentum type.

Definition at line 59 of file Particle_v1.h.

◆ GenVecFourMom_t

typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > xAOD::Particle_v1::GenVecFourMom_t

Base 4 Momentum type (GenVector).

Definition at line 65 of file Particle_v1.h.

Constructor & Destructor Documentation

◆ Particle_v1()

xAOD::Particle_v1::Particle_v1 ( )

Default constructor.

Definition at line 16 of file Particle_v1.cxx.

17 : IParticle() {
18 }
IParticle()=default

Member Function Documentation

◆ auxdata() [1/2]

template<class T>
XAOD_AUXDATA_DEPRECATED T & xAOD::IParticle::auxdata ( const std::string & name,
const std::string & clsname = "" )
inlineinherited

Fetch an aux data variable, as a non-const reference.

This function provides an easy way for users to decorate objects with auxiliary data.

Take note that this function is slow. Should not be used inside time-critical code.

Parameters
nameName of the aux variable
clsnameThe name of the associated class. May be blank
Returns
A modifiable reference to the decoration

Definition at line 98 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

99 {
100
101 return SG::Accessor< T >(name, clsname)(*this);
102 }
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573

◆ auxdata() [2/2]

template<class T>
XAOD_AUXDATA_DEPRECATED const T & xAOD::IParticle::auxdata ( const std::string & name,
const std::string & clsname = "" ) const
inlineinherited

Fetch an aux data variable, as a const reference.

This function provides an easy way for users to retrieve auxiliary decorations from an object.

Take note that this function is slow. Should not be used inside time-critical code.

Parameters
nameName of the aux variable
clsnameThe name of the associated class. May be blank
Returns
A constant reference to the decoration

Definition at line 118 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

119 {
120
121 return SG::ConstAccessor< T >( name, clsname )( *this );
122 }
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570

◆ charge()

float xAOD::Particle_v1::charge ( ) const

Return the electric charge.

◆ e()

virtual double xAOD::Particle_v1::e ( ) const
virtual

The total energy of the particle.

Implements xAOD::IParticle.

◆ et()

double xAOD::Particle_v1::et ( ) const

The transverse energy ( \(e_T\)) of the particle.

Note that this differs from ( \(p_T\)) for massive particles.

Definition at line 66 of file Particle_v1.cxx.

66 {
67 return p4().Et();
68 }
virtual FourMom_t p4() const
The full 4-momentum of the particle.

◆ eta()

double xAOD::Particle_v1::eta ( ) const
virtual

The pseudorapidity ( \(\eta\)) of the particle.

Implements xAOD::IParticle.

Definition at line 30 of file Particle_v1.cxx.

30 {
31 return genvecP4().Eta();
32 }
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector form.

◆ genvecP4()

Particle_v1::GenVecFourMom_t xAOD::Particle_v1::genvecP4 ( ) const

The full 4-momentum of the particle : GenVector form.

Definition at line 52 of file Particle_v1.cxx.

52 {
53 return GenVecFourMom_t( px(), py(), pz(), e() );
54 }
virtual double e() const
The total energy of the particle.
double py() const
Get the py momentum component of the particle.
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
Base 4 Momentum type (GenVector).
Definition Particle_v1.h:65
double px() const
Get the px momentum component of the particle.
double pz() const
Get the pz momentum component of the particle.

◆ hasCharge()

setPy setE bool xAOD::Particle_v1::hasCharge ( ) const

Check if this particle has its charge set.

Definition at line 120 of file Particle_v1.cxx.

120 {
121 static const SG::AuxElement::Accessor< float > chargeAcc( "charge" );
122 return chargeAcc.isAvailable( *this );
123 }
static const SG::AuxElement::Accessor< float > chargeAcc("charge")

◆ hasPdgId()

bool xAOD::Particle_v1::hasPdgId ( ) const

Check if this particle has its charge set.

◆ isAvailable()

template<class T>
XAOD_AUXDATA_DEPRECATED bool xAOD::IParticle::isAvailable ( const std::string & name,
const std::string & clsname = "" ) const
inlineinherited

Check if a user property is available for reading or not.

This function should be used to check if a user property which may or may not exist, is set on the object.

Parameters
nameName of the auxiliary variable
clsnameThe name of the associated class. May be blank
Returns
Whether the decoration exists or not

Definition at line 135 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

136 {
137
138 return SG::ConstAccessor< T >(name, clsname).isAvailable(*this);
139 }
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.

◆ isAvailableWritable()

template<class T>
XAOD_AUXDATA_DEPRECATED bool xAOD::IParticle::isAvailableWritable ( const std::string & name,
const std::string & clsname = "" ) const
inlineinherited

Check if a user property is available for writing or not.

This function can be used to check whether it will be possible to set a user property on the object.

Parameters
nameName of the auxiliary variable
clsnameThe name of the associated class. May be blank
Returns
Whether the decoration is possible to set

Definition at line 152 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

153 {
154
155 return SG::Accessor< T >(name, clsname).isAvailableWritable(*this);
156 }
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.

◆ m()

double xAOD::Particle_v1::m ( ) const
virtual

The invariant mass of the particle.

Implements xAOD::IParticle.

Definition at line 38 of file Particle_v1.cxx.

38 {
39 return genvecP4().M();
40 }

◆ p4()

Particle_v1::FourMom_t xAOD::Particle_v1::p4 ( ) const
virtual

The full 4-momentum of the particle.

Implements xAOD::IParticle.

Definition at line 48 of file Particle_v1.cxx.

48 {
49 return FourMom_t( px(), py(), pz(), e() );
50 }
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
Definition Particle_v1.h:59

◆ pdgId()

int xAOD::Particle_v1::pdgId ( ) const

Return the PDG identifier.

◆ phi()

double xAOD::Particle_v1::phi ( ) const
virtual

The azimuthal angle ( \(\phi\)) of the particle.

Implements xAOD::IParticle.

Definition at line 34 of file Particle_v1.cxx.

34 {
35 return genvecP4().Phi();
36 }

◆ pt()

double xAOD::Particle_v1::pt ( ) const
virtual

The transverse momentum ( \(p_T\)) of the particle.

Implements xAOD::IParticle.

Definition at line 26 of file Particle_v1.cxx.

26 {
27 return std::hypot( px(), py() );
28 }

◆ px()

double xAOD::Particle_v1::px ( ) const

Get the px momentum component of the particle.

◆ py()

double xAOD::Particle_v1::py ( ) const

Get the py momentum component of the particle.

◆ pz()

double xAOD::Particle_v1::pz ( ) const

Get the pz momentum component of the particle.

◆ rapidity()

double xAOD::Particle_v1::rapidity ( ) const
virtual

The true rapidity (y) of the particle.

Implements xAOD::IParticle.

Definition at line 44 of file Particle_v1.cxx.

44 {
45 return genvecP4().Rapidity();
46 }

◆ setCharge()

void xAOD::Particle_v1::setCharge ( float charge)

Set the electric charge.

◆ setE()

void xAOD::Particle_v1::setE ( double e)

Set the energy.

◆ setP4()

void xAOD::Particle_v1::setP4 ( const FourMom_t & vec)

Set the 4-vec.

Definition at line 71 of file Particle_v1.cxx.

71 {
72 static const Accessor< float > acc1( "px" );
73 acc1( *this ) = (float)(vec.Px());
74 static const Accessor< float > acc2( "py" );
75 acc2( *this ) = (float)(vec.Py());
76 static const Accessor< float > acc3( "pz" );
77 acc3( *this ) = (float)(vec.Pz());
78 static const Accessor< float > acc4( "e" );
79 acc4( *this ) = (float)(vec.E());
80 }
std::vector< size_t > vec

◆ setPdgId()

void xAOD::Particle_v1::setPdgId ( int pdgID)

Set the PDG identifier.

◆ setPx()

void xAOD::Particle_v1::setPx ( double px)

Set the x-component of the momentum.

◆ setPxPyPzE()

void xAOD::Particle_v1::setPxPyPzE ( double px,
double py,
double pz,
double e )

Set the 4-vec.

Definition at line 83 of file Particle_v1.cxx.

86 {
87 static const Accessor< float > acc1( "px" );
88 acc1( *this ) = (float)px;
89 static const Accessor< float > acc2( "py" );
90 acc2( *this ) = (float)py;
91 static const Accessor< float > acc3( "pz" );
92 acc3( *this ) = (float)pz;
93 static const Accessor< float > acc4( "e" );
94 acc4( *this ) = (float)e;
95 }

◆ setPy()

void xAOD::Particle_v1::setPy ( double py)

Set the y-component of the momentum.

◆ setPz()

void xAOD::Particle_v1::setPz ( double pz)

Set the z-component of the momentum.

◆ toPersistent()

void xAOD::Particle_v1::toPersistent ( )

Function preparing the object to be persistified.

◆ type()

Type::ObjectType xAOD::Particle_v1::type ( ) const
virtual

The type of the object as a simple enumeration.

Implements xAOD::IParticle.

Definition at line 56 of file Particle_v1.cxx.

56 {
57 return Type::Particle;
58 }

The documentation for this class was generated from the following files: