ATLAS Offline Software
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):
9 // Local include(s):
11 #include "ElectronAccessors_v1.h"
12 
13 #include <stdexcept>
14 
15 namespace xAOD {
16 
18  }
19 
21  this->makePrivateStore(el);
22  }
23 
25 
26  if (this != &el){ // protect against invalid self-assignment
27  this->Egamma_v1::operator=( el );
28  }
29  // by convention, always return *this
30  return *this;
31  }
32 
34 
36  return Type::Electron;
37  }
38 
40  //
41  // Implementation of the TrackParticle accessor functions
42  //
43 
45 
47  trackAcc( "trackParticleLinks" );
48 
49  if( trackAcc.isAvailable( *this ) ) {
50  return trackAcc( *this ).size();
51  }
52  return 0;
53  }
54 
56 
57  if( index >= nTrackParticles() ) {
58  return nullptr;
59  }
61  if( ! links[ index ].isValid() ) {
62  return nullptr;
63  }
64  return *( links[ index ] );
65  }
66 
69 
70  if( index >= nTrackParticles() ) {
72  return dummy;
73  }
74  return trackParticleLinks()[ index ];
75  }
76 
78  trackParticleLinks, setTrackParticleLinks )
79 
80  //
82 
84  //Implementation of the summary value accessor functions
85 
86  bool Electron_v1::trackCaloMatchValue( float& value, const EgammaParameters::TrackCaloMatchType information ) const {
87 
89  if( !acc ) {
90  return false;
91  }
92  if(!acc->isAvailable( *this) ){
93  return false;
94  }
95  // Retrieve the value:
96  value = ( *acc )( *this );
97  return true;
98  }
99 
102  if(!acc ) throw std::runtime_error( "Unknown/Unavailable Track to Calo Match type requested" );
103  return ( *acc )( *this );
104  }
105 
106  bool Electron_v1::setTrackCaloMatchValue( const float value,
107  const EgammaParameters::TrackCaloMatchType information ) {
108 
110  if( !acc ) return false;
111  // Set the value:
112  ( *acc )( *this ) = value;
113  return true;
114  }
115 
117  const std::array<double, 4> &deltaEta,
118  const std::array<double, 4> &deltaPhi,
119  const std::array<double, 4> &deltaPhiRescaled,
120  const double deltaPhiLast
121  ) {
122  bool ret = true;
123  // It's tempting, but clang warns about chaining these together with &.
124  if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[0]), xAOD::EgammaParameters::deltaEta0)) ret = false;
125  if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[1]), xAOD::EgammaParameters::deltaEta1)) ret = false;
126  if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[2]), xAOD::EgammaParameters::deltaEta2)) ret = false;
127  if (!setTrackCaloMatchValue(static_cast<float> (deltaEta[3]), xAOD::EgammaParameters::deltaEta3)) ret = false;
128  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[0]), xAOD::EgammaParameters::deltaPhi0)) ret = false;
129  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[1]), xAOD::EgammaParameters::deltaPhi1)) ret = false;
130  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[2]), xAOD::EgammaParameters::deltaPhi2)) ret = false;
131  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhi[3]), xAOD::EgammaParameters::deltaPhi3)) ret = false;
132  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[0]), xAOD::EgammaParameters::deltaPhiRescaled0)) ret = false;
133  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[1]), xAOD::EgammaParameters::deltaPhiRescaled1)) ret = false;
134  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[2]), xAOD::EgammaParameters::deltaPhiRescaled2)) ret = false;
135  if (!setTrackCaloMatchValue(static_cast<float> (deltaPhiRescaled[3]), xAOD::EgammaParameters::deltaPhiRescaled3)) ret = false;
137  return ret;
138  }
139 
140  bool Electron_v1::trackParticleSummaryValue( uint8_t& value, const SummaryType information, int index ) const {
141 
142  const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
143  if (!tempTrackParticle) return false;
144  return tempTrackParticle->summaryValue(value,information);
145  }
146 
147  bool Electron_v1::trackParticleSummaryValue( float& value, const SummaryType information, int index ) const {
148 
149  const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
150  if (!tempTrackParticle) return false;
151  return tempTrackParticle->summaryValue(value,information);
152  }
153 
155  const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
156  if (!tempTrackParticle) {
157  throw std::runtime_error( "TrackParticle not available" );
158  }
159  uint8_t value=0;
160  if(!tempTrackParticle->summaryValue(value,information)){
161  throw std::runtime_error( "Unknown/Unavailable Int Track Summary type requested" );
162  }
163  return value;
164  }
165 
166  float Electron_v1::trackParticleSummaryFloatValue( const SummaryType information, int index) const {
167  const xAOD::TrackParticle* tempTrackParticle = trackParticle(index);
168  if (!tempTrackParticle) {
169  throw std::runtime_error( "TrackParticle not available" );
170  }
171  float value=0;
172  if(!tempTrackParticle->summaryValue(value,information)){
173  throw std::runtime_error( "Unknown/Unavailable Float Track Summary type requested" );
174  }
175  return value;
176  }
178 
179 
180 } // namespace xAOD
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
egammaParameters::deltaPhiRescaled
@ deltaPhiRescaled
difference between the cluster phi (sampling 2) and the phi of the track extrapolated from the perige...
Definition: egammaParamDefs.h:595
ElectronAccessors_v1.h
xAOD::EgammaParameters::deltaPhi0
@ deltaPhi0
difference between the cluster phi (presampler) and the eta of the track extrapolated to the presampl...
Definition: EgammaEnums.h:193
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
xAOD::EgammaParameters::deltaPhi3
@ deltaPhi3
difference between the cluster eta (3rd sampling) and the eta of the track extrapolated to the 3rd sa...
Definition: EgammaEnums.h:207
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
ObjectType
ObjectType
Definition: BaseObject.h:11
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
AuxStoreAccessorMacros.h
index
Definition: index.py:1
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
xAOD::TrackParticle_v1::summaryValue
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
Definition: TrackParticle_v1.cxx:736
xAOD::Electron_v1::Electron_v1
Electron_v1()
Default constructor. No store is attached.
Definition: Electron_v1.cxx:17
xAOD::EgammaParameters::deltaEta0
@ deltaEta0
difference between the cluster eta (presampler) and the eta of the track extrapolated to the presampl...
Definition: EgammaEnums.h:176
xAOD::Electron_v1::trackParticleSummaryFloatValue
float trackParticleSummaryFloatValue(const SummaryType information, int index=0) const
Definition: Electron_v1.cxx:166
xAOD::EgammaParameters::deltaEta2
@ deltaEta2
difference between the cluster eta (second sampling) and the eta of the track extrapolated to the sec...
Definition: EgammaEnums.h:187
athena.value
value
Definition: athena.py:124
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::Electron_v1::trackParticle
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
Definition: Electron_v1.cxx:55
xAOD::EgammaParameters::deltaPhiRescaled3
@ deltaPhiRescaled3
difference between the cluster eta (3rd sampling) and the eta of the track extrapolated to the 3rd sa...
Definition: EgammaEnums.h:230
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:225
xAOD::Electron_v1::TPELVec_t
std::vector< ElementLink< TrackParticleContainer > > TPELVec_t
Helper type definition.
Definition: Electron_v1.h:93
xAOD::Electron_v1::trackCaloMatchValue
bool trackCaloMatchValue(float &value, const EgammaParameters::TrackCaloMatchType information) const
Accessor for Track to Calo Match Values.
xAOD::Electron_v1::nTrackParticles
size_t nTrackParticles() const
Return the number xAOD::TrackParticles that match the electron candidate.
Definition: Electron_v1.cxx:44
xAOD::Electron_v1::trackParticleLink
const ElementLink< TrackParticleContainer > & trackParticleLink(size_t index=0) const
ElementLink to the xAOD::TrackParticle/s that match the electron candidate.
Definition: Electron_v1.cxx:68
xAOD::EgammaParameters::deltaPhi1
@ deltaPhi1
difference between the cluster eta (1st sampling) and the eta of the track extrapolated to the 1st sa...
Definition: EgammaEnums.h:196
SG::IAuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::EgammaParameters::deltaPhiFromLastMeasurement
@ deltaPhiFromLastMeasurement
difference between the cluster phi (sampling 2) and the eta of the track extrapolated from the last m...
Definition: EgammaEnums.h:210
xAOD::SummaryType
SummaryType
Enumerates the different types of information stored in Summary.
Definition: TrackingPrimitives.h:228
xAOD::EgammaParameters::TrackCaloMatchType
TrackCaloMatchType
Definition: EgammaEnums.h:173
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:66
xAOD::Egamma_v1::operator=
Egamma_v1 & operator=(const Egamma_v1 &eg)
Assignment Operator. Using the assignment of SG::AuxElement.
Definition: Egamma_v1.cxx:53
DMTest::links
links
Definition: CLinks_v1.cxx:22
xAOD::charge
charge
Definition: TrigElectron_v1.cxx:85
xAOD::EgammaParameters::deltaEta3
@ deltaEta3
difference between the cluster eta (3rd sampling) and the eta of the track extrapolated to the 3rd sa...
Definition: EgammaEnums.h:190
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
xAOD::trackCaloMatchAccessorV1
const SG::AuxElement::Accessor< float > * trackCaloMatchAccessorV1(xAOD::EgammaParameters::TrackCaloMatchType type)
Helper function for managing Egamma Accessor objects.
Definition: ElectronAccessors_v1.cxx:25
xAOD::TauHelpers::trackParticleLinks
std::vector< ElementLink< xAOD::TrackParticleContainer > > trackParticleLinks(const xAOD::TauJet *tau, xAOD::TauJetParameters::TauTrackFlag flag=xAOD::TauJetParameters::TauTrackFlag::classifiedCharged)
Definition: TauxAODHelpers.cxx:22
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
python.xAODType.dummy
dummy
Definition: xAODType.py:4
xAOD::EgammaParameters::deltaPhiRescaled2
@ deltaPhiRescaled2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition: EgammaEnums.h:225
xAOD::EgammaParameters::deltaPhiRescaled0
@ deltaPhiRescaled0
difference between the cluster phi (presampler) and the eta of the track extrapolated to the presampl...
Definition: EgammaEnums.h:215
xAODType
Definition: ObjectType.h:13
xAOD::Electron_v1::operator=
Electron_v1 & operator=(const Electron_v1 &el)
Assignment Operator. Ends up using the assignment of AuxElement for the store.
Definition: Electron_v1.cxx:24
egammaParameters::deltaPhiLast
@ deltaPhiLast
deltaPhi from the las point
Definition: egammaParamDefs.h:724
Electron_v1.h
xAOD::EgammaParameters::deltaPhi2
@ deltaPhi2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition: EgammaEnums.h:204
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
xAOD::Electron_v1::trackParticleSummaryIntValue
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...
Definition: Electron_v1.cxx:154
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAOD::EgammaParameters::deltaPhiRescaled1
@ deltaPhiRescaled1
difference between the cluster eta (1st sampling) and the eta of the track extrapolated to the 1st sa...
Definition: EgammaEnums.h:220
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::Electron_v1::trackParticleSummaryValue
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...
Definition: Electron_v1.cxx:140
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::Electron_v1::setTrackCaloMatchValues
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.
Definition: Electron_v1.cxx:116
xAOD::EgammaParameters::deltaEta1
@ deltaEta1
difference between the cluster eta (first sampling) and the eta of the track extrapolated to the firs...
Definition: EgammaEnums.h:184
xAOD::Electron_v1::trackParticleLinks
const TPELVec_t & trackParticleLinks() const
Get all the track particles.
xAOD::Electron_v1::setTrackCaloMatchValue
bool setTrackCaloMatchValue(const float value, const EgammaParameters::TrackCaloMatchType information)
Set method for Track to Calo Match values.
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27