ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
SCT_GeoModel
src
SCT_DetectorTool.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 "
SCT_DetectorTool.h
"
6
7
#include "
SCT_DetectorFactory.h
"
8
#include "
SCT_DetectorFactoryLite.h
"
9
#include "
SCT_DataBase.h
"
10
#include "
SCT_Options.h
"
11
12
#include "
SCT_ReadoutGeometry/SCT_DetectorManager.h
"
13
14
#include "
GeoModelUtilities/GeoModelExperiment.h
"
15
#include "
GeoModelUtilities/DecodeVersionKey.h
"
16
#include "
RDBAccessSvc/IRDBRecord.h
"
17
#include "
RDBAccessSvc/IRDBRecordset.h
"
18
19
using
InDetDD::SCT_DetectorManager
;
20
using
InDetDD::SiDetectorManager
;
21
22
SCT_DetectorTool::SCT_DetectorTool
(
const
std::string&
type
,
23
const
std::string& name,
24
const
IInterface* parent)
25
:
GeoModelTool
(
type
, name, parent)
26
{
27
}
28
29
// Create the Geometry via the factory corresponding to this tool
30
31
StatusCode
32
SCT_DetectorTool::create
()
33
{
34
35
// Get the detector configuration.
36
ATH_CHECK
(
m_geoDbTagSvc
.retrieve());
37
38
ServiceHandle<IRDBAccessSvc>
accessSvc(
m_geoDbTagSvc
->getParamSvcName(),name());
39
ATH_CHECK
(accessSvc.retrieve());
40
41
// Print the SCT version tag:
42
std::string detectorTag{
""
};
43
std::string detectorNode{
""
};
44
GeoModelIO::ReadGeoModel* sqliteReader =
m_geoDbTagSvc
->getSqliteReader();
45
46
if
(!sqliteReader) {
47
DecodeVersionKey
versionKey{
m_geoDbTagSvc
.get(),
"SCT"
};
48
ATH_MSG_INFO
(
"Building SCT with Version Tag: "
<< versionKey.
tag
() <<
" at Node: "
<< versionKey.
node
());
49
50
detectorTag = versionKey.
tag
();
51
detectorNode = versionKey.
node
();
52
53
std::string sctVersionTag{accessSvc->getChildTag(
"SCT"
, detectorTag, detectorNode)};
54
55
ATH_MSG_INFO
(
"SCT Version: "
<< sctVersionTag);
56
if
(sctVersionTag.empty()) {
57
ATH_MSG_INFO
(
"No SCT Version. SCT will not be built."
);
58
return
StatusCode::SUCCESS;
59
}
60
else
{
61
ATH_MSG_DEBUG
(
"Keys for SCT Switches are "
<< detectorTag <<
" "
<< detectorNode);
62
}
63
}
64
std::string versionName;
65
IRDBRecordset_ptr
switchSet{accessSvc->getRecordsetPtr(
"SctSwitches"
, detectorTag, detectorNode)};
66
const
IRDBRecord
* switches{(*switchSet)[0]};
67
if
(not switches->
isFieldNull
(
"COSMICLAYOUT"
)) {
68
m_cosmic
= switches->
getInt
(
"COSMICLAYOUT"
);
69
}
70
if
(not switches->
isFieldNull
(
"VERSIONNAME"
)) {
71
versionName = switches->
getString
(
"VERSIONNAME"
);
72
}
73
74
if
(versionName.empty() &&
m_cosmic
) {
75
versionName =
"SR1"
;
76
}
77
78
ATH_MSG_DEBUG
(
"Creating the SCT"
);
79
ATH_MSG_DEBUG
(
"SCT Geometry Options: "
);
80
ATH_MSG_DEBUG
(
" Alignable: "
<< (
m_alignable
.value() ?
"true"
:
"false"
));
81
ATH_MSG_DEBUG
(
" CosmicLayout: "
<< (
m_cosmic
?
"true"
:
"false"
));
82
ATH_MSG_DEBUG
(
" VersionName: "
<< versionName);
83
84
SCT_Options
options;
85
options.setAlignable(
m_alignable
.value());
86
options.setDynamicAlignFolders(
m_useDynamicAlignFolders
.value());
87
88
// Locate the top level experiment node
89
GeoModelExperiment
* theExpt{
nullptr
};
90
ATH_CHECK
(detStore()->retrieve(theExpt,
"ATLAS"
));
91
92
// Pass athena services to factory, etc
93
m_athenaComps
.setDetStore(detStore().operator->());
94
m_athenaComps
.setGeoDbTagSvc(&*
m_geoDbTagSvc
);
95
m_athenaComps
.setRDBAccessSvc(&*accessSvc);
96
const
SCT_ID
* idHelper{
nullptr
};
97
ATH_CHECK
(detStore()->retrieve(idHelper,
"SCT_ID"
));
98
m_athenaComps
.setIdHelper(idHelper);
99
100
GeoPhysVol* world{theExpt->
getPhysVol
()};
101
102
// If we are using the SQLite reader, then we are not building the raw geometry but
103
// just locating it and attaching to readout geometry and various other actions
104
// taken in this factory.
105
if
(sqliteReader) {
106
ATH_MSG_INFO
(
"Building the geometry from the SQLite file"
);
107
SCT_DetectorFactoryLite
theSCT{sqliteReader, &
m_athenaComps
, options};
108
theSCT.
create
(world);
109
m_manager
= theSCT.
getDetectorManager
();
110
}
111
else
{
112
SCT_DetectorFactory
theSCT{&
m_athenaComps
, options};
113
theSCT.
create
(world);
114
m_manager
= theSCT.
getDetectorManager
();
115
}
116
117
if
(
m_manager
==
nullptr
) {
118
ATH_MSG_FATAL
(
"SCT_DetectorManager not created"
);
119
return
StatusCode::FAILURE;
120
}
121
122
ATH_MSG_DEBUG
(
"Registering SCT_DetectorManager. "
);
123
ATH_CHECK
(detStore()->record(
m_manager
,
m_manager
->getName()));
124
theExpt->
addManager
(
m_manager
);
125
126
// Create a symLink to the SiDetectorManager base class
127
const
SiDetectorManager
* siDetManager{
m_manager
};
128
ATH_CHECK
(detStore()->symLink(
m_manager
, siDetManager));
129
130
return
StatusCode::SUCCESS;
131
}
132
133
StatusCode
134
SCT_DetectorTool::clear
()
135
{
136
SG::DataProxy
* proxy{detStore()->proxy(
ClassID_traits<SCT_DetectorManager>::ID
(),
m_manager
->getName())};
137
if
(proxy) {
138
proxy->reset();
139
m_manager
=
nullptr
;
140
}
141
return
StatusCode::SUCCESS;
142
}
143
144
StatusCode
145
SCT_DetectorTool::align
()
146
{
147
if
(
m_manager
==
nullptr
) {
148
ATH_MSG_FATAL
(
"Manager does not exist"
);
149
return
StatusCode::FAILURE;
150
}
151
if
(
m_alignable
.value()) {
152
return
const_cast<
InDetDD::SCT_DetectorManager
*
>
(
m_manager
)->
align
();
153
}
else
{
154
ATH_MSG_DEBUG
(
"Alignment disabled. No alignments applied"
);
155
return
StatusCode::SUCCESS;
156
}
157
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DecodeVersionKey.h
GeoModelExperiment.h
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition
IRDBAccessSvc.h:30
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
SCT_DataBase.h
SCT_DetectorFactoryLite.h
SCT_DetectorFactory.h
SCT_DetectorManager.h
SCT_DetectorTool.h
SCT_Options.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
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition
IRDBRecord.h:28
IRDBRecord::isFieldNull
virtual bool isFieldNull(std::string_view fieldName) const =0
Check if the field value is NULL.
IRDBRecord::getInt
virtual int getInt(std::string_view fieldName) const =0
Get int field value.
IRDBRecord::getString
virtual const std::string & getString(std::string_view fieldName) const =0
Get string field value.
InDetDD::SCT_DetectorManager
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated SCT in...
Definition
SCT_DetectorManager.h:50
InDetDD::SiDetectorManager
Base class for Pixel and SCT Detector managers.
Definition
SiDetectorManager.h:60
SCT_DetectorFactoryLite
Definition
SCT_DetectorFactoryLite.h:34
SCT_DetectorFactoryLite::create
virtual void create(GeoPhysVol *world) override
Definition
SCT_DetectorFactoryLite.cxx:119
SCT_DetectorFactoryLite::getDetectorManager
virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const override
Definition
SCT_DetectorFactoryLite.cxx:309
SCT_DetectorFactory
Definition
SCT_DetectorFactory.h:23
SCT_DetectorFactory::create
virtual void create(GeoPhysVol *world)
Definition
SCT_DetectorFactory.cxx:134
SCT_DetectorFactory::getDetectorManager
virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const
Definition
SCT_DetectorFactory.cxx:357
SCT_DetectorTool::create
virtual StatusCode create() override final
Definition
SCT_DetectorTool.cxx:32
SCT_DetectorTool::SCT_DetectorTool
SCT_DetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
SCT_DetectorTool.cxx:22
SCT_DetectorTool::m_alignable
BooleanProperty m_alignable
Definition
SCT_DetectorTool.h:34
SCT_DetectorTool::m_manager
const InDetDD::SCT_DetectorManager * m_manager
Definition
SCT_DetectorTool.h:38
SCT_DetectorTool::align
virtual StatusCode align() override
Definition
SCT_DetectorTool.cxx:145
SCT_DetectorTool::m_athenaComps
SCT_GeoModelAthenaComps m_athenaComps
Definition
SCT_DetectorTool.h:40
SCT_DetectorTool::clear
virtual StatusCode clear() override final
Definition
SCT_DetectorTool.cxx:134
SCT_DetectorTool::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition
SCT_DetectorTool.h:42
SCT_DetectorTool::m_useDynamicAlignFolders
BooleanProperty m_useDynamicAlignFolders
Definition
SCT_DetectorTool.h:35
SCT_DetectorTool::m_cosmic
bool m_cosmic
Definition
SCT_DetectorTool.h:36
SCT_ID
This is an Identifier helper class for the SCT subdetector.
Definition
SCT_ID.h:68
SCT_Options
Definition
SCT_Options.h:12
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