ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
AFP
AFP_GeoModel
src
AFP_GeoModelTool.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 "
GeoModelUtilities/GeoModelExperiment.h
"
6
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
7
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
8
9
#include "
AFP_GeoModelTool.h
"
10
#include "
AFP_GeoModelFactory.h
"
11
#include "
AFP_GeoModelManager.h
"
12
#include "
AFP_Geometry/AFP_constants.h
"
13
17
AFP_GeoModelTool::AFP_GeoModelTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
18
:
GeoModelTool
(
type
, name, parent )
19
{
20
m_CfgParams
.clear();
21
m_pGeometry
=
nullptr
;
22
23
m_defsidcfg
.clear();
24
25
m_vecAFP00XStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,
AFP_CONSTANTS::SiT_FarDistanceToFloor
);
26
m_vecAFP00YStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,0.0*CLHEP::mm);
27
m_vecAFP01XStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,
AFP_CONSTANTS::SiT_NearDistanceToFloor
);
28
m_vecAFP01YStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,0.0*CLHEP::mm);
29
m_vecAFP02XStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,
AFP_CONSTANTS::SiT_NearDistanceToFloor
);
30
m_vecAFP02YStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,0.0*CLHEP::mm);
31
m_vecAFP03XStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,
AFP_CONSTANTS::SiT_FarDistanceToFloor
);
32
m_vecAFP03YStaggering
.assign(
AFP_CONSTANTS::SiT_Plate_amount
,0.0*CLHEP::mm);
33
34
//Properties of SID
35
declareProperty(
"SID_AddVacuumSensors"
,
m_defsidcfg
.bAddVacuumSensors=
false
);
36
37
38
//Properties of TD
39
40
41
//Properties of stations
42
declareProperty(
"AFP00_RPotFloorDistance"
,
m_CfgParams
.vecRPotFloorDistance[0]=
AFP_CONSTANTS::Stat_RPotFloorDistance
);
43
declareProperty(
"AFP01_RPotFloorDistance"
,
m_CfgParams
.vecRPotFloorDistance[1]=
AFP_CONSTANTS::Stat_RPotFloorDistance
);
44
declareProperty(
"AFP02_RPotFloorDistance"
,
m_CfgParams
.vecRPotFloorDistance[2]=
AFP_CONSTANTS::Stat_RPotFloorDistance
);
45
declareProperty(
"AFP03_RPotFloorDistance"
,
m_CfgParams
.vecRPotFloorDistance[3]=
AFP_CONSTANTS::Stat_RPotFloorDistance
);
46
47
declareProperty(
"AFP00_RPotYPos"
,
m_CfgParams
.vecRPotYPos[0]=
AFP_CONSTANTS::Stat_ShiftInYAxis
);
48
declareProperty(
"AFP01_RPotYPos"
,
m_CfgParams
.vecRPotYPos[1]=
AFP_CONSTANTS::Stat_ShiftInYAxis
);
49
declareProperty(
"AFP02_RPotYPos"
,
m_CfgParams
.vecRPotYPos[2]=
AFP_CONSTANTS::Stat_ShiftInYAxis
);
50
declareProperty(
"AFP03_RPotYPos"
,
m_CfgParams
.vecRPotYPos[3]=
AFP_CONSTANTS::Stat_ShiftInYAxis
);
51
52
declareProperty(
"AFP00_ZPos"
,
m_CfgParams
.vecStatNominalZPos[0]=
AFP_CONSTANTS::Stat_OuterZDistance
);
53
declareProperty(
"AFP01_ZPos"
,
m_CfgParams
.vecStatNominalZPos[1]=
AFP_CONSTANTS::Stat_InnerZDistance
);
54
declareProperty(
"AFP02_ZPos"
,
m_CfgParams
.vecStatNominalZPos[2]=-
AFP_CONSTANTS::Stat_InnerZDistance
);
55
declareProperty(
"AFP03_ZPos"
,
m_CfgParams
.vecStatNominalZPos[3]=-
AFP_CONSTANTS::Stat_OuterZDistance
);
56
57
m_CfgParams
.sidcfg[
EAS_AFP00
]=
m_defsidcfg
;
58
m_CfgParams
.sidcfg[
EAS_AFP01
]=
m_defsidcfg
;
59
m_CfgParams
.sidcfg[
EAS_AFP02
]=
m_defsidcfg
;
60
m_CfgParams
.sidcfg[
EAS_AFP03
]=
m_defsidcfg
;
61
}
62
66
AFP_GeoModelTool::~AFP_GeoModelTool
()
67
{
68
// This will need to be modified once we register the DetectorNode in
69
// the Transient Detector Store
70
if
(
m_detector
!=
nullptr
) {
71
delete
m_detector
;
72
m_detector
=
nullptr
;
73
}
74
75
if
(
m_pGeometry
!=
nullptr
){
76
delete
m_pGeometry
;
77
m_pGeometry
=
nullptr
;
78
}
79
}
80
81
StatusCode
AFP_GeoModelTool::checkPropertiesSettings
()
82
{
83
bool
bRes=
true
;
84
85
if
(!
m_vecAFP00XStaggering
.empty()){
86
if
(
m_vecAFP00XStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP00
].fLayerCount){
87
m_CfgParams
.sidcfg[
EAS_AFP00
].vecXStaggering=
m_vecAFP00XStaggering
;
88
}
89
else
{
90
ATH_MSG_ERROR
(
"Mismatch between SID_AFP01XStaggering and number of plates (SID_NumberOfLayers)"
);
91
bRes=
false
;
92
}
93
}
94
if
(!
m_vecAFP00YStaggering
.empty()){
95
if
(
m_vecAFP00YStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP00
].fLayerCount){
96
m_CfgParams
.sidcfg[
EAS_AFP00
].vecYStaggering=
m_vecAFP00YStaggering
;
97
}
98
else
{
99
ATH_MSG_ERROR
(
"Mismatch between SID_AFP00YStaggering and number of plates (SID_NumberOfLayers)"
);
100
bRes=
false
;
101
}
102
}
103
104
if
(!
m_vecAFP01XStaggering
.empty()){
105
if
(
m_vecAFP01XStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP01
].fLayerCount){
106
m_CfgParams
.sidcfg[
EAS_AFP01
].vecXStaggering=
m_vecAFP01XStaggering
;
107
}
108
else
{
109
ATH_MSG_ERROR
(
"Mismatch between SID_AFP01XStaggering and number of plates (SID_NumberOfLayers)"
);
110
bRes=
false
;
111
}
112
}
113
if
(!
m_vecAFP01YStaggering
.empty()){
114
if
(
m_vecAFP01YStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP01
].fLayerCount){
115
m_CfgParams
.sidcfg[
EAS_AFP01
].vecYStaggering=
m_vecAFP01YStaggering
;
116
}
117
else
{
118
ATH_MSG_ERROR
(
"Mismatch between SID_AFP01YStaggering and number of plates (SID_NumberOfLayers)"
);
119
bRes=
false
;
120
}
121
}
122
123
if
(!
m_vecAFP02XStaggering
.empty()){
124
if
(
m_vecAFP02XStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP02
].fLayerCount){
125
m_CfgParams
.sidcfg[
EAS_AFP02
].vecXStaggering=
m_vecAFP02XStaggering
;
126
}
127
else
{
128
ATH_MSG_ERROR
(
"Mismatch between SID_AFP02XStaggering and number of plates (SID_NumberOfLayers)"
);
129
bRes=
false
;
130
}
131
}
132
if
(!
m_vecAFP02YStaggering
.empty()){
133
if
(
m_vecAFP02YStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP02
].fLayerCount){
134
m_CfgParams
.sidcfg[
EAS_AFP02
].vecYStaggering=
m_vecAFP02YStaggering
;
135
}
136
else
{
137
ATH_MSG_ERROR
(
"Mismatch between SID_AFP02YStaggering and number of plates (SID_NumberOfLayers)"
);
138
bRes=
false
;
139
}
140
}
141
142
if
(!
m_vecAFP03XStaggering
.empty()){
143
if
(
m_vecAFP03XStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP03
].fLayerCount){
144
m_CfgParams
.sidcfg[
EAS_AFP03
].vecXStaggering=
m_vecAFP03XStaggering
;
145
}
146
else
{
147
ATH_MSG_ERROR
(
"Mismatch between SID_AFP03XStaggering and number of plates (SID_NumberOfLayers)"
);
148
bRes=
false
;
149
}
150
}
151
if
(!
m_vecAFP03YStaggering
.empty()){
152
if
(
m_vecAFP03YStaggering
.size()==
m_CfgParams
.sidcfg[
EAS_AFP03
].fLayerCount){
153
m_CfgParams
.sidcfg[
EAS_AFP03
].vecYStaggering=
m_vecAFP03YStaggering
;
154
}
155
else
{
156
ATH_MSG_ERROR
(
"Mismatch between SID_AFP03YStaggering and number of plates (SID_NumberOfLayers)"
);
157
bRes=
false
;
158
}
159
}
160
161
return
bRes? StatusCode::SUCCESS:StatusCode::FAILURE;
162
}
163
164
StatusCode
AFP_GeoModelTool::create
()
165
{
166
GeoModelExperiment
* theExpt =
nullptr
;
167
ATH_CHECK
( detStore()->retrieve( theExpt,
"ATLAS"
) );
168
169
ATH_CHECK
(
checkPropertiesSettings
());
170
171
m_pGeometry
=
new
AFP_Geometry
(&
m_CfgParams
);
172
m_pAFPDetectorFactory
=std::make_unique<AFP_GeoModelFactory>(detStore().operator->(),
m_pGeometry
);
173
174
if
(
m_detector
==
nullptr
)
175
{
176
try
177
{
178
GeoPhysVol *world=&*theExpt->
getPhysVol
();
179
m_pAFPDetectorFactory
->create(world);
180
}
181
catch
(std::bad_alloc
const
&)
182
{
183
ATH_MSG_FATAL
(
"Could not create new DetectorNode!"
);
184
return
StatusCode::FAILURE;
185
}
186
187
// Register the DetectorNode instance with the Transient Detector Store
188
theExpt->
addManager
(
m_pAFPDetectorFactory
->getDetectorManager());
189
ATH_CHECK
( detStore()->record(
m_pAFPDetectorFactory
->getDetectorManager(),
190
m_pAFPDetectorFactory
->getDetectorManager()->getName()) );
191
return
StatusCode::SUCCESS;
192
}
193
194
return
StatusCode::FAILURE;
195
}
EAS_AFP02
@ EAS_AFP02
Definition
AFP_ConfigParams.h:17
EAS_AFP03
@ EAS_AFP03
Definition
AFP_ConfigParams.h:17
EAS_AFP00
@ EAS_AFP00
Definition
AFP_ConfigParams.h:17
EAS_AFP01
@ EAS_AFP01
Definition
AFP_ConfigParams.h:17
AFP_GeoModelFactory.h
AFP_GeoModelManager.h
AFP_GeoModelTool.h
AFP_constants.h
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_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
AthenaAttributeList.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
GeoModelExperiment.h
AFP_GeoModelTool::m_vecAFP02YStaggering
std::vector< double > m_vecAFP02YStaggering
Definition
AFP_GeoModelTool.h:29
AFP_GeoModelTool::m_vecAFP01XStaggering
std::vector< double > m_vecAFP01XStaggering
Definition
AFP_GeoModelTool.h:28
AFP_GeoModelTool::m_vecAFP03XStaggering
std::vector< double > m_vecAFP03XStaggering
Definition
AFP_GeoModelTool.h:30
AFP_GeoModelTool::m_pGeometry
AFP_Geometry * m_pGeometry
Definition
AFP_GeoModelTool.h:24
AFP_GeoModelTool::m_vecAFP00YStaggering
std::vector< double > m_vecAFP00YStaggering
Definition
AFP_GeoModelTool.h:27
AFP_GeoModelTool::AFP_GeoModelTool
AFP_GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s).
Definition
AFP_GeoModelTool.cxx:17
AFP_GeoModelTool::m_vecAFP03YStaggering
std::vector< double > m_vecAFP03YStaggering
Definition
AFP_GeoModelTool.h:30
AFP_GeoModelTool::m_pAFPDetectorFactory
std::unique_ptr< AFP_GeoModelFactory > m_pAFPDetectorFactory
Definition
AFP_GeoModelTool.h:25
AFP_GeoModelTool::m_vecAFP00XStaggering
std::vector< double > m_vecAFP00XStaggering
Definition
AFP_GeoModelTool.h:27
AFP_GeoModelTool::create
virtual StatusCode create() override final
Definition
AFP_GeoModelTool.cxx:164
AFP_GeoModelTool::~AFP_GeoModelTool
virtual ~AFP_GeoModelTool() override final
Destructor.
Definition
AFP_GeoModelTool.cxx:66
AFP_GeoModelTool::m_vecAFP01YStaggering
std::vector< double > m_vecAFP01YStaggering
Definition
AFP_GeoModelTool.h:28
AFP_GeoModelTool::m_defsidcfg
AFP_SIDCONFIGURATION m_defsidcfg
Definition
AFP_GeoModelTool.h:26
AFP_GeoModelTool::m_CfgParams
AFP_CONFIGURATION m_CfgParams
Definition
AFP_GeoModelTool.h:23
AFP_GeoModelTool::checkPropertiesSettings
StatusCode checkPropertiesSettings()
Definition
AFP_GeoModelTool.cxx:81
AFP_GeoModelTool::m_vecAFP02XStaggering
std::vector< double > m_vecAFP02XStaggering
Definition
AFP_GeoModelTool.h:29
AFP_Geometry
Definition
AFP_Geometry.h:21
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
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition
GeoModelTool.h:28
AFP_CONSTANTS::Stat_OuterZDistance
static constexpr double Stat_OuterZDistance
Definition
AFP_constants.h:87
AFP_CONSTANTS::SiT_FarDistanceToFloor
static constexpr double SiT_FarDistanceToFloor
Definition
AFP_constants.h:21
AFP_CONSTANTS::Stat_ShiftInYAxis
static constexpr double Stat_ShiftInYAxis
Definition
AFP_constants.h:88
AFP_CONSTANTS::Stat_InnerZDistance
static constexpr double Stat_InnerZDistance
Definition
AFP_constants.h:86
AFP_CONSTANTS::SiT_Plate_amount
static constexpr double SiT_Plate_amount
Definition
AFP_constants.h:18
AFP_CONSTANTS::Stat_RPotFloorDistance
static constexpr double Stat_RPotFloorDistance
Definition
AFP_constants.h:89
AFP_CONSTANTS::SiT_NearDistanceToFloor
static constexpr double SiT_NearDistanceToFloor
Definition
AFP_constants.h:20
type
Generated on
for ATLAS Offline Software by
1.17.0