ATLAS Offline Software
Loading...
Searching...
No Matches
AFPProton_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
13
14// xAOD include(s):
16
17// Local include(s):
19
20namespace xAOD {
21
23
24 double AFPProton_v1::pt() const {
25
26 return p4().Pt();
27 }
28
29 double AFPProton_v1::eta() const {
30
31 return p4().Eta();
32 }
33
34 double AFPProton_v1::phi() const {
35
36 return p4().Phi();
37 }
38
39 double AFPProton_v1::m() const {
40
41 return p4().M();
42 }
43
45
47
48 return p4().Rapidity();
49 }
50
52
54 p4.SetPxPyPzE( px(), py(), pz(), e() );
55
56 return p4;
57 }
58
59 Type::ObjectType AFPProton_v1::type() const {
60
61 return Type::Particle;
62 }
63
67
68 void AFPProton_v1::setPxPyPzE( float px, float py, float pz, float e ) {
69
70 setPx( px );
71 setPy( py );
72 setPz( pz );
73 setE( e );
74
75 return;
76 }
77
78 void AFPProton_v1::setPx( float value ) {
79
80 static const Accessor< float > acc( "px" );
81 acc( *this ) = value;
82 return;
83 }
84
85 void AFPProton_v1::setPy( float value ) {
86
87 static const Accessor< float > acc( "py" );
88 acc( *this ) = value;
89 return;
90 }
91
92 void AFPProton_v1::setPz( float value ) {
93
94 static const Accessor< float > acc( "pz" );
95 acc( *this ) = value;
96 return;
97 }
98
99 void AFPProton_v1::setE( float value ) {
100
101 static const Accessor< float > acc( "e" );
102 acc( *this ) = value;
103 return;
104 }
105
109 setMethodID )
110
112 std::vector< AFPProton_v1::AFPTrackLink_t >,
113 afpTrackLinks, setAFPTrackLinks )
114
116 static const
117 SG::AuxElement::Accessor< std::vector< AFPProton_v1::AFPTrackLink_t > >
118 tracksAcc( "afpTrackLinks" );
119
121
122 tracksAcc( *this ).push_back( newTrack );
123 return;
124 }
125
126 size_t AFPProton_v1::nTracks() const {
127
128 // Check if the links are available:
129 if( ! tracksAcc.isAvailable( *this ) ) {
130 return 0;
131 }
132
133 return tracksAcc( *this ).size();
134 }
135
136 const AFPTrack* AFPProton_v1::track( size_t index ) const {
137
138 // Check if the links are available:
139 if( ! tracksAcc.isAvailable( *this ) ) {
140 return nullptr;
141 }
142
143 // Use the at(...) function so the code would throw an exception if an
144 // impossible index is requested:
145 auto link = tracksAcc( *this ).at( index );
146
147 // Check if the link can be de-referenced:
148 if( ! link.isValid() ) {
149 return nullptr;
150 }
151
152 // Return the pointer:
153 return *link;
154 }
155
156} // namespace xAOD
Header file for AFPProton_v1 class representing a reconstructed proton measured in AFP detectors.
#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME)
Macro creating a getter function with a type conversion.
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
Class representing a proton reconstructed in AFP.
void setPxPyPzE(float px, float py, float pz, float e)
Set the 4-momentum.
virtual double pt() const
The transverse momentum ( ) of the particle.
float pz() const
Get the z-component of the momentum.
void setE(float e)
Set the energy.
AFPProton_v1()
Default constructor.
void setPz(float pz)
Set the z-component of the momentum.
virtual double phi() const
The azimuthal angle ( ) of the particle (has range to .)
const AFPTrack * track(size_t index) const
Get one of the tracks that was used to reconstruct the proton.
virtual double m() const
The invariant mass of the particle.
virtual double rapidity() const
The true rapidity (y) of the particle.
void addAFPTrackLink(const AFPTrackLink_t &newTrack)
Add a link to a tracks used to reconstruct the proton.
void setPx(float px)
Set the x-component of the momentum.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
float py() const
Get the y-component of the momentum.
virtual double eta() const
The pseudorapidity ( ) of the particle.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
virtual double e() const
The total energy of the particle.
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
void setPy(float py)
Set the y-component of the momentum.
float px() const
Get the x-component of the momentum.
ElementLink< AFPTrackContainer > AFPTrackLink_t
Type of the track links.
size_t nTracks() const
Get the number of tracks that were used to reconstruct the proton.
IParticle()=default
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
double chi2(TH1 *h0, TH1 *h1)
Forward declaration.
Definition index.py:1
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
static setAFPTrackLinks const SG::AuxElement::Accessor< std::vector< AFPProton_v1::AFPTrackLink_t > > tracksAcc("afpTrackLinks")
Helper variable.
AFPTrack_v2 AFPTrack
Definition AFPTrack.h:12
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1