ATLAS Offline Software
Loading...
Searching...
No Matches
Particle_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: Particle_v1.cxx 643631 2015-02-02 16:52:33Z kkoeneke $
6
7// EDM include(s):
9
10// Local include(s):
12
13
14namespace xAOD {
15
19
20
22 //
23 // Functions implementing four-momentum
24 //
25
26 double Particle_v1::pt() const {
27 return std::hypot( px(), py() );
28 }
29
30 double Particle_v1::eta() const {
31 return genvecP4().Eta();
32 }
33
34 double Particle_v1::phi() const {
35 return genvecP4().Phi();
36 }
37
38 double Particle_v1::m() const {
39 return genvecP4().M();
40 }
41
43
45 return genvecP4().Rapidity();
46 }
47
49 return FourMom_t( px(), py(), pz(), e() );
50 }
51
55
56 Type::ObjectType Particle_v1::type() const {
57 return Type::Particle;
58 }
59
60
64
65
67 return p4().Et();
68 }
69
70
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 }
81
82
84 double py,
85 double pz,
86 double e ) {
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 }
96
97
99 float, double,
100 px, setPx )
102 float, double,
103 py, setPy )
105 float, double,
106 pz, setPz )
108 float, double,
109 e, setE )
110
111 // End: Functions implementing four-momentum
113
114
116 //
117 // Functions implementing other particly-type properties
118 //
119
120 bool Particle_v1::hasCharge() const {
121 static const SG::AuxElement::Accessor< float > chargeAcc( "charge" );
122 return chargeAcc.isAvailable( *this );
123 }
124
126 charge, setCharge )
127
128
129 bool Particle_v1::hasPdgId() const {
130 static const SG::AuxElement::Accessor< int > pdgAcc( "pdgId" );
131 return pdgAcc.isAvailable( *this );
132 }
133
134 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( Particle_v1, int,
135 pdgId, setPdgId )
136
137
138 // End: Functions implementing other particly-type properties
140
141
142
144 return;
145 }
146
147
148} // namespace xAOD
#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME)
Macro creating a getter function with a type conversion.
#define AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME, SETTER)
Macro creating a setter function with a type conversion.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
std::vector< size_t > vec
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
IParticle()=default
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
Description of a generic particle.
Definition Particle_v1.h:31
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double rapidity() const
The true rapidity (y) of the particle.
virtual double eta() const
The pseudorapidity ( ) of the particle.
double py() const
Get the py momentum component of the particle.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
bool hasPdgId() const
Check if this particle has its charge set.
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
Base 4 Momentum type (GenVector)
Definition Particle_v1.h:65
bool hasCharge() const
Check if this particle has its charge set.
Particle_v1()
Default constructor.
virtual double m() const
The invariant mass of the particle.
void setPxPyPzE(double px, double py, double pz, double e)
Set the 4-vec.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
Definition Particle_v1.h:59
double px() const
Get the px momentum component of the particle.
void setP4(const FourMom_t &vec)
Set the 4-vec.
void toPersistent()
Function preparing the object to be persistified.
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
double pz() const
Get the pz momentum component of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
double et() const
The transverse energy ( ) of the particle.
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector form.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1, float, double, px, setPx) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1
static const SG::AuxElement::Accessor< int > pdgAcc("pdgId")
static const SG::AuxElement::Accessor< float > chargeAcc("charge")