ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
ZDC
ZdcRec
src
ZdcRecV3Decode.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 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"
18
#include "
StoreGate/StoreGateSvc.h
"
19
#include "
StoreGate/WriteHandle.h
"
20
#include "
StoreGate/ReadHandle.h
"
21
//#include "Identifier/Identifier.h"
22
23
#include "
xAODForward/ZdcModuleAuxContainer.h
"
24
#include "
xAODForward/ZdcModuleContainer.h
"
25
#include "
ZdcRec/ZdcRecV3Decode.h
"
26
#include "
ZdcRec/ZdcRecChannelToolV2.h
"
27
#include "
xAODForward/ZdcModuleToString.h
"
28
#include "
ZdcByteStream/ZdcToString.h
"
29
30
//==================================================================================================
31
ZdcRecV3Decode::ZdcRecV3Decode
(
const
std::string& name, ISvcLocator* pSvcLocator) :
32
33
AthAlgorithm
(name, pSvcLocator)
34
{
35
}
36
//==================================================================================================
37
38
//==================================================================================================
39
ZdcRecV3Decode::~ZdcRecV3Decode
() {}
40
//==================================================================================================
41
42
//==================================================================================================
43
StatusCode
ZdcRecV3Decode::initialize
()
44
{
45
MsgStream mLog(msgSvc(), name());
46
47
// Unpacking tool
48
ATH_CHECK
(
m_ChannelTool
.retrieve() );
49
50
51
ATH_CHECK
(
m_zdcModuleContainerName
.initialize() );
52
ATH_CHECK
(
m_zdcSumContainerName
.initialize() );
53
ATH_CHECK
(
m_ttContainerName
.initialize(
SG::AllowEmpty
) );
54
55
if
(
m_ownPolicy
==
SG::OWN_ELEMENTS
)
56
mLog << MSG::DEBUG <<
"...will OWN its cells."
<<
endmsg
;
57
else
58
mLog << MSG::DEBUG <<
"...will VIEW its cells."
<<
endmsg
;
59
60
61
mLog << MSG::DEBUG <<
"--> ZDC: ZdcRecV3Decode initialization complete"
<<
endmsg
;
62
63
return
StatusCode::SUCCESS;
64
}
65
//==================================================================================================
66
67
//==================================================================================================
68
StatusCode
ZdcRecV3Decode::execute
(
const
EventContext& ctx)
69
{
70
71
ATH_MSG_DEBUG
(
"--> ZDC: ZdcRecV3Decode execute starting on "
72
<< ctx.evt()
73
<<
"th event"
);
74
75
//Look for the container presence
76
if
(
m_ttContainerName
.empty()) {
77
return
StatusCode::SUCCESS;
78
}
79
80
// Look up the Digits "TriggerTowerContainer" in Storegate
81
SG::ReadHandle<xAOD::TriggerTowerContainer>
ttContainer (
m_ttContainerName
, ctx);
82
83
//Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
84
std::unique_ptr<xAOD::ZdcModuleContainer> moduleContainer(
new
xAOD::ZdcModuleContainer
());
85
std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleAuxContainer(
new
xAOD::ZdcModuleAuxContainer
() );
86
moduleContainer->setStore( moduleAuxContainer.get() );
87
88
//Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
89
std::unique_ptr<xAOD::ZdcModuleContainer> moduleSumContainer(
new
xAOD::ZdcModuleContainer
());
90
std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleSumAuxContainer(
new
xAOD::ZdcModuleAuxContainer
() );
91
moduleSumContainer->setStore( moduleSumAuxContainer.get() );
92
93
// rearrange ZDC channels and perform fast reco on all channels (including non-big tubes)
94
int
ncha =
m_ChannelTool
->convertTT2ZM(ttContainer.
get
(), moduleContainer.get(), moduleSumContainer.get() );
95
ATH_MSG_DEBUG
(
"m_ChannelTool->convertTT2ZM returned "
<< ncha <<
" channels"
);
96
//msg( MSG::DEBUG ) << ZdcModuleToString(*moduleContainer) << endmsg;
97
98
SG::WriteHandle<xAOD::ZdcModuleContainer>
moduleContainerH (
m_zdcModuleContainerName
, ctx);
99
ATH_CHECK
( moduleContainerH.
record
(std::move(moduleContainer),
100
std::move(moduleAuxContainer)) );
101
102
SG::WriteHandle<xAOD::ZdcModuleContainer>
sumsContainerH (
m_zdcSumContainerName
, ctx);
103
ATH_CHECK
( sumsContainerH.
record
(std::move(moduleSumContainer),
104
std::move(moduleSumAuxContainer)) );
105
106
return
StatusCode::SUCCESS;
107
108
}
109
//==================================================================================================
110
111
//==================================================================================================
112
StatusCode
ZdcRecV3Decode::finalize
()
113
{
114
115
ATH_MSG_DEBUG
(
"--> ZDC: ZdcRecV3Decode finalize complete"
);
116
117
return
StatusCode::SUCCESS;
118
119
}
120
//==================================================================================================
121
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
StoreGateSvc.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
ZdcModuleAuxContainer.h
ZdcModuleContainer.h
ZdcModuleToString.h
ZdcRecChannelToolV2.h
ZdcRecV3Decode.h
ZdcToString.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:71
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ZdcRecV3Decode::m_zdcModuleContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_zdcModuleContainerName
Definition
ZdcRecV3Decode.h:71
ZdcRecV3Decode::ZdcRecV3Decode
ZdcRecV3Decode(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ZdcRecV3Decode.cxx:31
ZdcRecV3Decode::m_ChannelTool
ToolHandle< ZdcRecChannelToolV2 > m_ChannelTool
Definition
ZdcRecV3Decode.h:80
ZdcRecV3Decode::execute
StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
ZdcRecV3Decode.cxx:68
ZdcRecV3Decode::finalize
StatusCode finalize() override
Definition
ZdcRecV3Decode.cxx:112
ZdcRecV3Decode::m_zdcSumContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_zdcSumContainerName
Definition
ZdcRecV3Decode.h:74
ZdcRecV3Decode::m_ownPolicy
Gaudi::Property< int > m_ownPolicy
Definition
ZdcRecV3Decode.h:65
ZdcRecV3Decode::initialize
StatusCode initialize() override
Definition
ZdcRecV3Decode.cxx:43
ZdcRecV3Decode::m_ttContainerName
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_ttContainerName
Definition
ZdcRecV3Decode.h:68
ZdcRecV3Decode::~ZdcRecV3Decode
~ZdcRecV3Decode()
Definition
ZdcRecV3Decode.cxx:39
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:29
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition
OwnershipPolicy.h:17
xAOD::ZdcModuleContainer
ZdcModuleContainer_v1 ZdcModuleContainer
Definition
ZdcModuleContainer.h:18
xAOD::ZdcModuleAuxContainer
ZdcModuleAuxContainer_v2 ZdcModuleAuxContainer
Definition
ZdcModuleAuxContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0