ATLAS Offline Software
Loading...
Searching...
No Matches
CaloIdMgrDetDescrCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 Calo Det Descr converter package
7 -----------------------------------------
8 ***************************************************************************/
9
12
13
14// infrastructure includes
17#include "GaudiKernel/MsgStream.h"
20
21// Identifier includes
36
37
38long int
40{
41 return (storageType());
42}
43
44StatusCode
46{
47 // First call parent init
48 ATH_CHECK( DetDescrConverter::initialize() );
49 return StatusCode::SUCCESS;
50}
51
52
53//--------------------------------------------------------------------
54
55
56namespace {
57
58
59template <class T>
60StatusCode set_helper (const ServiceHandle<StoreGateSvc>& detStore,
61 const char* sgkey,
62 CaloIdManager* mgr,
63 MsgStream& log)
64{
65 const T* id = 0;
66 CHECK_WITH_CONTEXT( detStore->retrieve (id, sgkey), "CaloIdMgrDetDescrCnv" );
67 mgr->set_helper (id);
68 log << MSG::DEBUG << "Found Calo ID helper " << sgkey << endmsg;
69 return StatusCode::SUCCESS;
70}
71
72
73} // anonymous namespace
74
75StatusCode
76CaloIdMgrDetDescrCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj)
77{
78 ATH_MSG_INFO("in createObj: creating a CaloDescrManager object in the detector store");
79
80 // Create the manager
81 CaloIdManager* caloIdMgr = new CaloIdManager();
82
83 // Pass a pointer to the container to the Persistency service by reference.
84 pObj = SG::asStorable(caloIdMgr);
85
86 // Initialize manager with all helpers.
87#define SET_HELPER(H) CHECK( set_helper<H> (detStore(), #H, caloIdMgr, msg()) )
88
90
91 bool is_test_beam = false;
92 std::vector<std::string> file_names =
93 caloIdMgr->getCaloCell_ID()->file_names();
94 for (size_t i = 0; i < file_names.size(); i++) {
95 if (file_names[i].find ("_H8_") != std::string::npos) {
96 is_test_beam =true;
97 break;
98 }
99 }
100
109
110 if (!is_test_beam) {
116 }
117
118#undef SET_HELPER
119
120 // Initialize the calo mgr
121 // We protect here in case this has been initialized elsewhere
122 if (!caloIdMgr->isInitialized()) {
123
124 ATH_MSG_DEBUG("Initializing CaloIdMgr from values in CaloIdMgrDetDescrCnv");
125
126 // Initialize the manager ...
127
128 // in this one, only strictly calo work is done
129 caloIdMgr->initialize();
130
131 }
132
133
134 return StatusCode::SUCCESS;
135
136}
137
138//--------------------------------------------------------------------
139
140long
145
146//--------------------------------------------------------------------
147const CLID&
151
152//--------------------------------------------------------------------
154 :
155 DetDescrConverter(ClassID_traits<CaloIdManager>::ID(), svcloc, "CaloIdMgrDetDescrCnv")
156{}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::vector< Identifier > ID
Helper class for offline supercell identifiers.
#define SET_HELPER(H)
Helpers for checking error return status codes and reporting errors.
#define CHECK_WITH_CONTEXT(...)
Evaluate an expression and check for errors, with an explicitly specified context name.
const long DetDescr_StorageType
uint32_t CLID
The Class ID type.
Helper class for LArEM offline identifiers for supercells.
Helper class for LArHEC offline identifiers for supercells.
Helper class for Tile offline identifiers for supercells.
const std::vector< std::string > & file_names(void) const
File names for subdet dictionaries.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
Helper class for offline supercell identifiers.
Helper class for Calo Dead Material offline identifiers.
Definition CaloDM_ID.h:102
This class initializes the Calo (LAr and Tile) offline identifiers.
bool isInitialized(void) const
void initialize(void)
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
static const CLID & classID()
class ID (used by CnvFactory)
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
virtual StatusCode initialize() override
static long storageType()
Storage type (used by CnvFactory)
virtual long int repSvcType() const override
CaloIdMgrDetDescrCnv(ISvcLocator *svcloc)
Helper class for offline TT identifiers.
Definition CaloLVL1_ID.h:66
DetDescrConverter(const CLID &myCLID, ISvcLocator *svcloc, const char *name=nullptr)
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
Helper class for LArEM offline identifiers for supercells.
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
Helper class for LArFCAL offline identifiers for supercells.
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76
Helper class for LArHEC offline identifiers for supercells.
Helper class for LArMiniFCAL offline identifiers.
Helper class for Calo TT online identifiers.
Definition TTOnlineID.h:29
Helper class for TileCal offline identifiers.
Definition TileID.h:67
Helper class for Tile offline identifiers for supercells.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Default, invalid implementation of ClassID_traits.