ATLAS Offline Software
Loading...
Searching...
No Matches
TrigT1CaloMonErrorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6#include "GaudiKernel/IInterface.h"
7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/StatusCode.h"
12
17// #include "xAODTrigL1Calo/CPMRoIContainer.h"
18// #include "xAODTrigL1Calo/JEMRoIContainer.h"
19
20
26
31
32
34
36
37namespace LVL1 {
38
39
40// Constructor
41
43 const std::string& name)
44 : AsgTool(name)
45{
46
47 declareProperty("TriggerTowerLocation",
50 declareProperty("CPMTowerLocation",
52 declareProperty("CPMTowerLocationOverlap",
55 declareProperty("CMXCPTobLocation",
57 declareProperty("CMXCPHitsLocation",
59 declareProperty("CPMTobRoILocation",
61 declareProperty("JetElementLocation",
63 declareProperty("JetElementLocationOverlap",
66 declareProperty("CMXJetTobLocation",
68 declareProperty("CMXJetHitsLocation",
70 declareProperty("JEMTobRoILocation",
72 declareProperty("CMXRoILocation",
74 declareProperty("JEMEtSumsLocation",
76 declareProperty("CMXEtSumsLocation",
78 declareProperty("RodHeaderLocation",
80 declareProperty("RodHeaderLocationCPRoIB",
82 declareProperty("RodHeaderLocationJEPRoIB",
84 declareProperty("L1CaloErrorLocation",
85 m_robErrorVectorLocation = "L1CaloUnpackingErrors");
86 declareProperty("FlagCorruptEvents", m_flagCorruptEvents = "FullEventTimeout",
87 "Can be FullEventTimeout, AnyROBOrUnpackingError or None");
88
89}
90
91// Destructor
92
96
97// Initialize
98
100{
101 msg(MSG::INFO) << "Initializing " << name() << endmsg;
102
103 ATH_CHECK( m_eventInfoKey.initialize() );
104 return StatusCode::SUCCESS;
105}
106
107// Finalize
108
110{
111 return StatusCode::SUCCESS;
112}
113
114// Retrieve error vector
115
116StatusCode TrigT1CaloMonErrorTool::retrieve(const std::vector<unsigned int>*&
117 errColl)
118{
119
120 // Must ensure bytestream converters have unpacked all our data
121 // before retrieving error vector.
122
123 StatusCode sc;
124
125 //Retrieve Trigger Towers from SG
126 const xAOD::TriggerTowerContainer* triggerTowerTES = 0;
127 const xAOD::TriggerTowerContainer* triggerTowerSpareTES = 0;
128 const xAOD::TriggerTowerContainer* triggerTowerMuonTES = 0;
129 sc = evtStore()->retrieve(triggerTowerTES, m_triggerTowerLocation);
130 if ( sc.isFailure() || !triggerTowerTES ) {
131 msg(MSG::DEBUG) << "No Trigger Tower container found" << endmsg;
132 }
134 sc = evtStore()->retrieve(triggerTowerSpareTES,
135 m_triggerTowerLocation + "Spare");
136 } else sc = StatusCode::FAILURE;
137 if ( sc.isFailure() || !triggerTowerSpareTES ) {
138 msg(MSG::DEBUG) << "No Spare Trigger Tower container found" << endmsg;
139 }
141 sc = evtStore()->retrieve(triggerTowerMuonTES,
142 m_triggerTowerLocation + "Muon");
143 } else sc = StatusCode::FAILURE;
144 if ( sc.isFailure() || !triggerTowerMuonTES ) {
145 msg(MSG::DEBUG) << "No Tile Muon Trigger Tower container found" << endmsg;
146 }
147
148 //Retrieve Core and Overlap CPM Towers from SG
149 const xAOD::CPMTowerContainer* cpmTowerTES = 0;
150 const xAOD::CPMTowerContainer* cpmTowerOvTES = 0;
151 sc = evtStore()->retrieve(cpmTowerTES, m_cpmTowerLocation);
152 if ( sc.isFailure() || !cpmTowerTES ) {
153 msg(MSG::DEBUG) << "No Core CPM Tower container found" << endmsg;
154 }
156 sc = evtStore()->retrieve(cpmTowerOvTES, m_cpmTowerLocationOverlap);
157 } else sc = StatusCode::FAILURE;
158 if ( sc.isFailure() || !cpmTowerOvTES ) {
159 msg(MSG::DEBUG) << "No Overlap CPM Tower container found" << endmsg;
160 }
161
162 //Retrieve CPM RoIs from SG
163 const xAOD::CPMTobRoIContainer* cpmRoiTES = 0;
164 sc = evtStore()->retrieve( cpmRoiTES, m_cpmRoiLocation);
165 if ( sc.isFailure() || !cpmRoiTES ) {
166 msg(MSG::DEBUG) << "No CPM RoIs container found" << endmsg;
167 }
168
169 //Retrieve CMX-CP TOBs from SG
170 const xAOD::CMXCPTobContainer* cmxCpTobTES = 0;
171 sc = evtStore()->retrieve( cmxCpTobTES, m_cmxCpTobLocation);
172 if ( sc.isFailure() || !cmxCpTobTES ) {
173 msg(MSG::DEBUG) << "No CMX-CP TOB container found" << endmsg;
174 }
175
176 //Retrieve CMX-CP Hits from SG
177 const xAOD::CMXCPHitsContainer* cmxCpHitsTES = 0;
178 sc = evtStore()->retrieve( cmxCpHitsTES, m_cmxCpHitsLocation);
179 if ( sc.isFailure() || !cmxCpHitsTES ) {
180 msg(MSG::DEBUG) << "No CMX-CP Hits container found" << endmsg;
181 }
182
183 //Retrieve Core and Overlap Jet Elements from SG
184 const xAOD::JetElementContainer* jetElementTES = 0;
185 const xAOD::JetElementContainer* jetElementOvTES = 0;
186 sc = evtStore()->retrieve(jetElementTES, m_jetElementLocation);
187 if ( sc.isFailure() || !jetElementTES ) {
188 msg(MSG::DEBUG) << "No Core Jet Element container found" << endmsg;
189 }
191 sc = evtStore()->retrieve(jetElementOvTES, m_jetElementLocationOverlap);
192 } else sc = StatusCode::FAILURE;
193 if ( sc.isFailure() || !jetElementOvTES ) {
194 msg(MSG::DEBUG) << "No Overlap Jet Element container found" << endmsg;
195 }
196
197 //Retrieve JEM RoIs from SG
198 const xAOD::JEMTobRoIContainer* jemRoiTES = 0;
199 sc = evtStore()->retrieve( jemRoiTES, m_jemRoiLocation);
200 if ( sc.isFailure() || !jemRoiTES ) {
201 msg(MSG::DEBUG) << "No DAQ JEM RoIs container found" << endmsg;
202 }
203
204 //Retrieve CMX-Jet TOBs from SG
205 const xAOD::CMXJetTobContainer* cmxJetTobTES = 0;
206 sc = evtStore()->retrieve( cmxJetTobTES, m_cmxJetTobLocation);
207 if ( sc.isFailure() || !cmxJetTobTES ) {
208 msg(MSG::DEBUG) << "No CMX-Jet TOB container found" << endmsg;
209 }
210
211 //Retrieve CMX-Jet Hits from SG
212 const xAOD::CMXJetHitsContainer* cmxJetHitsTES = 0;
213 sc = evtStore()->retrieve( cmxJetHitsTES, m_cmxJetHitsLocation);
214 if ( sc.isFailure() || !cmxJetHitsTES ) {
215 msg(MSG::DEBUG) << "No CMX-Jet Hits container found" << endmsg;
216 }
217
218 //Retrieve CMX RoIs from SG
219 const xAOD::CMXRoIContainer* cmxRoiTES = 0;
220 sc = evtStore()->retrieve( cmxRoiTES, m_cmxRoiLocation);
221 if ( sc.isFailure() || !cmxRoiTES ) {
222 msg(MSG::DEBUG) << "No CMX RoIs container found" << endmsg;
223 }
224
225 //Retrieve JEM Et Sums from SG
226 const xAOD::JEMEtSumsContainer* jemEtSumsTES = 0;
227 sc = evtStore()->retrieve( jemEtSumsTES, m_jemEtSumsLocation);
228 if ( sc.isFailure() || !jemEtSumsTES ) {
229 msg(MSG::DEBUG) << "No JEM Et Sums container found" << endmsg;
230 }
231
232 //Retrieve CMX Et Sums from SG
233 const xAOD::CMXEtSumsContainer* cmxEtSumsTES = 0;
234 sc = evtStore()->retrieve( cmxEtSumsTES, m_cmxEtSumsLocation);
235 if ( sc.isFailure() || !cmxEtSumsTES ) {
236 msg(MSG::DEBUG) << "No CMX-Energy Et Sums container found" << endmsg;
237 }
238
239 //Retrieve ROD Headers from SG
240 const xAOD::RODHeaderContainer* rodTES = 0;
242 sc = evtStore()->retrieve(rodTES, m_rodHeaderLocation);
243 } else sc = StatusCode::FAILURE;
244 if ( sc.isFailure() || !rodTES ) {
245 msg(MSG::DEBUG) << "No ROD Header container found" << endmsg;
246 }
247
248 //Retrieve CP RoIB ROD Headers from SG
249 const xAOD::RODHeaderContainer* cpRoibTES = 0;
251 sc = evtStore()->retrieve(cpRoibTES, m_cpRoibRodHeaderLocation);
252 } else sc = StatusCode::FAILURE;
253 if ( sc.isFailure() || !cpRoibTES ) {
254 msg(MSG::DEBUG) << "No CP RoIB ROD Header container found" << endmsg;
255 }
256
257 //Retrieve JEP RoIB ROD Headers from SG
258 const xAOD::RODHeaderContainer* jepRoibTES = 0;
260 sc = evtStore()->retrieve(jepRoibTES, m_jepRoibRodHeaderLocation);
261 } else sc = StatusCode::FAILURE;
262 if ( sc.isFailure() || !jepRoibTES ) {
263 msg(MSG::DEBUG) << "No JEP RoIB ROD Header container found" << endmsg;
264 }
265
266 //Retrieve ROB Status and Unpacking Error vector from SG
267 errColl = 0;
268 if (evtStore()->contains<std::vector<unsigned int> >(m_robErrorVectorLocation)) {
269 sc = evtStore()->retrieve(errColl, m_robErrorVectorLocation);
270 } else sc = StatusCode::FAILURE;
271 if ( sc.isFailure() || !errColl ) {
272 msg(MSG::DEBUG) << "No ROB Status and Unpacking Error vector found"
273 << endmsg;
274 }
275
276 return sc;
277}
278
279// Return true if current event has any corruption errors
280
282{
283 if (m_flagCorruptEvents == "AnyROBOrUnpackingError") {
284 return robOrUnpackingError();
285 } else if (m_flagCorruptEvents == "FullEventTimeout") {
287 }
288
289 return false;
290}
291
292// Return true if current event has Full Event status generic timeout bit set
293
295{
297 unsigned int evtStatus =evtInfo->statusElement();
298 return (((evtStatus >> 2) & 0x1) == 1);
299}
300
301// Return true if any ROB/ROD fragments are missing
302
304{
305
306 const bool debug = msgLvl(MSG::DEBUG);
307
308 StatusCode sc;
309
310 //Retrieve DAQ ROD Headers from SG
311 const xAOD::RODHeaderContainer* rodTES = 0;
313 sc = evtStore()->retrieve(rodTES, m_rodHeaderLocation);
314 } else sc = StatusCode::FAILURE;
315 if ( sc.isFailure() || !rodTES ) {
316 if (debug) msg(MSG::DEBUG) << "No DAQ ROD Header container found"
317 << endmsg;
318 }
319
320 //Retrieve CP RoIB ROD Headers from SG
321 const xAOD::RODHeaderContainer* cpRoibTES = 0;
323 sc = evtStore()->retrieve(cpRoibTES, m_cpRoibRodHeaderLocation);
324 } else sc = StatusCode::FAILURE;
325 if ( sc.isFailure() || !cpRoibTES ) {
326 if (debug) msg(MSG::DEBUG) << "No CP RoIB ROD Header container found"
327 << endmsg;
328 }
329
330 //Retrieve JEP RoIB ROD Headers from SG
331 const xAOD::RODHeaderContainer* jepRoibTES = 0;
333 sc = evtStore()->retrieve(jepRoibTES, m_jepRoibRodHeaderLocation);
334 } else sc = StatusCode::FAILURE;
335 if ( sc.isFailure() || !jepRoibTES ) {
336 if (debug) msg(MSG::DEBUG) << "No JEP RoIB ROD Header container found"
337 << endmsg;
338 }
339
340 // Record fragments present
341 std::vector<int> noFragmentFlags(80, 1);
342 std::vector<const xAOD::RODHeaderContainer*> cols;
343 if (rodTES) cols.push_back(rodTES);
344 if (cpRoibTES) cols.push_back(cpRoibTES);
345 if (jepRoibTES) cols.push_back(jepRoibTES);
346 std::vector<const xAOD::RODHeaderContainer*>::const_iterator colIter =
347 cols.begin();
348 std::vector<const xAOD::RODHeaderContainer*>::const_iterator colIterEnd =
349 cols.end();
350 for (; colIter != colIterEnd; ++colIter) {
351 xAOD::RODHeaderContainer::const_iterator iter = (*colIter)->begin();
352 xAOD::RODHeaderContainer::const_iterator iterEnd = (*colIter)->end();
353 for (; iter != iterEnd; ++iter) {
354 const xAOD::RODHeader* header = *iter;
355 const int crate = header->crate();
356 const int slink = header->sLink();
357 const int dataType = header->dataType();
358 const int rod = crate + dataType * 6;
359 const int pos = rod * 4 + slink;
360 if (pos >= 80) continue;
361 noFragmentFlags[pos] = 0;
362 }
363 }
364
365 // Any fragments missing?
366 for (int pos = 0; pos < 80; ++pos) {
367 if ((pos % 2) && (pos >= 56 || (pos >= 32 && pos < 48))) continue;
368 if (noFragmentFlags[pos]) return true;
369 }
370
371 return false;
372}
373
374// Return true if current event has any ROB or unpacking errors
375
377{
378 const std::vector<unsigned int>* errVecTES = 0;
379 StatusCode sc = retrieve(errVecTES);
380 return (sc.isSuccess() && !errVecTES->empty());
381}
382
383} // end namespace
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
An STL vector of pointers that by default owns its pointed-to elements.
static Double_t sc
const bool debug
Handle class for reading from StoreGate.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
static const std::string CPMTobRoILocation
static const std::string CMXJetTobLocation
static const std::string RODHeaderLocation
static const std::string JetElementLocation
static const std::string JEMTobRoILocation
static const std::string JEMEtSumsLocation
static const std::string CMXJetHitsLocation
static const std::string xAODTriggerTowerLocation
static const std::string CMXEtSumsLocation
static const std::string CMXCPHitsLocation
static const std::string CMXRoILocation
static const std::string CPMTowerLocation
static const std::string CMXCPTobLocation
std::string m_cmxCpHitsLocation
CMX-CP hits container StoreGate key.
std::string m_cpmTowerLocationOverlap
CPM overlap tower container StoreGate key.
std::string m_flagCorruptEvents
Flag corrupt events.
std::string m_jemRoiLocation
JEM RoI container StoreGate key.
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
std::string m_cmxCpTobLocation
CMX-CP TOB container StoreGate key.
std::string m_jepRoibRodHeaderLocation
JEP RoIB ROD header container StoreGate key.
std::string m_triggerTowerLocation
Trigger Tower container StoreGate key.
std::string m_jetElementLocation
Core Jet Element container StoreGate key.
StatusCode retrieve(const std::vector< unsigned int > *&errColl)
Retrieve error vector.
std::string m_cmxRoiLocation
CMX RoI container StoreGate key.
std::string m_jetElementLocationOverlap
Overlap Jet Element container StoreGate key.
std::string m_cmxJetHitsLocation
CMX-Jet hits container StoreGate key.
TrigT1CaloMonErrorTool(const std::string &name)
std::string m_cmxEtSumsLocation
CMX Et sums container StoreGate key.
bool missingFragment()
Return true if any ROB/ROD fragments are missing.
std::string m_cmxJetTobLocation
CMX-Jet TOB container StoreGate key.
bool robOrUnpackingError()
Return true if current event has any ROB or unpacking errors.
std::string m_cpmRoiLocation
CPM RoI container StoreGate key.
std::string m_rodHeaderLocation
ROD header container StoreGate key.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
bool corrupt()
Return true if current event has any corruption errors.
std::string m_jemEtSumsLocation
JEM Et sums container StoreGate key.
std::string m_robErrorVectorLocation
ROB and Unpacking Error vector StoreGate key.
std::string m_cpRoibRodHeaderLocation
CP RoIB ROD header container StoreGate key.
std::string m_cpmTowerLocation
CPM core tower container StoreGate key.
bool fullEventTimeout()
Return true if current event has Full Event status generic timeout bit set.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
RODHeaderContainer_v2 RODHeaderContainer
Define the latest version of the RODHeader container.
CMXCPTobContainer_v1 CMXCPTobContainer
Define the latest version of the CMXCPTob class.
CMXJetHitsContainer_v1 CMXJetHitsContainer
Define the latest version of the CMXJetHits class.
CMXJetTobContainer_v1 CMXJetTobContainer
Define the latest version of the CMXJetTob class.
JetElementContainer_v2 JetElementContainer
Define the latest version of the JetElement container.
CPMTowerContainer_v2 CPMTowerContainer
Define the latest version of the CPMHits container.
CMXEtSumsContainer_v1 CMXEtSumsContainer
Define the latest version of the CMXEtSums class.
CMXCPHitsContainer_v1 CMXCPHitsContainer
Define the latest version of the CMXCPHits class.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
RODHeader_v2 RODHeader
Define the latest version of the RODHeader class.
CMXRoIContainer_v1 CMXRoIContainer
Define the latest version of the CMXRoI container.
JEMTobRoIContainer_v1 JEMTobRoIContainer
Define the latest version of the JEMTobRoI class.
JEMEtSumsContainer_v2 JEMEtSumsContainer
Define the latest version of the JEMEtSums container.
CPMTobRoIContainer_v1 CPMTobRoIContainer
Define the latest version of the CPMTobRoI class.
MsgStream & msg
Definition testRead.cxx:32