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