ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaEmulationPrecisionCaloHypoTool.cxx
Go to the documentation of this file.
1
3#include "GaudiKernel/SystemOfUnits.h"
4
5
6using namespace Trig;
7
8//**********************************************************************
9
13
14
15
17
18
20 bool &pass) const
21{
22 pass=false;
23
24 if( !input.roi ) return false;
25
26 if( input.clusters.empty() ) return false;
27
28 for ( const auto &cl : input.clusters )
29 {
30 if( decide( input, cl ) ){
31 pass=true;
32 return true;
33 }
34 }
35
36 return false;
37}
38
39
40
41
43 const xAOD::CaloCluster *pClus ) const
44{
45 unsigned PassedCuts=0;
46
47 if(!input.roi){
48 ATH_MSG_DEBUG("L1 not found");
49 return false;
50 }
51
52 // when leaving scope it will ship data to monTool
53 PassedCuts = PassedCuts + 1; //got called (data in place)
54
55 auto roiDescriptor = input.roi;
56
57
58 if ( std::abs( roiDescriptor->eta() ) > 2.6 ) {
59 ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" );
60 return false;
61 }
62
63 ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId()
64 << ": Eta = " << roiDescriptor->eta()
65 << ", Phi = " << roiDescriptor->phi() );
66
67 // fill local variables for RoI reference position
68 double etaRef = roiDescriptor->eta();
69 double phiRef = roiDescriptor->phi();
70 // correct phi the to right range ( probably not needed anymore )
71 if ( std::abs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range
72
73 float absEta = std::abs( pClus->eta() );
74
75 const int cutIndex = findCutIndex( absEta );
76
77 float dEta = pClus->eta() - etaRef;
78 // Deal with angle diferences greater than Pi
79 float dPhi = std::abs( pClus->phi() - phiRef );
80 dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only <
81 float eT_Cluster = pClus->et();
82 // apply cuts: DeltaEta( clus-ROI )
83 ATH_MSG_DEBUG( "CaloCluster: eta=" << pClus->eta()
84 << " roi eta=" << etaRef << " DeltaEta=" << dEta
85 << " cut: <" << m_detacluster );
86
87 if ( std::abs( pClus->eta() - etaRef ) > m_detacluster ) {
88 ATH_MSG_DEBUG("REJECT Cluster dEta cut failed");
89 return false;
90 }
91 PassedCuts = PassedCuts + 1; //Deta
92
93 // DeltaPhi( clus-ROI )
94 ATH_MSG_DEBUG( ": phi=" << pClus->phi()
95 << " roi phi="<< phiRef << " DeltaPhi="<< dPhi
96 << " cut: <" << m_dphicluster );
97
98 if( dPhi > m_dphicluster ) {
99 ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed");
100 return false;
101 }
102 PassedCuts = PassedCuts + 1; //DPhi
103
104
105
106 // eta range
107 if ( cutIndex == -1 ) { // VD
108 ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] );
109 return false;
110 } else {
111 ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex );
112 }
113 PassedCuts = PassedCuts + 1; // passed eta cut
114
115 // ET_em
116 ATH_MSG_DEBUG( "CaloCluster: ET_em=" << eT_Cluster << " cut: >" << m_eTthr[cutIndex] );
117 if ( eT_Cluster < m_eTthr[cutIndex] ) {
118 ATH_MSG_DEBUG("REJECT et cut failed");
119 return false;
120 }
121 PassedCuts = PassedCuts + 1; // ET_em
122
123
124 // got this far => passed!
125 // Reach this point successfully
126 ATH_MSG_DEBUG( "pass!" );
127
128 return true;
129
130}
131
133
135 const float absEta = std::abs(eta);
136
137 auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } );
138 if ( binIterator == m_etabin.end() ) {
139 return -1;
140 }
141 return binIterator - m_etabin.begin();
142}
143
144
145
146
147
148
#define M_PI
Scalar eta() const
pseudorapidity method
#define ATH_MSG_DEBUG(x)
int findCutIndex(float eta) const
==========================================================================
bool decide(const TrigData &input, const xAOD::CaloCluster *) const
virtual bool emulate(const TrigData &input, bool &pass) const override
==========================================================================
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
The common trigger namespace for trigger analysis tools.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.