ATLAS Offline Software
SCT_Forward.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
12 
21 
23 
25 
26 #include "GeoModelRead/ReadGeoModel.h"
27 #include "GeoModelKernel/GeoTube.h"
28 #include "GeoModelKernel/GeoLogVol.h"
29 #include "GeoModelKernel/GeoFullPhysVol.h"
30 #include "GeoModelKernel/GeoNameTag.h"
31 #include "GeoModelKernel/GeoIdentifierTag.h"
32 #include "GeoModelKernel/GeoTransform.h"
33 #include "GeoModelKernel/GeoAlignableTransform.h"
34 #include "GeoModelKernel/GeoMaterial.h"
35 #include "GaudiKernel/SystemOfUnits.h"
36 
37 #include <sstream>
38 #include <cmath>
39 
40 SCT_Forward::SCT_Forward(const std::string & name, int ec,
41  InDetDD::SCT_DetectorManager* detectorManager,
42  SCT_GeometryManager* geometryManager,
43  SCT_MaterialManager* materials,
44  GeoModelIO::ReadGeoModel* sqliteReader,
45  std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
46  std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
47  : SCT_UniqueComponentFactory(name, detectorManager, geometryManager, materials, sqliteReader, mapFPV, mapAX),
48  m_endcap(ec)
49 {
50  getParameters();
52 
53 }
54 
56 {
57 }
58 
59 void
61 {
64 
65  //m_numRingTypes = parameters->fwdNumRingTypes();
66  m_numModuleTypes = moduleParameters->fwdModuleNumTypes();
67  m_numWheels = parameters->fwdNumWheels();
68  m_innerRadius = parameters->fwdInnerRadius();
69  m_outerRadius = parameters->fwdOuterRadius();
70  m_zMin = parameters->fwdZMin();
71  m_zMax = parameters->fwdZMax();
72  m_trtGapPos = parameters->fwdTrtGapPos();
73  m_coolingPipeRadius = parameters->fwdCoolingPipeRadius();
74  m_numThermalShieldElements = parameters->fwdNumThermalShieldElements();
75  m_cylinderServicesPresent = parameters->fwdCylinderServicePresent();
76 
77  // Outer radius of cylinder services is given by inner radius of OTE
79  for (int iElement = 0; iElement < m_numThermalShieldElements; iElement++){
80  if(parameters->fwdThermalShieldMaterial(iElement) == "sct::FwdOTE") {
81  m_outerRadiusCylinderServices = parameters->fwdThermalShieldInnerRadius(iElement);
82  }
83  }
84  }
85 
86  // Length of forward envelope
87  m_length = m_zMax - m_zMin;
88 
89 
90  // Set numerology
92 
93 
94 }
95 
96 
97 
98 const GeoLogVol *
100 {
101  // Create the elements we need for the forward
102  // We make all the module types here. There is a outer, middle, truncated middle and inner type module.
103  std::vector<SCT_FwdModule*> modules;
104  for (int iModuleType = 0; iModuleType < m_numModuleTypes; iModuleType++){
105 
106  std::unique_ptr<SCT_FwdModule> module = std::make_unique<SCT_FwdModule>("FwdModule"+intToString(iModuleType), iModuleType,
108  modules.push_back(module.get());
109  m_modules.push_back(std::move(module));
110  }
111 
112  for (int iWheel = 0; iWheel < m_numWheels; iWheel++){
113  // Build Wheels
114  std::ostringstream name; name << "Wheel" << iWheel << ((m_endcap > 0) ? "A" : "C");
115  m_wheels.push_back(std::make_unique<SCT_FwdWheel>(name.str(), iWheel, modules, m_endcap,
117  }
118 
119  if(m_sqliteReader) return nullptr;
120 
121  // Make one end of the Forward tracker
122  // Tube envelope containing the forward
123  const GeoTube * forwardEnvelopeShape = new GeoTube(m_innerRadius, m_outerRadius, 0.5 * m_length);
124  const GeoLogVol * forwardLog =
125  new GeoLogVol(getName(), forwardEnvelopeShape, m_materials->gasMaterial());
126 
127  return forwardLog;
128 }
129 
130 GeoVPhysVol *
132 {
133  GeoFullPhysVol * forward=nullptr;
134  if(!m_sqliteReader)
135  {
136  forward = new GeoFullPhysVol(m_logVolume);
137 
138  for (int iWheel = 0; iWheel < m_numWheels; iWheel++){
139 
140  SCT_FwdWheel * wheel = m_wheels[iWheel].get();
141  std::ostringstream wheelName; wheelName << "Wheel#" << iWheel;
142  double zpos = wheel->zPosition() - zCenter();
143  forward->add(new GeoNameTag(wheelName.str()));
144  forward->add(new GeoIdentifierTag(iWheel));
145  GeoAlignableTransform * transform = new GeoAlignableTransform(GeoTrf::TranslateZ3D(zpos));
146  forward->add(transform);
147  id.setLayerDisk(iWheel);
148  GeoVPhysVol * wheelPV = wheel->build(id);
149  forward->add(wheelPV);
150 
151  // Store the alignable transform
152  m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, wheelPV);
153  }
154 
155  //
156  // Place SupportFrame
157  //
158  SCT_FwdSupportFrame supportFrame("SupportFrame", m_detectorManager, m_geometryManager, m_materials);
159  double supportFrameZPos = supportFrame.zPosition() - zCenter();
160  forward->add(new GeoTransform(GeoTrf::TranslateZ3D(supportFrameZPos)));
161  forward->add(supportFrame.getVolume());
162 
163  // Make and Place Cylinder Services
164 
166 
167  // New phi-dependent services
168  SCT_FwdCylinderServices cylinderServices("CylinderServices",
169  supportFrame.outerRadius(),
171  supportFrame.length(),
173  forward->add(new GeoTransform(GeoTrf::TranslateZ3D(supportFrameZPos)));
174  forward->add(cylinderServices.getVolume());
175 
176  } else {
177 
178  // Old cylindrical services
179  //
180  // Make cooling pipes. These extend from the wheel to the TRT Gap.
181  //
182  {
183  // End position of the pipes.
184  double endPos = m_trtGapPos;
185 
186  // Calculate radius to start placing cooling pipes. This is equal to the
187  // outer radius of the support frame + the pipe radius (The pipe radius is to just
188  // give a small gap - it is not really necessary)
189  double innerRadiusCooling = supportFrame.outerRadius() + m_coolingPipeRadius;
190 
191  // Inner radius of cylinder representing pipes. Gets incremented for each wheel.
192  double rStart = innerRadiusCooling;
193 
194  for (int iWheel = 0; iWheel < m_numWheels; iWheel++){
195  // Start position of the pipes.
196  double startPos = m_wheels[iWheel]->zPosition();
197 
198  // Assume one cooling circuit per quadrant of each ring. ie 8 pipes per ring.
199  int numPipes = 8 * m_wheels[iWheel]->numRings();
200 
201  // Label Cooling pipe with W# at end of string
202  SCT_FwdCoolingPipe coolingPipe("OffDiskCoolingPipeW"+intToString(iWheel),
203  numPipes, rStart, startPos, endPos,
205 
206  // Place the cooling pipes
207  double coolingPipeZPos = coolingPipe.zPosition() - zCenter();
208  forward->add(new GeoTransform(GeoTrf::TranslateZ3D(coolingPipeZPos)));
209  forward->add(coolingPipe.getVolume());
210 
211  // Set rStart for next cooling pipe equal to outer radius of this cooling pipe.
212  rStart = coolingPipe.outerRadius();
213 
214  }
215  }
216 
217  //
218  // Make Power Tapes. These extend from the wheel to the TRT Gap.
219  //
220  {
221 
222  // End position of the power tapes.
223  double endPos = m_trtGapPos;
224 
225  // Calculate radius to start placing power tapes. This is half way bewteen outer radius
226  // of support fram and outer radius of forward envelope.
227  // The -1 mm is to avoid a clash with the thermal shield.
228  double innerRadiusPowerTapes = 0.5*(supportFrame.outerRadius() + m_outerRadius) - 1*Gaudi::Units::mm;
229 
230  // Inner radius of cylinder representing power tapes. Gets incremented for each wheel.
231  double rStart = innerRadiusPowerTapes;
232 
233  for (int iWheel = 0; iWheel < m_numWheels; iWheel++){
234 
235  // Start position of the power tapes.
236  double startPos = m_wheels[iWheel]->zPosition();
237 
238  // Get total number of modules in wheel
239  int numModules = m_wheels[iWheel]->totalModules();
240 
241  // Label power tape with W# at end of string
242  SCT_FwdPowerTape powerTape("OffDiskPowerTapeW"+intToString(iWheel),
243  numModules, rStart, startPos, endPos,
245 
246  // Place Power Tapes
247  double powerTapeZPos = powerTape.zPosition() - zCenter();
248  forward->add(new GeoTransform(GeoTrf::TranslateZ3D(powerTapeZPos)));
249  forward->add(powerTape.getVolume());
250 
251  // Set rStart for next power tape equal to outer radius of this power tape.
252  rStart = powerTape.outerRadius();
253  } // end loop over wheels
254  }
255  }
256 
257  //
258  // Place Thermal Shield Elements
259  //
260  for (int iElement = 0; iElement < m_numThermalShieldElements; iElement++){
261  SCT_FwdThermalShieldElement thermalShieldElement("FwdThermalShieldElement"+intToString(iElement),
263  double elementZPos = thermalShieldElement.zPosition() - zCenter();
264  forward->add(new GeoTransform(GeoTrf::TranslateZ3D(elementZPos)));
265  forward->add(thermalShieldElement.getVolume());
266  }
267 
268  // Extra Material
270  xMat.add(forward, "SCTEndcap", zCenter());
271  if (m_endcap > 0) {
272  xMat.add(forward, "SCTEndcapA", zCenter());
273  } else {
274  xMat.add(forward, "SCTEndcapC", zCenter());
275  }
276 
277  }else
278  {
279  for (int iWheel = 0; iWheel < m_numWheels; iWheel++){
280 
281  SCT_FwdWheel * wheel = m_wheels[iWheel].get();
282  std::ostringstream wheelName; wheelName << "Wheel#" << iWheel;
283  id.setLayerDisk(iWheel);
284  wheel->build(id);
285 
286  std::string key=wheelName.str()+"_"+std::to_string(id.getBarrelEC());
287 
288  // Store the alignable transform
289  m_detectorManager->addAlignableTransform(2, id.getWaferId(), (*m_mapAX)[key], (*m_mapFPV)[key]);
290  }
291  if (m_endcap > 0) {
292  forward= (*m_mapFPV)["SCTEndcapA"];
293  } else {
294  forward= (*m_mapFPV)["SCTEndcapC"];
295  }
296 
297  }
298  return forward;
299 }
SCT_ComponentFactory::m_geometryManager
SCT_GeometryManager * m_geometryManager
Definition: SCT_ComponentFactory.h:42
SCT_MaterialManager
Definition: SCT_MaterialManager.h:21
SCT_FwdSupportFrame
Definition: SCT_FwdSupportFrame.h:15
SCT_Forward::m_modules
std::vector< std::unique_ptr< SCT_FwdModule > > m_modules
Definition: SCT_Forward.h:79
SCT_GeometryManager::forwardModuleParameters
const SCT_ForwardModuleParameters * forwardModuleParameters() const
Definition: SCT_GeometryManager.cxx:91
SCT_Identifier
Definition: SCT_Identifier.h:12
SCT_Forward::m_innerRadius
double m_innerRadius
Definition: SCT_Forward.h:63
SCT_FwdModule.h
InDetDD::SiDetectorManager::numerology
const SiNumerology & numerology() const
Access Numerology.
Definition: SiDetectorManager.h:126
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_FwdWheel::build
virtual GeoVPhysVol * build(SCT_Identifier id)
Definition: SCT_FwdWheel.cxx:259
SCT_UniqueComponentFactory::m_mapAX
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
Definition: SCT_ComponentFactory.h:96
SCT_MaterialManager.h
SCT_Forward::m_wheels
std::vector< std::unique_ptr< SCT_FwdWheel > > m_wheels
Definition: SCT_Forward.h:77
SCT_FwdSupportFrame::zPosition
double zPosition() const
Definition: SCT_FwdSupportFrame.h:32
SCT_GeometryManager::forwardParameters
const SCT_ForwardParameters * forwardParameters() const
Definition: SCT_GeometryManager.cxx:98
SCT_Forward::SCT_Forward
SCT_Forward(const std::string &name, int ec, 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_Forward.cxx:40
ExtraMaterial.h
SCT_FwdSupportFrame.h
SCT_Forward::m_outerRadiusCylinderServices
double m_outerRadiusCylinderServices
Definition: SCT_Forward.h:74
SCT_Forward::~SCT_Forward
~SCT_Forward()
Definition: SCT_Forward.cxx:55
SCT_ComponentFactory::m_detectorManager
InDetDD::SCT_DetectorManager * m_detectorManager
Definition: SCT_ComponentFactory.h:41
SCT_FwdThermalShieldElement.h
SCT_FwdCoolingPipe::zPosition
double zPosition() const
Definition: SCT_FwdCoolingPipe.h:34
SCT_Forward.h
InDetDD::ExtraMaterial::add
void add(GeoPhysVol *parent, const std::string &parentName, double zPos=0)
Definition: ExtraMaterial.cxx:42
SCT_FwdPowerTape::outerRadius
double outerRadius() const
Definition: SCT_FwdPowerTape.h:30
SCT_Forward::m_cylinderServicesPresent
bool m_cylinderServicesPresent
Definition: SCT_Forward.h:70
SCT_Forward::m_coolingPipeRadius
double m_coolingPipeRadius
Definition: SCT_Forward.h:68
SCT_FwdThermalShieldElement
Definition: SCT_FwdThermalShieldElement.h:15
SCT_FwdWheel.h
SCT_Forward::m_zMax
double m_zMax
Definition: SCT_Forward.h:66
python.PyAthena.module
module
Definition: PyAthena.py:134
SCT_FwdCoolingPipe.h
SCT_ForwardModuleParameters
Definition: SCT_ForwardModuleParameters.h:12
SCT_FwdPowerTape::zPosition
double zPosition() const
Definition: SCT_FwdPowerTape.h:33
SCT_FwdWheel::zPosition
double zPosition() const
Definition: SCT_FwdWheel.h:48
SCT_SharedComponentFactory::getVolume
GeoVPhysVol * getVolume()
Definition: SCT_ComponentFactory.h:67
SCT_MaterialManager::gasMaterial
const GeoMaterial * gasMaterial() const
Definition: SCT_MaterialManager.cxx:80
SCT_FwdPowerTape.h
SCT_FwdRing.h
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
SCT_FwdThermalShieldElement::zPosition
double zPosition() const
Definition: SCT_FwdThermalShieldElement.h:32
SCT_Forward::m_numModuleTypes
int m_numModuleTypes
Definition: SCT_Forward.h:61
SCT_ForwardModuleParameters.h
SCT_GeometryManager::distortedMatManager
InDetDD::DistortedMaterialManager * distortedMatManager() const
Definition: SCT_GeometryManager.cxx:111
SCT_ComponentFactory::intToString
std::string intToString(int i) const
Definition: SCT_ComponentFactory.cxx:29
SCT_ForwardModuleParameters::fwdModuleNumTypes
int fwdModuleNumTypes() const
Definition: SCT_ForwardModuleParameters.cxx:296
InDetDD::SiNumerology::setNumDisks
void setNumDisks(int nDisks)
Definition: SiNumerology.cxx:41
SCT_Forward::m_numThermalShieldElements
int m_numThermalShieldElements
Definition: SCT_Forward.h:69
SCT_Forward::m_outerRadius
double m_outerRadius
Definition: SCT_Forward.h:64
SCT_ComponentFactory::m_materials
SCT_MaterialManager * m_materials
Definition: SCT_ComponentFactory.h:43
SCT_FwdCoolingPipe
Definition: SCT_FwdCoolingPipe.h:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SCT_Forward::m_endcap
int m_endcap
Definition: SCT_Forward.h:60
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
SCT_FwdSupportFrame::length
double length() const
Definition: SCT_FwdSupportFrame.h:31
SCT_Forward::m_trtGapPos
double m_trtGapPos
Definition: SCT_Forward.h:67
SCT_Forward::zCenter
double zCenter() const
Definition: SCT_Forward.h:49
SCT_FwdCylinderServices.h
SCT_UniqueComponentFactory::m_logVolume
const GeoLogVol * m_logVolume
Definition: SCT_ComponentFactory.h:90
SCT_FwdPowerTape
Definition: SCT_FwdPowerTape.h:13
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
SCT_UniqueComponentFactory
Definition: SCT_ComponentFactory.h:76
SCT_Forward::preBuild
virtual const GeoLogVol * preBuild()
Definition: SCT_Forward.cxx:99
SCT_Forward::getParameters
void getParameters()
Definition: SCT_Forward.cxx:60
SCT_FwdWheel
Definition: SCT_FwdWheel.h:26
InDetDD::SCT_DetectorManager::addAlignableTransform
virtual void addAlignableTransform(int level, const Identifier &id, GeoAlignableTransform *xf, const GeoVFullPhysVol *child)
Add alignable transforms. No access to these, they will be changed by manager:
Definition: SCT_DetectorManager.cxx:264
SCT_Forward::m_numWheels
int m_numWheels
Definition: SCT_Forward.h:62
SCT_Forward::m_zMin
double m_zMin
Definition: SCT_Forward.h:65
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
SCT_ForwardParameters.h
SCT_Forward::m_length
double m_length
Definition: SCT_Forward.h:73
SCT_DetectorManager.h
SCT_UniqueComponentFactory::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition: SCT_ComponentFactory.h:91
SCT_FwdCylinderServices
Definition: SCT_FwdCylinderServices.h:13
InDetDD::ExtraMaterial
Definition: ExtraMaterial.h:23
SCT_ComponentFactory::getName
const std::string & getName() const
Definition: SCT_ComponentFactory.h:35
SCT_FwdSupportFrame::outerRadius
double outerRadius() const
Definition: SCT_FwdSupportFrame.h:30
SCT_Forward::build
virtual GeoVPhysVol * build(SCT_Identifier id)
Definition: SCT_Forward.cxx:131
SCT_GeometryManager.h
SCT_GeometryManager
Definition: SCT_GeometryManager.h:25
SCT_FwdCoolingPipe::outerRadius
double outerRadius() const
Definition: SCT_FwdCoolingPipe.h:31
SCT_ForwardParameters
Definition: SCT_ForwardParameters.h:16
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37