ATLAS Offline Software
ElectronSelectorHelpers.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "xAODEgamma/Electron.h"
9 #include <stdexcept>
10 
11 std::size_t
13  const xAOD::TrackParticle& tp)
14 {
15 
16  uint8_t nPixHits(0);
17  uint8_t nPixDead(0);
18 
19  bool allFound = true;
20  allFound = allFound && tp.summaryValue(nPixHits, xAOD::numberOfPixelHits);
21  allFound =
22  allFound && tp.summaryValue(nPixDead, xAOD::numberOfPixelDeadSensors);
23  if (!allFound) {
24  throw std::runtime_error(
25  "numberOfPixelHitsAndDeadSensors : Failed to load variables");
26  }
27 
28  return nPixHits + nPixDead;
29 }
30 
31 std::size_t
33  const xAOD::TrackParticle& tp)
34 {
35  uint8_t nSCTHits(0);
36  uint8_t nSCTDead(0);
37 
38  bool allFound = true;
39  allFound = allFound && tp.summaryValue(nSCTHits, xAOD::numberOfSCTHits);
40  allFound =
41  allFound && tp.summaryValue(nSCTDead, xAOD::numberOfSCTDeadSensors);
42  if (!allFound) {
43  throw std::runtime_error(
44  "numberOfSCTHitsAndDeadSensors : Failed to load variables");
45  }
46 
47  return nSCTHits + nSCTDead;
48 }
49 
50 std::size_t
52  const xAOD::TrackParticle& tp)
53 {
56 }
57 
58 bool
60 {
61 
62  uint8_t expectInnermostLayer(0);
63  uint8_t nInnermostLayerHits(0);
64  uint8_t nInnermostLayerOutliers(0);
65  uint8_t expectNextToInnermostLayer(0);
66  uint8_t nNextToInnermostLayerHits(0);
67  uint8_t nNextToInnermostLayerOutliers(0);
68 
69  bool allFound = true;
70  allFound =
71  allFound && tp.summaryValue(expectInnermostLayer, xAOD::expectBLayerHit);
72  allFound =
73  allFound && tp.summaryValue(nInnermostLayerHits, xAOD::numberOfBLayerHits);
74  allFound = allFound && tp.summaryValue(nInnermostLayerOutliers,
76  allFound =
77  allFound && tp.summaryValue(expectNextToInnermostLayer,
79  allFound =
80  allFound && tp.summaryValue(nNextToInnermostLayerHits,
82  allFound = allFound &&
83  tp.summaryValue(nNextToInnermostLayerOutliers,
85  if (!allFound) {
86  throw std::runtime_error(
87  "passBLayerRequirement : Failed to load variables");
88  }
89 
90  // If innermost and next to innermost layer are both masked off, then the
91  // selectors should PASS the BL cut, so the default here is true
92  bool passBLReq = true;
93 
94  if (expectInnermostLayer) {
95  passBLReq = (nInnermostLayerHits + nInnermostLayerOutliers > 0);
96  } else if (expectNextToInnermostLayer) {
97  passBLReq = (nNextToInnermostLayerHits + nNextToInnermostLayerOutliers > 0);
98  }
99 
100  return passBLReq;
101 }
102 
103 bool
105  const uint16_t criterion)
106 {
107 
108  // helper to check if ambiguity type is one of several that are stored in a
109  // bitmask
110  //
111  return (criterion & 0x1 << type);
112 }
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
ElectronSelectorHelpers::numberOfSCTHitsAndDeadSensors
std::size_t numberOfSCTHitsAndDeadSensors(const xAOD::TrackParticle &tp)
return the number of SCT hits plus dead sensors in the track particle
Definition: ElectronSelectorHelpers.cxx:32
ElectronSelectorHelpers::passAmbiguity
bool passAmbiguity(xAOD::AmbiguityTool::AmbiguityType type, const uint16_t criterion)
return true if the ambiguity type is one of several that are stored in a bitmask
Definition: ElectronSelectorHelpers.cxx:104
ElectronSelectorHelpers::numberOfSiliconHitsAndDeadSensors
std::size_t numberOfSiliconHitsAndDeadSensors(const xAOD::TrackParticle &tp)
return the number of Silicon hits plus dead sensors in the track particle
Definition: ElectronSelectorHelpers.cxx:51
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::expectBLayerHit
@ expectBLayerHit
Do we expect a b-layer hit for this track? [unit8_t] (should be [bool])
Definition: TrackingPrimitives.h:235
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
ElectronSelectorHelpers::passBLayerRequirement
bool passBLayerRequirement(const xAOD::TrackParticle &tp)
return true if effective number of BL hits + outliers is at least one
Definition: ElectronSelectorHelpers.cxx:59
xAOD::numberOfBLayerHits
@ numberOfBLayerHits
these are the hits in the first pixel layer, i.e.
Definition: TrackingPrimitives.h:231
ElectronSelectorHelpers.h
xAOD::expectNextToInnermostPixelLayerHit
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
Definition: TrackingPrimitives.h:247
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
xAOD::AmbiguityTool::AmbiguityType
AmbiguityType
Definition: IEGammaAmbiguityTool.h:33
xAOD::numberOfNextToInnermostPixelLayerOutliers
@ numberOfNextToInnermostPixelLayerOutliers
number of 1st pixel layer barrel outliers
Definition: TrackingPrimitives.h:249
xAOD::numberOfNextToInnermostPixelLayerHits
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
Definition: TrackingPrimitives.h:248
TauGNNUtils::Variables::Track::nSCTHits
bool nSCTHits(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:549
TrackParticle.h
xAOD::numberOfSCTDeadSensors
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
Definition: TrackingPrimitives.h:273
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
Electron.h
xAOD::numberOfPixelDeadSensors
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
Definition: TrackingPrimitives.h:266
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
TrackParticleContainer.h
xAOD::numberOfBLayerOutliers
@ numberOfBLayerOutliers
number of blayer outliers [unit8_t].
Definition: TrackingPrimitives.h:232
ElectronSelectorHelpers::numberOfPixelHitsAndDeadSensors
std::size_t numberOfPixelHitsAndDeadSensors(const xAOD::TrackParticle &tp)
return the number of Pixel hits plus dead sensors in the track particle
Definition: ElectronSelectorHelpers.cxx:12