ATLAS Offline Software
TrigEgammaEmulationFastCaloHypoTool.cxx
Go to the documentation of this file.
1 
2 
4 #include "GaudiKernel/SystemOfUnits.h"
5 
6 
7 using namespace Trig;
8 
9 //**********************************************************************
10 
13 {}
14 
16 
18 {
20  return StatusCode::SUCCESS;
21 }
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 
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 }
Trig::TrigEgammaEmulationFastCaloHypoTool::decide_ringer
bool decide_ringer(const Trig::TrigData &input) const
==========================================================================
Definition: TrigEgammaEmulationFastCaloHypoTool.cxx:249
Trig::TrigEgammaEmulationFastCaloHypoTool::m_hadeTthr
Gaudi::Property< std::vector< float > > m_hadeTthr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:48
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
Trig::TrigEgammaEmulationFastCaloHypoTool::m_useRinger
Gaudi::Property< bool > m_useRinger
Definition: TrigEgammaEmulationFastCaloHypoTool.h:39
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
Trig::TrigEgammaEmulationFastCaloHypoTool::m_caeratiothr
Gaudi::Property< std::vector< float > > m_caeratiothr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:51
egammaEnergyPositionAllSamples::e1
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Trig::TrigEgammaEmulationFastCaloHypoTool::m_emEtCut
Gaudi::Property< float > m_emEtCut
Definition: TrigEgammaEmulationFastCaloHypoTool.h:41
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
Trig::TrigEgammaEmulationFastCaloHypoTool::m_detacluster
Gaudi::Property< float > m_detacluster
Definition: TrigEgammaEmulationFastCaloHypoTool.h:56
Trig::TrigEgammaEmulationFastCaloHypoTool::m_hadeT2thr
Gaudi::Property< std::vector< float > > m_hadeT2thr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:49
Trig::TrigEgammaEmulationBaseHypoTool
Definition: TrigEgammaEmulationBaseHypoTool.h:22
Trig::TrigEgammaEmulationFastCaloHypoTool::decide
bool decide(const Trig::TrigData &input) const
==========================================================================
Definition: TrigEgammaEmulationFastCaloHypoTool.cxx:49
TrigEgammaEmulationFastCaloHypoTool.h
Trig::TrigEgammaEmulationFastCaloHypoTool::m_acceptAll
Gaudi::Property< bool > m_acceptAll
Definition: TrigEgammaEmulationFastCaloHypoTool.h:38
Trig::TrigEgammaEmulationFastCaloHypoTool::findCutIndex
int findCutIndex(float eta) const
==========================================================================
Definition: TrigEgammaEmulationFastCaloHypoTool.cxx:283
Trig::TrigEgammaEmulationFastCaloHypoTool::m_F3thr
Gaudi::Property< std::vector< float > > m_F3thr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:55
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
Trig::TrigEgammaEmulationBaseHypoTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: TrigEgammaEmulationBaseHypoTool.cxx:17
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Trig::TrigEgammaEmulationFastCaloHypoTool::m_carcorethr
Gaudi::Property< std::vector< float > > m_carcorethr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:50
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trig::TrigEgammaEmulationFastCaloHypoTool::m_eTthr
Gaudi::Property< std::vector< float > > m_eTthr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:46
Trig::TrigEgammaEmulationFastCaloHypoTool::m_dphicluster
Gaudi::Property< float > m_dphicluster
Definition: TrigEgammaEmulationFastCaloHypoTool.h:57
Trig::TrigEgammaEmulationFastCaloHypoTool::emulate
virtual bool emulate(const Trig::TrigData &input, bool &pass) const override
==========================================================================
Definition: TrigEgammaEmulationFastCaloHypoTool.cxx:26
Trig::TrigEgammaEmulationFastCaloHypoTool::m_pidName
Gaudi::Property< std::string > m_pidName
Definition: TrigEgammaEmulationFastCaloHypoTool.h:40
Trig::TrigEgammaEmulationFastCaloHypoTool::m_eT2thr
Gaudi::Property< std::vector< float > > m_eT2thr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:47
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
Trig::TrigEgammaEmulationFastCaloHypoTool::m_WETA2thr
Gaudi::Property< std::vector< float > > m_WETA2thr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:53
TrigRoiDescriptor::roiId
virtual unsigned int roiId() const override final
these quantities probably don't need to be used any more
Definition: TrigRoiDescriptor.h:133
Trig::TrigEgammaEmulationFastCaloHypoTool::initialize
virtual StatusCode initialize() override
==========================================================================
Definition: TrigEgammaEmulationFastCaloHypoTool.cxx:17
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
RoiDescriptor::phi
virtual double phi() const override final
Methods to retrieve data members.
Definition: RoiDescriptor.h:100
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
Trig::TrigEgammaEmulationFastCaloHypoTool::TrigEgammaEmulationFastCaloHypoTool
TrigEgammaEmulationFastCaloHypoTool(const std::string &myname)
Definition: TrigEgammaEmulationFastCaloHypoTool.cxx:11
Trig::TrigEgammaEmulationBaseHypoTool::avgmu
float avgmu() const
Definition: TrigEgammaEmulationBaseHypoTool.cxx:26
Trig::TrigData
Definition: TrigEgammaEmulationToolMT.h:40
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:232
RoiDescriptor::eta
virtual double eta() const override final
Definition: RoiDescriptor.h:101
Trig::TrigEgammaEmulationFastCaloHypoTool::m_WSTOTthr
Gaudi::Property< std::vector< float > > m_WSTOTthr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:54
egammaEnergyPositionAllSamples::e0
double e0(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in pre-sampler
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
Trig::TrigEgammaEmulationFastCaloHypoTool::m_F1thr
Gaudi::Property< std::vector< float > > m_F1thr
Definition: TrigEgammaEmulationFastCaloHypoTool.h:52
Trig::TrigEgammaEmulationFastCaloHypoTool::m_etabin
Gaudi::Property< std::vector< float > > m_etabin
selection variable for L2 calo selection:eta bins
Definition: TrigEgammaEmulationFastCaloHypoTool.h:45