9#include "GaudiKernel/Bootstrap.h"
10#include "GaudiKernel/ISvcLocator.h"
13#include "CLHEP/Units/SystemOfUnits.h"
41 ATH_MSG_INFO(
"Unable to retrieve envelope definitions from DDDB. Enabling Python-based fallback definitions.");
44 ATH_MSG_ERROR(
"Unable to retrieve envelope definitions from DDDB and Python-based fallback definitions are disabled.");
60 m_dbAccess.setName(geoDbTag->getParamSvcName());
87 ATH_MSG_ERROR(
"Unable to retrieve subdetector envelope for detector region '" <<
89 return StatusCode::FAILURE;
101 if (
sc.isFailure()) {
102 ATH_MSG_ERROR(
"Unable to retrieve sub-detector envelope in (r,z)-space for detector region '" <<
104 return StatusCode::FAILURE;
117 if (msgLvl(MSG::VERBOSE)) {
119 int numEntries =
m_rz[region].size();
121 for (
int num = 0; num<numEntries; num++) {
129 return StatusCode::SUCCESS;
147 if (
sc.isFailure()) {
148 ATH_MSG_DEBUG(
"Will try reading Python-based envelope definition for '" << dbNode <<
"'.");
152 if (
sc.isFailure()) {
153 ATH_MSG_WARNING(
"Could not create envelope volume for '" << dbNode <<
"'.");
154 return StatusCode::FAILURE;
156 ATH_MSG_INFO(
"Sucessfully read Python-based envelope definition for '" << dbNode <<
"'.");
160 return StatusCode::SUCCESS;
200 size_t numEntries = envelopeRec ? envelopeRec->
size() : 0;
202 ATH_MSG_INFO(
"No entries for table '" <<
node <<
"' in Detector Description Database (DDDB). Maybe you are using Python-based envelope definitions...");
203 return StatusCode::RECOVERABLE;
209 for ( ; recIt!=recEnd; ++recIt) {
212 double curR = (*recIt)->getDouble(
"R") * CLHEP::mm;
213 double curZ = (*recIt)->getDouble(
"Z") * CLHEP::mm;
215 rzVec.emplace_back(curR, curZ );
218 return StatusCode::SUCCESS;
227 unsigned short len =
r.size();
230 if ( len !=
z.size() ) {
231 ATH_MSG_ERROR(
"Unable to construct fallback envelope definition in (r,z) space, as the provided r and z vectors have different length");
233 return StatusCode::FAILURE;
237 for (
unsigned short pos=0; pos<len; ++pos) {
240 double curR =
r[pos];
241 double curZ =
z[pos];
243 rzVec.emplace_back(curR, curZ );
246 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::vector< double > FallbackDoubleVector
datatype used for fallback solution
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
std::vector< RZPair > RZPairVector
static const char * getName(int region)
~DetDescrDBEnvelopeSvc()
Destructor.
bool enableFallback()
enable fallback solution:
std::array< DoubleArrayProperty, AtlasDetDescr::fNumAtlasRegions > m_fallbackR
DetDescrDBEnvelopeSvc(const std::string &name, ISvcLocator *svc)
public AthService constructor
ServiceHandle< IGeoModelSvc > m_geoModelSvc
ATLAS GeoModel.
std::array< StringProperty, AtlasDetDescr::fNumAtlasRegions > m_node
the names of the DB nodes for the respective AtlasRegion
std::string m_atlasVersionTag
virtual StatusCode initialize() override
AthService initialize method.
StatusCode fallbackRZBoundary(const FallbackDoubleVector &r, const FallbackDoubleVector &z, RZPairVector &rzVec)
use the fallback approach (python arguments) to set the (r,z) values
StatusCode retrieveRZBoundaryOptionalFallback(const std::string &dbNode, const FallbackDoubleVector &r, const FallbackDoubleVector &z, RZPairVector &rzVec)
retrieve and store the (r,z) values locally for the given DB node.
StatusCode retrieveRZBoundary(const std::string &node, RZPairVector &rzVec)
retrieve and store the (r,z) values locally for the given DB node
ServiceHandle< IRDBAccessSvc > m_dbAccess
the DetectorDescription database access method
RZPairVector m_rposz[AtlasDetDescr::fNumAtlasRegions]
internal (r,z) representation for the positive z-side only, one RZPairVector for each AtlasRegion
std::string m_atlasNode
main DDDB node for the ATLAS detector
RZPairVector m_rz[AtlasDetDescr::fNumAtlasRegions]
internal (r,z) representation, one RZPairVector for each AtlasRegion
std::array< DoubleArrayProperty, AtlasDetDescr::fNumAtlasRegions > m_fallbackZ
Gaudi::Property< bool > m_allowFallback
fallback solution, in case something goes wrong with the DB
RecordsVector::const_iterator const_iterator
virtual const_iterator begin() const =0
virtual const_iterator end() const =0
virtual unsigned int size() const =0