ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcRecV3Decode.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * ZdcRecV3.cxx
7 *
8 * Created on: Sept 11, 2016 (never forget)
9 * Author: Peter.Steinberg@bnl.gov
10 */
11
12
13#include <memory>
14
15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/MsgStream.h"
17#include "GaudiKernel/StatusCode.h"
21//#include "Identifier/Identifier.h"
22
29
30//==================================================================================================
31ZdcRecV3Decode::ZdcRecV3Decode(const std::string& name, ISvcLocator* pSvcLocator) :
32
33 AthAlgorithm(name, pSvcLocator),
34 m_ownPolicy(static_cast<int> (SG::OWN_ELEMENTS))
35{
36 declareProperty("OwnPolicy",m_ownPolicy) ;
37}
38//==================================================================================================
39
40//==================================================================================================
42//==================================================================================================
43
44//==================================================================================================
46{
47 MsgStream mLog(msgSvc(), name());
48
49 // Unpacking tool
50 ATH_CHECK( m_ChannelTool.retrieve() );
51
52
53 ATH_CHECK( m_zdcModuleContainerName.initialize() );
54 ATH_CHECK( m_zdcSumContainerName.initialize() );
56
58 mLog << MSG::DEBUG << "...will OWN its cells." << endmsg;
59 else
60 mLog << MSG::DEBUG << "...will VIEW its cells." << endmsg;
61
62
63 mLog << MSG::DEBUG << "--> ZDC: ZdcRecV3Decode initialization complete" << endmsg;
64
65 return StatusCode::SUCCESS;
66}
67//==================================================================================================
68
69//==================================================================================================
70StatusCode ZdcRecV3Decode::execute(const EventContext& ctx)
71{
72
73 ATH_MSG_DEBUG ("--> ZDC: ZdcRecV3Decode execute starting on "
74 << ctx.evt()
75 << "th event");
76
77 //Look for the container presence
78 if (m_ttContainerName.empty()) {
79 return StatusCode::SUCCESS;
80 }
81
82 // Look up the Digits "TriggerTowerContainer" in Storegate
84
85 //Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
86 std::unique_ptr<xAOD::ZdcModuleContainer> moduleContainer( new xAOD::ZdcModuleContainer());
87 std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleAuxContainer( new xAOD::ZdcModuleAuxContainer() );
88 moduleContainer->setStore( moduleAuxContainer.get() );
89
90 //Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
91 std::unique_ptr<xAOD::ZdcModuleContainer> moduleSumContainer( new xAOD::ZdcModuleContainer());
92 std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleSumAuxContainer( new xAOD::ZdcModuleAuxContainer() );
93 moduleSumContainer->setStore( moduleSumAuxContainer.get() );
94
95 // rearrange ZDC channels and perform fast reco on all channels (including non-big tubes)
96 int ncha = m_ChannelTool->convertTT2ZM(ttContainer.get(), moduleContainer.get(), moduleSumContainer.get() );
97 ATH_MSG_DEBUG("m_ChannelTool->convertTT2ZM returned " << ncha << " channels");
98 //msg( MSG::DEBUG ) << ZdcModuleToString(*moduleContainer) << endmsg;
99
101 ATH_CHECK( moduleContainerH.record (std::move(moduleContainer),
102 std::move(moduleAuxContainer)) );
103
105 ATH_CHECK( sumsContainerH.record (std::move(moduleSumContainer),
106 std::move(moduleSumAuxContainer)) );
107
108 return StatusCode::SUCCESS;
109
110}
111//==================================================================================================
112
113//==================================================================================================
115{
116
117 ATH_MSG_DEBUG( "--> ZDC: ZdcRecV3Decode finalize complete" );
118
119 return StatusCode::SUCCESS;
120
121}
122//==================================================================================================
123
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_zdcModuleContainerName
ZdcRecV3Decode(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< ZdcRecChannelToolV2 > m_ChannelTool
StatusCode execute(const EventContext &ctx) override
Execute method.
StatusCode finalize() override
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_zdcSumContainerName
StatusCode initialize() override
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_ttContainerName
Forward declaration.
@ OWN_ELEMENTS
this data object owns its elements
ZdcModuleContainer_v1 ZdcModuleContainer
ZdcModuleAuxContainer_v2 ZdcModuleAuxContainer