ATLAS Offline Software
Loading...
Searching...
No Matches
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"
19//#include "Identifier/Identifier.h"
20
23#include "ZdcRec/ZdcRecV2.h"
26
28
29//==================================================================================================
30ZdcRecV2::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),
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//==================================================================================================
55//==================================================================================================
56
57//==================================================================================================
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;
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//==================================================================================================
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
110 if (!dg) {
111 if (m_complainContain) mLog << MSG::WARNING << "--> ZDC: StoreGate does not contain " << m_ttContainerName << endmsg;
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 {
121 mLog << MSG::WARNING
122 << "--> ZDC: Could not retrieve "
124 << " from StoreGate"
125 << endmsg;
127 return StatusCode::SUCCESS;
128 }
129
130 if (digitsLookupSC.isSuccess() && !m_ttContainer)
131 {
132 mLog << MSG::ERROR
133 << "--> ZDC: Storegate returned zero pointer for "
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//==================================================================================================
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
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
std::string ZdcModuleToString(const xAOD::ZdcModule &zm)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
MsgStream & msg() const
std::string m_zdcModuleContainerName
Raw data object name.
Definition ZdcRecV2.h:74
ToolHandle< ZdcRecChannelToolV2 > m_ChannelTool
Definition ZdcRecV2.h:88
const xAOD::TriggerTowerContainer * m_ttContainer
Pointer to Zdc input "digits" data.
Definition ZdcRecV2.h:79
bool m_complainRetrieve
Definition ZdcRecV2.h:83
int m_eventCount
Definition ZdcRecV2.h:81
int m_ownPolicy
Does the collection own it's objects ?
Definition ZdcRecV2.h:67
StatusCode initialize()
Definition ZdcRecV2.cxx:58
ServiceHandle< StoreGateSvc > m_storeGate
class member version of retrieving StoreGate
Definition ZdcRecV2.h:63
StatusCode execute()
Definition ZdcRecV2.cxx:96
bool m_complainContain
Definition ZdcRecV2.h:82
ZdcRecV2(const std::string &name, ISvcLocator *pSvcLocator)
Definition ZdcRecV2.cxx:30
StatusCode finalize()
Definition ZdcRecV2.cxx:160
std::string m_ttContainerName
Digits data container name.
Definition ZdcRecV2.h:71
std::string m_zdcModuleAuxContainerName
Definition ZdcRecV2.h:75
Forward declaration.
@ OWN_ELEMENTS
this data object owns its elements
ZdcModuleContainer_v1 ZdcModuleContainer
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
ZdcModuleAuxContainer_v2 ZdcModuleAuxContainer