ATLAS Offline Software
Loading...
Searching...
No Matches
SCTEventFlagWriter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9// Constructor
10
11SCTEventFlagWriter::SCTEventFlagWriter(const std::string& name, ISvcLocator* pSvcLocator) :
12 AthReentrantAlgorithm(name, pSvcLocator)
13{
14}
15
16// Initialize
17
19{
20 ATH_CHECK(m_bsErrTool.retrieve());
21 ATH_CHECK(m_xAODEvtInfoKey.initialize());
22
23 return StatusCode::SUCCESS;
24}
25
26// Execute
27
28StatusCode SCTEventFlagWriter::execute(const EventContext& ctx) const
29{
30 long unsigned int nLVL1IDErrors{m_bsErrTool->getErrorSet(SCT_ByteStreamErrors::LVL1IDError, ctx).size()};
31 long unsigned int nROBFragmentErrors{m_bsErrTool->getErrorSet(SCT_ByteStreamErrors::ROBFragmentError, ctx).size()};
32
33 if ((nLVL1IDErrors > 500) or (nROBFragmentErrors > 1000)) { // Check if number of errors exceed threshold
34 bool setOK_xAOD{false};
35 SG::ReadHandle<xAOD::EventInfo> xAODEvtInfo{m_xAODEvtInfoKey, ctx}; // Retrieve xAOD EventInfo
36 if (xAODEvtInfo.isValid()) { // Retrieving xAOD EventInfo successful
37 setOK_xAOD = xAODEvtInfo->updateErrorState(xAOD::EventInfo::SCT, xAOD::EventInfo::Error);
38 }
39 if (not setOK_xAOD) {
40 ATH_MSG_ERROR("Failed to retrieve EventInfo containers or to update error state");
41 return StatusCode::RECOVERABLE;
42 }
43 }
44
45 return StatusCode::SUCCESS;
46}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
interface file for tool that keeps track of errors in the bytestream.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode execute(const EventContext &ctx) const override
Execute.
SCTEventFlagWriter(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadHandleKey< xAOD::EventInfo > m_xAODEvtInfoKey
Read handle for the xAOD event info.
ToolHandle< ISCT_ByteStreamErrorsTool > m_bsErrTool
Tool that keeps track of modules that give rise to errors in the bytestream.
virtual StatusCode initialize() override
Initialize.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ Error
The sub-detector issued an error.