ATLAS Offline Software
RpcMeasViewAlg.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 
7 #include "RpcMeasViewAlg.h"
8 
9 #include <StoreGate/ReadHandle.h>
10 #include <StoreGate/WriteHandle.h>
12 
13 namespace MuonR4{
15  ATH_CHECK(m_readKey1D.initialize());
16  ATH_CHECK(m_readKeyBI.initialize());
17  ATH_CHECK(m_writeKey.initialize());
18  return StatusCode::SUCCESS;
19  }
20  template <class ContainerType>
23  const ContainerType*& contToPush) const {
24  contToPush = nullptr;
25  if (key.empty()) {
26  ATH_MSG_VERBOSE("No key has been parsed for object " << typeid(ContainerType).name());
27  return StatusCode::SUCCESS;
28  }
29  SG::ReadHandle<ContainerType> readHandle{key, ctx};
30  ATH_CHECK(readHandle.isPresent());
31  contToPush = readHandle.cptr();
32  return StatusCode::SUCCESS;
33  }
34 
35 
36  StatusCode RpcMeasViewAlg::execute(const EventContext& ctx) const {
37  const xAOD::RpcStripContainer* legacyStrips{nullptr};
38  const xAOD::RpcStrip2DContainer* bilStrips{nullptr};
39  ATH_CHECK(retrieveContainer(ctx, m_readKey1D, legacyStrips));
40  ATH_CHECK(retrieveContainer(ctx, m_readKeyBI, bilStrips));
41 
43  if (legacyStrips) {
44  outContainer.insert(outContainer.end(), legacyStrips->begin(), legacyStrips->end());
45  }
46  if (bilStrips) {
47  outContainer.insert(outContainer.end(), bilStrips->begin(), bilStrips->end());
48  }
50  ATH_CHECK(writeHandle.record(std::make_unique<xAOD::RpcMeasurementContainer>(*outContainer.asDataVector())));
51  return StatusCode::SUCCESS;
52  }
53 }
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonR4::RpcMeasViewAlg::m_readKeyBI
SG::ReadHandleKey< xAOD::RpcStrip2DContainer > m_readKeyBI
Definition: RpcMeasViewAlg.h:44
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::ReadHandleKey< ContainerType >
MuonR4::RpcMeasViewAlg::retrieveContainer
StatusCode retrieveContainer(const EventContext &ctx, const SG::ReadHandleKey< ContainerType > &key, const ContainerType *&contToPush) const
Helper method to fetch data from StoreGate.
Definition: RpcMeasViewAlg.cxx:21
WriteHandle.h
Handle class for recording to StoreGate.
RpcMeasViewAlg.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonR4::RpcMeasViewAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: RpcMeasViewAlg.cxx:36
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
MuonR4::RpcMeasViewAlg::initialize
StatusCode initialize() override
Definition: RpcMeasViewAlg.cxx:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
MuonR4::RpcMeasViewAlg::m_writeKey
SG::WriteHandleKey< xAOD::RpcMeasurementContainer > m_writeKey
Definition: RpcMeasViewAlg.h:47
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
MuonR4::RpcMeasViewAlg::m_readKey1D
SG::ReadHandleKey< xAOD::RpcStripContainer > m_readKey1D
Definition: RpcMeasViewAlg.h:41
ReadHandle.h
Handle class for reading from StoreGate.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37