ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaEmulationPrecisionPhotonHypoTool.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
5#include "GaudiKernel/SystemOfUnits.h"
6
7
8using namespace Trig;
9
10//**********************************************************************
11
15
17
23
25
27 bool &pass) const
28{
29 pass=false;
30 if( !input.roi ) return false;
31 if( input.photons.empty() ) return false;
32
33 for ( const auto& ph : input.photons )
34 {
35 if( decide( input, ph ) ){
36 pass=true;
37 return true;
38 }
39 }
40
41 return true;
42
43}
44
46
48 const xAOD::Photon *ph
49 ) const
50
51{
52
53 const TrigRoiDescriptor *roi = input.roi;
54 unsigned PassedCuts=0;
55
56
57 // when leaving scope it will ship data to monTool
58 PassedCuts = PassedCuts + 1; //got called (data in place)
59
60 if ( std::abs( roi->eta() ) > 2.6 ) {
61 ATH_MSG_DEBUG( "REJECT The photon had eta coordinates beyond the EM fiducial volume : "
62 << roi->eta() << "; stop the chain now" );
63 return false;
64 }
65
66 ATH_MSG_DEBUG( "; RoI ID = " << roi->roiId() << ": Eta = " << roi->eta() << ", Phi = " << roi->phi() );
67
68 // fill local variables for RoI reference position
69 double etaRef = roi->eta();
70 double phiRef = roi->phi();
71 // correct phi the to right range ( probably not needed anymore )
72 if ( std::abs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range
73
74 auto pClus = ph->caloCluster();
75
76 if(!pClus){
77 ATH_MSG_DEBUG("No calo cluster for this photon");
78 return false;
79 }
80
81
82 float absEta = std::abs( pClus->eta() );
83 const int cutIndex = findCutIndex( absEta );
84
85
86
87 float dEta = pClus->eta() - etaRef;
88 // Deal with angle diferences greater than Pi
89 float dPhi = std::abs( pClus->phi() - phiRef );
90 dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only <
91 float ET = pClus->et();
92
93
94 // eta range
95 if ( absEta > 2.47) { // VD
96 ATH_MSG_DEBUG( "Photon : " << absEta << " outside eta range " );
97 return false;
98 }
99 PassedCuts = PassedCuts + 1; // passed eta cut
100
101 // eta range
102 if ( cutIndex == -1 ) { // VD
103 ATH_MSG_DEBUG( "Photon : " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] );
104 return false;
105 } else {
106 ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex );
107 }
108 PassedCuts = PassedCuts + 1; // passed eta cut
109
110 // ET_em
111 ATH_MSG_DEBUG( "Photon: ET_em=" << ET << " cut: >" << m_eTthr[cutIndex] );
112 if ( ET < m_eTthr[cutIndex] ) {
113 ATH_MSG_DEBUG("REJECT et cut failed");
114 return false;
115 }
116 PassedCuts = PassedCuts + 1; // ET_em
117
118
119
120
121 // apply cuts: DeltaEta( clus-ROI )
122 ATH_MSG_DEBUG( "Photon : eta=" << pClus->eta() << " roi eta=" << etaRef << " DeltaEta=" << dEta
123 << " cut: <" << m_detacluster );
124
125 if ( std::abs( pClus->eta() - etaRef ) > m_detacluster ) {
126 ATH_MSG_DEBUG("REJECT Photon a cut failed");
127 return false;
128 }
129 PassedCuts = PassedCuts + 1; //Deta
130
131 // DeltaPhi( clus-ROI )
132 ATH_MSG_DEBUG( ": phi=" << pClus->phi() << " roi phi="<< phiRef << " DeltaPhi="<< dPhi
133 << " cut: <" << m_dphicluster );
134
135 if( dPhi > m_dphicluster ) {
136 ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed");
137 return false;
138 }
139 PassedCuts = PassedCuts + 1; //DPhi
140
141
142 // Apply phootn offline like selection
143 bool pass = input.isPassed(ph, m_pidName);
144
145
146
147 float Rhad1(0), Rhad(0), Reta(0), Rphi(0), e277(0), weta2c(0), //emax2(0),
148 Eratio(0), DeltaE(0), f1(0), weta1c(0), wtot(0), fracm(0);
149 float ptcone20(999), ptcone30(999), ptcone40(999), etcone20(999), etcone30(999), etcone40(999), topoetcone20(999), topoetcone30(999), topoetcone40(999), reletcone20(999);
150
151
152 // variables based on HCAL
153 // transverse energy in 1st scintillator of hadronic calorimeter/ET
155 // transverse energy in hadronic calorimeter/ET
157
158 // variables based on S2 of EM CAL
159 // E(7*7) in 2nd sampling
161 // E(3*7)/E(7*7) in 2nd sampling
163 // E(3*3)/E(3*7) in 2nd sampling
165 // shower width in 2nd sampling
167
168 // variables based on S1 of EM CAL
169 // fraction of energy reconstructed in the 1st sampling
171 // shower width in 3 strips in 1st sampling
173 // E of 2nd max between max and min in strips [NOT USED]
174 // eg->showerShapeValue(emax2, xAOD::EgammaParameters::e2tsts1);
175 // (E of 1st max in strips-E of 2nd max)/(E of 1st max+E of 2nd max)
177 // E(2nd max)-E(min) in strips
179 // total shower width in 1st sampling
181 // E(+/-3)-E(+/-1)/E(+/-1)
183
184 ph->isolationValue(ptcone20, xAOD::Iso::ptcone20);
185
186 ph->isolationValue(ptcone30, xAOD::Iso::ptcone30);
187
188 ph->isolationValue(ptcone40, xAOD::Iso::ptcone40);
189
190 ph->isolationValue(etcone20, xAOD::Iso::etcone20);
191
192 ph->isolationValue(etcone30, xAOD::Iso::etcone30);
193
194 ph->isolationValue(etcone40, xAOD::Iso::etcone40);
195
196 ph->isolationValue(topoetcone20, xAOD::Iso::topoetcone20);
197
198 ph->isolationValue(topoetcone30, xAOD::Iso::topoetcone30);
199
200 ph->isolationValue(topoetcone40, xAOD::Iso::topoetcone40);
201
202 ATH_MSG_DEBUG( " Rhad1 " << Rhad1 ) ;
203 ATH_MSG_DEBUG( " Rhad " << Rhad ) ;
204 ATH_MSG_DEBUG( " e277 " << e277 ) ;
205 ATH_MSG_DEBUG( " Reta " << Reta ) ;
206 ATH_MSG_DEBUG( " Rphi " << Rphi ) ;
207 ATH_MSG_DEBUG( " weta2c " << weta2c ) ;
208 ATH_MSG_DEBUG( " f1 " << f1 ) ;
209 ATH_MSG_DEBUG( " weta1c " << weta1c ) ;
210 ATH_MSG_DEBUG( " Eratio " << Eratio ) ;
211 ATH_MSG_DEBUG( " DeltaE " << DeltaE ) ;
212 ATH_MSG_DEBUG( " wtot " << wtot ) ;
213 ATH_MSG_DEBUG( " fracm " << fracm ) ;
214 ATH_MSG_DEBUG( " ptcone20 " << ptcone20 ) ;
215 ATH_MSG_DEBUG( " ptcone30 " << ptcone30 ) ;
216 ATH_MSG_DEBUG( " ptcone40 " << ptcone40 ) ;
217 ATH_MSG_DEBUG( " etcone20 " << etcone20 ) ;
218 ATH_MSG_DEBUG( " etcone30 " << etcone30 ) ;
219 ATH_MSG_DEBUG( " etcone40 " << etcone40 ) ;
220 ATH_MSG_DEBUG( " topoetcone20 " << topoetcone20 ) ;
221 ATH_MSG_DEBUG( " topoetcone30 " << topoetcone30 ) ;
222 ATH_MSG_DEBUG( " topoetcone40 " << topoetcone40 ) ;
223 // Monitor showershapes
224 reletcone20 = etcone20/ph->caloCluster()->et();
225 ATH_MSG_DEBUG("reletcone20 = " <<reletcone20 );
226 ATH_MSG_DEBUG("m_RelEtConeCut = " << m_RelTopoEtConeCut );
227
228
229 // Decode isEM bits of result to see which bits passed and which bits fialed
230 if ( !pass ){
231 ATH_MSG_DEBUG("REJECT isEM failed");
232 return false;
233 } else {
234 ATH_MSG_DEBUG("ACCEPT isEM passed");
235 }
236
237
238 // Check if need to apply isolation
239 // First check logic. if cut is very negative, then no isolation cut is defined
240 // if m_RelEtConeCut <-100 then hypo is configured not to apply isolation
241 if (m_RelTopoEtConeCut < -100){
242 ATH_MSG_DEBUG(" not applying isolation. Returning NOW");
243 ATH_MSG_DEBUG("TAccept = " << pass);
244 return true;
245 }
246 // Then, It will pass if reletcone20 is less than cut:
247 pass = (reletcone20 < m_RelTopoEtConeCut);
248 //
249 // Reach this point successfully
250 ATH_MSG_DEBUG( "pass = " << pass );
251
252 return pass;
253
254}
255
257
259 const float absEta = std::abs(eta);
260 auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } );
261 if ( binIterator == m_etabin.end() ) {
262 return -1;
263 }
264 return binIterator - m_etabin.begin();
265}
#define M_PI
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
virtual double phi() const override final
Methods to retrieve data members.
virtual double eta() const override final
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
virtual unsigned int roiId() const override final
these quantities probably don't need to be used any more
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
int findCutIndex(float eta) const
==========================================================================
virtual StatusCode initialize() override
==========================================================================
bool decide(const TrigData &input, const xAOD::Photon *ph) const
==========================================================================
virtual bool emulate(const TrigData &input, bool &pass) const override
==========================================================================
bool showerShapeValue(float &value, const EgammaParameters::ShowerShapeType information) const
Accessor for ShowerShape values.
bool isolationValue(float &value, const Iso::IsolationType information) const
old Accessor for Isolation values.
Definition Egamma_v1.h:251
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
The common trigger namespace for trigger analysis tools.
@ wtots1
shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips...
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition EgammaEnums.h:81
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
Definition EgammaEnums.h:53
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
@ DeltaE
e2tsts1-emins1
@ fracs1
shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n) is the energy in ± n strip...
@ weta2
the lateral width is calculated with a window of 3x5 cells using the energy weighted sum over all cel...
@ weta1
shower width using +/-3 strips around the one with the maximal energy deposit: w3 strips = sqrt{sum(E...
Definition EgammaEnums.h:98
@ topoetcone20
Topo-cluster ET-sum.
@ etcone20
Calorimeter isolation.
@ ptcone20
Track isolation.
Photon_v1 Photon
Definition of the current "egamma version".