Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
xAOD::EgammaHelpers Namespace Reference

Functions

const xAOD::ElectrongetRecoElectron (const xAOD::TruthParticle *)
 return the reco electron associated to the given TruthParticle (if any) More...
 
const xAOD::PhotongetRecoPhoton (const xAOD::TruthParticle *particle)
 return the reco photon associated to the given TruthParticle (if any) More...
 
bool isTrueConvertedPhoton (const xAOD::Photon *ph, float maxRadius=800.)
 is the object matched to a true converted photon with R < maxRadius More...
 
bool isTrueConvertedPhoton (const xAOD::TruthParticle *truePh, float maxRadius=800.)
 is the true object a converted photon with R < maxRadius More...
 
std::vector< const xAOD::TruthParticle * > getBkgElectronLineage (const xAOD::TruthParticle *truthel, const bool allTheWayBack=true)
 Helper function for getting the truth lineage of an electron that is arising from material interactions in simulation (so called Bkg Electron) There are cases when an electron has a photon (or electron) mother, that in turn comes from another electron of photon. More...
 
const xAOD::TruthParticlegetBkgElectronMother (const xAOD::Electron *el, const bool allTheWayBack=true)
 Helper wrapper function for calling the function above extracting the truth from a reco electron. More...
 
const xAOD::TruthParticlegetBkgElectronMother (const xAOD::TruthParticle *truthel, const bool allTheWayBack=true)
 Helper function for getting the "Mother" electron for an existing electron. More...
 
std::vector< const xAOD::TruthParticle * > getBkgElectronLineage (const xAOD::Electron *el, const bool allTheWayBack=true)
 Helper wrapper function for calling the function below that accepts truth input. More...
 
bool isElectron (const xAOD::Egamma *eg)
 is the object an electron (not Fwd) More...
 
bool isFwdElectron (const xAOD::Egamma *eg)
 is the object a Fwd electron More...
 
bool isPhoton (const xAOD::Egamma *eg)
 is the object a photon More...
 
bool isConvertedPhoton (const xAOD::Egamma *eg, bool excludeTRT=false)
 is the object a converted photon More...
 
bool isBarrel (const xAOD::Egamma *eg)
 return true if the cluster is in the barrel More...
 
bool isBarrel (const xAOD::CaloCluster *cluster)
 return true if the cluster (or the majority of its energy) is in the barrel More...
 
bool isFCAL (const xAOD::CaloCluster *cluster)
 return true if the cluster (or the majority of its energy) is in the FCAL0 More...
 
std::vector< ElementLink< xAOD::CaloClusterContainer > > getAssociatedTopoClustersLinks (const xAOD::CaloCluster *cluster)
 Return a vector of all the elementlinks to the topo clusters associated with the egamma cluster. More...
 
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters (const xAOD::CaloCluster *cluster)
 Return a vector of all the topo clusters associated with the egamma cluster. More...
 
std::vector< ElementLink< xAOD::FlowElementContainer > > getAssociatedFlowElementsLinks (const xAOD::Egamma *eg, bool neutral=true)
 Return a vector of the elementlinks to the flow elements associated with the egamma cluster (neutral for default) More...
 
std::vector< const xAOD::FlowElement * > getAssociatedFlowElements (const xAOD::Egamma *eg, bool neutral=true, bool charged=false)
 Return a vector of the flow elements associated with the egamma cluster (only neutral for default) More...
 
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. More...
 
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. More...
 
int summaryValueInt (const xAOD::TrackParticle &tp, const xAOD::SummaryType &info, int deflt=-999)
 return the summary value for a TrackParticle or default value (-999) (to be used mostly in python where uint8_t is converted to char and the Tracking does not provide unprotected methods) More...
 
float summaryValueFloat (const xAOD::TrackParticle &tp, const xAOD::SummaryType &info, float deflt=-999.)
 return the summary value for a TrackParticle or default value (-999) More...
 
unsigned short energyInMissingCells (const xAOD::Egamma &eg, double &e2, double &e3)
 Get the energies in sampling 2 and 3 that are in cells rejected by the topo-cluster timing cut but that would have been expected in a egamma cluster. More...
 
const xAOD::TrackParticlegetOriginalTrackParticle (const xAOD::Electron *el)
 Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron. More...
 
const xAOD::TrackParticlegetOriginalTrackParticleFromGSF (const xAOD::TrackParticle *trkPar)
 Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle. More...
 
float getLastMeasurementQoverP (const xAOD::TrackParticle *tp)
 return parameters for the last measurement for a GSF track particle More...
 
std::set< const xAOD::TrackParticle * > getTrackParticles (const xAOD::Electron *el, bool useBremAssoc=true, bool allParticles=true)
 Return a list of all or only the best TrackParticle associated to the object. More...
 
std::vector< const xAOD::TrackParticle * > getTrackParticlesVec (const xAOD::Electron *el, bool useBremAssoc=true, bool allParticles=true)
 Return a list of all or only the best TrackParticle associated to the object. More...
 
std::size_t numberOfSiHits (const xAOD::TrackParticle *tp)
 return the number of Si hits in the track particle More...
 
bool isConvertedPhoton (const xAOD::Photon *ph, bool excludeTRT=false)
 is the object a converted photon More...
 
xAOD::EgammaParameters::ConversionType conversionType (const xAOD::Photon *ph)
 return the photon conversion type (see EgammaEnums) More...
 
xAOD::EgammaParameters::ConversionType conversionType (const xAOD::Vertex *vx)
 return the photon conversion type (see EgammaEnums) More...
 
std::size_t numberOfSiTracks (const xAOD::Photon *eg)
 return the number of Si tracks in the conversion More...
 
std::size_t numberOfSiTracks (const xAOD::Vertex *vx)
 return the number of Si tracks in the conversion More...
 
std::size_t numberOfSiTracks (const xAOD::EgammaParameters::ConversionType convType)
 return the number of Si tracks in the conversion More...
 
float conversionRadius (const xAOD::Vertex *vx)
 return the conversion radius or 9999. More...
 
float conversionRadius (const xAOD::Photon *ph)
 return the conversion radius or 9999. More...
 
Amg::Vector3D momentumAtVertex (const xAOD::Photon *, bool debug=false)
 return the momentum at the vertex (which can be 0) More...
 
Amg::Vector3D momentumAtVertex (const xAOD::Vertex &, bool debug=false)
 return the momentum at the vertex (which can be 0) More...
 
std::set< const xAOD::TrackParticle * > getTrackParticles (const xAOD::Photon *ph, bool useBremAssoc=true)
 Return a list of all or only the best TrackParticle associated to the object. More...
 
std::vector< const xAOD::TrackParticle * > getTrackParticlesVec (const xAOD::Photon *ph, bool useBremAssoc=true)
 Return a list of all or only the best TrackParticle associated to the object. More...
 

Function Documentation

◆ conversionRadius() [1/2]

float xAOD::EgammaHelpers::conversionRadius ( const xAOD::Photon ph)

return the conversion radius or 9999.

Definition at line 82 of file PhotonxAODHelpers.cxx.

82  {
83  if (!ph || !ph->vertex()) return 9999.;
84  return conversionRadius(ph->vertex());
85 }

◆ conversionRadius() [2/2]

float xAOD::EgammaHelpers::conversionRadius ( const xAOD::Vertex vx)

return the conversion radius or 9999.

Definition at line 77 of file PhotonxAODHelpers.cxx.

77  {
78  if (!vx) return 9999.;
79  return sqrt( vx->x()*vx->x() + vx->y()*vx->y() );
80 }

◆ conversionType() [1/2]

xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType ( const xAOD::Photon ph)

return the photon conversion type (see EgammaEnums)

Definition at line 27 of file PhotonxAODHelpers.cxx.

27  {
29  return conversionType(ph->vertex());
30 }

◆ conversionType() [2/2]

xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType ( const xAOD::Vertex vx)

return the photon conversion type (see EgammaEnums)

Definition at line 32 of file PhotonxAODHelpers.cxx.

32  {
34 
35  const TrackParticle *trk1 = ( vx->nTrackParticles() ? vx->trackParticle(0) : nullptr );
36  const TrackParticle *trk2 = ( vx->nTrackParticles() > 1 ? vx->trackParticle(1) : nullptr );
37  uint8_t nSiHits1 = numberOfSiHits(trk1);
38  uint8_t nSiHits2 = numberOfSiHits(trk2);
39 
40  if (!trk1) {return xAOD::EgammaParameters::unconverted;}
41 
42  if (!trk2)
44 
45  if (nSiHits1 && nSiHits2){
47  }
48  if (nSiHits1 || nSiHits2){
50  }
51  else{
53  }
54 }

◆ energyInMissingCells()

unsigned short xAOD::EgammaHelpers::energyInMissingCells ( const xAOD::Egamma eg,
double e2,
double e3 
)

Get the energies in sampling 2 and 3 that are in cells rejected by the topo-cluster timing cut but that would have been expected in a egamma cluster.

Definition at line 176 of file EgammaxAODHelpers.cxx.

177  {
178 
179  const static SG::AuxElement::ConstAccessor<float> acc_Eadded_s2("Eadded_Lr2");
180  const static SG::AuxElement::ConstAccessor<float> acc_Eadded_s3("Eadded_Lr3");
181 
182  unsigned short status = 0;
183  if (acc_Eadded_s2.isAvailable(eg))
184  { e2 = acc_Eadded_s2(eg); }
185  else
186  { status += 1; }
187  if (acc_Eadded_s3.isAvailable(eg))
188  { e3 = acc_Eadded_s3(eg); }
189  else
190  { status += 2; }
191  return status;
192 }

◆ getAssociatedFlowElements()

std::vector< const xAOD::FlowElement * > xAOD::EgammaHelpers::getAssociatedFlowElements ( const xAOD::Egamma eg,
bool  neutral = true,
bool  charged = false 
)

Return a vector of the flow elements associated with the egamma cluster (only neutral for default)

Definition at line 92 of file EgammaxAODHelpers.cxx.

93  {
94  std::vector< const xAOD::FlowElement* > flowelements;
95  if (!neutral && !charged)
96  return flowelements;
97  std::vector< ElementLink< xAOD::FlowElementContainer > > veclinks = xAOD::EgammaHelpers::getAssociatedFlowElementsLinks(eg,neutral);
98  for (const auto& i : veclinks){
99  if(i.isValid()){
100  flowelements.push_back(*i);
101  }
102  else{
103  flowelements.push_back(nullptr);
104  }
105  }
106  if (neutral && charged) {
107  std::vector< ElementLink< xAOD::FlowElementContainer > > oveclinks = xAOD::EgammaHelpers::getAssociatedFlowElementsLinks(eg,false);
108  for (const auto& i : oveclinks){
109  if(i.isValid()){
110  flowelements.push_back(*i);
111  }
112  else{
113  flowelements.push_back(nullptr);
114  }
115  }
116  }
117  return flowelements;
118 }

◆ getAssociatedFlowElementsLinks()

std::vector< ElementLink< xAOD::FlowElementContainer > > xAOD::EgammaHelpers::getAssociatedFlowElementsLinks ( const xAOD::Egamma eg,
bool  neutral = true 
)

Return a vector of the elementlinks to the flow elements associated with the egamma cluster (neutral for default)

Definition at line 79 of file EgammaxAODHelpers.cxx.

80  {
81  static const SG::AuxElement::Accessor < std::vector< ElementLink< xAOD::FlowElementContainer > > > nflowElementLinks("neutralFELinks");
82  static const SG::AuxElement::Accessor < std::vector< ElementLink< xAOD::FlowElementContainer > > > cflowElementLinks("chargedFELinks");
83  std::vector< ElementLink< xAOD::FlowElementContainer > > veclinks;
84  if(neutral && nflowElementLinks.isAvailable(*eg)){
85  veclinks=nflowElementLinks(*eg);
86  } else if(!neutral && cflowElementLinks.isAvailable(*eg)){
87  veclinks=cflowElementLinks(*eg);
88  }
89  return veclinks;
90 }

◆ getAssociatedTopoClusters()

std::vector< const xAOD::CaloCluster * > xAOD::EgammaHelpers::getAssociatedTopoClusters ( const xAOD::CaloCluster cluster)

Return a vector of all the topo clusters associated with the egamma cluster.

Definition at line 65 of file EgammaxAODHelpers.cxx.

65  {
66  std::vector< const xAOD::CaloCluster* > topoclusters;
67  std::vector< ElementLink< xAOD::CaloClusterContainer > > veclinks = xAOD::EgammaHelpers::getAssociatedTopoClustersLinks(cluster);
68  for (const auto& i : veclinks){
69  if(i.isValid()){
70  topoclusters.push_back(*i);
71  }
72  else{
73  topoclusters.push_back(nullptr);
74  }
75  }
76  return topoclusters;
77 }

◆ getAssociatedTopoClustersLinks()

std::vector< ElementLink< xAOD::CaloClusterContainer > > xAOD::EgammaHelpers::getAssociatedTopoClustersLinks ( const xAOD::CaloCluster cluster)

Return a vector of all the elementlinks to the topo clusters associated with the egamma cluster.

Definition at line 55 of file EgammaxAODHelpers.cxx.

55  {
56 
57  static const SG::AuxElement::Accessor < std::vector< ElementLink< xAOD::CaloClusterContainer > > > caloClusterLinks("constituentClusterLinks");
58  std::vector< ElementLink< xAOD::CaloClusterContainer > > veclinks;
59  if(caloClusterLinks.isAvailable(*cluster)){
60  veclinks=caloClusterLinks(*cluster);
61  }
62  return veclinks;
63 }

◆ getBkgElectronLineage() [1/2]

std::vector< const xAOD::TruthParticle * > xAOD::EgammaHelpers::getBkgElectronLineage ( const xAOD::Electron el,
const bool  allTheWayBack = true 
)

Helper wrapper function for calling the function below that accepts truth input.

Definition at line 157 of file EgammaTruthxAODHelpers.cxx.

158  {
160  return getBkgElectronLineage(truthel,allTheWayBack);
161 }

◆ getBkgElectronLineage() [2/2]

std::vector< const xAOD::TruthParticle * > xAOD::EgammaHelpers::getBkgElectronLineage ( const xAOD::TruthParticle truthel,
const bool  allTheWayBack = true 
)

Helper function for getting the truth lineage of an electron that is arising from material interactions in simulation (so called Bkg Electron) There are cases when an electron has a photon (or electron) mother, that in turn comes from another electron of photon.

The allTheWayBack (default true) will return the full lineage of the electron going back to the earliest generator e/gamma truth particle available. When this is set to false we stop at the generator e/gamma particle that interacted with material in simulation (meaning we will not go at the beginning of the generator record). The 0th entry of the returned vector is the passed e/gamma particle, while the last is the last e/gamma particle we have seen in the lineage.

Definition at line 90 of file EgammaTruthxAODHelpers.cxx.

91  {
92  std::vector<const xAOD::TruthParticle*> vec;
93  //Truth must exist and be an electron
94  if (!truthel || !MC::isElectron(truthel)){
95  return vec;
96  }
97  vec.push_back(truthel); //push its self back as first entry
98 
99  // The first parent has to exist
100  if (!truthel->nParents()) {
101  return vec;
102  }
103 
104  if (!HepMC::is_simulation_particle(truthel) && !allTheWayBack) {
105  return vec;
106  }
107 
108  //And has to be a photon or electron
109  const xAOD::TruthParticle* parent = nullptr;
110  for (size_t p = 0; p < truthel->nParents(); ++p) {
111  if ( !MC::isPhoton(truthel->parent(p)) && !MC::isElectron(truthel->parent(p)) ) return vec;
112  parent = truthel->parent(p); //AV: note, here is an ambiguity for the case of multiple parents.
113  }
114 
115  if (!parent) return vec;
116  vec.push_back(parent); //push in the parent as the second entry
117 
118  //Loop over the generations
119  while (parent->nParents() &&
120  (HepMC::is_simulation_particle(parent) || allTheWayBack)) {
121  //Find the next parent
122  const xAOD::TruthParticle* tmp = nullptr;
123  //You want to see an electron or a photon
124  for (size_t p = 0; p < parent->nParents(); ++p) {
125  if (MC::isPhoton(parent->parent(p)) || MC::isElectron(parent->parent(p))) tmp = parent->parent(p); //AV: note some ambiguity for multiple parents passing the selection
126  }
127  if (tmp) {
128  parent = tmp;
129  } else { // if we do not see any more electron and photons we stop
130  break;
131  }
132  vec.push_back(parent); //push in the parent
133  }
134  return vec;
135 }

◆ getBkgElectronMother() [1/2]

const xAOD::TruthParticle * xAOD::EgammaHelpers::getBkgElectronMother ( const xAOD::Electron el,
const bool  allTheWayBack = true 
)

Helper wrapper function for calling the function above extracting the truth from a reco electron.

Definition at line 137 of file EgammaTruthxAODHelpers.cxx.

138  {
139  const xAOD::TruthParticle *truthel =
141  return getBkgElectronMother(truthel,allTheWayBack);
142 }

◆ getBkgElectronMother() [2/2]

const xAOD::TruthParticle * xAOD::EgammaHelpers::getBkgElectronMother ( const xAOD::TruthParticle truthel,
const bool  allTheWayBack = true 
)

Helper function for getting the "Mother" electron for an existing electron.

return the last entry in the lineage vector

Definition at line 145 of file EgammaTruthxAODHelpers.cxx.

146  {
147  std::vector<const xAOD::TruthParticle*> vec =
148  xAOD::EgammaHelpers::getBkgElectronLineage(truthel,allTheWayBack);
149  if (!vec.empty()) {
150  return vec.back();
151  }
152  return nullptr;
153 }

◆ getLastMeasurementQoverP()

float xAOD::EgammaHelpers::getLastMeasurementQoverP ( const xAOD::TrackParticle tp)

return parameters for the last measurement for a GSF track particle

Definition at line 31 of file ElectronxAODHelpers.cxx.

31  {
32  static const SG::AuxElement::Accessor<float > QoverPLM ("QoverPLM");
33  if(tp && QoverPLM.isAvailable(*tp)){
34  return QoverPLM(*tp);
35  }
36  return -999 ;
37 }

◆ getOriginalTrackParticle()

const xAOD::TrackParticle * xAOD::EgammaHelpers::getOriginalTrackParticle ( const xAOD::Electron el)

Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.

Definition at line 11 of file ElectronxAODHelpers.cxx.

11  {
12 
13  if(el){
14  const xAOD::TrackParticle* trkPar= el->trackParticle();
15  if(trkPar){
16  return getOriginalTrackParticleFromGSF(trkPar);
17  }
18  }
19  return nullptr;
20 }

◆ getOriginalTrackParticleFromGSF()

const xAOD::TrackParticle * xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF ( const xAOD::TrackParticle trkPar)

Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle.

Definition at line 22 of file ElectronxAODHelpers.cxx.

22  {
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 }

◆ getRecoElectron()

const xAOD::Electron * xAOD::EgammaHelpers::getRecoElectron ( const xAOD::TruthParticle particle)

return the reco electron associated to the given TruthParticle (if any)

Definition at line 31 of file EgammaTruthxAODHelpers.cxx.

31  {
32 
33  if( ! recoElectronLinkAcc.isAvailable( *particle ) ) {
34  return nullptr;
35  }
37  recoElectronLinkAcc( *particle );
38  if( ! link.isValid() ) {
39  return nullptr;
40  }
41  return *link;
42 }

◆ getRecoPhoton()

const xAOD::Photon * xAOD::EgammaHelpers::getRecoPhoton ( const xAOD::TruthParticle particle)

return the reco photon associated to the given TruthParticle (if any)

Definition at line 54 of file EgammaTruthxAODHelpers.cxx.

54  {
55 
56  if( ! recoPhotonLinkAcc.isAvailable( *particle ) ) {
57  return nullptr;
58  }
60  recoPhotonLinkAcc( *particle );
61  if( ! link.isValid() ) {
62  return nullptr;
63  }
64  return *link;
65 }

◆ getTrackParticles() [1/3]

std::set< const xAOD::TrackParticle * > xAOD::EgammaHelpers::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.

If useBremAssoc is set, get the original TrackParticle This is useful when a std::set of the original track Particles is required, which is mainly the case for the as it will re-order the elements in pointer order and not best match.

Definition at line 120 of file EgammaxAODHelpers.cxx.

122  {
123 
124  if (eg) {
125  if (eg->type()==xAOD::Type::Electron) {
126  const xAOD::Electron* el = static_cast<const xAOD::Electron*> (eg);
127  if (el) {
128  return getTrackParticles(el, useBremAssoc, allParticles);
129  }
130  }
131  else if (eg->type()==xAOD::Type::Photon) {
132  const xAOD::Photon* ph = static_cast<const xAOD::Photon*> (eg);
133  if (ph) {
134  return getTrackParticles(ph, useBremAssoc);
135  }
136  }
137  }
138  return std::set<const xAOD::TrackParticle*>{};
139 }

◆ getTrackParticles() [2/3]

std::set< const xAOD::TrackParticle * > xAOD::EgammaHelpers::getTrackParticles ( const xAOD::Electron el,
bool  useBremAssoc = true,
bool  allParticles = true 
)

Return a list of all or only the best TrackParticle associated to the object.

If useBremAssoc is set, get the original TrackParticle This is useful when a std::set of the original track Particles is required, which is mainly the case for the
as it will re-order the elements in pointer order and not best match.

Definition at line 39 of file ElectronxAODHelpers.cxx.

41  {
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 }

◆ getTrackParticles() [3/3]

std::set< const xAOD::TrackParticle * > xAOD::EgammaHelpers::getTrackParticles ( const xAOD::Photon ph,
bool  useBremAssoc = true 
)

Return a list of all or only the best TrackParticle associated to the object.

If useBremAssoc is set, get the original TrackParticle This is useful when a std::set of the original track Particles is required, which is mainly the case for the
as it will re-order the elements in pointer order and not best match.

Definition at line 116 of file PhotonxAODHelpers.cxx.

117  {
118 
119  std::set<const xAOD::TrackParticle*> tps;
120  if (!ph) return tps;
121  for (unsigned int ivx = 0; ivx < ph->nVertices(); ++ivx)
122  {
123  const xAOD::Vertex* vx = ph->vertex(ivx);
124  for (unsigned int i=0; vx && i < vx->nTrackParticles(); ++i){
125  const xAOD::TrackParticle *tp = vx->trackParticle(i);
126  tps.insert( useBremAssoc ? xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(tp) : tp );
127  }
128  }
129  return tps;
130 }

◆ getTrackParticlesVec() [1/3]

std::vector< const xAOD::TrackParticle * > xAOD::EgammaHelpers::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.

If useBremAssoc is set, get the original TrackParticle This one returns a vector so as to be more "user friendly", as it retains the original best match ordering

Definition at line 141 of file EgammaxAODHelpers.cxx.

143  {
144  if (eg) {
145  if (eg->type()==xAOD::Type::Electron) {
146  const xAOD::Electron* el = static_cast<const xAOD::Electron*> (eg);
147  if (el) {
148  return getTrackParticlesVec(el, useBremAssoc, allParticles);
149  }
150  }
151  else if (eg->type()==xAOD::Type::Photon) {
152  const xAOD::Photon* ph = static_cast<const xAOD::Photon*> (eg);
153  if (ph) {
154  return getTrackParticlesVec(ph, useBremAssoc);
155  }
156  }
157  }
158  return std::vector<const xAOD::TrackParticle*>{};
159 }

◆ getTrackParticlesVec() [2/3]

std::vector< const xAOD::TrackParticle * > xAOD::EgammaHelpers::getTrackParticlesVec ( const xAOD::Electron el,
bool  useBremAssoc = true,
bool  allParticles = true 
)

Return a list of all or only the best TrackParticle associated to the object.

If useBremAssoc is set, get the original TrackParticle This one returns a vector so as to be more "user friendly",as it retains the original best match ordering

Definition at line 52 of file ElectronxAODHelpers.cxx.

54  {
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 }

◆ getTrackParticlesVec() [3/3]

std::vector< const xAOD::TrackParticle * > xAOD::EgammaHelpers::getTrackParticlesVec ( const xAOD::Photon ph,
bool  useBremAssoc = true 
)

Return a list of all or only the best TrackParticle associated to the object.

If useBremAssoc is set, get the original TrackParticle This one returns a vector so as to be more "user friendly",as it retains the original best match ordering

Definition at line 132 of file PhotonxAODHelpers.cxx.

133  {
134  std::vector<const xAOD::TrackParticle*> tps;
135  if (!ph) return tps;
136  for (unsigned int ivx = 0; ivx < ph->nVertices(); ++ivx)
137  {
138  const xAOD::Vertex* vx = ph->vertex(ivx);
139  for (unsigned int i=0; vx && i < vx->nTrackParticles(); ++i){
140  const xAOD::TrackParticle *tp = vx->trackParticle(i);
141  tps.push_back( useBremAssoc ? xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(tp) : tp );
142  }
143  }
144  return tps;
145 }

◆ isBarrel() [1/2]

bool xAOD::EgammaHelpers::isBarrel ( const xAOD::CaloCluster cluster)

return true if the cluster (or the majority of its energy) is in the barrel

Definition at line 37 of file EgammaxAODHelpers.cxx.

37  {
38  const bool isBarrel = cluster->inBarrel();
39  const bool isEndcap = cluster->inEndcap();
40  if (isBarrel && isEndcap){
41  return cluster->eSample(CaloSampling::EMB2) >= cluster->eSample(CaloSampling::EME2);
42  }
43  return isBarrel;
44 }

◆ isBarrel() [2/2]

bool xAOD::EgammaHelpers::isBarrel ( const xAOD::Egamma eg)

return true if the cluster is in the barrel

Definition at line 33 of file EgammaxAODHelpers.cxx.

33  {
34  return (eg ? isBarrel(eg->caloCluster()) : false);
35 }

◆ isConvertedPhoton() [1/2]

bool xAOD::EgammaHelpers::isConvertedPhoton ( const xAOD::Egamma eg,
bool  excludeTRT = false 
)

is the object a converted photon

Definition at line 25 of file EgammaxAODHelpers.cxx.

25  {
26  if (!eg || eg->type()!=xAOD::Type::Photon){
27  return false;
28  }
29  const xAOD::Photon *ph = static_cast<const xAOD::Photon*>(eg);
30  return xAOD::EgammaHelpers::isConvertedPhoton(ph,excludeTRT);
31 }

◆ isConvertedPhoton() [2/2]

bool xAOD::EgammaHelpers::isConvertedPhoton ( const xAOD::Photon ph,
bool  excludeTRT = false 
)

is the object a converted photon

Definition at line 15 of file PhotonxAODHelpers.cxx.

15  {
16  const bool hasVertices = ph && (ph->nVertices() > 0);
17  if (excludeTRT) {
18  // special case for Run3: consider unconv if TRT Conv in the barrel
21  const bool isTRTConv = (conversionType == singleTRT) || (conversionType == doubleTRT);
22  return hasVertices && (std::abs(ph->eta()) > 0.8 || !isTRTConv);
23  }
24  return hasVertices;
25 }

◆ isElectron()

bool xAOD::EgammaHelpers::isElectron ( const xAOD::Egamma eg)

is the object an electron (not Fwd)

Definition at line 12 of file EgammaxAODHelpers.cxx.

12  {
13  return ( (eg->type()==xAOD::Type::Electron) &&
15 }

◆ isFCAL()

bool xAOD::EgammaHelpers::isFCAL ( const xAOD::CaloCluster cluster)

return true if the cluster (or the majority of its energy) is in the FCAL0

Definition at line 46 of file EgammaxAODHelpers.cxx.

46  {
47  const bool hasEME2 = cluster->hasSampling(CaloSampling::EME2);
48  const bool hasFCAL0 = cluster->hasSampling(CaloSampling::FCAL0);
49  if (hasEME2 && hasFCAL0){
50  return cluster->eSample(CaloSampling::FCAL0) >= cluster->eSample(CaloSampling::EME2);
51  }
52  return hasFCAL0;
53 }

◆ isFwdElectron()

bool xAOD::EgammaHelpers::isFwdElectron ( const xAOD::Egamma eg)

is the object a Fwd electron

Definition at line 17 of file EgammaxAODHelpers.cxx.

17  {
19 }

◆ isPhoton()

bool xAOD::EgammaHelpers::isPhoton ( const xAOD::Egamma eg)

is the object a photon

Definition at line 21 of file EgammaxAODHelpers.cxx.

21  {
22  return (eg->type()==xAOD::Type::Photon);
23 }

◆ isTrueConvertedPhoton() [1/2]

bool xAOD::EgammaHelpers::isTrueConvertedPhoton ( const xAOD::Photon ph,
float  maxRadius = 800. 
)

is the object matched to a true converted photon with R < maxRadius

Definition at line 69 of file EgammaTruthxAODHelpers.cxx.

69  {
71  if (!truthPh) {return false;}
72  // In older versions egammaTruthParticles did not have a decay vertex associated
73  // so we look for the original truth particle
74  if (truthPh->hasDecayVtx()){
75  return isTrueConvertedPhoton(truthPh, maxRadius);
76  }
77  const xAOD::TruthParticle *orgTruthPh = xAOD::TruthHelpers::getTruthParticle(*truthPh);
78  if (!orgTruthPh){ return false;}
79  return xAOD::EgammaHelpers::isTrueConvertedPhoton(orgTruthPh, maxRadius);
80 }

◆ isTrueConvertedPhoton() [2/2]

bool xAOD::EgammaHelpers::isTrueConvertedPhoton ( const xAOD::TruthParticle truePh,
float  maxRadius = 800. 
)

is the true object a converted photon with R < maxRadius

Definition at line 83 of file EgammaTruthxAODHelpers.cxx.

83  {
84  return (MC::isPhoton(truthPh) && truthPh->hasDecayVtx()
85  && truthPh->decayVtx()->perp() < maxRadius);
86 }

◆ momentumAtVertex() [1/2]

Amg::Vector3D xAOD::EgammaHelpers::momentumAtVertex ( const xAOD::Photon photon,
bool  debug = false 
)

return the momentum at the vertex (which can be 0)

Definition at line 89 of file PhotonxAODHelpers.cxx.

89  {
90  if (!photon || !photon->vertex()) return Amg::Vector3D(0., 0., 0.);
91  return momentumAtVertex(*photon->vertex(), debug);
92 }

◆ momentumAtVertex() [2/2]

Amg::Vector3D xAOD::EgammaHelpers::momentumAtVertex ( const xAOD::Vertex vertex,
bool  debug = false 
)

return the momentum at the vertex (which can be 0)

Definition at line 95 of file PhotonxAODHelpers.cxx.

95  {
96 
97  static const SG::AuxElement::Accessor<float> accPx("px");
98  static const SG::AuxElement::Accessor<float> accPy("py");
99  static const SG::AuxElement::Accessor<float> accPz("pz");
100 
101  if (accPx.isAvailable(vertex) &&
102  accPy.isAvailable(vertex) &&
103  accPz.isAvailable(vertex))
104  {
105  return Amg::Vector3D(accPx(vertex),
106  accPy(vertex),
107  accPz(vertex));
108  }
109  if (debug){
110  std::cout << "Vertex not decorated with momentum" << std::endl;
111  }
112  return Amg::Vector3D(0., 0., 0.);
113 }

◆ numberOfSiHits()

std::size_t xAOD::EgammaHelpers::numberOfSiHits ( const xAOD::TrackParticle tp)

return the number of Si hits in the track particle

Definition at line 66 of file ElectronxAODHelpers.cxx.

66  {
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 }

◆ numberOfSiTracks() [1/3]

std::size_t xAOD::EgammaHelpers::numberOfSiTracks ( const xAOD::EgammaParameters::ConversionType  convType)

return the number of Si tracks in the conversion

Definition at line 68 of file PhotonxAODHelpers.cxx.

68  {
69  if (convType == xAOD::EgammaParameters::doubleSi) {return 2;}
70  if (convType == xAOD::EgammaParameters::singleSi ||
71  convType == xAOD::EgammaParameters::doubleSiTRT) {return 1;}
72  return 0;
73 }

◆ numberOfSiTracks() [2/3]

std::size_t xAOD::EgammaHelpers::numberOfSiTracks ( const xAOD::Photon eg)

return the number of Si tracks in the conversion

Definition at line 58 of file PhotonxAODHelpers.cxx.

58  {
59  if (!ph || !ph->vertex()) {return 0;}
60  return numberOfSiTracks(ph->vertex());
61 }

◆ numberOfSiTracks() [3/3]

std::size_t xAOD::EgammaHelpers::numberOfSiTracks ( const xAOD::Vertex vx)

return the number of Si tracks in the conversion

Definition at line 63 of file PhotonxAODHelpers.cxx.

63  {
64  if (!vx) return 0;
65  return numberOfSiTracks(conversionType(vx));
66 }

◆ summaryValueFloat()

float xAOD::EgammaHelpers::summaryValueFloat ( const xAOD::TrackParticle tp,
const xAOD::SummaryType info,
float  deflt = -999. 
)

return the summary value for a TrackParticle or default value (-999)

Definition at line 168 of file EgammaxAODHelpers.cxx.

170  {
171  float dummy(0);
172  return (tp.summaryValue(dummy, info) ? dummy : deflt);
173 }

◆ summaryValueInt()

int xAOD::EgammaHelpers::summaryValueInt ( const xAOD::TrackParticle tp,
const xAOD::SummaryType info,
int  deflt = -999 
)

return the summary value for a TrackParticle or default value (-999) (to be used mostly in python where uint8_t is converted to char and the Tracking does not provide unprotected methods)

Definition at line 161 of file EgammaxAODHelpers.cxx.

163  {
164  uint8_t dummy(0);
165  return (tp.summaryValue(dummy, info) ? dummy : deflt);
166 }
xAOD::EgammaParameters::unconverted
@ unconverted
unconverted photon
Definition: EgammaEnums.h:270
grepfile.info
info
Definition: grepfile.py:38
xAOD::Photon_v1::nVertices
size_t nVertices() const
Return the number xAOD::Vertex/vertices that match the photon candidate.
xAOD::Vertex_v1::x
float x() const
Returns the x position.
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
xAOD::Vertex_v1::nTrackParticles
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
Definition: Vertex_v1.cxx:270
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
ParticleTest.eg
eg
Definition: ParticleTest.py:29
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::EgammaHelpers::getBkgElectronLineage
std::vector< const xAOD::TruthParticle * > getBkgElectronLineage(const xAOD::TruthParticle *truthel, const bool allTheWayBack=true)
Helper function for getting the truth lineage of an electron that is arising from material interactio...
Definition: EgammaTruthxAODHelpers.cxx:90
ParticleTest.tp
tp
Definition: ParticleTest.py:25
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:260
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
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
xAOD::EgammaParameters::ConversionType
ConversionType
Definition: EgammaEnums.h:268
xAOD::EgammaParameters::AuthorFwdElectron
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition: EgammaDefs.h:30
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
xAOD::EgammaHelpers::getBkgElectronMother
const xAOD::TruthParticle * getBkgElectronMother(const xAOD::Electron *el, const bool allTheWayBack=true)
Helper wrapper function for calling the function above extracting the truth from a reco electron.
Definition: EgammaTruthxAODHelpers.cxx:137
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
xAOD::TruthParticle_v1::nParents
size_t nParents() const
Number of parents of this particle.
Definition: TruthParticle_v1.cxx:122
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::EgammaHelpers::numberOfSiTracks
std::size_t numberOfSiTracks(const xAOD::Photon *eg)
return the number of Si tracks in the conversion
Definition: PhotonxAODHelpers.cxx:58
xAOD::EgammaHelpers::isConvertedPhoton
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
Definition: EgammaxAODHelpers.cxx:25
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
columnar::ContainerId::cluster
@ cluster
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition: MagicNumbers.h:355
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::EgammaHelpers::isElectron
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Definition: EgammaxAODHelpers.cxx:12
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
xAOD::EgammaHelpers::momentumAtVertex
Amg::Vector3D momentumAtVertex(const xAOD::Photon *, bool debug=false)
return the momentum at the vertex (which can be 0)
Definition: PhotonxAODHelpers.cxx:89
xAOD::EgammaParameters::doubleSi
@ doubleSi
two tracks, both with Si hits
Definition: EgammaEnums.h:279
test_pyathena.parent
parent
Definition: test_pyathena.py:15
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
python.xAODType.dummy
dummy
Definition: xAODType.py:4
xAOD::Vertex_v1::trackParticle
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Definition: Vertex_v1.cxx:249
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
xAOD::EgammaHelpers::getAssociatedTopoClustersLinks
std::vector< ElementLink< xAOD::CaloClusterContainer > > getAssociatedTopoClustersLinks(const xAOD::CaloCluster *cluster)
Return a vector of all the elementlinks to the topo clusters associated with the egamma cluster.
Definition: EgammaxAODHelpers.cxx:55
xAOD::EgammaParameters::doubleSiTRT
@ doubleSiTRT
two tracks, only one with Si hits
Definition: EgammaEnums.h:285
xAOD::EgammaParameters::singleTRT
@ singleTRT
one track only, no Si hits (TRT only)
Definition: EgammaEnums.h:276
CP::neutral
@ neutral
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11
xAOD::EgammaHelpers::isTrueConvertedPhoton
bool isTrueConvertedPhoton(const xAOD::Photon *ph, float maxRadius=800.)
is the object matched to a true converted photon with R < maxRadius
Definition: EgammaTruthxAODHelpers.cxx:69
xAOD::EgammaParameters::singleSi
@ singleSi
one track only, with Si hits
Definition: EgammaEnums.h:273
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
xAOD::TruthHelpers::getTruthParticle
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
Definition: xAODTruthHelpers.cxx:25
xAOD::EgammaHelpers::conversionRadius
float conversionRadius(const xAOD::Vertex *vx)
return the conversion radius or 9999.
Definition: PhotonxAODHelpers.cxx:77
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
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
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
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::EgammaHelpers::getAssociatedFlowElementsLinks
std::vector< ElementLink< xAOD::FlowElementContainer > > getAssociatedFlowElementsLinks(const xAOD::Egamma *eg, bool neutral=true)
Return a vector of the elementlinks to the flow elements associated with the egamma cluster (neutral ...
Definition: EgammaxAODHelpers.cxx:79
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:200
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::Photon_v1
Definition: Photon_v1.h:37
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
xAOD::EgammaHelpers::isPhoton
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
Definition: EgammaxAODHelpers.cxx:21
xAOD::Vertex_v1::y
float y() const
Returns the y position.
xAOD::EgammaHelpers::conversionType
xAOD::EgammaParameters::ConversionType conversionType(const xAOD::Photon *ph)
return the photon conversion type (see EgammaEnums)
Definition: PhotonxAODHelpers.cxx:27
xAOD::TruthParticle_v1::parent
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Definition: TruthParticle_v1.cxx:131
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:269
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:70
xAOD::EgammaParameters::doubleTRT
@ doubleTRT
two tracks, none with Si hits (TRT only)
Definition: EgammaEnums.h:282
merge.status
status
Definition: merge.py:17
xAOD::EgammaParameters::NumberOfVertexConversionTypes
@ NumberOfVertexConversionTypes
maximum number of types
Definition: EgammaEnums.h:288
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
xAOD::Photon_v1::vertex
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
Definition: Photon_v1.cxx:46
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CP::charged
@ charged
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11
IDTPM::nSiHits
float nSiHits(const U &p)
Definition: TrackParametersHelper.h:427