ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
AtlasGeometryCommon
BeamPipeGeoModel
src
BeamPipeDetectorTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
BeamPipeDetectorTool.h
"
6
#include "
BeamPipeDetectorFactory.h
"
7
#include "
BeamPipeDetectorFactory_Lite.h
"
8
#include "
BeamPipeGeoModel/BeamPipeDetectorManager.h
"
9
10
#include "
GeoModelInterfaces/IGeoDbTagSvc.h
"
11
#include "
GeoModelUtilities/GeoModelExperiment.h
"
12
#include "GaudiKernel/IService.h"
13
#include "GaudiKernel/ISvcLocator.h"
14
15
#include "
StoreGate/StoreGateSvc.h
"
16
17
#include "
RDBAccessSvc/IRDBAccessSvc.h
"
18
#include "
AthenaKernel/ClassID_traits.h
"
19
#include "
SGTools/DataProxy.h
"
20
21
#include "GeoModelKernel/GeoVolumeCursor.h"
22
23
BeamPipeDetectorTool::BeamPipeDetectorTool
(
const
std::string&
type
,
24
const
std::string& name,
25
const
IInterface* parent ):
26
GeoModelTool
(
type
,name,parent)
27
{
28
}
29
30
BeamPipeDetectorTool::~BeamPipeDetectorTool
() =
default
;
31
32
33
StatusCode
BeamPipeDetectorTool::create
()
34
{
35
ATH_MSG_INFO
(
"Building Beam Pipe"
);
36
37
SmartIF<IGeoDbTagSvc> geoDbTag{Gaudi::svcLocator()->service(
"GeoDbTagSvc"
)};
38
ATH_CHECK
(geoDbTag.isValid());
39
40
std::string atlasVersion = geoDbTag->atlasVersion();
41
std::string versionNode =
"ATLAS"
;
42
43
GeoModelExperiment
* theExpt{
nullptr
};
44
ATH_CHECK
(detStore()->retrieve(theExpt,
"ATLAS"
));
45
46
GeoPhysVol* world=theExpt->
getPhysVol
();
47
48
ServiceHandle<IRDBAccessSvc>
accessSvc(geoDbTag->getParamSvcName(),name());
49
ATH_CHECK
(accessSvc.retrieve());
50
51
GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
52
if
(sqliteReader) {
53
BeamPipeDetectorFactory_Lite
theBeamPipeFactory;
54
theBeamPipeFactory.
create
(world);
55
m_manager
= theBeamPipeFactory.
getDetectorManager
();
56
}
57
else
{
58
// Check we have the beampipe and print its version
59
// Print the version tag:
60
std::string beampipeVersionTag;
61
beampipeVersionTag = accessSvc->getChildTag(
"BeamPipe"
, atlasVersion,versionNode);
62
ATH_MSG_DEBUG
(
"Beampipe Version: "
<< beampipeVersionTag);
63
64
if
(beampipeVersionTag.empty()) {
65
ATH_MSG_INFO
(
"No BeamPipe Version. Beam pipe will not be built."
);
66
}
67
else
{
68
BeamPipeDetectorFactory
theBeamPipeFactory(detStore().operator->(),accessSvc.operator->());
69
theBeamPipeFactory.
setTagNode
(std::move(atlasVersion),std::move(versionNode),
m_mode
);
70
theBeamPipeFactory.
create
(world);
71
72
m_manager
= theBeamPipeFactory.
getDetectorManager
();
73
}
74
}
75
76
if
(
m_manager
) {
77
theExpt->
addManager
(
m_manager
);
78
ATH_CHECK
(detStore()->record(
m_manager
,
m_manager
->getName()));
79
return
StatusCode::SUCCESS;
80
}
81
82
return
StatusCode::FAILURE;
83
}
84
85
StatusCode
BeamPipeDetectorTool::clear
()
86
{
87
SG::DataProxy
* proxy = detStore()->proxy(
ClassID_traits<BeamPipeDetectorManager>::ID
(),
m_manager
->getName());
88
if
(proxy) {
89
proxy->reset();
90
m_manager
=
nullptr
;
91
}
92
return
StatusCode::SUCCESS;
93
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
BeamPipeDetectorFactory.h
BeamPipeDetectorFactory_Lite.h
BeamPipeDetectorManager.h
BeamPipeDetectorTool.h
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
DataProxy.h
GeoModelExperiment.h
IGeoDbTagSvc.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
StoreGateSvc.h
BeamPipeDetectorFactory_Lite
Definition
BeamPipeDetectorFactory_Lite.h:12
BeamPipeDetectorFactory_Lite::getDetectorManager
virtual const BeamPipeDetectorManager * getDetectorManager() const override
Definition
BeamPipeDetectorFactory_Lite.cxx:28
BeamPipeDetectorFactory_Lite::create
virtual void create(GeoPhysVol *world) override
Definition
BeamPipeDetectorFactory_Lite.cxx:18
BeamPipeDetectorFactory
Definition
BeamPipeDetectorFactory.h:19
BeamPipeDetectorFactory::create
virtual void create(GeoPhysVol *world) override
Definition
BeamPipeDetectorFactory.cxx:46
BeamPipeDetectorFactory::setTagNode
void setTagNode(std::string tag, std::string node, std::string mode)
Definition
BeamPipeDetectorFactory.cxx:310
BeamPipeDetectorFactory::getDetectorManager
virtual const BeamPipeDetectorManager * getDetectorManager() const override
Definition
BeamPipeDetectorFactory.cxx:305
BeamPipeDetectorTool::create
virtual StatusCode create() override final
Definition
BeamPipeDetectorTool.cxx:33
BeamPipeDetectorTool::m_mode
StringProperty m_mode
Definition
BeamPipeDetectorTool.h:26
BeamPipeDetectorTool::~BeamPipeDetectorTool
virtual ~BeamPipeDetectorTool() override final
BeamPipeDetectorTool::clear
virtual StatusCode clear() override final
Definition
BeamPipeDetectorTool.cxx:85
BeamPipeDetectorTool::BeamPipeDetectorTool
BeamPipeDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
BeamPipeDetectorTool.cxx:23
BeamPipeDetectorTool::m_manager
const BeamPipeDetectorManager * m_manager
Definition
BeamPipeDetectorTool.h:25
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