ATLAS Offline Software
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"
18 #include "StoreGate/StoreGateSvc.h"
20 
21 // Identifier includes
30 #include "CaloIdentifier/TileID.h"
36 
37 
38 long int
40 {
41  return (storageType());
42 }
43 
46 {
47  // First call parent init
49  return StatusCode::SUCCESS;
50 }
51 
52 
53 //--------------------------------------------------------------------
54 
55 
56 namespace {
57 
58 
59 template <class T>
61  const char* sgkey,
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 
76 CaloIdMgrDetDescrCnv::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 
107  SET_HELPER (TileID);
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 
140 long
142 {
143  return DetDescr_StorageType;
144 }
145 
146 //--------------------------------------------------------------------
147 const CLID&
150 }
151 
152 //--------------------------------------------------------------------
154  :
155  DetDescrConverter(ClassID_traits<CaloIdManager>::ID(), svcloc, "CaloIdMgrDetDescrCnv")
156 {}
common.sgkey
def sgkey(tool)
Definition: common.py:1028
CaloIdMgrDetDescrCnv::classID
static const CLID & classID()
class ID (used by CnvFactory)
Definition: CaloIdMgrDetDescrCnv.cxx:148
CaloIdMgrDetDescrCnv.h
CHECK_WITH_CONTEXT
#define CHECK_WITH_CONTEXT(...)
Evaluate an expression and check for errors, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:396
LArEM_ID.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DetDescr_StorageType
const long DetDescr_StorageType
Definition: DetDescrCnvSvc.cxx:20
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TTOnlineID
Helper class for Calo TT online identifiers.
Definition: TTOnlineID.h:37
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArFCAL_SuperCell_ID
Helper class for LArFCAL offline identifiers for supercells.
Definition: LArFCAL_SuperCell_ID.h:48
LArFCAL_SuperCell_ID.h
DetDescrAddress.h
LArHEC_ID
Helper class for LArHEC offline identifiers.
Definition: LArHEC_ID.h:85
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
Tile_SuperCell_ID
Helper class for Tile offline identifiers for supercells.
Definition: Tile_SuperCell_ID.h:64
LArHEC_ID.h
LArEM_SuperCell_ID.h
Helper class for LArEM offline identifiers for supercells.
TileID.h
CaloCell_ID.h
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
LArHEC_SuperCell_ID.h
Helper class for LArHEC offline identifiers for supercells.
CaloIdMgrDetDescrCnv::CaloIdMgrDetDescrCnv
CaloIdMgrDetDescrCnv(ISvcLocator *svcloc)
Definition: CaloIdMgrDetDescrCnv.cxx:153
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
CaloIdManager::initialize
void initialize(void)
Definition: CaloIdManager.cxx:146
LArEM_SuperCell_ID
Helper class for LArEM offline identifiers for supercells.
Definition: LArEM_SuperCell_ID.h:122
DetDescrConverter
Definition: DetDescrConverter.h:25
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
CaloCell_SuperCell_ID
Helper class for offline supercell identifiers.
Definition: CaloCell_SuperCell_ID.h:48
lumiFormat.i
int i
Definition: lumiFormat.py:85
AtlasDetectorID::file_names
const std::vector< std::string > & file_names(void) const
File names for subdet dictionaries.
Definition: AtlasDetectorID.cxx:716
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CaloIdMgrDetDescrCnv::storageType
static long storageType()
Storage type (used by CnvFactory)
Definition: CaloIdMgrDetDescrCnv.cxx:141
TTOnlineID.h
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
CaloDM_ID.h
CaloIdManager::isInitialized
bool isInitialized(void) const
Definition: CaloIdManager.cxx:152
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
CaloLVL1_ID
Helper class for offline TT identifiers.
Definition: CaloLVL1_ID.h:66
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition: CaloIdManager.cxx:63
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SET_HELPER
#define SET_HELPER(H)
LArFCAL_ID.h
CaloLVL1_ID.h
LArMiniFCAL_ID
Helper class for LArMiniFCAL offline identifiers.
Definition: LArMiniFCAL_ID.h:57
DetDescrConverter.h
LArMiniFCAL_ID.h
CaloDM_ID
Helper class for Calo Dead Material offline identifiers.
Definition: CaloDM_ID.h:102
DEBUG
#define DEBUG
Definition: page_access.h:11
LArHEC_SuperCell_ID
Helper class for LArHEC offline identifiers for supercells.
Definition: LArHEC_SuperCell_ID.h:59
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Tile_SuperCell_ID.h
Helper class for Tile offline identifiers for supercells.
CaloIdManager.h
LArEM_ID
Helper class for LArEM offline identifiers.
Definition: LArEM_ID.h:118
CaloIdMgrDetDescrCnv::repSvcType
virtual long int repSvcType() const override
Definition: CaloIdMgrDetDescrCnv.cxx:39
LArFCAL_ID
Helper class for LArFCAL offline identifiers.
Definition: LArFCAL_ID.h:60
CaloIdMgrDetDescrCnv::initialize
virtual StatusCode initialize() override
Definition: CaloIdMgrDetDescrCnv.cxx:45
StoreGateSvc.h
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
ServiceHandle< StoreGateSvc >
CaloIdMgrDetDescrCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Definition: CaloIdMgrDetDescrCnv.cxx:76