ATLAS Offline Software
Loading...
Searching...
No Matches
Electron_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: Electron_v1$
6
7// EDM include(s):
10// Local include(s):
13
14#include <stdexcept>
15
16namespace xAOD {
17
20
22 this->makePrivateStore(el);
23 }
24
26
27 if (this != &el){ // protect against invalid self-assignment
28 this->Egamma_v1::operator=( el );
29 }
30 // by convention, always return *this
31 return *this;
32 }
33
35
37 return Type::Electron;
38 }
39
40 double Electron_v1::m() const {
42 }
43
45 //
46 // Implementation of the TrackParticle accessor functions
47 //
48
50
52 trackAcc( "trackParticleLinks" );
53
54 if( trackAcc.isAvailable( *this ) ) {
55 return trackAcc( *this ).size();
56 }
57 return 0;
58 }
59
61
62 if( index >= nTrackParticles() ) {
63 return nullptr;
64 }
65 const TPELVec_t& links = trackParticleLinks();
66 if( ! links[ index ].isValid() ) {
67 return nullptr;
68 }
69 return *( links[ index ] );
70 }
71
74
75 if( index >= nTrackParticles() ) {
77 return dummy;
78 }
79 return trackParticleLinks()[ index ];
80 }
81
83 trackParticleLinks, setTrackParticleLinks )
84
85 //
87
89 //Implementation of the summary value accessor functions
90
91 bool Electron_v1::trackCaloMatchValue( float& value, const EgammaParameters::TrackCaloMatchType information ) const {
92
94 if( !acc ) {
95 return false;
96 }
97 if(!acc->isAvailable( *this) ){
98 return false;
99 }
100 // Retrieve the value:
101 value = ( *acc )( *this );
102 return true;
103 }
104
107 if(!acc ) throw std::runtime_error( "Unknown/Unavailable Track to Calo Match type requested" );
108 return ( *acc )( *this );
109 }
110
111 bool Electron_v1::setTrackCaloMatchValue( const float value,
112 const EgammaParameters::TrackCaloMatchType information ) {
113
114 const xAOD::Electron_v1::Accessor< float >* acc = trackCaloMatchAccessorV1( information );
115 if( !acc ) return false;
116 // Set the value:
117 ( *acc )( *this ) = value;
118 return true;
119 }
120
122 const std::array<double, 4> &deltaEta,
123 const std::array<double, 4> &deltaPhi,
124 const std::array<double, 4> &deltaPhiRescaled,
125 const double deltaPhiLast
126 ) {
127 bool ret = true;
128 // It's tempting, but clang warns about chaining these together with &.
129 if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[0]), xAOD::EgammaParameters::deltaEta0)) ret = false;
130 if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[1]), xAOD::EgammaParameters::deltaEta1)) ret = false;
131 if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[2]), xAOD::EgammaParameters::deltaEta2)) ret = false;
132 if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[3]), xAOD::EgammaParameters::deltaEta3)) ret = false;
133 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[0]), xAOD::EgammaParameters::deltaPhi0)) ret = false;
134 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[1]), xAOD::EgammaParameters::deltaPhi1)) ret = false;
135 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[2]), xAOD::EgammaParameters::deltaPhi2)) ret = false;
136 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[3]), xAOD::EgammaParameters::deltaPhi3)) ret = false;
137 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[0]), xAOD::EgammaParameters::deltaPhiRescaled0)) ret = false;
138 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[1]), xAOD::EgammaParameters::deltaPhiRescaled1)) ret = false;
139 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[2]), xAOD::EgammaParameters::deltaPhiRescaled2)) ret = false;
140 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[3]), xAOD::EgammaParameters::deltaPhiRescaled3)) ret = false;
141 if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiLast), xAOD::EgammaParameters::deltaPhiFromLastMeasurement)) ret = false;
142 return ret;
143 }
144
145 bool Electron_v1::trackParticleSummaryValue( uint8_t& value, const SummaryType information, int index ) const {
146
147 const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
148 if (!tempTrackParticle) return false;
149 return tempTrackParticle->summaryValue(value,information);
150 }
151
152 bool Electron_v1::trackParticleSummaryValue( float& value, const SummaryType information, int index ) const {
153
154 const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
155 if (!tempTrackParticle) return false;
156 return tempTrackParticle->summaryValue(value,information);
157 }
158
160 const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
161 if (!tempTrackParticle) {
162 throw std::runtime_error( "TrackParticle not available" );
163 }
164 uint8_t value=0;
165 if(!tempTrackParticle->summaryValue(value,information)){
166 throw std::runtime_error( "Unknown/Unavailable Int Track Summary type requested" );
167 }
168 return value;
169 }
170
171 float Electron_v1::trackParticleSummaryFloatValue( const SummaryType information, int index) const {
172 const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
173 if (!tempTrackParticle) {
174 throw std::runtime_error( "TrackParticle not available" );
175 }
176 float value=0;
177 if(!tempTrackParticle->summaryValue(value,information)){
178 throw std::runtime_error( "Unknown/Unavailable Float Track Summary type requested" );
179 }
180 return value;
181 }
182
183
184
185} // namespace xAOD
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
ObjectType
Definition BaseObject.h:11
A number of constexpr particle constants to avoid hardcoding them directly in various places.
void makePrivateStore()
Create a new (empty) private store for this object.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
Egamma_v1()
Default constructor.
Definition Egamma_v1.cxx:48
Egamma_v1 & operator=(const Egamma_v1 &eg)
Assignment Operator. Using the assignment of SG::AuxElement.
Definition Egamma_v1.cxx:54
bool trackCaloMatchValue(float &value, const EgammaParameters::TrackCaloMatchType information) const
Accessor for Track to Calo Match Values.
std::vector< ElementLink< TrackParticleContainer > > TPELVec_t
Helper type definition.
float trackParticleSummaryFloatValue(const SummaryType information, int index=0) const
Electron_v1 & operator=(const Electron_v1 &el)
Assignment Operator. Ends up using the assignment of AuxElement for the store.
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
virtual Type::ObjectType type() const override final
The type of the object as a simple enumeration.
const TPELVec_t & trackParticleLinks() const
Get all the track particles.
bool trackParticleSummaryValue(uint8_t &value, const SummaryType information, int index=0) const
Accessor to the matching track(s) float information (index = 0 is the best match) If 'information' is...
size_t nTrackParticles() const
Return the number xAOD::TrackParticles that match the electron candidate.
bool setTrackCaloMatchValue(const float value, const EgammaParameters::TrackCaloMatchType information)
Set method for Track to Calo Match values.
const ElementLink< TrackParticleContainer > & trackParticleLink(size_t index=0) const
ElementLink to the xAOD::TrackParticle/s that match the electron candidate.
Electron_v1()
Default constructor. No store is attached.
uint8_t trackParticleSummaryIntValue(const SummaryType information, int index=0) const
Accessor to the matching track(s) int information (index = 0 is the best match) Will lead to an excep...
virtual double m() const override final
The invariant mass of the particle.
bool setTrackCaloMatchValues(const std::array< double, 4 > &deltaEta, const std::array< double, 4 > &deltaPhi, const std::array< double, 4 > &deltaPhiRescaled, const double deltaPhiLast)
Convinience wrapper for setTrackCaloMatchValue.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
constexpr double electronMassInMeV
the mass of the electron (in MeV)
Definition index.py:1
@ deltaPhiRescaled0
difference between the cluster phi (presampler) and the eta of the track extrapolated to the presampl...
@ deltaPhi3
difference between the cluster eta (3rd sampling) and the eta of the track extrapolated to the 3rd sa...
@ deltaPhiFromLastMeasurement
difference between the cluster phi (sampling 2) and the eta of the track extrapolated from the last m...
@ deltaPhiRescaled1
difference between the cluster eta (1st sampling) and the eta of the track extrapolated to the 1st sa...
@ deltaPhi1
difference between the cluster eta (1st sampling) and the eta of the track extrapolated to the 1st sa...
@ deltaPhiRescaled3
difference between the cluster eta (3rd sampling) and the eta of the track extrapolated to the 3rd sa...
@ deltaEta2
difference between the cluster eta (second sampling) and the eta of the track extrapolated to the sec...
@ deltaEta0
difference between the cluster eta (presampler) and the eta of the track extrapolated to the presampl...
@ deltaPhi0
difference between the cluster phi (presampler) and the eta of the track extrapolated to the presampl...
@ deltaEta3
difference between the cluster eta (3rd sampling) and the eta of the track extrapolated to the 3rd sa...
@ deltaPhiRescaled2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
@ deltaPhi2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
@ deltaEta1
difference between the cluster eta (first sampling) and the eta of the track extrapolated to the firs...
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setStrategy setMatchFlag ElementLink< TrackParticleContainer >
static const SG::AuxElement::Accessor< Vertex_v1::TrackParticleLinks_t > trackAcc("trackParticleLinks")
Accessor for the track links.
const SG::AuxElement::Accessor< float > * trackCaloMatchAccessorV1(xAOD::EgammaParameters::TrackCaloMatchType type)
Helper function for managing Egamma Accessor objects.
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
TrackParticle_v1 TrackParticle
Reference the current persistent version:
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
SummaryType
Enumerates the different types of information stored in Summary.