ATLAS Offline Software
LArOnline_SuperCellIDDetDescrCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***************************************************************************
6  LAr DetDescrCnv package
7  -----------------------------------------
8  ***************************************************************************/
9 
10 
12 
15 #include "GaudiKernel/MsgStream.h"
16 #include "StoreGate/StoreGateSvc.h"
17 
20 
21 
22 long int
24 {
25  return (storageType());
26 }
27 
30 {
31  // First call parent init
33  MsgStream log(msgSvc(), "LArOnline_SuperCellIDDetDescrCnv");
34  log << MSG::DEBUG << "in initialize" << endmsg;
35 
36  if (sc.isFailure()) {
37  log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg;
38  return sc;
39  }
40 
41  return StatusCode::SUCCESS;
42 }
43 
44 //--------------------------------------------------------------------
45 
48 {
49  MsgStream log(msgSvc(), "LArOnline_SuperCellIDDetDescrCnv");
50  log << MSG::DEBUG << "in finalize" << endmsg;
51 
52  return StatusCode::SUCCESS;
53 }
54 
55 //--------------------------------------------------------------------
56 
58 LArOnline_SuperCellIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
59 {
60  //StatusCode sc = StatusCode::SUCCESS;
61  MsgStream log(msgSvc(), "LArOnline_SuperCellIDDetDescrCnv");
62  log << MSG::INFO << "in createObj: creating a LArOnline_SuperCellID helper object in the detector store" << endmsg;
63 
64  // Create a new LArOnline_SuperCellID
65 
66  DetDescrAddress* ddAddr;
67  ddAddr = dynamic_cast<DetDescrAddress*> (pAddr);
68  if(!ddAddr) {
69  log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg;
70  return StatusCode::FAILURE;
71  }
72 
73  // Get the StoreGate key of this container.
74  std::string helperKey = *( ddAddr->par() );
75  if ("" == helperKey) {
76  log << MSG::DEBUG << "No Helper key " << endmsg;
77  }
78  else {
79  log << MSG::DEBUG << "Helper key is " << helperKey << endmsg;
80  }
81 
82 
83  // get DetectorStore service
85  StatusCode status = serviceLocator()->service("DetectorStore", detStore);
86  if (status.isFailure()) {
87  log << MSG::FATAL << "DetectorStore service not found !" << endmsg;
88  return StatusCode::FAILURE;
89  } else {}
90 
91  // Get the dictionary manager from the detector store
92  //const DataHandle<IdDictManager> idDictMgr;
93  const IdDictManager* idDictMgr;
94  status = detStore->retrieve(idDictMgr, "IdDict");
95  if (status.isFailure()) {
96  log << MSG::FATAL << "Could not get IdDictManager !" << endmsg;
97  return StatusCode::FAILURE;
98  }
99  else {
100  log << MSG::DEBUG << " Found the IdDictManager. " << endmsg;
101  }
102 
103 
104  // create the helper
106  // pass a pointer to IMessageSvc to the helper
107  online_id->setMessageSvc(msgSvc());
108 
109  if (idDictMgr->initializeHelper(*online_id)) {
110  log << MSG::ERROR << "Unable to initialize LArOnline_SuperCellID" << endmsg;
111  return StatusCode::FAILURE;
112  }
113  else {
114  log << MSG::DEBUG << " Initialized LArOnline_SuperCellID. " << endmsg;
115  }
116 
117  // Pass a pointer to the container to the Persistency service by reference.
118  pObj = SG::asStorable(online_id);
119 
120  return StatusCode::SUCCESS;
121 
122 }
123 
124 //--------------------------------------------------------------------
125 
126 long
128 {
129  return DetDescr_StorageType;
130 }
131 
132 //--------------------------------------------------------------------
133 const CLID&
136 }
137 
138 //--------------------------------------------------------------------
140  :
142 {}
143 
144 
145 
LArOnline_SuperCellIDDetDescrCnv.h
AtlasDetectorID::setMessageSvc
virtual void setMessageSvc(IMessageSvc *msgSvc) override
Definition: AtlasDetectorID.cxx:748
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
DetDescr_StorageType
const long DetDescr_StorageType
Definition: DetDescrCnvSvc.cxx:20
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
LArOnline_SuperCellIDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:58
initialize
void initialize()
Definition: run_EoverP.cxx:894
DetDescrAddress.h
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
IdDictManager.h
LArOnline_SuperCellIDDetDescrCnv::storageType
static long storageType()
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:127
LArOnline_SuperCellIDDetDescrCnv::repSvcType
virtual long int repSvcType() const
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:23
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
DetDescrConverter
Definition: DetDescrConverter.h:32
DetDescrAddress
Definition: DetDescrAddress.h:32
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
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
LArOnline_SuperCellIDDetDescrCnv::initialize
virtual StatusCode initialize()
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
LArOnline_SuperCellIDDetDescrCnv::finalize
virtual StatusCode finalize()
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:47
LArOnline_SuperCellIDDetDescrCnv::LArOnline_SuperCellIDDetDescrCnv
LArOnline_SuperCellIDDetDescrCnv(ISvcLocator *svcloc)
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:139
IdDictManager::initializeHelper
int initializeHelper(IdHelper &helper) const
Return value: 0 OK, >0 error.
Definition: IdDictManager.cxx:44
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition: IdDictManager.h:36
LArOnline_SuperCellID
Definition: LArOnline_SuperCellID.h:20
DetDescrConverter.h
DEBUG
#define DEBUG
Definition: page_access.h:11
LArOnline_SuperCellIDDetDescrCnv::classID
static const CLID & classID()
Definition: LArOnline_SuperCellIDDetDescrCnv.cxx:134
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArOnline_SuperCellID.h
merge.status
status
Definition: merge.py:17
StoreGateSvc.h