ATLAS Offline Software
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 
14 namespace xAOD {
15 
17  : IParticle() {
18  }
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 
44  double Particle_v1::rapidity() const {
45  return genvecP4().Rapidity();
46  }
47 
49  return FourMom_t( px(), py(), pz(), e() );
50  }
51 
53  return GenVecFourMom_t( px(), py(), pz(), e() );
54  }
55 
57  return Type::Particle;
58  }
59 
60 
64 
65 
66  double Particle_v1::et() const {
67  return p4().Et();
68  }
69 
70 
71  void Particle_v1::setP4( const FourMom_t& vec ) {
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
python.CaloBCIDAvgAlgConfig.acc3
def acc3
Definition: CaloBCIDAvgAlgConfig.py:69
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::Particle_v1::genvecP4
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector form.
Definition: Particle_v1.cxx:52
et
Extra patterns decribing particle interation process.
test_pyathena.px
px
Definition: test_pyathena.py:18
xAOD::Particle_v1::GenVecFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
Base 4 Momentum type (GenVector)
Definition: Particle_v1.h:65
xAOD::float
float
Definition: BTagging_v1.cxx:168
xAOD::Particle_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: Particle_v1.cxx:34
SG::Accessor< float >
AuxStoreAccessorMacros.h
xAOD::Particle_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: Particle_v1.cxx:48
xAOD::Particle_v1::m
virtual double m() const
The invariant mass of the particle.
Definition: Particle_v1.cxx:38
xAOD::Particle_v1::e
virtual double e() const
The total energy of the particle.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
xAOD::py
py
Definition: CompositeParticle_v1.cxx:160
xAOD::Particle
Particle_v1 Particle
Define the latest version of the particle class.
Definition: Event/xAOD/xAODParticleEvent/xAODParticleEvent/Particle.h:17
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:69
xAOD::Particle_v1::toPersistent
void toPersistent()
Function preparing the object to be persistified.
xAOD::Particle_v1::setP4
void setP4(const FourMom_t &vec)
Set the 4-vec.
Definition: Particle_v1.cxx:71
xAOD::AUXSTORE_PRIMITIVE_SETTER_WITH_CAST
AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1, float, double, px, setPx) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CompositeParticle_v1
xAOD::e
setPy e
Definition: CompositeParticle_v1.cxx:166
Particle_v1.h
python.CaloBCIDAvgAlgConfig.acc1
def acc1
Definition: CaloBCIDAvgAlgConfig.py:49
xAOD::Particle_v1::setPxPyPzE
void setPxPyPzE(double px, double py, double pz, double e)
Set the 4-vec.
Definition: Particle_v1.cxx:83
xAOD::AUXSTORE_PRIMITIVE_GETTER_WITH_CAST
AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(Muon_v1, uint8_t, Muon_v1::EnergyLossType, energyLossType) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(Muon_v1
xAOD::charge
charge
Definition: TrigElectron_v1.cxx:85
xAOD::Particle_v1::pz
double pz() const
Get the pz momentum component of the particle.
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
python.CaloBCIDAvgAlgConfig.acc2
def acc2
Definition: CaloBCIDAvgAlgConfig.py:59
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
python.LArRecUtilsConfig.acc4
def acc4
Definition: LArRecUtilsConfig.py:196
xAOD::Particle_v1
Description of a generic particle.
Definition: Particle_v1.h:31
xAOD::Particle_v1::py
double py() const
Get the py momentum component of the particle.
xAOD::Particle_v1::FourMom_t
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
Definition: Particle_v1.h:59
xAOD::Particle_v1::Particle_v1
Particle_v1()
Default constructor.
Definition: Particle_v1.cxx:16
xAOD::Particle_v1::hasPdgId
bool hasPdgId() const
Check if this particle has its charge set.
xAOD::Particle_v1::type
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
Definition: Particle_v1.cxx:56
xAOD::Particle_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: Particle_v1.cxx:30
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition: ObjectType.h:32
xAOD::Particle_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Particle_v1.cxx:26
xAOD::Particle_v1::px
double px() const
Get the px momentum component of the particle.