ATLAS Offline Software
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"
18 #include "StoreGate/StoreGateSvc.h"
19 #include "StoreGate/WriteHandle.h"
20 #include "StoreGate/ReadHandle.h"
21 //#include "Identifier/Identifier.h"
22 
25 #include "ZdcRec/ZdcRecV3Decode.h"
29 
30 //==================================================================================================
31 ZdcRecV3Decode::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 //==================================================================================================
71 {
72 
73  const EventContext& ctx = Gaudi::Hive::currentContext();
74  ATH_MSG_DEBUG ("--> ZDC: ZdcRecV3Decode execute starting on "
75  << ctx.evt()
76  << "th event");
77 
78  //Look for the container presence
79  if (m_ttContainerName.empty()) {
80  return StatusCode::SUCCESS;
81  }
82 
83  // Look up the Digits "TriggerTowerContainer" in Storegate
85 
86  //Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
87  std::unique_ptr<xAOD::ZdcModuleContainer> moduleContainer( new xAOD::ZdcModuleContainer());
88  std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleAuxContainer( new xAOD::ZdcModuleAuxContainer() );
89  moduleContainer->setStore( moduleAuxContainer.get() );
90 
91  //Create the containers to hold the reconstructed information (you just pass the pointer and the converter does the work)
92  std::unique_ptr<xAOD::ZdcModuleContainer> moduleSumContainer( new xAOD::ZdcModuleContainer());
93  std::unique_ptr<xAOD::ZdcModuleAuxContainer> moduleSumAuxContainer( new xAOD::ZdcModuleAuxContainer() );
94  moduleSumContainer->setStore( moduleSumAuxContainer.get() );
95 
96  // rearrange ZDC channels and perform fast reco on all channels (including non-big tubes)
97  int ncha = m_ChannelTool->convertTT2ZM(ttContainer.get(), moduleContainer.get(), moduleSumContainer.get() );
98  ATH_MSG_DEBUG("m_ChannelTool->convertTT2ZM returned " << ncha << " channels");
99  //msg( MSG::DEBUG ) << ZdcModuleToString(*moduleContainer) << endmsg;
100 
102  ATH_CHECK( moduleContainerH.record (std::move(moduleContainer),
103  std::move(moduleAuxContainer)) );
104 
106  ATH_CHECK( sumsContainerH.record (std::move(moduleSumContainer),
107  std::move(moduleSumAuxContainer)) );
108 
109  return StatusCode::SUCCESS;
110 
111 }
112 //==================================================================================================
113 
114 //==================================================================================================
116 {
117 
118  ATH_MSG_DEBUG( "--> ZDC: ZdcRecV3Decode finalize complete" );
119 
120  return StatusCode::SUCCESS;
121 
122 }
123 //==================================================================================================
124 
ZdcRecV3Decode::finalize
StatusCode finalize() override
Definition: ZdcRecV3Decode.cxx:115
ZdcRecV3Decode::m_zdcModuleContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_zdcModuleContainerName
Definition: ZdcRecV3Decode.h:69
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
ZdcRecV3Decode::m_ttContainerName
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_ttContainerName
Definition: ZdcRecV3Decode.h:66
ZdcRecV3Decode::ZdcRecV3Decode
ZdcRecV3Decode(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ZdcRecV3Decode.cxx:31
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::ZdcModuleAuxContainer_v2
Auxiliary store for xAOD::ZdcModuleContainer_v2.
Definition: ZdcModuleAuxContainer_v2.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ZdcModuleAuxContainer.h
WriteHandle.h
Handle class for recording to StoreGate.
ZdcRecV3Decode::initialize
StatusCode initialize() override
Definition: ZdcRecV3Decode.cxx:45
ZdcRecV3Decode.h
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ZdcRecV3Decode::~ZdcRecV3Decode
~ZdcRecV3Decode()
Definition: ZdcRecV3Decode.cxx:41
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
ZdcToString.h
ZdcRecV3Decode::m_zdcSumContainerName
SG::WriteHandleKey< xAOD::ZdcModuleContainer > m_zdcSumContainerName
Definition: ZdcRecV3Decode.h:72
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ZdcRecChannelToolV2.h
ZdcRecV3Decode::execute
StatusCode execute() override
Definition: ZdcRecV3Decode.cxx:70
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ZdcModuleToString.h
DEBUG
#define DEBUG
Definition: page_access.h:11
ZdcRecV3Decode::m_ownPolicy
int m_ownPolicy
Definition: ZdcRecV3Decode.h:63
ReadHandle.h
Handle class for reading from StoreGate.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
StoreGateSvc.h
ZdcModuleContainer.h
ZdcRecV3Decode::m_ChannelTool
ToolHandle< ZdcRecChannelToolV2 > m_ChannelTool
Definition: ZdcRecV3Decode.h:78