ATLAS Offline Software
Loading...
Searching...
No Matches
SoftElectronSelectionAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11#include "xAODEgamma/Electron.h"
14
15#include "TLorentzVector.h"
16
17namespace FlavorTagJetDecorators {
18
20 const std::string& name, ISvcLocator* loc)
21 : AthReentrantAlgorithm(name, loc) {}
22
24 ATH_CHECK(m_jetContainerKey.initialize());
26 ATH_CHECK(m_ghostElectronsKey.initialize());
28 ATH_CHECK(m_energyOverPKey.initialize());
29 ATH_CHECK(m_etKey.initialize());
30 ATH_CHECK(m_isoOverPtKey.initialize());
31 ATH_CHECK(m_dpopKey.initialize());
32 return StatusCode::SUCCESS;
33 }
34
36 const EventContext& ctx) const
37 {
39 ATH_CHECK(jets.isValid());
40
43 ATH_CHECK(electrons.isValid());
44
47
50
52 m_energyOverPKey, ctx);
54 m_etKey, ctx);
56 m_isoOverPtKey, ctx);
58 m_dpopKey, ctx);
59
60 for (const xAOD::Jet* jet : *jets) {
61 std::vector<ElementLink<xAOD::IParticleContainer>> selected;
62
63 for (const auto& link : ghostElectrons(*jet)) {
64 const auto* el = dynamic_cast<const xAOD::Electron*>(*link);
65 if (!el) continue;
66
67 if (passedCuts(*jet, *el,
68 energyOverP(*el), et(*el),
69 isoOverPt(*el), dpop(*el))) {
70 selected.push_back(
72 *electrons, el->index()));
73 }
74 }
75
76 selectedOut(*jet) = selected;
77 }
78
79 return StatusCode::SUCCESS;
80 }
81
83 const xAOD::Jet& jet,
84 const xAOD::Electron& el,
85 float energyOverP,
86 float et,
87 float isoOverPt,
88 float dpop) const
89 {
90 TLorentzVector jet4;
91 jet4.SetPtEtaPhiE(jet.pt(), jet.eta(), jet.phi(), jet.e());
92 TLorentzVector el4;
93 el4.SetPtEtaPhiE(el.pt(), el.eta(), el.phi(), el.e());
94
95 if (m_maxDeltaR > 0. && jet4.DeltaR(el4) > m_maxDeltaR)
96 return false;
97
98 if (std::abs(el.eta()) > m_absEtaMaximum)
99 return false;
100 if (el.pt() <= m_ptMinimum)
101 return false;
102 if (el.pt() >= m_ptMaximum)
103 return false;
104
105 const auto* track = el.trackParticle();
106 if (!track) return false;
107
108 if (std::isfinite(m_d0Maximum) &&
109 std::abs(track->d0()) >= m_d0Maximum)
110 return false;
111
112 // E/p and ET from pre-computed decorations (not caloCluster)
113 if (std::abs(energyOverP) > m_eopMaximum)
114 return false;
115 if (std::abs(et) > m_etMaximum)
116 return false;
117
118 if (std::abs(isoOverPt) > m_isoptMaximum)
119 return false;
120
121 float ptrel = el4.Vect().Perp(jet4.Vect());
122 if (std::abs(ptrel) > m_ptrelMaximum)
123 return false;
124
125 float rhad1 = el.showerShapeValue(xAOD::EgammaParameters::Rhad1);
126 float wstot = el.showerShapeValue(xAOD::EgammaParameters::wtots1);
127 float rphi = el.showerShapeValue(xAOD::EgammaParameters::Rphi);
128 float reta = el.showerShapeValue(xAOD::EgammaParameters::Reta);
129 float deta1 = el.trackCaloMatchValue(
131
132 if (std::abs(rhad1) > m_rhad1Maximum)
133 return false;
134 if (std::abs(wstot) > m_wstotMaximum)
135 return false;
136 if (std::abs(rphi) > m_rphiMaximum)
137 return false;
138 if (std::abs(reta) > m_retaMaximum)
139 return false;
140 if (std::abs(deta1) > m_deta1Maximum)
141 return false;
142 if (std::abs(dpop) > m_dpopMaximum)
143 return false;
144
145 return true;
146 }
147
148} // namespace FlavorTagJetDecorators
#define ATH_CHECK
Evaluate an expression and check for errors.
float et(const xAOD::jFexSRJetRoI *j)
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_dpopKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_ghostElectronsKey
SoftElectronSelectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_etKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_isoOverPtKey
virtual StatusCode execute(const EventContext &) const override
bool passedCuts(const xAOD::Jet &jet, const xAOD::Electron &el, float energyOverP, float et, float isoOverPt, float dpop) const
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronContainerKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_selectedElectronsKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_energyOverPKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainerKey
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
@ deltaEta1
difference between the cluster eta (first sampling) and the eta of the track extrapolated to the firs...
@ wtots1
shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips...
Jet_v1 Jet
Definition of the current "jet version".
Electron_v1 Electron
Definition of the current "egamma version".
Extra patterns decribing particle interation process.