ATLAS Offline Software
Loading...
Searching...
No Matches
CavernInfraDetectorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
8
12
13
15 const std::string& name,
16 const IInterface* parent )
17 : GeoModelTool( type, name, parent )
18{
19}
20
22{
23 ServiceHandle<IGeoDbTagSvc> geoDbTag("GeoDbTagSvc", name());
24 ATH_CHECK(geoDbTag.retrieve());
25
26 std::string cavernInfraVersion = geoDbTag->cavernInfraVersion();
27 if(cavernInfraVersion.empty()) {
28 ATH_MSG_INFO("No Cavern Infra version for the given configuration. Skip building CavernInfraGeoModel");
29 return StatusCode::SUCCESS;
30 }
31 else {
32 ATH_MSG_INFO("Building Cavern geometry version " << cavernInfraVersion);
33 }
34
35 std::string versionNode = "CavernInfra";
36
37 GeoModelExperiment* theExpt = nullptr;
38 ATH_CHECK(detStore()->retrieve(theExpt,"ATLAS"));
39
40 GeoPhysVol *world=theExpt->getPhysVol();
41 ServiceHandle<IRDBAccessSvc> raccess("RDBAccessSvc",name());
42 ATH_CHECK(raccess.retrieve());
43
44 if(!m_manager) {
45 CavernInfraDetectorFactory theCavernInfraFactory(detStore(),raccess);
46 theCavernInfraFactory.setTagNode(cavernInfraVersion,versionNode);
47 theCavernInfraFactory.create(world);
48 m_manager = theCavernInfraFactory.getDetectorManager();
49 }
50
51 if(m_manager) {
52 theExpt->addManager(m_manager);
53 ATH_CHECK(detStore()->record(m_manager,m_manager->getName()));
54 }
55 else {
56 ATH_MSG_ERROR("ERROR. Failed to build Cavern Version " << cavernInfraVersion);
57 return StatusCode::FAILURE;
58 }
59
60 return StatusCode::SUCCESS;
61}
62
64{
65 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<CavernInfraDetectorManager>::ID(),m_manager->getName());
66 if(proxy) {
67 proxy->reset();
68 m_manager = nullptr;
69 }
70 return StatusCode::SUCCESS;
71}
72
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Definition of the abstract IRDBAccessSvc interface.
void setTagNode(const std::string &tag, const std::string &node)
virtual const CavernInfraDetectorManager * getDetectorManager() const override
virtual void create(GeoPhysVol *world) override
virtual StatusCode create() override
const CavernInfraDetectorManager * m_manager
virtual StatusCode clear() override
CavernInfraDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)