ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
InDetServMatGeoModel
src
InDetServMatTool.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 "
InDetServMatTool.h
"
6
#include "
InDetServMatFactory_Lite.h
"
7
#include "
InDetServMatFactory.h
"
8
9
#include "
GeoModelUtilities/GeoModelExperiment.h
"
10
#include "
GeoModelUtilities/DecodeVersionKey.h
"
11
#include "
StoreGate/StoreGateSvc.h
"
12
#include "
RDBAccessSvc/IRDBAccessSvc.h
"
13
#include "
RDBAccessSvc/IRDBRecord.h
"
14
#include "
RDBAccessSvc/IRDBRecordset.h
"
15
#include "
AthenaKernel/errorcheck.h
"
16
#include "GaudiKernel/ServiceHandle.h"
17
#include "GaudiKernel/ToolHandle.h"
18
19
#include "
AthenaKernel/ClassID_traits.h
"
20
#include "
SGTools/DataProxy.h
"
21
25
InDetServMatTool::InDetServMatTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
26
:
GeoModelTool
(
type
, name, parent )
27
{
28
}
29
33
StatusCode
InDetServMatTool::create
()
34
{
35
36
//
37
// Locate the top level experiment node
38
//
39
GeoModelExperiment
* theExpt{
nullptr
};
40
ATH_CHECK
(detStore()->retrieve(theExpt,
"ATLAS"
));
41
42
// Get the detector configuration.
43
ATH_CHECK
(
m_geoDbTagSvc
.retrieve());
44
45
ServiceHandle<IRDBAccessSvc>
accessSvc(
m_geoDbTagSvc
->getParamSvcName(),name());
46
ATH_CHECK
(accessSvc.retrieve());
47
48
GeoPhysVol *world=theExpt->
getPhysVol
();
49
50
GeoModelIO::ReadGeoModel* sqliteReader =
m_geoDbTagSvc
->getSqliteReader();
51
52
if
(sqliteReader) {
53
InDetServMatFactory_Lite
factoryLite;;
54
factoryLite.
create
(world);
55
m_manager
= factoryLite.
getDetectorManager
();
56
}
57
else
{
58
DecodeVersionKey
versionKey(
m_geoDbTagSvc
.get(),
"InnerDetector"
);
59
60
std::string versionTag = accessSvc->getChildTag(
"InDetServices"
, versionKey.
tag
(), versionKey.
node
());
61
ATH_MSG_DEBUG
(
"versionTag="
<< versionTag <<
" %%%"
);
62
63
// If versionTag is NULL then don't build.
64
if
(versionTag.empty()) {
65
ATH_MSG_INFO
(
"No InDetService Version. InDetService will not be built."
);
66
ATH_MSG_DEBUG
(
"InnerDetector Version Tag: "
<< versionKey.
tag
() <<
" at Node: "
<< versionKey.
node
());
67
return
StatusCode::SUCCESS;
68
}
69
70
ATH_MSG_DEBUG
(
"Keys for InDetServMat Switches are "
<< versionKey.
tag
() <<
" "
<< versionKey.
node
());
71
72
std::string versionName{
"CSC"
};
73
if
(!
m_overrideVersionName
.empty()) {
74
versionName =
m_overrideVersionName
;
75
ATH_MSG_INFO
(
"Overriding version name: "
<< versionName);
76
}
77
ATH_MSG_INFO
(
"Building Inner Detector Service Material. Version: "
<< versionName);
78
79
// Pass athena services to factory, etc
80
m_athenaComps
.setDetStore(detStore().
get
());
81
m_athenaComps
.setGeoDbTagSvc(
m_geoDbTagSvc
.get());
82
m_athenaComps
.setRDBAccessSvc(accessSvc.get());
83
84
// Retrieve builder tool (SLHC only)
85
if
(versionName ==
"SLHC"
) {
86
if
(!
m_builderTool
.empty()) {
87
if
(
m_builderTool
.retrieve().isFailure()) {
88
ATH_MSG_WARNING
(
"Could not retrieve "
<<
m_builderTool
<<
", some services will not be built."
);
89
}
90
else
{
91
ATH_MSG_INFO
(
"Service builder tool retrieved: "
<<
m_builderTool
);
92
m_athenaComps
.setBuilderTool(&*
m_builderTool
);
93
}
94
}
95
else
{
96
// This will become an error once the tool is ready.
97
ATH_MSG_INFO
(
"Service builder tool not specified."
);
98
}
99
}
100
101
if
(versionName ==
"CSC"
) {
102
ATH_MSG_DEBUG
(
"InDetServMat Factory CSC"
);
103
InDetServMatFactory
theIDSM(&
m_athenaComps
);
104
theIDSM.
create
(world);
105
m_manager
=theIDSM.
getDetectorManager
();
106
}
else
{
107
// Unrecognized name.
108
ATH_MSG_FATAL
(
"Unrecognized VersionName: "
<< versionName);
109
return
StatusCode::FAILURE;
110
}
111
}
112
113
if
(
m_manager
) {
114
theExpt->
addManager
(
m_manager
);
115
ATH_CHECK
(detStore()->record (
m_manager
,
m_manager
->getName()));
116
}
117
else
{
118
ATH_MSG_FATAL
(
"Could not create InDetServMatManager!"
);
119
return
StatusCode::FAILURE;
120
}
121
122
return
StatusCode::SUCCESS;
123
}
124
125
StatusCode
InDetServMatTool::clear
()
126
{
127
SG::DataProxy
* proxy = detStore()->proxy(
ClassID_traits<InDetDD::InDetServMatManager>::ID
(),
m_manager
->getName());
128
if
(proxy) {
129
proxy->reset();
130
m_manager
=
nullptr
;
131
}
132
return
StatusCode::SUCCESS;
133
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataProxy.h
DecodeVersionKey.h
GeoModelExperiment.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
InDetServMatFactory.h
InDetServMatFactory_Lite.h
InDetServMatTool.h
StoreGateSvc.h
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition
DecodeVersionKey.h:18
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition
DecodeVersionKey.cxx:91
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition
DecodeVersionKey.cxx:97
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
InDetServMatFactory_Lite
Definition
InDetServMatFactory_Lite.h:13
InDetServMatFactory_Lite::getDetectorManager
virtual const InDetDD::InDetServMatManager * getDetectorManager() const override
Definition
InDetServMatFactory_Lite.cxx:22
InDetServMatFactory_Lite::create
virtual void create(GeoPhysVol *world) override
Definition
InDetServMatFactory_Lite.cxx:11
InDetServMatFactory
Definition
InDetServMatFactory.h:15
InDetServMatFactory::create
virtual void create(GeoPhysVol *world) override
Definition
InDetServMatFactory.cxx:50
InDetServMatFactory::getDetectorManager
virtual const InDetDD::InDetServMatManager * getDetectorManager() const override
Definition
InDetServMatFactory.cxx:278
InDetServMatTool::m_athenaComps
InDetServMatAthenaComps m_athenaComps
Definition
InDetServMatTool.h:39
InDetServMatTool::m_manager
const InDetDD::InDetServMatManager * m_manager
Definition
InDetServMatTool.h:38
InDetServMatTool::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition
InDetServMatTool.h:34
InDetServMatTool::create
virtual StatusCode create() override
Create the Detector Node corresponding to this tool.
Definition
InDetServMatTool.cxx:33
InDetServMatTool::m_overrideVersionName
StringProperty m_overrideVersionName
Definition
InDetServMatTool.h:36
InDetServMatTool::m_builderTool
ToolHandle< IInDetServMatBuilderTool > m_builderTool
Definition
InDetServMatTool.h:35
InDetServMatTool::clear
virtual StatusCode clear() override
Definition
InDetServMatTool.cxx:125
InDetServMatTool::InDetServMatTool
InDetServMatTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s).
Definition
InDetServMatTool.cxx:25
SG::DataProxy
Definition
DataProxy.h:45
ServiceHandle
Definition
ClusterMakerTool.h:36
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition
hcg.cxx:132
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