ATLAS Offline Software
TileHWIDDetDescrCnv.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  Tile DetDescrCnv package
7  -----------------------------------------
8  ***************************************************************************/
9 
10 //<doc><file> $Id: TileHWIDDetDescrCnv.cxx,v 1.7 2009-02-12 10:11:09 solodkov Exp $
11 //<version> $Name: not supported by cvs2svn $
12 
13 //<<<<<< INCLUDES >>>>>>
14 
16 
19 #include "GaudiKernel/MsgStream.h"
20 #include "StoreGate/StoreGateSvc.h"
21 
23 //#include "Identifier/IdentifierHash.h"
25 
26 //<<<<<< PRIVATE DEFINES >>>>>>
27 //<<<<<< PRIVATE CONSTANTS >>>>>>
28 //<<<<<< PRIVATE TYPES >>>>>>
29 //<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>>
30 //<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>>
31 //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>>
32 //<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>>
33 //<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>>
34 //<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>>
35 
38 {
39  // First call parent init
41  MsgStream log(msgSvc(), "TileHWIDDetDescrCnv");
42  log << MSG::DEBUG << "in initialize" << endmsg;
43 
44  if (sc.isFailure()) {
45  log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg;
46  return sc;
47  }
48 
49  return StatusCode::SUCCESS;
50 }
51 
52 //--------------------------------------------------------------------
53 
56 {
57  MsgStream log(msgSvc(), "TileHWIDDetDescrCnv");
58  log << MSG::DEBUG << "in finalize" << endmsg;
59 
60  return StatusCode::SUCCESS;
61 }
62 
63 //--------------------------------------------------------------------
64 
66 TileHWIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
67 {
68  //StatusCode sc = StatusCode::SUCCESS;
69  MsgStream log(msgSvc(), "TileHWIDDetDescrCnv");
70  log << MSG::INFO << "in createObj: creating a TileHWID helper object in the detector store" << endmsg;
71 
72  // Create a new TileHWID
73 
74  DetDescrAddress* ddAddr;
75  ddAddr = dynamic_cast<DetDescrAddress*> (pAddr);
76  if(!ddAddr) {
77  log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg;
78  return StatusCode::FAILURE;
79  }
80 
81  // Get the StoreGate key of this container.
82  std::string helperKey = *( ddAddr->par() );
83  if ("" == helperKey) {
84  log << MSG::DEBUG << "No Helper key " << endmsg;
85  }
86  else {
87  log << MSG::DEBUG << "Helper key is " << helperKey << endmsg;
88  }
89 
90 
91  // get DetectorStore service
93  StatusCode status = serviceLocator()->service("DetectorStore", detStore);
94  if (status.isFailure()) {
95  log << MSG::FATAL << "DetectorStore service not found !" << endmsg;
96  return StatusCode::FAILURE;
97  } else {}
98 
99  // Get the dictionary manager from the detector store
100  const IdDictManager* idDictMgr;
101  status = detStore->retrieve(idDictMgr, "IdDict");
102  if (status.isFailure()) {
103  log << MSG::FATAL << "Could not get IdDictManager !" << endmsg;
104  return StatusCode::FAILURE;
105  }
106  else {
107  log << MSG::DEBUG << " Found the IdDictManager. " << endmsg;
108  }
109 
110 
111  // create the helper
112  TileHWID* tilehw_id = new TileHWID;
113 
114  // pass a pointer to IMessageSvc to the helper
115  tilehw_id->setMessageSvc(msgSvc());
116 
117  if (idDictMgr->initializeHelper(*tilehw_id)) {
118  log << MSG::ERROR << "Unable to initialize TileHWID" << endmsg;
119  return StatusCode::FAILURE;
120  }
121  else {
122  log << MSG::DEBUG << " Initialized TileHWID. " << endmsg;
123  }
124 
125  // Pass a pointer to the container to the Persistency service by reference.
126  pObj = SG::asStorable(tilehw_id);
127 
128  return StatusCode::SUCCESS;
129 
130 }
131 
132 //--------------------------------------------------------------------
133 
134 long
136 {
137  return DetDescr_StorageType;
138 }
139 
140 long
142 {
143  return DetDescr_StorageType;
144 }
145 
146 //--------------------------------------------------------------------
147 const CLID&
150 }
151 
152 //--------------------------------------------------------------------
154  :
156 {}
157 
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
TileHWIDDetDescrCnv::TileHWIDDetDescrCnv
TileHWIDDetDescrCnv(ISvcLocator *svcloc)
Definition: TileHWIDDetDescrCnv.cxx:153
initialize
void initialize()
Definition: run_EoverP.cxx:894
TileHWIDDetDescrCnv::classID
static const CLID & classID()
Definition: TileHWIDDetDescrCnv.cxx:148
DetDescrAddress.h
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
IdDictManager.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TileHWIDDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Definition: TileHWIDDetDescrCnv.cxx:66
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
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
TileHWID.h
DetDescrAddress
Definition: DetDescrAddress.h:32
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
TileHWIDDetDescrCnv::repSvcType
virtual long repSvcType() const
Definition: TileHWIDDetDescrCnv.cxx:141
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
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
python.Classes.TileHWID
TileHWID
Definition: TileIdentifier/python/Classes.py:5
IdDictManager::initializeHelper
int initializeHelper(IdHelper &helper) const
Return value: 0 OK, >0 error.
Definition: IdDictManager.cxx:44
TileHWIDDetDescrCnv.h
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
TileHWIDDetDescrCnv::initialize
virtual StatusCode initialize()
Definition: TileHWIDDetDescrCnv.cxx:37
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition: IdDictManager.h:36
DetDescrConverter.h
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TileHWIDDetDescrCnv::finalize
virtual StatusCode finalize()
Definition: TileHWIDDetDescrCnv.cxx:55
merge.status
status
Definition: merge.py:17
TileHWIDDetDescrCnv::storageType
static long storageType()
Definition: TileHWIDDetDescrCnv.cxx:135
StoreGateSvc.h