ATLAS Offline Software
ElectronxAODHelpers.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "xAODEgamma/Electron.h"
9 
10 // ==================================================================
12 
13  if(el){
14  const xAOD::TrackParticle* trkPar= el->trackParticle();
15  if(trkPar){
16  return getOriginalTrackParticleFromGSF(trkPar);
17  }
18  }
19  return nullptr;
20 }
21 // ==================================================================
23 
24  if(! trkPar) {return nullptr;}
25  static const SG::AuxElement::Accessor<ElementLink<xAOD::TrackParticleContainer> > orig ("originalTrackParticle");
26  if (!orig.isAvailable(*trkPar) || !orig(*trkPar).isValid()) {return nullptr;}
27 
28  return (*orig(*trkPar));
29 }
30 // ==================================================================
32  static const SG::AuxElement::Accessor<float > QoverPLM ("QoverPLM");
33  if(tp && QoverPLM.isAvailable(*tp)){
34  return QoverPLM(*tp);
35  }
36  return -999 ;
37 }
38 // ==================================================================
39 std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Electron* el,
40  bool useBremAssoc /* = true */,
41  bool allParticles /* = true */){
42  std::set<const xAOD::TrackParticle*> tps;
43  for (unsigned int i = 0; i < el->nTrackParticles(); ++i){
44  const xAOD::TrackParticle* tp = el->trackParticle(i);
46  if (tp) tps.insert( tp );
47  if (!allParticles) break; // break after first particle
48  }
49  return tps;
50 }
51 // ==================================================================
52 std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Electron* el,
53  bool useBremAssoc /* = true */,
54  bool allParticles /* = true */){
55 
56  std::vector<const xAOD::TrackParticle*> tps;
57  for (unsigned int i = 0; i < el->nTrackParticles(); ++i){
58  const xAOD::TrackParticle* tp = el->trackParticle(i);
60  if (tp) {tps.push_back( tp );}
61  if (!allParticles) {break;} // break after first particle
62  }
63  return tps;
64 }
65 // ==================================================================
67  if (!tp) return 0;
68  uint8_t dummy(0);
69  uint8_t nSiHits(0);
70  if (tp->summaryValue(dummy, xAOD::numberOfPixelHits)){
71  nSiHits += dummy;
72  }
73  if (tp->summaryValue(dummy, xAOD::numberOfSCTHits)){
74  nSiHits += dummy;
75  }
76  return nSiHits;
77 }
78 
79 
80 
81 
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::EgammaHelpers::getLastMeasurementQoverP
float getLastMeasurementQoverP(const xAOD::TrackParticle *tp)
return parameters for the last measurement for a GSF track particle
Definition: ElectronxAODHelpers.cxx:31
ElectronxAODHelpers.h
ParticleTest.tp
tp
Definition: ParticleTest.py:25
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::EgammaHelpers::getTrackParticles
std::set< const xAOD::TrackParticle * > getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc=true, bool allParticles=true)
Return a list of all or only the best TrackParticle associated to the object.
Definition: EgammaxAODHelpers.cxx:120
xAOD::EgammaHelpers::getTrackParticlesVec
std::vector< const xAOD::TrackParticle * > getTrackParticlesVec(const xAOD::Egamma *eg, bool useBremAssoc=true, bool allParticles=true)
Return a list of all or only the best TrackParticle associated to the object.
Definition: EgammaxAODHelpers.cxx:141
lumiFormat.i
int i
Definition: lumiFormat.py:85
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
python.xAODType.dummy
dummy
Definition: xAODType.py:4
xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF
const xAOD::TrackParticle * getOriginalTrackParticleFromGSF(const xAOD::TrackParticle *trkPar)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle...
Definition: ElectronxAODHelpers.cxx:22
xAOD::EgammaHelpers::numberOfSiHits
std::size_t numberOfSiHits(const xAOD::TrackParticle *tp)
return the number of Si hits in the track particle
Definition: ElectronxAODHelpers.cxx:66
xAOD::Electron_v1
Definition: Electron_v1.h:34
TrackParticle.h
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
xAOD::EgammaHelpers::getOriginalTrackParticle
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.
Definition: ElectronxAODHelpers.cxx:11
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Electron.h
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
TrackParticleContainer.h
IDTPM::nSiHits
float nSiHits(const U &p)
Definition: TrackParametersHelper.h:427