ATLAS Offline Software
SCTEventFlagWriter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "SCTEventFlagWriter.h"
6 
8 
9 // Constructor
10 
11 SCTEventFlagWriter::SCTEventFlagWriter(const std::string& name, ISvcLocator* pSvcLocator) :
12  AthReentrantAlgorithm(name, pSvcLocator)
13 {
14 }
15 
16 // Initialize
17 
19 {
20  ATH_CHECK(m_bsErrTool.retrieve());
22 
23  return StatusCode::SUCCESS;
24 }
25 
26 // Execute
27 
28 StatusCode 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}; // Retrive xAOD EventInfo
36  if (xAODEvtInfo.isValid()) { // Retriving 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 }
ISCT_ByteStreamErrorsTool.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SCTEventFlagWriter::SCTEventFlagWriter
SCTEventFlagWriter(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: SCTEventFlagWriter.cxx:11
xAOD::EventInfo_v1::Error
@ Error
The sub-detector issued an error.
Definition: EventInfo_v1.h:349
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SCTEventFlagWriter::initialize
virtual StatusCode initialize() override
Initialize.
Definition: SCTEventFlagWriter.cxx:18
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SCTEventFlagWriter.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SCTEventFlagWriter::m_bsErrTool
ToolHandle< ISCT_ByteStreamErrorsTool > m_bsErrTool
Tool that keeps track of modules that give rise to errors in the bytestream.
Definition: SCTEventFlagWriter.h:48
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SCTEventFlagWriter::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute.
Definition: SCTEventFlagWriter.cxx:28
SCTEventFlagWriter::m_xAODEvtInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_xAODEvtInfoKey
Read handle for the xAOD event info.
Definition: SCTEventFlagWriter.h:52
xAOD::EventInfo_v1::SCT
@ SCT
The SCT.
Definition: EventInfo_v1.h:333