ATLAS Offline Software
LArTimeVetoAlg.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 "LArTimeVetoAlg.h"
8 #include "Gaudi/Property.h"
11 
12 //__________________________________________________________________________
14  {
15  ATH_MSG_INFO("LArTimeVetoAlg initialize()" );
19  return StatusCode::SUCCESS;
20 
21  }
22 
23 //__________________________________________________________________________
25  {
26  ATH_MSG_DEBUG( "LArTimeVetoAlg finalize()" );
27  ATH_MSG_INFO( "Number of events processed " << m_nevt << ". Number of events in LAr bad time interval " << m_nevtMasked );
28  return StatusCode::SUCCESS;
29  }
30 
31 //__________________________________________________________________________
32 StatusCode LArTimeVetoAlg::execute( const EventContext& ctx ) const
33 {
34  ATH_MSG_DEBUG("LArTimeVetoAlg execute()");
35 
36  m_nevt++;
38  const AthenaAttributeList* dd_atrList{*ev_handle};
39  if (dd_atrList==nullptr) {
40  ATH_MSG_FATAL("Null pointer to the read conditions object");
41  return StatusCode::FAILURE;
42  }
43 
44  const uint32_t vetoWord = (*dd_atrList)["EventVeto"].data<uint32_t>();
45 
46  if (vetoWord != 0) {
47 
48  m_nevtMasked++;
49 
50  // retrieve EventInfo
53  ATH_MSG_WARNING( " cannot set error state for LAr " );
54  }
55  if (vetoWord & 0x1FFFF) {
56  ATH_MSG_DEBUG("Event flagged as Noise Burst!");
58  ATH_MSG_WARNING( " cannot set flag bit for LAr " );
59  }
60 
61  if (vetoWord & 0x10000) {
62  ATH_MSG_DEBUG("Event flagged as Mini-Noise Burst!");
64  ATH_MSG_WARNING( " cannot set flag bit for LAr " );
65  }
66  }
67 
68  //Record location (partition) of noise burst
69  for (int i=0;i<8;i++) {
70  if (vetoWord & (1<<i)) {
71  if (!eventInfo->updateEventFlagBit(xAOD::EventInfo::LAr,20+i)) {
72  ATH_MSG_WARNING( " cannot set flag bit for LAr documenting noise burst location " );
73  }
74  }
75  }
76  }//end if one of the first 16 bits set
77  if (vetoWord & 0xFFF80000) {
78  ATH_MSG_DEBUG("Event flagged as DataCorruption!");
80  ATH_MSG_WARNING( " cannot set flag bit for LAr " );
81  }
82  }//end if one of the second 16 bits set
83 
84  ATH_MSG_VERBOSE( "LAr bit in error word " << eventInfo->errorState(xAOD::EventInfo::LAr) );
85  ATH_MSG_VERBOSE( "LAr word " << std::hex << eventInfo->eventFlags(xAOD::EventInfo::LAr) << std::dec );
86 
87  } //if vetoWord
88 
89 
90  return StatusCode::SUCCESS;
91 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
LArTimeVetoAlg::m_nevtMasked
std::atomic< unsigned > m_nevtMasked
Definition: LArTimeVetoAlg.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
LArEventBitInfo::MININOISEBURSTTIGHT
@ MININOISEBURSTTIGHT
Definition: LArEventBitInfo.h:18
xAOD::EventInfo_v1::updateEventFlagBit
bool updateEventFlagBit(const EventFlagSubDet subDet, const size_t bit) const
Change detector flags with update semantics.
Definition: EventInfo_v1.cxx:746
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthenaAttributeList.h
xAOD::EventInfo_v1::LAr
@ LAr
The LAr calorimeter.
Definition: EventInfo_v1.h:335
LArEventBitInfo.h
xAOD::EventInfo_v1::Error
@ Error
The sub-detector issued an error.
Definition: EventInfo_v1.h:349
LArEventBitInfo::NOISEBURSTVETO
@ NOISEBURSTVETO
Definition: LArEventBitInfo.h:13
LArTimeVetoAlg.h
LArTimeVetoAlg::finalize
virtual StatusCode finalize() override
Definition: LArTimeVetoAlg.cxx:24
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArTimeVetoAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: LArTimeVetoAlg.h:33
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
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
LArTimeVetoAlg::m_eventInfoDecorKey
SG::WriteDecorHandleKey< xAOD::EventInfo > m_eventInfoDecorKey
Definition: LArTimeVetoAlg.h:34
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
EventInfo.h
xAOD::EventInfo_v1::eventFlags
uint32_t eventFlags(EventFlagSubDet subDet) const
Get the event flags for a particular sub-detector.
Definition: EventInfo_v1.cxx:697
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArTimeVetoAlg::initialize
virtual StatusCode initialize() override
Definition: LArTimeVetoAlg.cxx:13
xAOD::EventInfo_v1::errorState
EventFlagErrorState errorState(EventFlagSubDet subDet) const
Get the error state for a particular sub-detector.
Definition: EventInfo_v1.cxx:817
xAOD::EventInfo_v1::updateErrorState
bool updateErrorState(const EventFlagSubDet subDet, const EventFlagErrorState state) const
Update the error state for one particular sub-detector.
Definition: EventInfo_v1.cxx:856
LArTimeVetoAlg::m_nevt
std::atomic< unsigned > m_nevt
Definition: LArTimeVetoAlg.h:29
LArTimeVetoAlg::m_eventVetoKey
SG::ReadCondHandleKey< AthenaAttributeList > m_eventVetoKey
Definition: LArTimeVetoAlg.h:32
LArEventBitInfo::DATACORRUPTEDVETO
@ DATACORRUPTEDVETO
Definition: LArEventBitInfo.h:15
LArTimeVetoAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: LArTimeVetoAlg.cxx:32