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