ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_Barrel.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "SCT_Barrel.h"
6
8
11#include "SCT_Identifier.h"
12
13#include "SCT_Layer.h"
14#include "SCT_Module.h"
15#include "SCT_Sensor.h"
16#include "SCT_InterLink.h"
17#include "SCT_Spider.h"
18#include "SCT_PixelAttachment.h"
19
21
24
25#include "GeoModelRead/ReadGeoModel.h"
26#include "GeoModelKernel/GeoTube.h"
27#include "GeoModelKernel/GeoTubs.h"
28#include "GeoModelKernel/GeoLogVol.h"
29#include "GeoModelKernel/GeoFullPhysVol.h"
30#include "GeoModelKernel/GeoPhysVol.h"
31#include "GeoModelKernel/GeoNameTag.h"
32#include "GeoModelKernel/GeoIdentifierTag.h"
33#include "GeoModelKernel/GeoTransform.h"
34#include "GeoModelKernel/GeoAlignableTransform.h"
35#include "GeoModelKernel/GeoMaterial.h"
36#include "GeoModelKernel/GeoShape.h"
37#include "GeoModelKernel/GeoShapeShift.h"
38#include "GaudiKernel/SystemOfUnits.h"
39#include "GaudiKernel/MsgStream.h"
40
41#include <iostream>
42#include <utility>
43
44SCT_Barrel::SCT_Barrel(const std::string & name,
45 InDetDD::SCT_DetectorManager* detectorManager,
46 SCT_GeometryManager* geometryManager,
47 SCT_MaterialManager* materials,
48 GeoModelIO::ReadGeoModel* sqliteReader,
49 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
50 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX)
51 : SCT_UniqueComponentFactory(name, detectorManager, geometryManager, materials, sqliteReader, std::move(mapFPV), std::move(mapAX))
52{
54 if(!m_sqliteReader) {
56 }
57}
58
59
60void
62{
63 const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters();
64
65 if(!m_sqliteReader){
66 m_innerRadius = parameters->barrelInnerRadius();
67 m_outerRadius = parameters->barrelOuterRadius();
68 m_length = parameters->barrelLength();
69
70 // Used in old geometry
71 m_thermalShieldEndWallThickness = parameters->thermalShieldEndCapThickness();
72
73 // Clearannce in z between layer and interlink.
74 m_zClearance = 1.*Gaudi::Units::mm;
75
76 // Layer internal structure and services depend on geometry version
77 m_isOldGeometry = parameters->isOldGeometry();
78 }
79 m_numLayers = parameters->numLayers();
80 // Set numerology
81 m_detectorManager->numerology().setNumLayers(m_numLayers);
82
83}
84
85const GeoLogVol *
87{
88 // Create the barrel volume
89 // Tube envelope containing the barrel.
90 const GeoTube * barrelEnvelopeShape = new GeoTube(m_innerRadius, m_outerRadius, 0.5 * m_length);
91 GeoLogVol * barrelLog = new GeoLogVol(getName(), barrelEnvelopeShape, m_materials->gasMaterial());
92 return barrelLog;
93}
94
95GeoVPhysVol *
97{
98 GeoFullPhysVol * barrel=nullptr;
100 {
101 barrel = new GeoFullPhysVol(m_logVolume);
102
103 // Old geometries are no longer supported - give up now if one is requested
104 if(m_isOldGeometry) {
105 MsgStream log(Athena::getMessageSvc(), "SCT_Barrel");
106 log<< MSG::INFO <<"SCT_Barrel Old barrel geometry versions are not supported"<<endmsg;
107 return barrel;
108 }
109
110 // There is only one type of module. So we create it just the once and pass it to the layers.
112
113 // Create the interlinks
115
116 // Calculte the length of the layer cylinder. This is the barrel length less the thermal
117 // shield and interlink width.
118 // This is only used for 'OldGeometry". In new geometry, layer length is set internally,
119 // and is equal to support cylinder length
120 double layerLength = m_length - 2*m_thermalShieldEndWallThickness - 2*interLink.length();
121
122 // We reduce to allow some alignment clearance
123 layerLength -= 2*m_zClearance;
124
125 for (int iLayer = 0; iLayer < m_numLayers; iLayer++) {
126
127 // Create the layers
128
129 layerLength = 0.;
131 barrel->add(new GeoNameTag("Layer#"+intToString(iLayer)));
132 barrel->add(new GeoIdentifierTag(iLayer)); // Identifier layer= iLayer
133 id.setLayerDisk(iLayer);
134 GeoAlignableTransform * transform = new GeoAlignableTransform(GeoTrf::Transform3D::Identity());
135 barrel->add(transform);
136 GeoVPhysVol * layerPV = layer.build(id);
137 barrel->add(layerPV);
138 // Store alignable transform
139 m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, layerPV);
140 layerLength = std::max(layerLength,layer.length());
141 }
142
143 // Build and place the interlinks
144 double interLinkZPos = 0.;
145 interLinkZPos = 0.5 * layerLength + m_zClearance + 0.5 * interLink.length();
146 barrel->add(new GeoTransform(GeoTrf::TranslateZ3D(+interLinkZPos)));
147 barrel->add(interLink.getVolume());
148 barrel->add(new GeoTransform(GeoTrf::TranslateZ3D(-interLinkZPos)));
149 barrel->add(interLink.getVolume());
150
151 // Build and place the cooling spiders
152 double spiderZPos = 0.;
154 spiderZPos = interLinkZPos + 0.5*interLink.length() + 0.5*spider.length();
155 barrel->add(new GeoTransform(GeoTrf::TranslateZ3D(+spiderZPos)));
156 barrel->add(spider.getVolume());
157 barrel->add(new GeoTransform(GeoTrf::TranslateZ3D(-spiderZPos)));
158 barrel->add(spider.getVolume());
159
160 // Build and place the thermal shield.
162
163 // Build and place the EMI shield (inner thermal shield).
165
166 // Build and place SCT to Pixel attachment
167 SCT_PixelAttachment pixelAttachment("AttachmentPixelToSCT", m_detectorManager, m_geometryManager, m_materials);
168 barrel->add(new GeoTransform(GeoTrf::TranslateZ3D(+pixelAttachment.zPosition()))); // +ve z
169 barrel->add(pixelAttachment.getVolume());
170 barrel->add(new GeoTransform(GeoTrf::TranslateZ3D(-pixelAttachment.zPosition()))); // -ve z
171 barrel->add(pixelAttachment.getVolume());
172
173 // Extra Material
174 InDetDD::ExtraMaterial xMat(m_geometryManager->distortedMatManager());
175 xMat.add(barrel, "SCTBarrel");
176
177 }else
178 {
179
180 // There is only one type of module. So we create it just the once and pass it to the layers.
182
183 for (int iLayer = 0; iLayer < m_numLayers; iLayer++) {
184 // Create the layers
186 id.setLayerDisk(iLayer);
187 layer.build(id); //MB to verify
188 // Store alignable transform
189 m_detectorManager->addAlignableTransform(2, id.getWaferId(), (*m_mapAX)["Layer#"+intToString(iLayer)], (*m_mapFPV)["Layer#"+intToString(iLayer)]);
190
191 }
192 }
193
194 return barrel;
195
196}
197
198void SCT_Barrel::buildThermalShield(GeoFullPhysVol * parent)
199{
200
201 // The thermal shield is now in 3 parts:
202 // (a) outer cylinder
203 // (b) bulkheads
204 // (c) end panels
205 // The inner cylinder is called 'EMI shield' for backwards compatibility
206
207 const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters();
208
209 double cylinderOuterRadius = parameters->thermalShieldOuterRadius();
210 double cylinderInnerRadius = parameters->thermalShieldInnerRadius();
211 double cylinderLength = parameters->cylinderLength();
212 double bulkheadInnerRadius = parameters->thermalShieldBulkheadInnerRadius();
213 double bulkheadOuterRadius = parameters->thermalShieldBulkheadOuterRadius();
214 double bulkheadThickness = parameters->thermalShieldEndCapCylThickness();
215 double endPanelInnerRadius = parameters->thermalShieldEndPanelInnerRadius();
216 double endPanelOuterRadius = parameters->thermalShieldEndPanelOuterRadius();
217 double endPanelThickness = parameters->thermalShieldEndCapThickness();
218 double endPanelZMax = parameters->thermalShieldEndZMax();
219
220 std::string cylinderMaterialName = parameters->thermalShieldMaterialCyl();
221 std::string bulkheadMaterialName = parameters->thermalShieldMaterialOuterSect();
222 std::string endPanelMaterialName = parameters->thermalShieldMaterialInnerSect();
223
224
225 // The outer cylinder part of thermal shield.
226 const GeoTube * cylinderShape = new GeoTube(cylinderInnerRadius, cylinderOuterRadius, 0.5*cylinderLength);
227 const GeoMaterial* cylinderMaterial = m_materials->getMaterialForVolume(cylinderMaterialName,cylinderShape->volume());
228 const GeoLogVol * cylinderLog = new GeoLogVol("ThShieldOuterCyl", cylinderShape, cylinderMaterial);
229 GeoPhysVol * cylinder = new GeoPhysVol(cylinderLog);
230 parent->add(cylinder);
231
232 // The bulkheads
233 const GeoTube * bulkheadShape = new GeoTube(bulkheadInnerRadius, bulkheadOuterRadius, 0.5*bulkheadThickness);
234 const GeoMaterial* bulkheadMaterial = m_materials->getMaterialForVolume(bulkheadMaterialName,bulkheadShape->volume());
235 const GeoLogVol * bulkheadLog = new GeoLogVol("ThShieldBulkhead", bulkheadShape, bulkheadMaterial);
236 GeoPhysVol * bulkhead = new GeoPhysVol(bulkheadLog);
237 GeoTransform * bulkheadPosPlus = new GeoTransform(GeoTrf::TranslateZ3D(+(endPanelZMax-endPanelThickness-0.5*bulkheadThickness)));
238 GeoTransform * bulkheadPosMinus = new GeoTransform(GeoTrf::TranslateZ3D(-(endPanelZMax-endPanelThickness-0.5*bulkheadThickness)));
239 parent->add(bulkheadPosPlus);
240 parent->add(bulkhead);
241 parent->add(bulkheadPosMinus);
242 parent->add(bulkhead);
243
244 // The end panels
245 const GeoTube * endPanelShape = new GeoTube(endPanelInnerRadius, endPanelOuterRadius, 0.5*endPanelThickness);
246 const GeoMaterial* endPanelMaterial = m_materials->getMaterialForVolume(endPanelMaterialName,endPanelShape->volume());
247 const GeoLogVol * endPanelLog = new GeoLogVol("ThShieldEndPanel", endPanelShape, endPanelMaterial);
248 GeoPhysVol * endPanel = new GeoPhysVol(endPanelLog);
249 GeoTransform * endPanelPosPlus = new GeoTransform(GeoTrf::TranslateZ3D(+(endPanelZMax-0.5*endPanelThickness)));
250 GeoTransform * endPanelPosMinus = new GeoTransform(GeoTrf::TranslateZ3D(-(endPanelZMax-0.5*endPanelThickness)));
251 parent->add(endPanelPosPlus);
252 parent->add(endPanel);
253 parent->add(endPanelPosMinus);
254 parent->add(endPanel);
255
256}
257
258void SCT_Barrel::buildEMIShield(GeoFullPhysVol * parent)
259{
260
261 const SCT_BarrelParameters * parameters = m_geometryManager->barrelParameters();
262
263 // Parameters of cylinder
264 double innerRadius = parameters->emiShieldInnerRadius();
265 double deltaR = parameters->emiShieldDeltaR();
266 double outerRadius = innerRadius + deltaR;
267 double length = 2 * parameters->emiShieldZMax();
268 std::string materialName = parameters->emiShieldMaterial();
269
270 // Parameters of Electrical Shield Joint
271 double jointDeltaR = 0;
272 double jointRPhi = 0;
273 std::string jointMaterialName;
274 if(!m_isOldGeometry) {
275 jointDeltaR = parameters->emiJointDeltaR();
276 jointRPhi = parameters->emiJointRPhi();
277 jointMaterialName = parameters->emiJointMaterial();
278 }
279
280 // Parameters of Pixel Attachment - needed for cut-out
281 double pixelAttachmentLength = parameters->pixelAttachmentDeltaZ();
282 double pixelAttachmentZpos = parameters->pixelAttachmentZMin() + 0.5 * pixelAttachmentLength;
283
284 // Build cylinder (with cut-outs)
285 const GeoShape * emiShieldShape = nullptr;
286 const GeoMaterial * material;
287 const GeoTube * emiShieldTube = new GeoTube(innerRadius, outerRadius, 0.5*length);
288 if (m_isOldGeometry) {
289 emiShieldShape = emiShieldTube;
290 material = m_materials->getMaterial(materialName);
291 } else {
292 const GeoTube* cutOut = new GeoTube(innerRadius, outerRadius, 0.5*pixelAttachmentLength);
293 const GeoShape* emiTemp = (GeoShape*)&(emiShieldTube->subtract(*cutOut << GeoTrf::TranslateZ3D(pixelAttachmentZpos)));
294 emiShieldShape = (GeoShape*)&emiTemp->subtract(*cutOut << GeoTrf::TranslateZ3D(-pixelAttachmentZpos));
295 double emiVolume = emiShieldTube->volume() - 2. * cutOut->volume();
296 material = m_materials->getMaterialForVolume(materialName, emiVolume);
297 }
298 const GeoLogVol * emiShieldLog = new GeoLogVol("EMIShield", emiShieldShape, material);
299 GeoPhysVol * emiShield = new GeoPhysVol(emiShieldLog);
300 parent->add(emiShield);
301
302 // Build electrical shield joints (with cut-outs)
303 if (!m_isOldGeometry) {
304 double dphi = jointRPhi / outerRadius;
305 const GeoTubs* emiJointTubs = new GeoTubs(outerRadius, outerRadius+jointDeltaR, 0.5*length,
306 -0.5 * dphi * Gaudi::Units::radian, dphi * Gaudi::Units::radian);
307 const GeoTubs* jointCutOut = new GeoTubs(outerRadius, outerRadius+jointDeltaR, 0.5*pixelAttachmentLength,
308 -0.5 * dphi * Gaudi::Units::radian, dphi * Gaudi::Units::radian);
309 const GeoShape* jointTemp = (GeoShape*)&(emiJointTubs->subtract(*jointCutOut << GeoTrf::TranslateZ3D(pixelAttachmentZpos)));
310 const GeoShape* emiJointShape = (GeoShape*)&jointTemp->subtract(*jointCutOut << GeoTrf::TranslateZ3D(-pixelAttachmentZpos));
311 double jointVolume = emiJointTubs->volume() - 2. * jointCutOut->volume();
312 const GeoMaterial * jointMaterial = m_materials->getMaterialForVolume(jointMaterialName, jointVolume);
313 const GeoLogVol * emiJointLog = new GeoLogVol("EMIShieldJoint", emiJointShape, jointMaterial);
314 GeoPhysVol * emiJoint = new GeoPhysVol(emiJointLog);
315 // Place 3 copies
316 for (int i=0; i<3; i++) {
317 double angle = (90. + i * 120.) * Gaudi::Units::degree;
318 parent->add(new GeoTransform(GeoTrf::RotateZ3D(angle)));
319 parent->add(emiJoint);
320 }
321 }
322}
Scalar deltaR(const MatrixBase< Derived > &vec) const
#define endmsg
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
void add(GeoPhysVol *parent, const std::string &parentName, double zPos=0)
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated SCT in...
void getParameters()
double outerRadius() const
Definition SCT_Barrel.h:32
double innerRadius() const
Definition SCT_Barrel.h:31
double m_length
Definition SCT_Barrel.h:47
SCT_Barrel(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)
double length() const
Definition SCT_Barrel.h:33
virtual GeoVPhysVol * build(SCT_Identifier id)
double m_innerRadius
Definition SCT_Barrel.h:45
int m_numLayers
Definition SCT_Barrel.h:43
double m_thermalShieldEndWallThickness
Definition SCT_Barrel.h:49
double m_outerRadius
Definition SCT_Barrel.h:46
void buildThermalShield(GeoFullPhysVol *parent)
bool m_isOldGeometry
Definition SCT_Barrel.h:53
double m_zClearance
Definition SCT_Barrel.h:51
virtual const GeoLogVol * preBuild()
void buildEMIShield(GeoFullPhysVol *parent)
const std::string & getName() const
std::string intToString(int i) const
InDetDD::SCT_DetectorManager * m_detectorManager
SCT_GeometryManager * m_geometryManager
SCT_MaterialManager * m_materials
double length() const
Definition SCT_Spider.h:27
SCT_UniqueComponentFactory(const std::string &name, InDetDD::SCT_DetectorManager *detectorManager, SCT_GeometryManager *geometryManager, SCT_MaterialManager *materials=nullptr, GeoModelIO::ReadGeoModel *sqliteReader=nullptr, std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > mapFPV=nullptr, std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > mapAX=nullptr)
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
GeoModelIO::ReadGeoModel * m_sqliteReader
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
STL namespace.