ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
AtlasGeometryCommon
CavernInfraGeoModel
src
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
5
#include "
CavernInfraDetectorTool.h
"
6
#include "
CavernInfraDetectorFactory.h
"
7
#include "
CavernInfraDetectorManager.h
"
8
9
#include "
GeoModelInterfaces/IGeoDbTagSvc.h
"
10
#include "
GeoModelUtilities/GeoModelExperiment.h
"
11
#include "
RDBAccessSvc/IRDBAccessSvc.h
"
12
13
14
CavernInfraDetectorTool::CavernInfraDetectorTool
(
const
std::string&
type
,
15
const
std::string& name,
16
const
IInterface* parent )
17
:
GeoModelTool
(
type
, name, parent )
18
{
19
}
20
21
StatusCode
CavernInfraDetectorTool::create
()
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
63
StatusCode
CavernInfraDetectorTool::clear
()
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
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CavernInfraDetectorFactory.h
CavernInfraDetectorManager.h
CavernInfraDetectorTool.h
GeoModelExperiment.h
IGeoDbTagSvc.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
CavernInfraDetectorFactory
Definition
CavernInfraDetectorFactory.h:16
CavernInfraDetectorFactory::setTagNode
void setTagNode(const std::string &tag, const std::string &node)
Definition
CavernInfraDetectorFactory.cxx:444
CavernInfraDetectorFactory::getDetectorManager
virtual const CavernInfraDetectorManager * getDetectorManager() const override
Definition
CavernInfraDetectorFactory.cxx:439
CavernInfraDetectorFactory::create
virtual void create(GeoPhysVol *world) override
Definition
CavernInfraDetectorFactory.cxx:38
CavernInfraDetectorTool::create
virtual StatusCode create() override
Definition
CavernInfraDetectorTool.cxx:21
CavernInfraDetectorTool::m_manager
const CavernInfraDetectorManager * m_manager
Definition
CavernInfraDetectorTool.h:21
CavernInfraDetectorTool::clear
virtual StatusCode clear() override
Definition
CavernInfraDetectorTool.cxx:63
CavernInfraDetectorTool::CavernInfraDetectorTool
CavernInfraDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CavernInfraDetectorTool.cxx:14
GeoModelExperiment
Definition
GeoModelExperiment.h:32
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition
GeoModelExperiment.cxx:21
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition
GeoModelExperiment.cxx:40
GeoModelTool
Definition
GeoModelTool.h:15
SG::DataProxy
Definition
DataProxy.h:45
ServiceHandle
Definition
ClusterMakerTool.h:36
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
type
Generated on
for ATLAS Offline Software by
1.17.0