ATLAS Offline Software
EndOfEventROIConfirmerAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 
8 
9 EndOfEventROIConfirmerAlg::EndOfEventROIConfirmerAlg(const std::string& name, ISvcLocator* pSvcLocator)
10  : AthReentrantAlgorithm(name, pSvcLocator) {}
11 
12 
14  ATH_MSG_DEBUG( "EndOfEventROIConfirmerAlg::initialize()" );
15  ATH_CHECK( m_writeHandleKeyArray_ROIs.initialize() );
16  return StatusCode::SUCCESS;
17 }
18 
19 
20 StatusCode EndOfEventROIConfirmerAlg::execute(const EventContext& context) const {
21  ATH_MSG_DEBUG( "EndOfEventROIConfirmerAlg::execute()" );
22 
24  ATH_CHECK( rhk.initialize() );
25 
26  for (const auto& whk : m_writeHandleKeyArray_ROIs) {
27  rhk = whk.key(); // update the key
28  auto readHandle = SG::makeHandle(rhk, context);
29  if ( readHandle.isValid() ) {
30  ATH_MSG_DEBUG( "The " << whk.key() << " already present - this chain must have run as part of the trigger in this event" );
31  } else {
32  ATH_MSG_DEBUG( "The " << whk.key() << " is not here - we should create it such that we can run algorithms at the end of the HLT-accepted event" );
33 
34  auto handle = SG::makeHandle(whk, context);
35  auto objp = std::make_unique<TrigRoiDescriptorCollection> (TrigRoiDescriptorCollection());
36  ATH_CHECK( handle.record (std::move (objp)) );
37  handle->push_back(new TrigRoiDescriptor(true));
38  }
39  }
40  return StatusCode::SUCCESS;
41 }
EndOfEventROIConfirmerAlg::EndOfEventROIConfirmerAlg
EndOfEventROIConfirmerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: EndOfEventROIConfirmerAlg.cxx:9
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::ReadHandleKey< TrigRoiDescriptorCollection >
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
EndOfEventROIConfirmerAlg.h
EndOfEventROIConfirmerAlg::m_writeHandleKeyArray_ROIs
SG::WriteHandleKeyArray< TrigRoiDescriptorCollection > m_writeHandleKeyArray_ROIs
Definition: EndOfEventROIConfirmerAlg.h:26
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
TrigRoiDescriptorCollection
Athena::TPCnvVers::Current Athena::TPCnvVers::Old TrigRoiDescriptorCollection
Definition: TrigSteeringEventTPCnv.cxx:78
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
EndOfEventROIConfirmerAlg::initialize
virtual StatusCode initialize() override
Definition: EndOfEventROIConfirmerAlg.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EndOfEventROIConfirmerAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: EndOfEventROIConfirmerAlg.cxx:20
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68