ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9#include "AFP_GeoModelTool.h"
10#include "AFP_GeoModelFactory.h"
11#include "AFP_GeoModelManager.h"
13
17AFP_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
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
61}
62
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
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
165{
166 GeoModelExperiment * theExpt = nullptr;
167 ATH_CHECK( detStore()->retrieve( theExpt, "ATLAS" ) );
168
170
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_AFP03
@ EAS_AFP00
@ EAS_AFP01
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
std::vector< double > m_vecAFP02YStaggering
std::vector< double > m_vecAFP01XStaggering
std::vector< double > m_vecAFP03XStaggering
AFP_Geometry * m_pGeometry
std::vector< double > m_vecAFP00YStaggering
AFP_GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
std::vector< double > m_vecAFP03YStaggering
std::unique_ptr< AFP_GeoModelFactory > m_pAFPDetectorFactory
std::vector< double > m_vecAFP00XStaggering
virtual StatusCode create() override final
virtual ~AFP_GeoModelTool() override final
Destructor.
std::vector< double > m_vecAFP01YStaggering
AFP_SIDCONFIGURATION m_defsidcfg
AFP_CONFIGURATION m_CfgParams
StatusCode checkPropertiesSettings()
std::vector< double > m_vecAFP02XStaggering
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
GeoVDetectorManager * m_detector
static constexpr double Stat_OuterZDistance
static constexpr double SiT_FarDistanceToFloor
static constexpr double Stat_ShiftInYAxis
static constexpr double Stat_InnerZDistance
static constexpr double SiT_Plate_amount
static constexpr double Stat_RPotFloorDistance
static constexpr double SiT_NearDistanceToFloor