ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaFastPhotonHypoTool.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4*/
5
6
11
12namespace TCU = TrigCompositeUtils;
13
15 const std::string& name,
16 const IInterface* parent )
17 : AthAlgTool( type, name, parent ),
18 m_decisionId( HLT::Identifier::fromToolName( name ) ) {}
19
20
21
23
24 if ( !m_monTool.empty() )
25 ATH_CHECK( m_monTool.retrieve() );
26
27 ATH_MSG_DEBUG( "Initialization completed successfully:" );
28 ATH_MSG_DEBUG( "AcceptAll = " << ( m_acceptAll==true ? "True" : "False" ) );
29 ATH_MSG_DEBUG( "EtaBins = " << m_etabin );
30 ATH_MSG_DEBUG( "ETthr = " << m_eTthr << "(lo)/" << m_eT2thr << "(hi)" );
31 ATH_MSG_DEBUG( "HADETthr = " << m_hadeTthr << "(lo)/" << m_hadeT2thr << "(hi)" );
32 ATH_MSG_DEBUG( "CARCOREthr = " << m_carcorethr );
33 ATH_MSG_DEBUG( "CAERATIOthr = " << m_caeratiothr );
34
35
36 std::vector<size_t> sizes( {m_eTthr.size(), m_eT2thr.size(),
37 m_hadeTthr.size(), m_hadeT2thr.size(),
38 m_carcorethr.size(), m_caeratiothr.size() } );
39
40 if ( *std::min_element( sizes.begin(), sizes.end() ) != *std::max_element( sizes.begin(), sizes.end() ) ) {
41 ATH_MSG_ERROR( "Missconfiguration, cut properties listed above ( when DEBUG ) have different dimensions shortest: "
42 << *std::min_element( sizes.begin(), sizes.end() ) << " longest "
43 << *std::max_element( sizes.begin(), sizes.end() ) );
44 return StatusCode::FAILURE;
45 }
46
47 return StatusCode::SUCCESS;
48}
49
50//==================================================================
51
52StatusCode TrigEgammaFastPhotonHypoTool::decide( std::vector<PhotonInfo>& input) const {
53 for ( auto& i: input ) {
54 if ( TCU::passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) {
55 if ( decide( i.photon ) ) {
56 TCU::addDecisionID( m_decisionId, i.decision );
57 }
58 }
59 }
60 return StatusCode::SUCCESS;
61}
62
63//==================================================================
64
66
67 auto cutCounter = Monitored::Scalar<int>( "CutCounter", -1 );
68 auto mon_Et = Monitored::Scalar( "Et", -99. );
69 auto mon_Eta = Monitored::Scalar( "Eta", -99. );
70 auto mon_Phi = Monitored::Scalar( "Phi", -99. );
71 auto mon_Rcore = Monitored::Scalar( "Rcore", -99. );
72 auto mon_Eratio = Monitored::Scalar( "Eratio", -99. );
73 auto mon_HadEt = Monitored::Scalar( "Et_had", -99. );
74 auto mon_F1 = Monitored::Scalar( "F1", -99. );
75 auto mon_HadEmRatio = Monitored::Scalar( "HadEmRatio", -99. );
76 auto monitorIt = Monitored::Group( m_monTool,
77 cutCounter,
78 mon_Et,
79 mon_Eta, mon_Phi,
80 mon_Rcore, mon_Eratio,
81 mon_HadEt, mon_F1,mon_HadEmRatio );
82
83 float EmET = -99.0;
84 float HadEmRatio = -99.0;
85 float Reta = -99.0;
86 float Eratio = -99.0;
87 float f1 = -99.0;
88 float HadET = -99.0;
89
90 if(!photon) return false;
91
92 cutCounter++;
93
94 // Determine which eta bin to apply the cuts
95 float absEta = std::abs( photon->eta() );
96
97 int etaBin = findCutIndex(absEta);
98
99 // getting photon variable
100 Eratio = photon->eratio();
101 Reta = photon->rcore();
102 EmET = photon->pt();
103 HadET = photon->etHad();
104 f1 = photon->f1();
105
106 if(m_acceptAll) {
107 ATH_MSG_DEBUG ( "Accept all property is set: TrigPhoton: ET_em=" << EmET << " cut in etaBin "
108 << etaBin << " is ET_em >= " << m_eTthr[0] );
109 return true;
110 }
111
112 // eta range
113 if ( etaBin==-1 ) {
114 ATH_MSG_DEBUG( "Photon FAILS eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] );
115 return false;
116 } else {
117 ATH_MSG_DEBUG( "eta bin used for cuts " << etaBin );
118 }
119 cutCounter++; // passed eta cut
120 mon_Eta = photon->eta();
121 mon_Phi = photon->phi();
122
123 // ET_em
124 if ( EmET < m_eTthr[etaBin]) {
125 ATH_MSG_DEBUG( "TrigPhoton FAILS ET_em=" << EmET
126 << " not in etaBin " << etaBin << " is ET_em < " << m_eTthr[etaBin] );
127 return false;
128 }
129 mon_Et = EmET;
130 cutCounter++; // passed ET threshold cut
131
132 // Reta (was previously called Rcore)
133 if ( Reta < m_carcorethr[etaBin] ){
134 ATH_MSG_DEBUG( "FastPhoton FAILS Reta=" << Reta << " cut in etaBin "
135 << etaBin << " is Reta >= " << m_carcorethr[etaBin] );
136 return false;
137 }
138 mon_Rcore = Reta;
139 cutCounter++;
140
141
142 // // Eratio
143 bool inCrack = ( absEta > 2.37 || ( absEta > 1.37 && absEta < 1.52) );
144 if ( inCrack || f1<m_F1thr[etaBin] ) {
145 ATH_MSG_DEBUG( "FastPhoton: InCrack= " << inCrack << " F1=" << f1
146 << " Eratio cut not being applied" );
147 } else {
148 if ( Eratio < m_caeratiothr[etaBin] ) {
149 ATH_MSG_DEBUG( "FastPhoton FAILS Eratio=" << Eratio << " cut in etaBin "
150 << etaBin << " is Eratio >= " << m_caeratiothr[etaBin] );
151 return false;
152 }
153 }
154 cutCounter++;
155 if(inCrack) Eratio = -1; //Set default value in crack for monitoring.
156 mon_Eratio = Eratio;
157 mon_F1 = f1;
158 // ET_had
159 // find which ET_had to apply : this depends on the ET_em and the eta bin
160 float hadET_cut=-1;
161
162 if ( EmET > m_eT2thr[etaBin] ) {
163 hadET_cut = m_hadeT2thr[etaBin] ;
164 ATH_MSG_DEBUG( "ET_em>" << m_eT2thr[etaBin] );
165 } else {
166 hadET_cut = m_hadeTthr[etaBin];
167 ATH_MSG_DEBUG( "ET_em<" << m_eT2thr[etaBin] );
168 }
169
170 HadEmRatio = (EmET!=0) ? HadET/EmET : -1.0;
171
172 if ( HadEmRatio > hadET_cut ){
173 ATH_MSG_DEBUG( "FastPhoton FAILS ET_had=" << HadEmRatio << " cut in etaBin "
174 << etaBin << " is ERatio >= " << hadET_cut );
175 return false;
176
177 }
178 mon_HadEt = HadET;
179 mon_HadEmRatio = HadEmRatio;
180 cutCounter++;
181 ATH_MSG_DEBUG( "FastPhoton PASS");
182
183 return true;
184
185}
186
187//==================================================================
188
190 const float absEta = std::abs(eta);
191 auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } );
192 if ( binIterator == m_etabin.end() ) {
193 return -1;
194 }
195 return binIterator - m_etabin.begin();
196}
197
198
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
Gaudi::Property< std::vector< float > > m_caeratiothr
Gaudi::Property< std::vector< float > > m_etabin
Gaudi::Property< std::vector< float > > m_F1thr
Gaudi::Property< std::vector< float > > m_hadeT2thr
TrigEgammaFastPhotonHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::vector< float > > m_hadeTthr
ToolHandle< GenericMonitoringTool > m_monTool
Gaudi::Property< std::vector< float > > m_eT2thr
virtual StatusCode initialize() override
Gaudi::Property< std::vector< float > > m_eTthr
Gaudi::Property< std::vector< float > > m_carcorethr
StatusCode decide(std::vector< PhotonInfo > &decisions) const
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.
TrigPhoton_v1 TrigPhoton
Declare the latest version of TrigPhoton.