ATLAS Offline Software
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 
17 AFP_GeoModelTool::AFP_GeoModelTool( const std::string& type, const std::string& name, const IInterface* parent )
19 {
21  m_pGeometry=nullptr;
22 
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){
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){
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){
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){
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){
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){
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){
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){
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
EAS_AFP02
@ EAS_AFP02
Definition: AFP_ConfigParams.h:18
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
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
AFP_GeoModelTool::m_vecAFP02XStaggering
std::vector< double > m_vecAFP02XStaggering
Definition: AFP_GeoModelTool.h:29
AFP_GeoModelTool::~AFP_GeoModelTool
virtual ~AFP_GeoModelTool() override final
Destructor.
Definition: AFP_GeoModelTool.cxx:66
AFP_GeoModelTool::m_defsidcfg
AFP_SIDCONFIGURATION m_defsidcfg
Definition: AFP_GeoModelTool.h:26
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
AFP_GeoModelTool::m_vecAFP03XStaggering
std::vector< double > m_vecAFP03XStaggering
Definition: AFP_GeoModelTool.h:30
AFP_CONSTANTS::SiT_NearDistanceToFloor
static constexpr double SiT_NearDistanceToFloor
Definition: AFP_constants.h:20
AFP_GeoModelTool::create
virtual StatusCode create() override final
Definition: AFP_GeoModelTool.cxx:164
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
AFP_CONFIGURATION::sidcfg
std::map< eAFPStation, AFP_SIDCONFIGURATION > sidcfg
Definition: AFP_ConfigParams.h:136
AFP_CONSTANTS::SiT_FarDistanceToFloor
static constexpr double SiT_FarDistanceToFloor
Definition: AFP_constants.h:21
EAS_AFP00
@ EAS_AFP00
Definition: AFP_ConfigParams.h:18
AFP_constants.h
EAS_AFP01
@ EAS_AFP01
Definition: AFP_ConfigParams.h:18
GeoModelExperiment
Definition: GeoModelExperiment.h:32
AFP_GeoModelTool.h
AFP_GeoModelTool::checkPropertiesSettings
StatusCode checkPropertiesSettings()
Definition: AFP_GeoModelTool.cxx:81
AFP_CONSTANTS::SiT_Plate_amount
static constexpr double SiT_Plate_amount
Definition: AFP_constants.h:18
AthenaAttributeList.h
AFP_CONFIGURATION::vecRPotFloorDistance
std::vector< double > vecRPotFloorDistance
Definition: AFP_ConfigParams.h:139
AFP_GeoModelFactory.h
AFP_GeoModelTool::m_vecAFP02YStaggering
std::vector< double > m_vecAFP02YStaggering
Definition: AFP_GeoModelTool.h:29
AFP_CONSTANTS::Stat_OuterZDistance
static constexpr double Stat_OuterZDistance
Definition: AFP_constants.h:87
GeoModelExperiment.h
AFP_GeoModelTool::m_pAFPDetectorFactory
std::unique_ptr< AFP_GeoModelFactory > m_pAFPDetectorFactory
Definition: AFP_GeoModelTool.h:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AFP_SIDCONFIGURATION::bAddVacuumSensors
bool bAddVacuumSensors
Definition: AFP_ConfigParams.h:110
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AFP_CONSTANTS::Stat_RPotFloorDistance
static constexpr double Stat_RPotFloorDistance
Definition: AFP_constants.h:89
AFP_GeoModelTool::AFP_GeoModelTool
AFP_GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: AFP_GeoModelTool.cxx:17
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:17
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AFP_CONFIGURATION::vecStatNominalZPos
std::vector< double > vecStatNominalZPos
Definition: AFP_ConfigParams.h:141
EAS_AFP03
@ EAS_AFP03
Definition: AFP_ConfigParams.h:18
AFP_Geometry
Definition: AFP_Geometry.h:20
AFP_GeoModelTool::m_vecAFP03YStaggering
std::vector< double > m_vecAFP03YStaggering
Definition: AFP_GeoModelTool.h:30
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
AFP_GeoModelTool::m_vecAFP01XStaggering
std::vector< double > m_vecAFP01XStaggering
Definition: AFP_GeoModelTool.h:28
AFP_GeoModelTool::m_vecAFP01YStaggering
std::vector< double > m_vecAFP01YStaggering
Definition: AFP_GeoModelTool.h:28
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition: GeoModelTool.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AFP_GeoModelTool::m_vecAFP00XStaggering
std::vector< double > m_vecAFP00XStaggering
Definition: AFP_GeoModelTool.h:27
AFP_GeoModelManager.h
AFP_GeoModelTool::m_vecAFP00YStaggering
std::vector< double > m_vecAFP00YStaggering
Definition: AFP_GeoModelTool.h:27
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
AFP_CONFIGURATION::clear
void clear()
Definition: AFP_ConfigParams.cxx:9
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
AFP_SIDCONFIGURATION::clear
void clear()
Definition: AFP_ConfigParams.cxx:45
AFP_GeoModelTool::m_CfgParams
AFP_CONFIGURATION m_CfgParams
Definition: AFP_GeoModelTool.h:23
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFP_GeoModelTool::m_pGeometry
AFP_Geometry * m_pGeometry
Definition: AFP_GeoModelTool.h:24
AFP_CONFIGURATION::vecRPotYPos
std::vector< double > vecRPotYPos
Definition: AFP_ConfigParams.h:140