ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
ZDC
ZdcRec
src
ZdcRecV2.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/*
6
* ZdcRecV2.cxx
7
*
8
* Created on: Nov 24, 2009
9
* Author: leite
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 "Identifier/Identifier.h"
20
21
#include "
xAODForward/ZdcModuleAuxContainer.h
"
22
#include "
xAODForward/ZdcModuleContainer.h
"
23
#include "
ZdcRec/ZdcRecV2.h
"
24
#include "
ZdcRec/ZdcRecChannelToolV2.h
"
25
#include "
xAODForward/ZdcModuleToString.h
"
26
27
#include "
ZdcByteStream/ZdcToString.h
"
28
29
//==================================================================================================
30
ZdcRecV2::ZdcRecV2
(
const
std::string& name, ISvcLocator* pSvcLocator) :
31
32
AthAlgorithm
(name, pSvcLocator),
33
m_storeGate
(
"StoreGateSvc"
, name),
34
m_ownPolicy
(static_cast<int> (
SG
::OWN_ELEMENTS)),
35
m_ttContainerName
(
"ZdcTriggerTowers"
),
36
m_zdcModuleContainerName
(
"ZdcModules"
),
37
m_zdcModuleAuxContainerName
(
"ZdcModulesAux."
),
38
m_ttContainer
(nullptr),
39
m_eventCount
(0),
40
m_complainContain
(1),
41
m_complainRetrieve
(1),
42
m_ChannelTool
(
"ZdcRecChannelToolV2"
)
43
44
{
45
declareProperty
(
"OwnPolicy"
,
m_ownPolicy
) ;
46
47
declareProperty
(
"DigitsContainerName"
,
m_ttContainerName
,
"ZdcTriggerTowers"
);
48
declareProperty
(
"ZdcModuleContainerName"
,
m_zdcModuleContainerName
,
"ZdcModules"
);
49
declareProperty
(
"ZdcModuleAuxContainerName"
,
m_zdcModuleAuxContainerName
,
"ZdcModulesAux."
);
50
}
51
//==================================================================================================
52
53
//==================================================================================================
54
ZdcRecV2::~ZdcRecV2
() {}
55
//==================================================================================================
56
57
//==================================================================================================
58
StatusCode
ZdcRecV2::initialize
()
59
{
60
MsgStream mLog(msgSvc(), name());
61
62
// Look up the Storegate service
63
StatusCode
sc
=
m_storeGate
.retrieve();
64
if
(
sc
.isFailure())
65
{
66
mLog << MSG::FATAL <<
"--> ZDC: Unable to retrieve pointer to StoreGateSvc"
<<
endmsg
;
67
return
sc
;
68
}
69
70
71
// Reconstruction Tool
72
StatusCode scTool =
m_ChannelTool
.retrieve();
73
if
(scTool.isFailure())
74
{
75
mLog << MSG::WARNING <<
"--> ZDC: Could not retrieve "
<<
m_ChannelTool
<<
endmsg
;
76
return
StatusCode::FAILURE;
77
}
78
mLog << MSG::DEBUG <<
"--> ZDC: SUCCESS retrieving "
<<
m_ChannelTool
<<
endmsg
;
79
80
// Container output name
81
//TODO: change MESSAGE !!
82
mLog << MSG::DEBUG <<
" Output Container Name "
<<
m_zdcModuleContainerName
<<
endmsg
;
83
if
(
m_ownPolicy
==
SG::OWN_ELEMENTS
)
84
mLog << MSG::DEBUG <<
"...will OWN its cells."
<<
endmsg
;
85
else
86
mLog << MSG::DEBUG <<
"...will VIEW its cells."
<<
endmsg
;
87
88
89
mLog << MSG::DEBUG <<
"--> ZDC: ZdcRecV2 initialization complete"
<<
endmsg
;
90
91
return
StatusCode::SUCCESS;
92
}
93
//==================================================================================================
94
95
//==================================================================================================
96
StatusCode
ZdcRecV2::execute
(
const
EventContext&
/*ctx*/
)
97
{
98
99
MsgStream mLog(msgSvc(), name());
100
mLog << MSG::DEBUG
101
<<
"--> ZDC: ZdcRecV2 execute starting on "
102
<<
m_eventCount
103
<<
"th event"
104
<<
endmsg
;
105
106
m_eventCount
++;
107
108
//Look for the container presence
109
bool
dg =
m_storeGate
->contains<
xAOD::TriggerTowerContainer
>(
m_ttContainerName
);
110
if
(!dg) {
111
if
(
m_complainContain
) mLog << MSG::WARNING <<
"--> ZDC: StoreGate does not contain "
<<
m_ttContainerName
<<
endmsg
;
112
m_complainContain
= 0;
113
return
StatusCode::SUCCESS;
114
}
115
116
// Look up the Digits "TriggerTowerContainer" in Storegate
117
StatusCode digitsLookupSC =
m_storeGate
->retrieve(
m_ttContainer
,
m_ttContainerName
);
118
if
(digitsLookupSC.isFailure())
119
{
120
if
(
m_complainRetrieve
)
121
mLog << MSG::WARNING
122
<<
"--> ZDC: Could not retrieve "
123
<<
m_ttContainerName
124
<<
" from StoreGate"
125
<<
endmsg
;
126
m_complainRetrieve
= 0;
127
return
StatusCode::SUCCESS;
128
}
129
130
if
(digitsLookupSC.isSuccess() && !
m_ttContainer
)
131
{
132
mLog << MSG::ERROR
133
<<
"--> ZDC: Storegate returned zero pointer for "
134
<<
m_ttContainerName
135
<<
endmsg
;
136
return
StatusCode::SUCCESS;
137
}
138
139
//Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
140
std::unique_ptr<xAOD::ZdcModuleContainer> moduleContainer(
new
xAOD::ZdcModuleContainer
());
141
std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleAuxContainer(
new
xAOD::ZdcModuleAuxContainer
() );
142
moduleContainer->setStore( moduleAuxContainer.get() );
143
144
// Disabled for Run 3 since this code isn't being run anyway
145
//int ncha = m_ChannelTool->convertTT2ZM(m_ttContainer, moduleContainer.get() );
146
//msg( MSG::DEBUG ) << "Channel tool returns " << ncha << endmsg;
147
148
msg
( MSG::DEBUG ) <<
ZdcModuleToString
(*moduleContainer) <<
endmsg
;
149
//msg( MSG::INFO ) << ZdcModuleToString(*moduleContainer) << endmsg;
150
151
ATH_CHECK
(
evtStore
()->record( std::move(moduleContainer),
m_zdcModuleContainerName
) );
152
ATH_CHECK
(
evtStore
()->record( std::move(moduleAuxContainer),
m_zdcModuleAuxContainerName
) );
153
154
return
StatusCode::SUCCESS;
155
156
}
157
//==================================================================================================
158
159
//==================================================================================================
160
StatusCode
ZdcRecV2::finalize
()
161
{
162
163
MsgStream mLog(msgSvc(),name());
164
165
mLog << MSG::DEBUG
166
<<
"--> ZDC: ZdcRecV2 finalize complete"
167
<<
endmsg
;
168
169
return
StatusCode::SUCCESS;
170
171
}
172
//==================================================================================================
173
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
StoreGateSvc.h
ZdcModuleAuxContainer.h
ZdcModuleContainer.h
ZdcModuleToString
std::string ZdcModuleToString(const xAOD::ZdcModule &zm)
Definition
ZdcModuleToString.cxx:11
ZdcModuleToString.h
ZdcRecChannelToolV2.h
ZdcRecV2.h
ZdcToString.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
ZdcRecV2::m_zdcModuleContainerName
std::string m_zdcModuleContainerName
Raw data object name.
Definition
ZdcRecV2.h:74
ZdcRecV2::m_ChannelTool
ToolHandle< ZdcRecChannelToolV2 > m_ChannelTool
Definition
ZdcRecV2.h:88
ZdcRecV2::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
ZdcRecV2.cxx:96
ZdcRecV2::m_ttContainer
const xAOD::TriggerTowerContainer * m_ttContainer
Pointer to Zdc input "digits" data.
Definition
ZdcRecV2.h:79
ZdcRecV2::m_complainRetrieve
bool m_complainRetrieve
Definition
ZdcRecV2.h:83
ZdcRecV2::m_eventCount
int m_eventCount
Definition
ZdcRecV2.h:81
ZdcRecV2::m_ownPolicy
int m_ownPolicy
Does the collection own it's objects ?
Definition
ZdcRecV2.h:67
ZdcRecV2::initialize
StatusCode initialize()
Definition
ZdcRecV2.cxx:58
ZdcRecV2::m_storeGate
ServiceHandle< StoreGateSvc > m_storeGate
class member version of retrieving StoreGate
Definition
ZdcRecV2.h:63
ZdcRecV2::m_complainContain
bool m_complainContain
Definition
ZdcRecV2.h:82
ZdcRecV2::ZdcRecV2
ZdcRecV2(const std::string &name, ISvcLocator *pSvcLocator)
Definition
ZdcRecV2.cxx:30
ZdcRecV2::finalize
StatusCode finalize()
Definition
ZdcRecV2.cxx:160
ZdcRecV2::m_ttContainerName
std::string m_ttContainerName
Digits data container name.
Definition
ZdcRecV2.h:71
ZdcRecV2::~ZdcRecV2
~ZdcRecV2()
Definition
ZdcRecV2.cxx:54
ZdcRecV2::m_zdcModuleAuxContainerName
std::string m_zdcModuleAuxContainerName
Definition
ZdcRecV2.h:75
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
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::TriggerTowerContainer
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
Definition
TriggerTowerContainer.h:15
xAOD::ZdcModuleAuxContainer
ZdcModuleAuxContainer_v2 ZdcModuleAuxContainer
Definition
ZdcModuleAuxContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0