ATLAS Offline Software
T_Muon_IDDetDescrCnv.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "AthenaKernel/StorableConversions.h"
6 #include "DetDescrCnvSvc/DetDescrConverter.h"
7 #include "IdDictDetDescr/IdDictManager.h"
8 
9 
10 /// Constructor
11 template <class IDHELPER>
12 T_Muon_IDDetDescrCnv<IDHELPER>::T_Muon_IDDetDescrCnv(ISvcLocator* svcloc, const char* name)
13  : DetDescrConverter(ClassID_traits<IDHELPER>::ID(), svcloc, name)
14 {}
15 
16 
17 template <class IDHELPER>
18 StatusCode
19 T_Muon_IDDetDescrCnv<IDHELPER>::initialize()
20 {
21  ATH_CHECK( DetDescrConverter::initialize() );
22  return StatusCode::SUCCESS;
23 }
24 
25 
26 template <class IDHELPER>
27 StatusCode
28 T_Muon_IDDetDescrCnv<IDHELPER>::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj)
29 {
30  ATH_MSG_DEBUG("in createObj: creating a helper object in the detector store");
31 
32  // Get the dictionary manager from the detector store.
33  const IdDictManager* idDictMgr = nullptr;
34  ATH_CHECK( detStore()->retrieve(idDictMgr, "IdDict") );
35 
36  // Create the helper.
37  auto id_helper = new IDHELPER;
38  ATH_CHECK( idDictMgr->initializeHelper(*id_helper)==0 );
39 
40  // Pass a pointer to the container to the Persistency service by reference.
41  pObj = SG::asStorable(id_helper);
42 
43  return StatusCode::SUCCESS;
44 }