ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaForwardPrecisionCaloHypoTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <algorithm>
12
13
14namespace TCU = TrigCompositeUtils;
15
17 const std::string& name,
18 const IInterface* parent )
19 : base_class( type, name, parent ),
20 m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
21
23{
24 ATH_MSG_DEBUG( "Initialization completed successfully" );
25 ATH_MSG_DEBUG( "EtaBins = " << m_etabin );
26 ATH_MSG_DEBUG( "ETthr = " << m_eTthr << "( lo )/" << m_eT2thr << "( hi )" );
27 ATH_MSG_DEBUG( "dPHICLUSTERthr = " << m_dphicluster );
28 ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster );
29
30 if ( m_etabin.size() == 0 ) {
31 ATH_MSG_ERROR( " There are no cuts set (EtaBins property is an empty list)" );
32 return StatusCode::FAILURE;
33 }
34
35 unsigned int nEtaBin = m_etabin.size();
36
37#define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \
38 { ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; }
39
40 CHECK_SIZE( eTthr );
41 CHECK_SIZE( eT2thr );
42#undef CHECK_SIZE
43
44
45
46 ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId );
47
48 if ( not m_monTool.name().empty() )
49 CHECK( m_monTool.retrieve() );
50
51 return StatusCode::SUCCESS;
52}
53
54
56
57 bool pass = false;
58
59 auto dEta = Monitored::Scalar( "dEta", -1. );
60 auto dPhi = Monitored::Scalar( "dPhi", -1. );
61 auto eT_Cluster = Monitored::Scalar( "Et_em" , -1.0 );
62 auto etaBin = Monitored::Scalar( "EtaBin", -1. );
63 auto monEta = Monitored::Scalar( "Eta", -99. );
64 auto monPhi = Monitored::Scalar( "Phi", -99. );
65 auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 );
66 auto monitorIt = Monitored::Group( m_monTool,dEta, dPhi, eT_Cluster,
67 etaBin, monEta,monPhi,PassedCuts );
68 // when leaving scope it will ship data to monTool
69 PassedCuts = PassedCuts + 1; //got called (data in place)
70
71 auto roiDescriptor = input.roi;
72
73
74 if ( std::abs( roiDescriptor->eta() ) > 2.6 ) {
75 ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" );
76 pass=false; // special case
77 return pass;
78 }
79
80 ATH_MSG_INFO( "; RoI ID = " << roiDescriptor->roiId()
81 << ": Eta = " << roiDescriptor->eta()
82 << ", Phi = " << roiDescriptor->phi() );
83
84 // fill local variables for RoI reference position
85 double etaRef = roiDescriptor->eta();
86 double phiRef = roiDescriptor->phi();
87 // correct phi the to right range ( probably not needed anymore )
88 if ( std::abs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range
89
90
91 auto pClus = input.cluster;
92
93 float absEta = std::abs( pClus->eta() );
94 const int cutIndex = findCutIndex( absEta );
95
96
97
98 dEta = pClus->eta() - etaRef;
99 // Deal with angle diferences greater than Pi
100 dPhi = std::abs( pClus->phi() - phiRef );
101 dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only <
102 eT_Cluster = pClus->et();
103 // apply cuts: DeltaEta( clus-ROI )
104 ATH_MSG_INFO( "CaloCluster: eta=" << pClus->eta()
105 << " roi eta=" << etaRef << " DeltaEta=" << dEta
106 << " cut: <" << m_detacluster );
107
108 if ( std::abs( pClus->eta() - etaRef ) > m_detacluster ) {
109 ATH_MSG_DEBUG("REJECT Cluster dEta cut failed");
110 return pass;
111 }
112 PassedCuts = PassedCuts + 1; //Deta
113
114 // DeltaPhi( clus-ROI )
115 ATH_MSG_DEBUG( ": phi=" << pClus->phi()
116 << " roi phi="<< phiRef << " DeltaPhi="<< dPhi
117 << " cut: <" << m_dphicluster );
118
119 if( dPhi > m_dphicluster ) {
120 ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed");
121 return pass;
122 }
123 PassedCuts = PassedCuts + 1; //DPhi
124
125 // eta range
126 if ( cutIndex == -1 ) { // VD
127 ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] );
128 return pass;
129 } else {
130 ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex );
131 }
132 PassedCuts = PassedCuts + 1; // passed eta cut
133
134 // ET_em
135 ATH_MSG_DEBUG( "CaloCluster: ET_em=" << eT_Cluster << " cut: >" << m_eTthr[cutIndex] );
136 if ( eT_Cluster < m_eTthr[cutIndex] ) {
137 ATH_MSG_DEBUG("REJECT et cut failed");
138 return pass;
139 }
140 PassedCuts = PassedCuts + 1; // ET_em
141
142 // got this far => passed!
143 pass = true;
144
145 // Reach this point successfully
146 ATH_MSG_DEBUG( "pass = " << pass );
147
148 return pass;
149
150}
151
153 const float absEta = std::abs(eta);
154
155 auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } );
156 if ( binIterator == m_etabin.end() ) {
157 return -1;
158 }
159 return binIterator - m_etabin.begin();
160}
161
162
163StatusCode TrigEgammaForwardPrecisionCaloHypoTool::decide( std::vector<ClusterInfo>& input ) const {
164 for ( auto& i: input ) {
165 if ( TCU::passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
166 if ( decide( i ) ) {
167 TCU::addDecisionID( m_decisionId, i.decision );
168 }
169 }
170 }
171 return StatusCode::SUCCESS;
172}
#define M_PI
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Header file to be included by clients of the Monitored infrastructure.
#define CHECK_SIZE(__n)
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
virtual StatusCode decide(std::vector< ITrigEgammaForwardPrecisionCaloHypoTool::ClusterInfo > &input) const override
Gaudi::Property< std::vector< float > > m_etabin
selection variable for PRECISION calo selection:eta bins
TrigEgammaForwardPrecisionCaloHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.