ATLAS Offline Software
Loading...
Searching...
No Matches
TrigT1CaloMonErrorToolV1.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
27
29
30namespace LVL1 {
31
32
33// Constructor
34
36 const std::string& name)
37 : AsgTool(name)
38{
39
40 declareProperty("TriggerTowerLocation",
43 declareProperty("CPMTowerLocation",
45 declareProperty("CPMTowerLocationOverlap",
48 declareProperty("CPMHitsLocation",
50 declareProperty("CMMCPHitsLocation",
52 declareProperty("CPMRoILocation",
54 declareProperty("JetElementLocation",
57 declareProperty("JetElementLocationOverlap",
60 declareProperty("JEMHitsLocation",
62 declareProperty("CMMJetHitsLocation",
65 declareProperty("JEMRoILocation",
67 declareProperty("CMMRoILocation",
69 declareProperty("JEMEtSumsLocation",
71 declareProperty("CMMEtSumsLocation",
73 declareProperty("RodHeaderLocation",
75 declareProperty("RodHeaderLocationCPRoIB",
77 declareProperty("RodHeaderLocationJEPRoIB",
79 declareProperty("L1CaloErrorLocation",
80 m_robErrorVectorLocation = "L1CaloUnpackingErrors");
81 declareProperty("FlagCorruptEvents", m_flagCorruptEvents = "FullEventTimeout",
82 "Can be FullEventTimeout, AnyROBOrUnpackingError or None");
83
84}
85
86// Destructor
87
91
92// Initialize
93
95{
96 msg(MSG::INFO) << "Initializing " << name() << endmsg;
97
98 ATH_CHECK( m_eventInfoKey.initialize() );
99 return StatusCode::SUCCESS;
100}
101
102// Finalize
103
105{
106 return StatusCode::SUCCESS;
107}
108
109// Retrieve error vector
110
111StatusCode TrigT1CaloMonErrorToolV1::retrieve(const std::vector<unsigned int>*&
112 errColl)
113{
114
115 // Must ensure bytestream converters have unpacked all our data
116 // before retrieving error vector.
117
119 typedef DataVector<LVL1::CPMTower> CpmTowerCollection;
120 typedef DataVector<LVL1::CPMHits> CpmHitsCollection;
121 typedef DataVector<LVL1::CMMCPHits> CmmCpHitsCollection;
122 typedef DataVector<LVL1::CPMRoI> CpmRoiCollection;
124 typedef DataVector<LVL1::JEMHits> JemHitsCollection;
125 typedef DataVector<LVL1::CMMJetHits> CmmJetHitsCollection;
126 typedef DataVector<LVL1::JEMRoI> JemRoiCollection;
127 typedef DataVector<LVL1::JEMEtSums> JemEtSumsCollection;
128 typedef DataVector<LVL1::CMMEtSums> CmmEtSumsCollection;
129 typedef DataVector<LVL1::RODHeader> RodHeaderCollection;
130
131 StatusCode sc;
132
133 //Retrieve Trigger Towers from SG
134 const TriggerTowerCollection* triggerTowerTES = 0;
135 const TriggerTowerCollection* triggerTowerSpareTES = 0;
136 const TriggerTowerCollection* triggerTowerMuonTES = 0;
137 sc = evtStore()->retrieve(triggerTowerTES, m_triggerTowerLocation);
138 if ( sc.isFailure() || !triggerTowerTES ) {
139 msg(MSG::DEBUG) << "No Trigger Tower container found" << endmsg;
140 }
142 sc = evtStore()->retrieve(triggerTowerSpareTES,
143 m_triggerTowerLocation + "Spare");
144 } else sc = StatusCode::FAILURE;
145 if ( sc.isFailure() || !triggerTowerSpareTES ) {
146 msg(MSG::DEBUG) << "No Spare Trigger Tower container found" << endmsg;
147 }
149 sc = evtStore()->retrieve(triggerTowerMuonTES,
150 m_triggerTowerLocation + "Muon");
151 } else sc = StatusCode::FAILURE;
152 if ( sc.isFailure() || !triggerTowerMuonTES ) {
153 msg(MSG::DEBUG) << "No Tile Muon Trigger Tower container found" << endmsg;
154 }
155
156 //Retrieve Core and Overlap CPM Towers from SG
157 const CpmTowerCollection* cpmTowerTES = 0;
158 const CpmTowerCollection* cpmTowerOvTES = 0;
159 sc = evtStore()->retrieve(cpmTowerTES, m_cpmTowerLocation);
160 if ( sc.isFailure() || !cpmTowerTES ) {
161 msg(MSG::DEBUG) << "No Core CPM Tower container found" << endmsg;
162 }
164 sc = evtStore()->retrieve(cpmTowerOvTES, m_cpmTowerLocationOverlap);
165 } else sc = StatusCode::FAILURE;
166 if ( sc.isFailure() || !cpmTowerOvTES ) {
167 msg(MSG::DEBUG) << "No Overlap CPM Tower container found" << endmsg;
168 }
169
170 //Retrieve CPM RoIs from SG
171 const CpmRoiCollection* cpmRoiTES = 0;
172 sc = evtStore()->retrieve( cpmRoiTES, m_cpmRoiLocation);
173 if ( sc.isFailure() || !cpmRoiTES ) {
174 msg(MSG::DEBUG) << "No CPM RoIs container found" << endmsg;
175 }
176
177 //Retrieve CPM Hits from SG
178 const CpmHitsCollection* cpmHitsTES = 0;
179 sc = evtStore()->retrieve( cpmHitsTES, m_cpmHitsLocation);
180 if ( sc.isFailure() || !cpmHitsTES ) {
181 msg(MSG::DEBUG) << "No CPM Hits container found" << endmsg;
182 }
183
184 //Retrieve CMM-CP Hits from SG
185 const CmmCpHitsCollection* cmmCpHitsTES = 0;
186 sc = evtStore()->retrieve( cmmCpHitsTES, m_cmmCpHitsLocation);
187 if ( sc.isFailure() || !cmmCpHitsTES ) {
188 msg(MSG::DEBUG) << "No CMM-CP Hits container found" << endmsg;
189 }
190
191 //Retrieve Core and Overlap Jet Elements from SG
192 const JetElementCollection* jetElementTES = 0;
193 const JetElementCollection* jetElementOvTES = 0;
194 sc = evtStore()->retrieve(jetElementTES, m_jetElementLocation);
195 if ( sc.isFailure() || !jetElementTES ) {
196 msg(MSG::DEBUG) << "No Core Jet Element container found" << endmsg;
197 }
199 sc = evtStore()->retrieve(jetElementOvTES, m_jetElementLocationOverlap);
200 } else sc = StatusCode::FAILURE;
201 if ( sc.isFailure() || !jetElementOvTES ) {
202 msg(MSG::DEBUG) << "No Overlap Jet Element container found" << endmsg;
203 }
204
205 //Retrieve JEM RoIs from SG
206 const JemRoiCollection* jemRoiTES = 0;
207 sc = evtStore()->retrieve( jemRoiTES, m_jemRoiLocation);
208 if ( sc.isFailure() || !jemRoiTES ) {
209 msg(MSG::DEBUG) << "No DAQ JEM RoIs container found" << endmsg;
210 }
211
212 //Retrieve JEM Hits from SG
213 const JemHitsCollection* jemHitsTES = 0;
214 sc = evtStore()->retrieve( jemHitsTES, m_jemHitsLocation);
215 if ( sc.isFailure() || !jemHitsTES ) {
216 msg(MSG::DEBUG) << "No JEM Hits container found" << endmsg;
217 }
218
219 //Retrieve CMM-Jet Hits from SG
220 const CmmJetHitsCollection* cmmJetHitsTES = 0;
221 sc = evtStore()->retrieve( cmmJetHitsTES, m_cmmJetHitsLocation);
222 if ( sc.isFailure() || !cmmJetHitsTES ) {
223 msg(MSG::DEBUG) << "No CMM-Jet Hits container found" << endmsg;
224 }
225
226 //Retrieve CMM RoIs from SG
227 const LVL1::CMMRoI* cmmRoiTES = 0;
228 sc = evtStore()->retrieve( cmmRoiTES, m_cmmRoiLocation);
229 if ( sc.isFailure() || !cmmRoiTES ) {
230 msg(MSG::DEBUG) << "No CMM RoIs container found" << endmsg;
231 }
232
233 //Retrieve JEM Et Sums from SG
234 const JemEtSumsCollection* jemEtSumsTES = 0;
235 sc = evtStore()->retrieve( jemEtSumsTES, m_jemEtSumsLocation);
236 if ( sc.isFailure() || !jemEtSumsTES ) {
237 msg(MSG::DEBUG) << "No JEM Et Sums container found" << endmsg;
238 }
239
240 //Retrieve CMM Et Sums from SG
241 const CmmEtSumsCollection* cmmEtSumsTES = 0;
242 sc = evtStore()->retrieve( cmmEtSumsTES, m_cmmEtSumsLocation);
243 if ( sc.isFailure() || !cmmEtSumsTES ) {
244 msg(MSG::DEBUG) << "No CMM-Energy Et Sums container found" << endmsg;
245 }
246
247 //Retrieve ROD Headers from SG
248 const RodHeaderCollection* rodTES = 0;
250 sc = evtStore()->retrieve(rodTES, m_rodHeaderLocation);
251 } else sc = StatusCode::FAILURE;
252 if ( sc.isFailure() || !rodTES ) {
253 msg(MSG::DEBUG) << "No ROD Header container found" << endmsg;
254 }
255
256 //Retrieve CP RoIB ROD Headers from SG
257 const RodHeaderCollection* cpRoibTES = 0;
259 sc = evtStore()->retrieve(cpRoibTES, m_cpRoibRodHeaderLocation);
260 } else sc = StatusCode::FAILURE;
261 if ( sc.isFailure() || !cpRoibTES ) {
262 msg(MSG::DEBUG) << "No CP RoIB ROD Header container found" << endmsg;
263 }
264
265 //Retrieve JEP RoIB ROD Headers from SG
266 const RodHeaderCollection* jepRoibTES = 0;
268 sc = evtStore()->retrieve(jepRoibTES, m_jepRoibRodHeaderLocation);
269 } else sc = StatusCode::FAILURE;
270 if ( sc.isFailure() || !jepRoibTES ) {
271 msg(MSG::DEBUG) << "No JEP RoIB ROD Header container found" << endmsg;
272 }
273
274 //Retrieve ROB Status and Unpacking Error vector from SG
275 errColl = 0;
276 if (evtStore()->contains<std::vector<unsigned int> >(m_robErrorVectorLocation)) {
277 sc = evtStore()->retrieve(errColl, m_robErrorVectorLocation);
278 } else sc = StatusCode::FAILURE;
279 if ( sc.isFailure() || !errColl ) {
280 msg(MSG::DEBUG) << "No ROB Status and Unpacking Error vector found"
281 << endmsg;
282 }
283
284 return sc;
285}
286
287// Return true if current event has any corruption errors
288
290{
291 if (m_flagCorruptEvents == "AnyROBOrUnpackingError") {
292 return robOrUnpackingError();
293 } else if (m_flagCorruptEvents == "FullEventTimeout") {
295 }
296
297 return false;
298}
299
300// Return true if current event has Full Event status generic timeout bit set
301
303{
305 unsigned int evtStatus =evtInfo->statusElement();
306 return (((evtStatus >> 2) & 0x1) == 1);
307}
308
309// Return true if any ROB/ROD fragments are missing
310
312{
313
314 typedef DataVector<LVL1::RODHeader> RodHeaderCollection;
315
316 const bool debug = msgLvl(MSG::DEBUG);
317
318 StatusCode sc;
319
320 //Retrieve DAQ ROD Headers from SG
321 const RodHeaderCollection* rodTES = 0;
323 sc = evtStore()->retrieve(rodTES, m_rodHeaderLocation);
324 } else sc = StatusCode::FAILURE;
325 if ( sc.isFailure() || !rodTES ) {
326 if (debug) msg(MSG::DEBUG) << "No DAQ ROD Header container found"
327 << endmsg;
328 }
329
330 //Retrieve CP RoIB ROD Headers from SG
331 const RodHeaderCollection* cpRoibTES = 0;
333 sc = evtStore()->retrieve(cpRoibTES, m_cpRoibRodHeaderLocation);
334 } else sc = StatusCode::FAILURE;
335 if ( sc.isFailure() || !cpRoibTES ) {
336 if (debug) msg(MSG::DEBUG) << "No CP RoIB ROD Header container found"
337 << endmsg;
338 }
339
340 //Retrieve JEP RoIB ROD Headers from SG
341 const RodHeaderCollection* jepRoibTES = 0;
343 sc = evtStore()->retrieve(jepRoibTES, m_jepRoibRodHeaderLocation);
344 } else sc = StatusCode::FAILURE;
345 if ( sc.isFailure() || !jepRoibTES ) {
346 if (debug) msg(MSG::DEBUG) << "No JEP RoIB ROD Header container found"
347 << endmsg;
348 }
349
350 // Record fragments present
351 std::vector<int> noFragmentFlags(80, 1);
352 std::vector<const RodHeaderCollection*> cols;
353 if (rodTES) cols.push_back(rodTES);
354 if (cpRoibTES) cols.push_back(cpRoibTES);
355 if (jepRoibTES) cols.push_back(jepRoibTES);
356 std::vector<const RodHeaderCollection*>::const_iterator colIter =
357 cols.begin();
358 std::vector<const RodHeaderCollection*>::const_iterator colIterEnd =
359 cols.end();
360 for (; colIter != colIterEnd; ++colIter) {
361 RodHeaderCollection::const_iterator iter = (*colIter)->begin();
362 RodHeaderCollection::const_iterator iterEnd = (*colIter)->end();
363 for (; iter != iterEnd; ++iter) {
364 const LVL1::RODHeader* header = *iter;
365 const int crate = header->crate();
366 const int slink = header->sLink();
367 const int dataType = header->dataType();
368 const int rod = crate + dataType * 6;
369 const int pos = rod * 4 + slink;
370 if (pos >= 80) continue;
371 noFragmentFlags[pos] = 0;
372 }
373 }
374
375 // Any fragments missing?
376 for (int pos = 0; pos < 80; ++pos) {
377 if ((pos % 2) && (pos >= 56 || (pos >= 32 && pos < 48))) continue;
378 if (noFragmentFlags[pos]) return true;
379 }
380
381 return false;
382}
383
384// Return true if current event has any ROB or unpacking errors
385
387{
388 const std::vector<unsigned int>* errVecTES = 0;
389 StatusCode sc = retrieve(errVecTES);
390 return (sc.isSuccess() && !errVecTES->empty());
391}
392
393} // 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.
DataVector< LVL1::JetElement > JetElementCollection
static Double_t sc
const bool debug
Handle class for reading from StoreGate.
DataVector< LVL1::TriggerTower > TriggerTowerCollection
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
bool msgLvl(const MSG::Level lvl) const
Derived DataVector<T>.
Definition DataVector.h:795
static const std::string CMMRoILocation
static const std::string TriggerTowerLocation
static const std::string RODHeaderLocation
static const std::string CPMRoILocation
static const std::string JetElementLocation
static const std::string CMMEtSumsLocation
static const std::string JEMRoILocation
static const std::string CMMJetHitsLocation
static const std::string JEMEtSumsLocation
static const std::string CMMCPHitsLocation
static const std::string CPMTowerLocation
static const std::string CPMHitsLocation
static const std::string JEMHitsLocation
std::string m_jemEtSumsLocation
JEM Et sums container StoreGate key.
TrigT1CaloMonErrorToolV1(const std::string &name)
std::string m_cpmHitsLocation
CPM hits container StoreGate key.
std::string m_jemRoiLocation
JEM RoI container StoreGate key.
std::string m_jemHitsLocation
JEM hits container StoreGate key.
std::string m_jetElementLocationOverlap
Overlap Jet Element container StoreGate key.
bool missingFragment()
Return true if any ROB/ROD fragments are missing.
StatusCode retrieve(const std::vector< unsigned int > *&errColl)
Retrieve error vector.
bool corrupt()
Return true if current event has any corruption errors.
bool robOrUnpackingError()
Return true if current event has any ROB or unpacking errors.
std::string m_cmmRoiLocation
CMM RoI container StoreGate key.
std::string m_rodHeaderLocation
ROD header container StoreGate key.
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
std::string m_cpmRoiLocation
CPM RoI container StoreGate key.
std::string m_jetElementLocation
Core Jet Element container StoreGate key.
std::string m_cpRoibRodHeaderLocation
CP RoIB ROD header container StoreGate key.
std::string m_cpmTowerLocationOverlap
CPM overlap tower container StoreGate key.
std::string m_robErrorVectorLocation
ROB and Unpacking Error vector 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.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
std::string m_cmmCpHitsLocation
CMM-CP hits 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_cmmJetHitsLocation
CMM-Jet hits container StoreGate key.
std::string m_flagCorruptEvents
Flag corrupt events.
std::string m_cmmEtSumsLocation
CMM Et sums container StoreGate key.
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...
MsgStream & msg
Definition testRead.cxx:32