ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaEmulationFastCaloHypoTool.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#include "GaudiKernel/SystemOfUnits.h"
7
8
9using namespace Trig;
10
11//**********************************************************************
12
16
18
24
26
27
29 bool &pass ) const
30{
31 pass = false;
32
33 if(!input.roi){
34 ATH_MSG_DEBUG( "RoI is null ptr");
35 return false;
36 }
37
38 if(!input.emCluster){
39 ATH_MSG_DEBUG( "Cluster is null ptr");
40 return false;
41 }
42
43 pass = m_useRinger? decide_ringer(input) : decide(input);
44
45 return true;
46}
47
49
50
52{
53 const TrigRoiDescriptor *roiDescriptor = input.roi;
54 bool pass = false;
55 int PassedCuts=0;
56 float rCore = 0, F1 =0 , F3 = 0, Weta2 = 0, Wstot = 0 , hadET_T2Calo = 0, energyRatio = -1;
57
58
59 // when leaving scope it will ship data to monTool
60 PassedCuts = PassedCuts + 1; //got called (data in place)
61
62 if ( m_acceptAll ) {
63 pass = true;
64 ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" );
65 } else {
66 pass = false;
67 ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" );
68 }
69
70
71 if ( std::abs( roiDescriptor->eta() ) > 2.6 ) {
72 ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" );
73 pass=false; // special case
74 return pass;
75 }
76
77 ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId()
78 << ": Eta = " << roiDescriptor->eta()
79 << ", Phi = " << roiDescriptor->phi() );
80
81 // fill local variables for RoI reference position
82 float etaRef = roiDescriptor->eta();
83 float phiRef = roiDescriptor->phi();
84 // correct phi the to right range ( probably not needed anymore )
85 if ( std::abs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range
86
87 auto pClus = input.emCluster;
88 float absEta = std::abs( pClus->eta() );
89
90 const int cutIndex = findCutIndex( absEta );
91
92 // find if electron is in calorimeter crack
93 bool inCrack = ( absEta > 2.37 || ( absEta > 1.37 && absEta < 1.52 ) );
94 float dEta = pClus->eta() - etaRef;
95
96 // Deal with angle diferences greater than Pi
97 float dPhi = std::abs( pClus->phi() - phiRef );
98 dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only <
99
100 // calculate cluster quantities // definition taken from TrigElectron constructor
101 if ( pClus->emaxs1() + pClus->e2tsts1() > 0 )
102 energyRatio = ( pClus->emaxs1() - pClus->e2tsts1() ) / ( pClus->emaxs1() + pClus->e2tsts1() );
103
104 // ( VD ) here the definition is a bit different to account for the cut of e277 @ EF
105 if ( pClus->e277()!= 0. ) rCore = pClus->e237() / pClus->e277();
106
107 //fraction of energy deposited in 1st sampling
108 if ( std::abs( pClus->energy() ) > 0.00001 ) F1 = ( pClus->energy( CaloSampling::EMB1 )+pClus->energy( CaloSampling::EME1 ) )/pClus->energy();
109 float eT_T2Calo = pClus->et();
110 if ( eT_T2Calo!=0 && pClus->eta()!=0 ) hadET_T2Calo = pClus->ehad1()/cosh( fabs( pClus->eta() ) )/eT_T2Calo;
111
112 //extract Weta2 varable
113 Weta2 = pClus->weta2();
114
115 //extract Wstot varable
116 Wstot = pClus->wstot();
117
118 //extract F3 ( backenergy i EM calorimeter
119 float e0 = pClus->energy( CaloSampling::PreSamplerB ) + pClus->energy( CaloSampling::PreSamplerE );
120 float e1 = pClus->energy( CaloSampling::EMB1 ) + pClus->energy( CaloSampling::EME1 );
121 float e2 = pClus->energy( CaloSampling::EMB2 ) + pClus->energy( CaloSampling::EME2 );
122 float e3 = pClus->energy( CaloSampling::EMB3 ) + pClus->energy( CaloSampling::EME3 );
123 float eallsamples = e0+e1+e2+e3;
124 //coverity[DIVIDE_BY_ZERO:FALSE]
125 F3 = std::abs( eallsamples )>0. ? e3/eallsamples : 0.;
126
127 // apply cuts: DeltaEta( clus-ROI )
128 ATH_MSG_DEBUG( "TrigEMCluster: eta=" << pClus->eta()
129 << " roi eta=" << etaRef << " DeltaEta=" << dEta
130 << " cut: <" << m_detacluster );
131
132 if ( std::abs( pClus->eta() - etaRef ) > m_detacluster ) {
133 ATH_MSG_DEBUG("REJECT Cluster dEta cut failed");
134 return pass;
135 }
136 PassedCuts = PassedCuts + 1; //Deta
137
138 // DeltaPhi( clus-ROI )
139 ATH_MSG_DEBUG( ": phi=" << pClus->phi()
140 << " roi phi="<< phiRef << " DeltaPhi="<< dPhi
141 << " cut: <" << m_dphicluster );
142
143 if( dPhi > m_dphicluster ) {
144 ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed");
145 return pass;
146 }
147 PassedCuts = PassedCuts + 1; //DPhi
148
149 // eta range
150 if ( cutIndex == -1 ) { // VD
151 ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] );
152 return pass;
153 }
154 else {
155 ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex );
156 }
157 PassedCuts = PassedCuts + 1; // passed eta cut
158
159 // Rcore
160 ATH_MSG_DEBUG ( "TrigEMCluster: Rcore=" << rCore
161 << " cut: >" << m_carcorethr[cutIndex] );
162 if ( rCore < m_carcorethr[cutIndex] ) {
163 ATH_MSG_DEBUG("REJECT rCore cut failed");
164 return pass;
165 }
166 PassedCuts = PassedCuts + 1; //Rcore
167
168 // Eratio
169 ATH_MSG_DEBUG( " cut: >" << m_caeratiothr[cutIndex] );
170 if ( inCrack || F1 < m_F1thr[0] ) {
171 ATH_MSG_DEBUG ( "TrigEMCluster: InCrack= " << inCrack << " F1=" << F1 );
172 }
173 else {
174 if ( energyRatio < m_caeratiothr[cutIndex] ) {
175 ATH_MSG_DEBUG("REJECT e ratio cut failed");
176 return pass;
177 }
178 }
179 PassedCuts = PassedCuts + 1; //Eratio
180 if( inCrack ) energyRatio = -1; //Set default value in crack for monitoring.
181
182 // ET_em
183 ATH_MSG_DEBUG( "TrigEMCluster: ET_em=" << eT_T2Calo << " cut: >" << m_eTthr[cutIndex] );
184 if ( eT_T2Calo < m_eTthr[cutIndex] ) {
185 ATH_MSG_DEBUG("REJECT et cut failed");
186 return pass;
187 }
188 PassedCuts = PassedCuts + 1; // ET_em
189
190 float hadET_cut = 0.0;
191 // find which ET_had to apply : this depends on the ET_em and the eta bin
192 if ( eT_T2Calo > m_eT2thr[cutIndex] ) {
193 hadET_cut = m_hadeT2thr[cutIndex] ;
194 ATH_MSG_DEBUG ( "ET_em>" << m_eT2thr[cutIndex] << ": use high ET_had cut: <" << hadET_cut );
195 }
196 else {
197 hadET_cut = m_hadeTthr[cutIndex];
198 ATH_MSG_DEBUG ( "ET_em<" << m_eT2thr[cutIndex] << ": use low ET_had cut: <" << hadET_cut );
199 }
200
201 // ET_had
202 ATH_MSG_DEBUG ( "TrigEMCluster: ET_had=" << hadET_T2Calo << " cut: <" << hadET_cut );
203 if ( hadET_T2Calo > hadET_cut ) {
204 ATH_MSG_DEBUG("REJECT et had cut failed");
205 return pass;
206 }
207 PassedCuts = PassedCuts + 1; //ET_had
208
209 // F1
210 ATH_MSG_DEBUG ( "TrigEMCluster: F1=" << F1 << " cut: >" << m_F1thr[0] );
211 PassedCuts = PassedCuts + 1; //F1
212
213 //Weta2
214 ATH_MSG_DEBUG ( "TrigEMCluster: Weta2=" << Weta2 << " cut: <" << m_WETA2thr[cutIndex] );
215 if ( Weta2 > m_WETA2thr[cutIndex] ) {
216 ATH_MSG_DEBUG("REJECT weta 2 cut failed");
217 return pass;
218 }
219 PassedCuts = PassedCuts + 1; //Weta2
220
221 //Wstot
222 ATH_MSG_DEBUG ( "TrigEMCluster: Wstot=" <<Wstot << " cut: <" << m_WSTOTthr[cutIndex] );
223 if ( Wstot >= m_WSTOTthr[cutIndex] ) {
224 ATH_MSG_DEBUG("REJECT wstot cut failed");
225 return pass;
226 }
227 PassedCuts = PassedCuts + 1; //Wstot
228
229 //F3
230 ATH_MSG_DEBUG( "TrigEMCluster: F3=" << F3 << " cut: <" << m_F3thr[cutIndex] );
231 if ( F3 > m_F3thr[cutIndex] ) {
232 ATH_MSG_DEBUG("REJECT F3 cut failed");
233 return pass;
234 }
235 PassedCuts = PassedCuts + 1; //F3
236
237 // got this far => passed!
238 pass = true;
239
240 // Reach this point successfully
241 ATH_MSG_DEBUG( "pass = " << pass );
242
243 return pass;
244
245
246}
247
248
250
251
253{
254
255
256 if ( m_acceptAll ) {
257 return true;
258 ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" );
259 } else {
260 ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" );
261 }
262
263 if(input.emCluster->et() < m_emEtCut)
264 {
265 ATH_MSG_DEBUG( "Event reproved by Et threshold. Et = " << input.emCluster->et() << " EtCut = " << m_emEtCut );
266 return false;
267 }
268
269 if(!input.rings)
270 {
271 ATH_MSG_DEBUG( "Ringer is null ptr");
272 return false;
273 }
274
275
276 bool pass = input.isPassed( input.rings, avgmu(), m_pidName);
277
278
279 // got this far => passed!
280 return pass;
281}
282
283
285
287{
288 const float absEta = std::abs(eta);
289 auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } );
290 if ( binIterator == m_etabin.end() ) {
291 return -1;
292 }
293 return binIterator - m_etabin.begin();
294}
#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.
virtual StatusCode initialize() override
==========================================================================
int findCutIndex(float eta) const
==========================================================================
Gaudi::Property< std::vector< float > > m_etabin
selection variable for L2 calo selection:eta bins
bool decide_ringer(const Trig::TrigData &input) const
==========================================================================
bool decide(const Trig::TrigData &input) const
==========================================================================
Gaudi::Property< std::vector< float > > m_caeratiothr
virtual bool emulate(const Trig::TrigData &input, bool &pass) const override
==========================================================================
The common trigger namespace for trigger analysis tools.