ATLAS Offline Software
SCT_OuterSide.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
12 
13 // module parts.
17 
19 
20 #include "GeoModelRead/ReadGeoModel.h"
21 #include "GeoModelKernel/GeoBox.h"
22 #include "GeoModelKernel/GeoLogVol.h"
23 #include "GeoModelKernel/GeoPhysVol.h"
24 #include "GeoModelKernel/GeoFullPhysVol.h"
25 #include "GeoModelKernel/GeoNameTag.h"
26 #include "GeoModelKernel/GeoIdentifierTag.h"
27 #include "GeoModelKernel/GeoTransform.h"
28 #include "GeoModelKernel/GeoShape.h"
29 #include "GeoModelKernel/GeoShapeUnion.h"
30 #include "GeoModelKernel/GeoShapeShift.h"
31 #include "GeoModelKernel/GeoDefinitions.h"
32 #include "GaudiKernel/SystemOfUnits.h"
33 
34 #include <cmath>
35 #include <utility>
36 
37 SCT_OuterSide::SCT_OuterSide(const std::string & name,
38  InDetDD::SCT_DetectorManager* detectorManager,
39  SCT_GeometryManager* geometryManager,
40  SCT_MaterialManager* materials,
41  GeoModelIO::ReadGeoModel* sqliteReader,
42  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
43  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
44  : SCT_UniqueComponentFactory(name, detectorManager, geometryManager, materials, sqliteReader, std::move(mapFPV), std::move(mapAX))
45 {
46  getParameters();
48 }
49 
50 
52 
53 
54 void
56 {
57  const SCT_GeneralParameters * generalParameters = m_geometryManager->generalParameters();
59 
60  m_safety = generalParameters->safety();
61  m_hybridOffsetZ = parameters->hybridOffsetZ();
62  m_hybridOffsetX = parameters->hybridOffsetX();
63 }
64 
65 
66 const GeoLogVol *
68 {
69  // Create child components
70  m_sensor = std::make_unique<SCT_Sensor>("BRLSensor", m_detectorManager, m_geometryManager, m_materials, m_sqliteReader, m_mapFPV, m_mapAX);
71 
72  if(m_sqliteReader) return nullptr;
73 
74  m_hybrid = std::make_unique<SCT_Hybrid>("Hybrid", m_detectorManager, m_geometryManager, m_materials);
75  m_pigtail = std::make_unique<SCT_Pigtail>("Pigtail", m_detectorManager, m_geometryManager, m_materials);
76 
77  //
78  // Define constants for convenience.
79  // t_XXX: thickness of XXX.
80  // w_XXX: width of XXX.
81  // l_XXX: length of XXX.
82  //
83  const double t_hybrid = m_hybrid->thickness();
84  const double w_hybrid = m_hybrid->width();
85  //const double l_hybrid = m_hybrid->length();
86 
87  const double t_pigtail = m_pigtail->thickness();
88  const double w_pigtail = m_pigtail->width();
89  const double l_pigtail = m_pigtail->length();
90 
91  const double t_sensor = m_sensor->thickness();
92  const double w_sensor = m_sensor->width();
93  const double l_sensor = m_sensor->length();
94 
95  //
96  // Calculate a few things.
97  //
98  const double sensorPosX = 0.0;
99  const double sensorPosY = 0.0;
100  const double sensorPosZ = 0.0;
101 
102  const double hybridPosX = m_hybridOffsetX;
103  const double hybridPosY = 0.0;
104  const double hybridPosZ = m_hybridOffsetZ;
105 
106  const double pigtailPosX = hybridPosX + 0.5*t_hybrid - 0.5*t_pigtail;
107  const double pigtailPosY = -0.5*w_hybrid - 0.5*w_pigtail;
108  const double pigtailPosZ = hybridPosZ;
109 
110  //
111  // ose : OuterSideEnvelope
112  // Reference: sct_module_geometry.ps
113  //
114  const double w_ose1 = w_sensor + m_safety;
115  const double t_ose1 = t_sensor + m_safety;
116  const double l_ose1 = l_sensor + m_safety;
117 
118  const double t_ose2 = t_hybrid + m_safety;
119  const double w_ose2 = w_hybrid + w_pigtail + m_safety;
120  const double l_ose2 = l_pigtail + m_safety;
121 
122  const double ose2PosX = hybridPosX;
123  const double ose2PosY = hybridPosY - 0.5*w_pigtail;
124  const double ose2PosZ = hybridPosZ;
125 
126  m_env1RefPointVector = std::make_unique<GeoTrf::Vector3D>(0.0, 0.0, 0.0);
127  m_env2RefPointVector = std::make_unique<GeoTrf::Vector3D>(-ose2PosX, -ose2PosY, -ose2PosZ);
128 
129  m_hybridPos = new GeoTransform(GeoTrf::Translate3D(hybridPosX, hybridPosY, hybridPosZ));
130  m_pigtailPos = new GeoTransform(GeoTrf::Translate3D(pigtailPosX, pigtailPosY, pigtailPosZ));
131 
132  // The depth axis goes from the backside to the implant side
133  // and so point to away from the module center.
134  // The two sensor+hybrid combinations are built in a similar way.
135  //
136  // ^
137  // --- hybrid |
138  // ------- sensor | x-axis
139  //
140  // Shown is the outer side. The inner side is the same but with a rotation of 180 Gaudi::Units::deg around the z-axis.
141  //
142  //Gaudi::Units::HepRotation rotSensor;
143  //rotSensor.rotateZ(180*Gaudi::Units::deg);
144  m_sensorPos = new GeoTransform(GeoTrf::Translate3D(sensorPosX, sensorPosY, sensorPosZ));
145 
146  //
147  // Make an envelope for the whole module.
148  //
149  const GeoBox * ose1Shape = new GeoBox(0.5 * t_ose1,
150  0.5 * w_ose1,
151  0.5 * l_ose1);
152  const GeoBox * ose2Shape = new GeoBox(0.5 * t_ose2,
153  0.5 * w_ose2,
154  0.5 * l_ose2);
155 
156  const GeoShape & OuterSideEnvelopeShape = (*ose1Shape).
157  add(*ose2Shape << GeoTrf::Translate3D(ose2PosX, ose2PosY, ose2PosZ));
158 
159  const GeoLogVol * OuterSideEnvelopeLog = new GeoLogVol("OuterSideEnvelope",
160  &OuterSideEnvelopeShape,
162 
163  m_thickness = 0.5*t_ose1 + m_hybridOffsetX + 0.5*t_ose2;
164  m_width = w_ose2;
165  m_length = l_ose1;
166 
167  return OuterSideEnvelopeLog;
168 }
169 
170 
171 GeoVPhysVol *
173 {
174 
175  if(m_sqliteReader){
176 
177  m_sensor->build(id);
178  return nullptr;
179  }
180 
181  GeoFullPhysVol * outerSide = new GeoFullPhysVol(m_logVolume);
182 
183  //
184  // Build the outerSide
185  //
186  // Add Sensor
187  outerSide->add(new GeoIdentifierTag(1000));
188  outerSide->add(m_sensorPos);
189  outerSide->add(m_sensor->build(id));
190 
191  // Add Hybrid
192  outerSide->add(m_hybridPos);
193  outerSide->add(m_hybrid->getVolume());
194 
195  // Add Pigtail
196  outerSide->add(m_pigtailPos);
197  outerSide->add(m_pigtail->getVolume());
198 
199  return outerSide;
200 }
SCT_ComponentFactory::m_geometryManager
SCT_GeometryManager * m_geometryManager
Definition: SCT_ComponentFactory.h:42
SCT_OuterSide::m_thickness
double m_thickness
Definition: SCT_OuterSide.h:64
SCT_MaterialManager
Definition: SCT_MaterialManager.h:21
SCT_Identifier
Definition: SCT_Identifier.h:12
InDetDD::SCT_DetectorManager
Definition: SCT_DetectorManager.h:49
SCT_UniqueComponentFactory::m_mapFPV
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
Definition: SCT_ComponentFactory.h:95
SCT_GeneralParameters::safety
double safety() const
Definition: SCT_GeneralParameters.cxx:48
SCT_OuterSide::m_pigtail
std::unique_ptr< SCT_Pigtail > m_pigtail
Definition: SCT_OuterSide.h:73
SCT_Identifier.h
SCT_OuterSide::m_hybridPos
GeoIntrusivePtr< GeoTransform > m_hybridPos
Definition: SCT_OuterSide.h:76
SCT_OuterSide::SCT_OuterSide
SCT_OuterSide(const std::string &name, InDetDD::SCT_DetectorManager *detectorManager, SCT_GeometryManager *geometryManager, SCT_MaterialManager *materials, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * >> mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * >> mapAX)
Definition: SCT_OuterSide.cxx:37
SCT_UniqueComponentFactory::m_mapAX
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
Definition: SCT_ComponentFactory.h:96
SCT_MaterialManager.h
SCT_OuterSide::m_hybridOffsetX
double m_hybridOffsetX
Definition: SCT_OuterSide.h:68
SCT_Sensor.h
SCT_OuterSide.h
SCT_OuterSide::~SCT_OuterSide
~SCT_OuterSide()
SCT_BarrelModuleParameters.h
SCT_ComponentFactory::m_detectorManager
InDetDD::SCT_DetectorManager * m_detectorManager
Definition: SCT_ComponentFactory.h:41
SCT_OuterSide::m_env1RefPointVector
std::unique_ptr< GeoTrf::Vector3D > m_env1RefPointVector
Definition: SCT_OuterSide.h:79
SCT_GeometryManager::generalParameters
const SCT_GeneralParameters * generalParameters() const
Definition: SCT_GeometryManager.cxx:105
SCT_GeneralParameters.h
SCT_OuterSide::m_sensorPos
GeoIntrusivePtr< GeoTransform > m_sensorPos
Definition: SCT_OuterSide.h:78
SCT_OuterSide::preBuild
virtual const GeoLogVol * preBuild()
Definition: SCT_OuterSide.cxx:67
SCT_OuterSide::m_env2RefPointVector
std::unique_ptr< GeoTrf::Vector3D > m_env2RefPointVector
Definition: SCT_OuterSide.h:80
SCT_OuterSide::m_pigtailPos
GeoIntrusivePtr< GeoTransform > m_pigtailPos
Definition: SCT_OuterSide.h:77
SCT_MaterialManager::gasMaterial
const GeoMaterial * gasMaterial() const
Definition: SCT_MaterialManager.cxx:69
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
SCT_OuterSide::m_safety
double m_safety
Definition: SCT_OuterSide.h:70
SCT_OuterSide::m_length
double m_length
Definition: SCT_OuterSide.h:66
SCT_Hybrid.h
SCT_GeneralParameters
Definition: SCT_GeneralParameters.h:16
SCT_GeometryManager::barrelModuleParameters
const SCT_BarrelModuleParameters * barrelModuleParameters() const
Definition: SCT_GeometryManager.cxx:84
SCT_OuterSide::m_hybridOffsetZ
double m_hybridOffsetZ
Definition: SCT_OuterSide.h:69
SCT_ComponentFactory::m_materials
SCT_MaterialManager * m_materials
Definition: SCT_ComponentFactory.h:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_BarrelModuleParameters
Definition: SCT_BarrelModuleParameters.h:12
SCT_UniqueComponentFactory::m_logVolume
const GeoLogVol * m_logVolume
Definition: SCT_ComponentFactory.h:90
SCT_UniqueComponentFactory
Definition: SCT_ComponentFactory.h:76
SCT_OuterSide::m_sensor
std::unique_ptr< SCT_Sensor > m_sensor
Definition: SCT_OuterSide.h:74
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
SCT_Pigtail.h
SCT_OuterSide::getParameters
void getParameters()
Definition: SCT_OuterSide.cxx:55
SCT_DetectorManager.h
SCT_UniqueComponentFactory::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition: SCT_ComponentFactory.h:91
SCT_OuterSide::build
virtual GeoVPhysVol * build(SCT_Identifier id)
Definition: SCT_OuterSide.cxx:172
SCT_OuterSide::m_hybrid
std::unique_ptr< SCT_Hybrid > m_hybrid
Definition: SCT_OuterSide.h:72
SCT_OuterSide::m_width
double m_width
Definition: SCT_OuterSide.h:65
SCT_GeometryManager.h
SCT_GeometryManager
Definition: SCT_GeometryManager.h:25