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