ATLAS Offline Software
Loading...
Searching...
No Matches
VP1DetInfo.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class VP1DetInfo //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: March 2008 //
12// //
14
15#include "VP1Utils/VP1DetInfo.h"
19#include "VP1Base/VP1Msg.h"
20#include "VP1Base/IVP1System.h"
22
34
45
46#include "Identifier/Identifier.h"
47
48//____________________________________________________________________
50public:
51 template <class T>
52 static const T * cachedRetrieve(const T*& cachedPtr, const char* key, const bool& configallows );
53
54 static bool m_initialised;
55 static const char m_badInitFlag;//Address of this means bad initialisation.
56
67 static const CaloIdManager * m_caloIdMgr;
68
70 static const CscIdHelper * m_cscIDHelper;
71 static const RpcIdHelper * m_rpcIDHelper;
72 static const TgcIdHelper * m_tgcIDHelper;
74 static const MdtIdHelper * m_mdtIDHelper;
75 static const MmIdHelper * m_mmIDHelper;
76 static const PixelID * m_pixelIDHelper;
77 static const SCT_ID * m_sctIDHelper;
78 static const TRT_ID * m_trtIDHelper;
79};
80
82const char VP1DetInfo::Imp::m_badInitFlag = ' ';
83
95
106
107//____________________________________________________________________
108template <class T>
109const T * VP1DetInfo::Imp::cachedRetrieve(const T*& cachedPtr, const char* preferredKey, const bool& configallows ) {
110 const T * bad = static_cast<const T*>(static_cast<const void*>(&m_badInitFlag));
111 if (cachedPtr)
112 return ( cachedPtr==bad? 0 : cachedPtr );
113 QString key(preferredKey);
114 if (!configallows) {
115 VP1Msg::messageDebug("VP1DetInfo WARNING: Will not attempt to get (type="+QString(typeid(T).name())+", key="+key+") due to missing/disabled features in job!");
116 cachedPtr = bad;
117 return 0;
118 }
120 //Try to gracefully guess at a different key:
122 if (keys.empty()) {
123 VP1Msg::messageDebug("VP1DetInfo WARNING: Could not find (type="+QString(typeid(T).name())+") in detector store (expected key="+key+")");
124 cachedPtr = bad;
125 return 0;
126 }
127 if (keys.count()>1) {
128 VP1Msg::messageDebug("VP1DetInfo WARNING: Could not find (type="+QString(typeid(T).name())+", key="+key+") in detector store, and could not uniquely guess at alternate key.");
129 cachedPtr = bad;
130 return 0;
131 }
132 VP1Msg::messageDebug("VP1DetInfo WARNING: Could not find (type="+QString(typeid(T).name())+", key="+key+") in detector store. Trying with key="+keys.first()+")");
133 key = keys.first();
134 }
135 if (!VP1SGAccessHelper(VP1AthenaPtrs::detectorStore()).retrieve(cachedPtr,key)||!cachedPtr) {
136 VP1Msg::messageDebug("VP1DetInfo WARNING: Could not retrieve (type="+QString(typeid(T).name())+", key="+key+") from detector store!");
137 cachedPtr = bad;
138 return 0;
139 }
140 VP1Msg::messageVerbose("VP1DetInfo Succesfully retrieved (type="+QString(typeid(T).name())+", key="+key+") from detector store!");
141 return cachedPtr;
142
143}
144
156
167
168//____________________________________________________________________
170
171 const AtlasDetectorID * idhelper = atlasIDHelper();
172 if ( !idhelper || !id.is_valid() )
173 return true;
174
175 if (idhelper->is_indet(id)) {
176 if (!VP1JobConfigInfo::hasTRTGeometry() && idhelper->is_trt(id))
177 return true;
178 if (!VP1JobConfigInfo::hasPixelGeometry() && idhelper->is_pixel(id))
179 return true;
180 if (!VP1JobConfigInfo::hasSCTGeometry() && idhelper->is_sct(id))
181 return true;
182 } else if (idhelper->is_muon(id)) {
184 return true;
185 } else if (idhelper->is_calo(id)) {
186 if (!VP1JobConfigInfo::hasLArGeometry() && idhelper->is_lar(id) )
187 return true;
188 if (!VP1JobConfigInfo::hasTileGeometry() && idhelper->is_tile(id) )
189 return true;
190 }
191 return false;
192}
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
This is an Identifier helper class for the TRT subdetector.
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
bool is_indet(Identifier id) const
bool is_lar(Identifier id) const
bool is_sct(Identifier id) const
bool is_pixel(Identifier id) const
bool is_muon(Identifier id) const
bool is_calo(Identifier id) const
bool is_tile(Identifier id) const
bool is_trt(Identifier id) const
This class initializes the Calo (LAr and Tile) offline identifiers.
A manager class providing access to readout geometry information for the electromagnetic barrel calor...
A manager class providing access to readout geometry information for the electromagnetic endcap calor...
A manager class providing access to readout geometry information for the forward calorimeter.
A manager class providing access to readout geometry information for the hadronic endcap calorimeter.
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated pixel ...
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated SCT in...
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Stored in storegate.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:82
static StoreGateSvc * detectorStore()
static const TgcIdHelper * m_tgcIDHelper
static const sTgcIdHelper * m_stgcIDHelper
static const CaloIdManager * m_caloIdMgr
static const InDetDD::SCT_DetectorManager * m_sctDetMgr
static const EMECDetectorManager * m_emecDetMgr
static bool m_initialised
static const PixelID * m_pixelIDHelper
static const HECDetectorManager * m_hecDetMgr
static const FCALDetectorManager * m_fcalDetMgr
static const InDetDD::TRT_DetectorManager * m_trtDetMgr
static const char m_badInitFlag
static const CscIdHelper * m_cscIDHelper
static const MdtIdHelper * m_mdtIDHelper
static const MmIdHelper * m_mmIDHelper
static const SCT_ID * m_sctIDHelper
static const T * cachedRetrieve(const T *&cachedPtr, const char *key, const bool &configallows)
static const EMBDetectorManager * m_embDetMgr
static const LArDetectorManager * m_larDetMgr
static const AtlasDetectorID * m_atlasIDHelper
static const MuonGM::MuonDetectorManager * m_muonDetMgr
static const TileDetDescrManager * m_tileDetMgr
static const RpcIdHelper * m_rpcIDHelper
static const TRT_ID * m_trtIDHelper
static const InDetDD::PixelDetectorManager * m_pixelDetMgr
static bool isUnsafe(const Identifier &)
static const InDetDD::SCT_DetectorManager * sctDetMgr()
static const CaloIdManager * caloIDMgr()
static const InDetDD::PixelDetectorManager * pixelDetMgr()
static const FCALDetectorManager * fcalDetMgr()
static const RpcIdHelper * rpcIDHelper()
static const EMECDetectorManager * emecDetMgr()
static const TgcIdHelper * tgcIDHelper()
static const TileDetDescrManager * tileDetMgr()
static const TRT_ID * trtIDHelper()
static const MdtIdHelper * mdtIDHelper()
static const EMBDetectorManager * embDetMgr()
static const HECDetectorManager * hecDetMgr()
static const sTgcIdHelper * stgcIDHelper()
static const AtlasDetectorID * atlasIDHelper()
static const PixelID * pixelIDHelper()
static const MuonGM::MuonDetectorManager * muonDetMgr()
static const InDetDD::TRT_DetectorManager * trtDetMgr()
static const SCT_ID * sctIDHelper()
static const MmIdHelper * mmIDHelper()
static const LArDetectorManager * larDetMgr()
static const CscIdHelper * cscIDHelper()
static bool hasTileGeometry()
static bool hasTRTGeometry()
static bool hasMuonNSWGeometry()
static bool hasLArGeometry()
static bool hasPixelGeometry()
static bool hasSCTGeometry()
static bool hasMuonGeometry()
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39
QStringList getKeys() const
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114