ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_SkiAux.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//
6// 1st Feb 2005 D.Naito modified.
7// 28th Mar 2005 S.Mima modified.
8//
9#include "SCT_SkiAux.h"
10
11#include "SCT_MaterialManager.h"
12#include "SCT_GeometryManager.h"
13
14#include "SCT_Ski.h"
15#include "SCT_Module.h"
16#include "SCT_Bracket.h"
17#include "SCT_Harness.h"
18#include "SCT_SkiPowerTape.h"
19
20#include "GeoModelKernel/GeoTubs.h"
21#include "GeoModelKernel/GeoLogVol.h"
22#include "GeoModelKernel/GeoPhysVol.h"
23#include "GeoModelKernel/GeoNameTag.h"
24#include "GeoModelKernel/GeoTransform.h"
25#include "GeoModelKernel/GeoMaterial.h"
26#include "GeoModelKernel/GeoDefinitions.h"
27#include "GeoModelKernel/Units.h"
28
29#include <cmath>
30
31inline double sqr(double x) {return x*x;}
32
33// Small utility function to determine min and max angle of components.
34void
35calcMinMaxRatioS(double xCenter, double yCenter,
36 double xWidth, double yWidth,
37 double & minRatio, double & maxRatio);
38
39SCT_SkiAux::SCT_SkiAux(const std::string & name,
40 SCT_Ski * ski,
44 double innerRadius,
45 double bracketPhiOffset,
46 double powerTapePhiOffset,
47 double divisionAngle,
48 InDetDD::SCT_DetectorManager* detectorManager,
49 SCT_GeometryManager* geometryManager,
50 SCT_MaterialManager* materials) :
51 SCT_SharedComponentFactory(name, detectorManager, geometryManager, materials),
55 m_sectorAngle(divisionAngle),
57{
60}
61
62void
66
67GeoVPhysVol *
69{
70 // SkiAux is a composition with all the elements that go along with
71 // ski but are not tilted with the ski. Currently the brackets, harness
72 // and powertapes. Harness is not present in older geometries.
73 // The reference point is the beam axis.
74 // The envelope is a tube sector.
75
76 //
77 // Calculate Position of Brackets. Z position is calculated when it is positioned
78 //
79 // phi offset is calculated in SCT_Layer. For AGE compatible version it is positioned
80 // such that the lower edge of the bracket is lined up with the upper
81 // edge of the next module below it.
82
83 // Define small distance for avoiding overlaps.
84 double radiusBracket = m_innerRadius + 0.5*m_bracket->thickness() + epsilon();
85 double xBracketPos = radiusBracket * cos(m_bracketPhiOffset);
86 double yBracketPos = radiusBracket * sin(m_bracketPhiOffset);
87
88 // Calculate position of harness, if present. Phi offset is
89 // same as power tapes, and we leave a gap equal to one tape
90 // width
91 double xHarnessPos = 0;
92 double yHarnessPos = 0;
93 if(m_harness != nullptr) {
94 double radiusHarness = m_innerRadius +
95 0.5 * m_harness->thickness() +
96 m_skiPowerTape->powerTapeThickness();
97 xHarnessPos = radiusHarness * cos(m_powerTapePhiOffset);
98 yHarnessPos = radiusHarness * sin(m_powerTapePhiOffset);
99 }
100
101 //
102 // Calculate Position of PowerTapes
103 //
104 // Calculate x position of stack of tapes.
105 // If no harness is present, this is on the outer surface of the support
106 // cylinder with a gap equal to a tape width. In AGE there is a bug at the
107 // moment so this is not identical to AGE.
108 // If the harness is present, the power tapes are moved beyond the harness
109
110 double radiusTape = m_innerRadius +
111 0.5 * m_skiPowerTape->thickness() +
112 m_skiPowerTape->powerTapeThickness();
113 if(m_harness != nullptr) {radiusTape += m_harness->thickness();}
114 double xTapePos = radiusTape * cos(m_powerTapePhiOffset);
115 double yTapePos = radiusTape * sin(m_powerTapePhiOffset);
116
117 //
118 // Calculate envelope.
119 //
120 // Calculate the max radius that the components extend to.
121 // N.B. harness is inside power tape, so don't need to check it
122 double rMaxExtentOfPowerTape =
123 sqrt( sqr(radiusTape + 0.5 * m_skiPowerTape->thickness()) +
124 sqr(0.5 * m_skiPowerTape->width()) );
125
126 double rMaxExtentOfBracket =
127 sqrt( sqr(radiusBracket + 0.5 * m_bracket->thickness()) +
128 sqr(0.5 * m_bracket->width()) );
129
130 m_outerRadius = std::max(rMaxExtentOfBracket,rMaxExtentOfPowerTape) + epsilon();
131
132
133 // calculate min and max tan(alpha) = y/x in order to work out
134 // maximum and minimum angle for the sector.
135 // Assumes angles are between -pi/2 and pi/2 and don't straddle pi/2 boarder.
136 double minAngle=0.;
137 double maxAngle=0.;
138
139 double halfAngleBracket = atan(0.5 * m_bracket->width()/m_innerRadius);
140 double halfAnglePowerTape = atan(0.5 * m_skiPowerTape->width()/m_innerRadius);
141 // Harness and power tape are at same phi
142 if(m_harness != nullptr) {
143 double halfAngleHarness = atan(0.5 * m_harness->width()/m_innerRadius);
144 halfAnglePowerTape = std::max(halfAnglePowerTape, halfAngleHarness);
145 }
146
148 minAngle = m_bracketPhiOffset - halfAngleBracket;
149 maxAngle = m_powerTapePhiOffset + halfAnglePowerTape;
150 } else {
151 minAngle = m_powerTapePhiOffset - halfAnglePowerTape;
152 maxAngle = m_bracketPhiOffset + halfAngleBracket;
153 }
154
155
156 // Calculate extent so that min and max angle are equal distant to sector edge
157 double midAngle = 0.5 * (minAngle+maxAngle);
158 m_sectorStartAngle = midAngle - 0.5 * m_sectorAngle;
159
160 // Length is same as power tape length
161 m_length = m_skiPowerTape->length();
162
163 const GeoTubs * skiAuxShape = new GeoTubs(m_innerRadius, m_outerRadius, 0.5*m_length,
165 const GeoLogVol *skiAuxLog =
166 new GeoLogVol(getName(), skiAuxShape, m_materials->gasMaterial());
167 GeoPhysVol * skiAux = new GeoPhysVol(skiAuxLog);
168
169 //
170 // Position brackets
171 //
172
173 // Loop over modules in ski as we need their z positions.
174 for (int iModule = 0; iModule < m_ski->modulesPerSki(); iModule++) {
175
176 // Z Position is position of the center of the baseBoard:
177 double coolingCenterPosZ = m_ski->zPos(iModule) + m_ski->coolingBlockOffsetZ();
178 GeoTrf::Translation3D posBracket(xBracketPos, yBracketPos, coolingCenterPosZ);
179 GeoTrf::RotateZ3D rotBracket(m_bracketPhiOffset);
180 skiAux->add(new GeoTransform(GeoTrf::Transform3D(posBracket*rotBracket)));
181 skiAux->add(m_bracket->getVolume());
182 }
183
184 // Position the harness
185 if(m_harness != nullptr) {
186 GeoTrf::Translation3D posHarness(xHarnessPos, yHarnessPos, 0);
187 GeoTrf::RotateZ3D rotHarness(m_powerTapePhiOffset);
188 skiAux->add(new GeoTransform(GeoTrf::Transform3D(posHarness*rotHarness)));
189 skiAux->add(m_harness->getVolume());
190 }
191
192 //
193 // Position the power tapes
194 //
195 GeoTrf::Translation3D posTape(xTapePos, yTapePos, 0);
196 GeoTrf::RotateZ3D rotTape(m_powerTapePhiOffset);
197
198 skiAux->add(new GeoTransform(GeoTrf::Transform3D(posTape*rotTape)));
199 skiAux->add(m_skiPowerTape->getVolume());
200
201
202 // return the volume pointer of the top volume
203 return skiAux;
204
205}
206
207void
208calcMinMaxRatioS(double xCenter, double yCenter,
209 double xWidth, double yWidth,
210 double & minRatio, double & maxRatio)
211{
212 // Returns minRatio and maxRatio
213
214 // This function assumes x is always positive.
215 double x = 0.5 * xWidth;
216 double y = 0.5 * yWidth;
217
218 double r00,r01,r10,r11;
219
220 r11 = (yCenter + y) / (xCenter + x);
221 r00 = (yCenter - y) / (xCenter - x);
222 r10 = (yCenter + y) / (xCenter - x);
223 r01 = (yCenter - y) / (xCenter + x);
224
225 minRatio = std::min(r11 , std::min(r00, std::min(r10, r01)));
226 maxRatio = std::max(r11 , std::max(r00, std::max(r10, r01)));
227
228}
#define sqr(t)
void calcMinMaxRatioS(double xCenter, double yCenter, double xWidth, double yWidth, double &minRatio, double &maxRatio)
#define y
#define x
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated SCT in...
const std::string & getName() const
SCT_MaterialManager * m_materials
SCT_SharedComponentFactory(const std::string &name, InDetDD::SCT_DetectorManager *detectorManager, SCT_GeometryManager *geometryManager, SCT_MaterialManager *materials=nullptr)
double m_bracketPhiOffset
Definition SCT_SkiAux.h:65
SCT_Harness * m_harness
Definition SCT_SkiAux.h:73
SCT_SkiPowerTape * m_skiPowerTape
Definition SCT_SkiAux.h:74
double m_length
Definition SCT_SkiAux.h:64
const SCT_SkiPowerTape * skiPowerTape() const
Definition SCT_SkiAux.h:54
SCT_Bracket * m_bracket
Definition SCT_SkiAux.h:72
double m_sectorStartAngle
Definition SCT_SkiAux.h:67
double powerTapePhiOffset() const
Definition SCT_SkiAux.h:47
SCT_Ski * m_ski
Definition SCT_SkiAux.h:71
double m_powerTapePhiOffset
Definition SCT_SkiAux.h:66
double m_innerRadius
Definition SCT_SkiAux.h:62
virtual GeoVPhysVol * build()
void getParameters()
const SCT_Ski * ski() const
Definition SCT_SkiAux.h:51
SCT_SkiAux(const std::string &name, SCT_Ski *ski, SCT_Bracket *bracket, SCT_Harness *harness, SCT_SkiPowerTape *skiPowerTape, double innerRadius, double bracketPhiOffset, double powerTapePhiOffset, double divisionAngle, InDetDD::SCT_DetectorManager *detectorManager, SCT_GeometryManager *geometryManager, SCT_MaterialManager *materials)
double m_sectorAngle
Definition SCT_SkiAux.h:68
const SCT_Harness * harness() const
Definition SCT_SkiAux.h:53
double m_outerRadius
Definition SCT_SkiAux.h:63
double innerRadius() const
Definition SCT_SkiAux.h:40
double bracketPhiOffset() const
Definition SCT_SkiAux.h:46
const SCT_Bracket * bracket() const
Definition SCT_SkiAux.h:52