48{
49
50 msg(MSG::DEBUG) <<
"Building SCT Service Material" <<
endmsg;
51
52 DecodeVersionKey atlasVersionKey(
geoDbTagSvc(),
"ATLAS");
53 DecodeVersionKey indetVersionKey(
geoDbTagSvc(),
"InnerDetector");
54 DecodeVersionKey sctVersionKey(
geoDbTagSvc(),
"SCT");
55
56 std::string railversion =
rdbAccessSvc()->
getChildTag(
"IDDetailedRail",indetVersionKey.tag(),indetVersionKey.node());
57 if(!railversion.empty()) {
58
59
60
67
68
69
74
75
76
77 double outROfIDet = (*atls)[0]->getDouble("IDETOR")*Gaudi::Units::cm;
78 double endZOfIDet = (*atls)[0]->getDouble("IDETZMX")*Gaudi::Units::cm;
79
80
81 double minRofGap = 1089.0*Gaudi::Units::mm;
82 double phiWid=(70.*Gaudi::Units::mm)/outROfIDet;
83
84 double safetyGap=1.*Gaudi::Units::mm;
85
86
87
88 double rminInt = (*cage)[0]->getDouble("RINGRMIN");
89
91 if(commonParameters->
size()==0)
93
94 double yWidthUSP1 = (*commonParameters)[0]->getDouble("YWIDTHUSP1");
95 double yRailSup = (*commonParameters)[0]->getDouble("YRAILSUP");
96 double yRailSupPart3 = (*commonParameters)[0]->getDouble("YRAILSUPPART3");
97 double gapOfRSF = (*commonParameters)[0]->getDouble("GAPOFRSF");
98 double yWidthTRSB = (*commonParameters)[0]->getDouble("YWIDTHTRSB");
99
100 double coordY = yWidthUSP1/2. - yRailSup + (yRailSupPart3 - gapOfRSF/2.);
101
102 double phiTop = asin((yWidthTRSB + coordY) / (rminInt));
103 double phiBot = asin((yWidthTRSB/2. - coordY) / (rminInt));
104
105 GeoIntrusivePtr<const GeoShape> railGap1{new GeoTubs( rminInt, outROfIDet+safetyGap ,endZOfIDet+safetyGap ,
106 -phiBot, phiBot + phiTop)};
107 GeoIntrusivePtr<const GeoShape> railGap2{new GeoTubs( rminInt, outROfIDet+safetyGap ,endZOfIDet+safetyGap ,
108 -phiTop +
M_PI, phiBot + phiTop)};
109 GeoIntrusivePtr<const GeoShape> railGap12{new GeoTubs( rminInt, outROfIDet+safetyGap ,endZOfIDet+safetyGap ,
110 -phiTop, phiBot + phiTop)};
111
112
113
114 std::string NameOfService;
115 for (
unsigned int ii =0; ii < sctGenServices->
size(); ii++) {
116
117 NameOfService = (*sctGenServices)[ii]->getString("NAME");
118 InDetDD::GenericTubeMaker tubeHelper((*sctGenServices)[ii]);
119
120 const GeoShape * serviceTubeTmp = tubeHelper.buildShape();
121
122 std::string logName = tubeHelper.name();
123 if (logName.empty()) {
124 std::ostringstream o; o << ii;
125 logName = "ServMat"+o.str();
126 }
127 logName = "Sct" + logName;
128
129 double volumeCut = 0;
130 const GeoShape* serviceTube = serviceTubeTmp;
131 const GeoShape* serviceTube2 = serviceTubeTmp;
132 if( tubeHelper.volData().maxRadius() > minRofGap && tubeHelper.volData().phiStart()*Gaudi::Units::radian < phiTop) {
133
134 if (NameOfService == "PPB1EFEG" || NameOfService == "CableTrayEFEG")
135 {
136 serviceTube = (GeoShape*) & (*serviceTubeTmp).subtract(*railGap1);
137 serviceTube2 = (GeoShape*) & (*serviceTubeTmp).subtract(*railGap12);
138 }
139 else
140 serviceTube = (GeoShape*) & (*serviceTubeTmp).subtract(*railGap2).subtract(*railGap1);
141
142
143
144
146 double rminCut = std::max(minRofGap, tubeHelper.volData().rmin());
147 double rmaxCut = tubeHelper.volData().maxRadius();
148 volumeCut = 0.5*phiWid*(rmaxCut+rminCut)*(rmaxCut-rminCut) * tubeHelper.volData().length();
150 }
151 }
152
153 std::string materialName = tubeHelper.materialName();
154
155
156
157
158
159 const GeoMaterial* material =
m_materialManager->getMaterialForVolume(materialName, serviceTubeTmp->volume()-volumeCut);
160
161 const GeoLogVol* servLog = new GeoLogVol(logName,serviceTube,material);
162 GeoVPhysVol* servPhys = new GeoPhysVol(servLog);
163
164 if (NameOfService == "PPB1EFEG" || NameOfService == "CableTrayEFEG")
165 {
166 const GeoLogVol* serv2Log = new GeoLogVol(logName,serviceTube2,material);
167 GeoVPhysVol* serv2Phys = new GeoPhysVol(serv2Log);
168
169 GeoTrf::TranslateZ3D trans(tubeHelper.volData().zMid());
170 GeoTrf::TranslateZ3D trans2(-tubeHelper.volData().zMid());
171
172 GeoTransform * xform1 = new GeoTransform(trans);
173 GeoTransform * xform1Neg = new GeoTransform(trans2);
174 GeoTransform * xform2 = new GeoTransform(GeoTrf::RotateZ3D(180*Gaudi::Units::deg)*trans);
175 GeoTransform * xform2Neg = new GeoTransform(GeoTrf::RotateZ3D(180*Gaudi::Units::deg)*trans2);
176
177
178
179 mother->add(xform1); mother->add(servPhys); mother->add(xform1Neg); mother->add(servPhys);
180 mother->add(xform2); mother->add(serv2Phys); mother->add(xform2Neg); mother->add(serv2Phys);
181 }
182 else
183 tubeHelper.placeVolume(mother, servPhys);
184
185 }
186
187
188
189
190
191
192
193 {
194 double RMinW, RMaxW, ZHalfLengthW, ZStartW, WidI, WidO, DPhi;
195 std::string matName,logName;
196
197 std::string NameOfMaterial;
198
199 for (
unsigned int ii =0; ii < sctsup->
size(); ii++) {
200
201 RMinW = (*sctsup)[ii]->getFloat("RMIN")*Gaudi::Units::mm;
202 RMaxW = (*sctsup)[ii]->getFloat("RMAX")*Gaudi::Units::mm;
203 ZHalfLengthW = (*sctsup)[ii]->getFloat("THICK")/2.*Gaudi::Units::mm;
204 WidI = (*sctsup)[ii]->getFloat("WIDTHINNER")*Gaudi::Units::mm;
205 WidO = (*sctsup)[ii]->getFloat("WIDTHOUTER")*Gaudi::Units::mm;
206 ZStartW = (*sctsup)[ii]->getFloat("ZSTART")*Gaudi::Units::mm;
207 NameOfMaterial = (*sctsup)[ii]->getString("MATERIAL");
208 DPhi = asin(WidI/2./RMinW);
209
210 if (NameOfMaterial != "sct::FwdMechanism")
211 {
212 const GeoShape* pTub1 = new GeoTubs(RMinW, RMaxW, ZHalfLengthW, 0.-DPhi, 2.*DPhi);
213 const GeoShape* wing = pTub1;
214
215 double wingVolume = -1;
216 if (WidI > WidO) {
217 double H1=sqrt(RMinW*RMinW - WidI*WidI/4.);
218 double H2=sqrt(RMaxW*RMaxW - WidO*WidO/4.);
219 double Shift = H1 + (
H2-H1)*WidI/(WidI-WidO);
220 double RMaxDop = sqrt(WidI*WidI/4. + (
Shift-H1)*(
Shift-H1));
221
222 double DPhiDop =
atan(WidI/2./(
Shift-H1));
223 const GeoShape* pTub2 =
new GeoTubs(0., RMaxDop, ZHalfLengthW,
M_PI-DPhiDop, 2.*DPhiDop);
224 const GeoShape* pTub3 = (GeoShape*) & ((*pTub2) << GeoTrf::TranslateX3D(
Shift));
225 wing = (GeoShape*) & (*pTub1).intersect(*pTub3);
226
227
228
229 double trapArea = 0.5 * (
H2-H1)*(WidI+WidO);
230 double upperSeg =
atan(0.5*WidO/
H2)*RMaxW*RMaxW - 0.5*
H2*WidO;
231 double lowerSeg =
atan(0.5*WidI/H1)*RMinW*RMinW - 0.5*H1*WidI;
232 wingVolume = (trapArea + upperSeg - lowerSeg) * 2 * ZHalfLengthW;
233
234 }
235
236 matName = (*sctsup)[ii]->getString("MATERIAL");
237 logName = "SctSupportGeneral";
238 std::string newMatName;
239 std::ostringstream o; o << ii;
240 if(matName.find("rWing") != std::string::npos) logName="FwdRearWing";
241 if(matName.find("tWing") != std::string::npos) logName="FwdFrontWing";
242 if(matName.find("Mech") != std::string::npos) {
243 logName="FwdMechanism"+o.str();
244 newMatName = matName + o.str();
245 }
246
247 if (wingVolume < 0) wingVolume = wing->volume();
248
249
250
251 const GeoMaterial* wingMat =
m_materialManager->getMaterialForVolume(matName, wingVolume, newMatName);
252
253
254
255 const GeoLogVol* wingLog = new GeoLogVol(logName,wing,wingMat);
256 GeoVPhysVol* wingPhys = new GeoPhysVol(wingLog);
257 GeoTransform* wPos1 = new GeoTransform(GeoTrf::Translate3D(0.,0., ZStartW+ZHalfLengthW));
258 GeoTransform* wPos2 =
new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(-
M_PI,0,0),GeoTrf::Vector3D(0.,0., ZStartW+ZHalfLengthW)));
259 GeoTransform* wPos3 = new GeoTransform(GeoTrf::Translate3D(0.,0.,-ZStartW-ZHalfLengthW));
260 GeoTransform* wPos4 =
new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(-
M_PI,0,0),GeoTrf::Vector3D(0.,0.,-ZStartW-ZHalfLengthW)));
261 mother->add(wPos1);
262 mother->add(wingPhys);
263 mother->add(wPos2);
264 mother->add(wingPhys);
265 mother->add(wPos3);
266 mother->add(wingPhys);
267 mother->add(wPos4);
268 mother->add(wingPhys);
269 }
270 }
271 }
272 }
273 else {
274
275
281
282
283
287
288
289
290 double outROfIDet = (*atls)[0]->getDouble("IDETOR")*Gaudi::Units::cm;
291 double endZOfIDet = (*atls)[0]->getDouble("IDETZMX")*Gaudi::Units::cm;
292
293
294 double minRofGap = 1089.0*Gaudi::Units::mm;
295 double phiWid=(70.*Gaudi::Units::mm)/outROfIDet;
296
297 double safetyGap=1.*Gaudi::Units::mm;
298 GeoIntrusivePtr<const GeoShape> railGap1{new GeoTubs( minRofGap, outROfIDet+safetyGap ,endZOfIDet+safetyGap ,
299 -phiWid/2.,phiWid)};
300 GeoIntrusivePtr<const GeoShape> railGap2{new GeoTubs( minRofGap, outROfIDet+safetyGap ,endZOfIDet+safetyGap ,
301 -phiWid/2.+
M_PI,phiWid)};
302
303
304
305
306 for (
unsigned int ii =0; ii < sctGenServices->
size(); ii++) {
307
308 InDetDD::GenericTubeMaker tubeHelper((*sctGenServices)[ii]);
309 const GeoShape * serviceTubeTmp = tubeHelper.buildShape();
310
311 std::string logName = tubeHelper.name();
312 if (logName.empty()) {
313 std::ostringstream o; o << ii;
314 logName = "ServMat"+o.str();
315 }
316 logName = "Sct" + logName;
317
318 double volumeCut = 0;
319 const GeoShape* serviceTube = serviceTubeTmp;
320 if( tubeHelper.volData().maxRadius() > minRofGap && tubeHelper.volData().phiStart() < phiWid/2.) {
321
322 serviceTube = (GeoShape*) & (*serviceTubeTmp).subtract(*railGap2).subtract(*railGap1);
323
324
325
326
328 double rminCut = std::max(minRofGap, tubeHelper.volData().rmin());
329 double rmaxCut = tubeHelper.volData().maxRadius();
330 volumeCut = 0.5*phiWid*(rmaxCut+rminCut)*(rmaxCut-rminCut) * tubeHelper.volData().length();
332 }
333 }
334
335 std::string materialName = tubeHelper.materialName();
336
337
338
339
340
342
343 const GeoLogVol* servLog = new GeoLogVol(logName,serviceTube,material);
344 GeoVPhysVol* servPhys = new GeoPhysVol(servLog);
345
346 tubeHelper.placeVolume(mother, servPhys);
347
348 }
349
350
351 {
352 double RMinW, RMaxW, ZHalfLengthW, ZStartW, WidI, WidO, DPhi;
353 std::string matName,logName;
354
355 for (
unsigned int ii =0; ii < sctsup->
size(); ii++) {
356
357 RMinW = (*sctsup)[ii]->getFloat("RMIN")*Gaudi::Units::mm;
358 RMaxW = (*sctsup)[ii]->getFloat("RMAX")*Gaudi::Units::mm;
359 ZHalfLengthW = (*sctsup)[ii]->getFloat("THICK")/2.*Gaudi::Units::mm;
360 WidI = (*sctsup)[ii]->getFloat("WIDTHINNER")*Gaudi::Units::mm;
361 WidO = (*sctsup)[ii]->getFloat("WIDTHOUTER")*Gaudi::Units::mm;
362 ZStartW = (*sctsup)[ii]->getFloat("ZSTART")*Gaudi::Units::mm;
363 DPhi = asin(WidI/2./RMinW);
364
365 const GeoShape* pTub1 = new GeoTubs(RMinW, RMaxW, ZHalfLengthW, 0.-DPhi, 2.*DPhi);
366 const GeoShape* wing = pTub1;
367
368 double wingVolume = -1;
369 if (WidI > WidO) {
370 double H1=sqrt(RMinW*RMinW - WidI*WidI/4.);
371 double H2=sqrt(RMaxW*RMaxW - WidO*WidO/4.);
372 double Shift = H1 + (
H2-H1)*WidI/(WidI-WidO);
373 double RMaxDop = sqrt(WidI*WidI/4. + (
Shift-H1)*(
Shift-H1));
374
375 double DPhiDop =
atan(WidI/2./(
Shift-H1));
376 const GeoShape* pTub2 =
new GeoTubs(0., RMaxDop, ZHalfLengthW,
M_PI-DPhiDop, 2.*DPhiDop);
377 const GeoShape* pTub3 = (GeoShape*) & ((*pTub2) << GeoTrf::TranslateX3D(
Shift));
378 wing = (GeoShape*) & (*pTub1).intersect(*pTub3);
379
380
381
382 double trapArea = 0.5 * (
H2-H1)*(WidI+WidO);
383 double upperSeg =
atan(0.5*WidO/
H2)*RMaxW*RMaxW - 0.5*
H2*WidO;
384 double lowerSeg =
atan(0.5*WidI/H1)*RMinW*RMinW - 0.5*H1*WidI;
385 wingVolume = (trapArea + upperSeg - lowerSeg) * 2 * ZHalfLengthW;
386
387 }
388
389 matName = (*sctsup)[ii]->getString("MATERIAL");
390 logName = "SctSupportGeneral";
391 std::string newMatName;
392 std::ostringstream o; o << ii;
393 if(matName.find("rWing") != std::string::npos) logName="FwdRearWing";
394 if(matName.find("tWing") != std::string::npos) logName="FwdFrontWing";
395 if(matName.find("Mech") != std::string::npos) {
396 logName="FwdMechanism"+o.str();
397 newMatName = matName + o.str();
398 }
399
400 if (wingVolume < 0) wingVolume = wing->volume();
401
402
403
405
406
407
408 const GeoLogVol* wingLog = new GeoLogVol(logName,wing,wingMat);
409 GeoVPhysVol* wingPhys = new GeoPhysVol(wingLog);
410 GeoTransform* wPos1 = new GeoTransform(GeoTrf::Translate3D(0.,0., ZStartW+ZHalfLengthW));
411 GeoTransform* wPos2 =
new GeoTransform(GeoTrf::Transform3D(GeoTrf::Translation3D(0.,0., ZStartW+ZHalfLengthW)*GeoTrf::RotateX3D(
M_PI)));
412 GeoTransform* wPos3 = new GeoTransform(GeoTrf::Translate3D(0.,0.,-ZStartW-ZHalfLengthW));
413 GeoTransform* wPos4 =
new GeoTransform(GeoTrf::Transform3D(GeoTrf::Translation3D(0.,0.,-ZStartW-ZHalfLengthW)*GeoTrf::RotateX3D(
M_PI)));
414 mother->add(wPos1);
415 mother->add(wingPhys);
416 mother->add(wPos2);
417 mother->add(wingPhys);
418 mother->add(wPos3);
419 mother->add(wingPhys);
420 mother->add(wPos4);
421 mother->add(wingPhys);
422 }
423 }
424 }
425}
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
virtual std::string getChildTag(const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName="ATLASDD")=0
Gets the tag name for the node by giving its parent node tag.
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
virtual unsigned int size() const =0
InDetMaterialManager * materialManager()
const IGeoDbTagSvc * geoDbTagSvc() const
InDetMaterialManager * m_materialManager
IRDBAccessSvc * rdbAccessSvc()
InDetDD::AthenaComps * getAthenaComps()
std::unique_ptr< InDetMaterialManager > m_materialManagerUnique
const GeoMaterial * getMaterialForVolume(const std::string &materialName, double volume, const std::string &newName="")
Create and get material with a density calculated to give weight in predefined weight table.