51 std::string railversion =
rdbAccessSvc()->
getChildTag(
"IDDetailedRail",indetVersionKey.tag(),indetVersionKey.node());
52 if(!railversion.empty()) {
62 std::string sqversionStr =
rdbAccessSvc()->
getChildTag(
"SquirrelCage", indetVersionKey.tag(), indetVersionKey.node());
63 size_t pos = sqversionStr.find(
'-');
65 if (
pos != std::string::npos &&
pos+1 != sqversionStr.size()) {
66 std::istringstream tmpStr(sqversionStr.substr(
pos+1));
108 double zposSupRing = zposFirstRing+ringWid*5. + zposGap1 + zposGap2 + zposGap3 + zposGap4;
115 if(commonParameters->size()==0)
119 double yRailSup = (*commonParameters)[0]->getDouble(
"YRAILSUP");
120 double yRailSupPart3 = (*commonParameters)[0]->getDouble(
"YRAILSUPPART3");
121 double gapOfRSF = (*commonParameters)[0]->getDouble(
"GAPOFRSF");
137 double bUSS = 0.;
double eUSS = 0.;
138 for (
unsigned int i = 0;
i < sctGenServices->size();
i++)
140 if ((*sctGenServices)[
i]->getString(
"NAME") ==
"HSP")
142 bUSS = (*sctGenServices)[
i]->getDouble(
"ZMAX");
144 if ((*sctGenServices)[
i]->getString(
"NAME") ==
"FwdRadialServ")
146 eUSS = (*sctGenServices)[
i]->getDouble(
"ZMIN");
150 double zLengthUS = eUSS - bUSS;
152 std::unique_ptr<IRDBQuery> queryUSP =
rdbAccessSvc()->
getQuery(
"IDDetRailUSP",indetVersionKey.tag(), indetVersionKey.node());
160 double xDepthUSP1 = queryUSP->
data<
double>(
"IDDETRAILUSP_DATA.XDEPTH");
161 double yWidthUSP1 = queryUSP->
data<
double>(
"IDDETRAILUSP_DATA.YWIDTH");
164 double xDepthUSP2 = queryUSP->
data<
double>(
"IDDETRAILUSP_DATA.XDEPTH");
165 double yWidthUSP2 = queryUSP->
data<
double>(
"IDDETRAILUSP_DATA.YWIDTH");
168 double xDepthUSP3 = queryUSP->
data<
double>(
"IDDETRAILUSP_DATA.XDEPTH");
169 double yWidthUSP3 = queryUSP->
data<
double>(
"IDDETRAILUSP_DATA.YWIDTH");
174 GeoBox* UShapePart1 =
new GeoBox(xDepthUSP1/2., yWidthUSP1/2., zLengthUS/2.);
175 GeoBox* UShapePart2 =
new GeoBox(xDepthUSP2/2., yWidthUSP2/2., zLengthUS/2.);
176 GeoBox* UShapePart3 =
new GeoBox(xDepthUSP3/2., yWidthUSP3/2., zLengthUS/2.);
178 GeoTrf::Vector3D trans1UShapeP2(xDepthUSP2/2. - xDepthUSP1/2., yWidthUSP1/2. + yWidthUSP2/2., 0.);
179 GeoTrf::Vector3D trans2UShapeP2(- xDepthUSP2/2. + xDepthUSP1/2., yWidthUSP1/2. + yWidthUSP2/2., 0.);
181 GeoTrf::Vector3D trans1UShapeP3(xDepthUSP3/2. - xDepthUSP1/2., - yWidthUSP1/2. - yWidthUSP3/2., 0.);
182 GeoTrf::Vector3D trans2UShapeP3(- xDepthUSP3/2. + xDepthUSP1/2., - yWidthUSP1/2. - yWidthUSP3/2., 0.);
186 double coordY = yWidthUSP1/2. - yRailSup + (yRailSupPart3 - gapOfRSF/2.);
189 const GeoLogVol* UShapeLP1 =
new GeoLogVol(
"UShapeSupport1", UShapePart1, ringMat);
190 const GeoLogVol* UShapeLP2 =
new GeoLogVol(
"UShapeSupport2", UShapePart2, ringMat);
191 const GeoLogVol* UShapeLP3 =
new GeoLogVol(
"UShapeSupport3", UShapePart3, ringMat);
194 GeoVPhysVol* UShapePP1 =
new GeoPhysVol(UShapeLP1);
195 GeoVPhysVol* UShapePP2 =
new GeoPhysVol(UShapeLP2);
196 GeoVPhysVol* UShapePP3 =
new GeoPhysVol(UShapeLP3);
201 double phiICRT = asin((yWidthUSP1/2. + yWidthUSP2 + coordY) / rminInt);
204 double phiICRB = asin((yWidthUSP1/2. + yWidthUSP2 - coordY) / rminInt);
207 GeoTubs* ICRT =
new GeoTubs(rminInt, rminInt + ringThick, ringWid/2., phiICRT, DphiICRT);
209 GeoTubs* ICRB =
new GeoTubs(rminInt, rminInt + ringThick, ringWid/2.,
Gaudi::Units::pi + phiICRB, DphiICRB);
212 const GeoLogVol* ICRTLog =
new GeoLogVol(
"SQringIntTop", ICRT, ringMat);
213 GeoVPhysVol* ICRTPhys =
new GeoPhysVol(ICRTLog);
215 const GeoLogVol* ICRBLog =
new GeoLogVol(
"SQringIntBottom", ICRB, ringMat);
216 GeoVPhysVol* ICRBPhys =
new GeoPhysVol(ICRBLog);
220 double phiECRT = asin((yWidthUSP1/2. + yWidthUSP2 + coordY) / (rminInt+ringGap+ringThick));
223 double phiECRB = asin((yWidthUSP1/2. + yWidthUSP2 - coordY) / (rminInt+ringGap+ringThick));
231 GeoTubs* ECRT =
new GeoTubs(rminInt+ringGap+ringThick, rminInt+2.*ringThick+ringGap, ringWid/2., phiECRT, DphiECRT);
232 GeoTubs* ECRB =
new GeoTubs(rminInt+ringGap+ringThick, rminInt+2.*ringThick+ringGap, ringWid/2.,
Gaudi::Units::pi + phiECRB, DphiECRB);
234 const GeoLogVol* ECRTLog =
new GeoLogVol(
"SQringExtTop", ECRT, ringMat);
235 GeoVPhysVol* ECRTPhys =
new GeoPhysVol(ECRTLog);
237 const GeoLogVol* ECRBLog =
new GeoLogVol(
"SQringExtBottom", ECRB, ringMat);
238 GeoVPhysVol* ECRBPhys =
new GeoPhysVol(ECRBLog);
241 GeoTube* ringSup =
new GeoTube( rminSup, rminSup+supThick, supWid/2.);
243 const GeoLogVol* ringLogSup =
new GeoLogVol(
"SQringSup",ringSup,ringMat);
244 GeoVPhysVol* ringPhysSup =
new GeoPhysVol(ringLogSup);
249 GeoTrf::Translate3D servpos1(0.,0., zposFirstRing+ringWid/2.);
250 GeoTrf::Translate3D servpos2(0.,0.,-zposFirstRing-ringWid/2.);
251 GeoTrf::Translate3D servpos3(0.,0., zposFirstRing+ringWid*3./2. + zposGap1);
252 GeoTrf::Translate3D servpos4(0.,0.,-zposFirstRing-ringWid*3./2. - zposGap1);
253 GeoTrf::Translate3D servpos5(0.,0., zposFirstRing+ringWid*5./2. + zposGap1 + zposGap2);
254 GeoTrf::Translate3D servpos6(0.,0.,-zposFirstRing-ringWid*5./2. - zposGap1 - zposGap2);
255 GeoTrf::Translate3D servpos7(0.,0., zposFirstRing+ringWid*7./2. + zposGap1 + zposGap2 + zposGap3);
256 GeoTrf::Translate3D servpos8(0.,0.,-zposFirstRing-ringWid*7./2. - zposGap1 - zposGap2 - zposGap3);
257 GeoTrf::Translate3D servpos9(0.,0., zposFirstRing+ringWid*9./2. + zposGap1 + zposGap2 + zposGap3 + zposGap4);
258 GeoTrf::Translate3D servpos10(0.,0.,-zposFirstRing-ringWid*9./2. - zposGap1 - zposGap2 - zposGap3 - zposGap4);
259 GeoTransform *xform1 =
new GeoTransform(servpos1);
260 GeoTransform *xform2 =
new GeoTransform(servpos2);
261 GeoTransform *xform3 =
new GeoTransform(servpos3);
262 GeoTransform *xform4 =
new GeoTransform(servpos4);
263 GeoTransform *xform5 =
new GeoTransform(servpos5);
264 GeoTransform *xform6 =
new GeoTransform(servpos6);
265 GeoTransform *xform7 =
new GeoTransform(servpos7);
266 GeoTransform *xform8 =
new GeoTransform(servpos8);
267 GeoTransform *xform9 =
new GeoTransform(servpos9);
268 GeoTransform *xform10 =
new GeoTransform(servpos10);
270 mother->add(xform1); mother->add(ICRTPhys); mother->add(xform1); mother->add(ECRTPhys);
271 mother->add(xform2); mother->add(ICRTPhys); mother->add(xform2); mother->add(ECRTPhys);
272 mother->add(xform3); mother->add(ICRTPhys); mother->add(xform3); mother->add(ECRTPhys);
273 mother->add(xform4); mother->add(ICRTPhys); mother->add(xform4); mother->add(ECRTPhys);
274 mother->add(xform5); mother->add(ICRTPhys); mother->add(xform5); mother->add(ECRTPhys);
275 mother->add(xform6); mother->add(ICRTPhys); mother->add(xform6); mother->add(ECRTPhys);
276 mother->add(xform7); mother->add(ICRTPhys); mother->add(xform7); mother->add(ECRTPhys);
277 mother->add(xform8); mother->add(ICRTPhys); mother->add(xform8); mother->add(ECRTPhys);
278 mother->add(xform9); mother->add(ICRTPhys); mother->add(xform9); mother->add(ECRTPhys);
279 mother->add(xform10); mother->add(ICRTPhys); mother->add(xform10); mother->add(ECRTPhys);
281 mother->add(xform1); mother->add(ICRBPhys); mother->add(xform1); mother->add(ECRBPhys);
282 mother->add(xform2); mother->add(ICRBPhys); mother->add(xform2); mother->add(ECRBPhys);
283 mother->add(xform3); mother->add(ICRBPhys); mother->add(xform3); mother->add(ECRBPhys);
284 mother->add(xform4); mother->add(ICRBPhys); mother->add(xform4); mother->add(ECRBPhys);
285 mother->add(xform5); mother->add(ICRBPhys); mother->add(xform5); mother->add(ECRBPhys);
286 mother->add(xform6); mother->add(ICRBPhys); mother->add(xform6); mother->add(ECRBPhys);
287 mother->add(xform7); mother->add(ICRBPhys); mother->add(xform7); mother->add(ECRBPhys);
288 mother->add(xform8); mother->add(ICRBPhys); mother->add(xform8); mother->add(ECRBPhys);
289 mother->add(xform9); mother->add(ICRBPhys); mother->add(xform9); mother->add(ECRBPhys);
290 mother->add(xform10); mother->add(ICRBPhys); mother->add(xform10); mother->add(ECRBPhys);
296 GeoTransform* transUSS{
nullptr};
299 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
300 mother->add(transUSS); mother->add(UShapePP1);
301 tmpVec = USSupCoordX +
GeoTrf::Vector3D(0, coordY, bUSS + zLengthUS/2.) + trans1UShapeP2;
302 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
303 mother->add(transUSS); mother->add(UShapePP2);
304 tmpVec = USSupCoordX +
GeoTrf::Vector3D(0, coordY, bUSS + zLengthUS/2.) + trans1UShapeP3 ;
305 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
306 mother->add(transUSS); mother->add(UShapePP3);
309 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
310 mother->add(transUSS); mother->add(UShapePP1);
311 tmpVec = -USSupCoordX +
GeoTrf::Vector3D(0, coordY, bUSS + zLengthUS/2.) + trans2UShapeP2;
312 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
313 mother->add(transUSS); mother->add(UShapePP2);
314 tmpVec = -USSupCoordX +
GeoTrf::Vector3D(0, coordY, bUSS + zLengthUS/2.) + trans2UShapeP3;
315 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
316 mother->add(transUSS); mother->add(UShapePP3);
319 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
320 mother->add(transUSS); mother->add(UShapePP1);
321 tmpVec = USSupCoordX -
GeoTrf::Vector3D(0, - coordY, bUSS + zLengthUS/2.) + trans1UShapeP2;
322 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
323 mother->add(transUSS); mother->add(UShapePP2);
324 tmpVec = USSupCoordX -
GeoTrf::Vector3D(0, - coordY, bUSS + zLengthUS/2.) + trans1UShapeP3;
325 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
326 mother->add(transUSS); mother->add(UShapePP3);
328 tmpVec = - USSupCoordX -
GeoTrf::Vector3D(0, - coordY, bUSS + zLengthUS/2.);
329 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
330 mother->add(transUSS); mother->add(UShapePP1);
331 tmpVec = - USSupCoordX -
GeoTrf::Vector3D(0, - coordY, bUSS + zLengthUS/2.) + trans2UShapeP2;
332 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
333 mother->add(transUSS); mother->add(UShapePP2);
334 tmpVec = - USSupCoordX -
GeoTrf::Vector3D(0, - coordY, bUSS + zLengthUS/2.) + trans2UShapeP3;
335 transUSS =
new GeoTransform(GeoTrf::Translate3D(tmpVec.x(),tmpVec.y(),tmpVec.z()));
336 mother->add(transUSS); mother->add(UShapePP3);
342 GeoTrf::Translate3D suppos1(0.,0., zposSupRing+supWid/2.);
344 GeoTransform *sform1 =
new GeoTransform(suppos1);
345 GeoTransform *sform2 =
new GeoTransform(GeoTrf::GeoTransformRT(GeoTrf::GeoRotation(0,-
M_PI,0),suppos2));
347 mother->add(ringPhysSup);
349 mother->add(ringPhysSup);
358 std::string sqversionStr =
rdbAccessSvc()->
getChildTag(
"SquirrelCage", indetVersionKey.tag(), indetVersionKey.node());
359 size_t pos = sqversionStr.find(
'-');
361 if (
pos != std::string::npos &&
pos+1 != sqversionStr.size()) {
362 std::istringstream tmpStr(sqversionStr.substr(
pos+1));
404 double zposSupRing = zposFirstRing+ringWid*5. + zposGap1 + zposGap2 + zposGap3 + zposGap4;
409 double ribLeng = ringWid*5. + zposGap1 + zposGap2 + zposGap3 + zposGap4;
411 if (sqversion >= 3) ribThick = (*cage)[0]->getDouble(
"RIBTHICK")*
Gaudi::Units::mm;
413 double ribThickMax = ringGap - 2*safety;
414 if (ribThick == 0 || ribThick > ribThickMax) {
415 ribThick = ribThickMax;
417 double rmidRib = rminInt+ringThick+0.5*ringGap;
419 GeoTube* ringInt =
new GeoTube( rminInt, rminInt+ringThick, ringWid/2.);
420 GeoTube* ringExt =
new GeoTube( rminInt+ringGap+ringThick, rminInt+2.*ringThick+ringGap, ringWid/2.);
421 GeoTube* ringSup =
new GeoTube( rminSup, rminSup+supThick, supWid/2.);
426 double phiWid=ribWid/(rminInt+ringThick+ringGap/2.);
429 GeoTubs* ribSup =
new GeoTubs( rmidRib-0.5*ribThick, rmidRib+0.5*ribThick,
430 ribLeng/2., -phiWid/2.,phiWid);
437 const GeoLogVol* ringLogInt =
new GeoLogVol(
"SQringInt",ringInt,ringMat);
438 const GeoLogVol* ringLogExt =
new GeoLogVol(
"SQringExt",ringExt,ringMat);
439 const GeoLogVol* ringLogSup =
new GeoLogVol(
"SQringSup",ringSup,ringMat);
440 const GeoLogVol* ribLogSup =
new GeoLogVol(
"SQribSup" ,ribSup ,ringMat);
441 GeoVPhysVol* ringPhysInt =
new GeoPhysVol(ringLogInt);
442 GeoVPhysVol* ringPhysExt =
new GeoPhysVol(ringLogExt);
443 GeoVPhysVol* ringPhysSup =
new GeoPhysVol(ringLogSup);
444 GeoVPhysVol* ribPhysSup =
new GeoPhysVol(ribLogSup);
446 GeoTrf::Translate3D servpos1(0.,0., zposFirstRing+ringWid/2.);
448 GeoTrf::Translate3D servpos3(0.,0., zposFirstRing+ringWid*3./2. + zposGap1);
450 GeoTrf::Translate3D servpos5(0.,0., zposFirstRing+ringWid*5./2. + zposGap1 + zposGap2);
452 GeoTrf::Translate3D servpos7(0.,0., zposFirstRing+ringWid*7./2. + zposGap1 + zposGap2 + zposGap3);
454 GeoTrf::Translate3D servpos9(0.,0., zposFirstRing+ringWid*9./2. + zposGap1 + zposGap2 + zposGap3 + zposGap4);
455 GeoTrf::Translation3D servpos10(0.,0.,-zposFirstRing-ringWid*9./2. - zposGap1 - zposGap2 - zposGap3 - zposGap4);
456 GeoTransform *xform1 =
new GeoTransform(servpos1);
458 GeoTransform *xform3 =
new GeoTransform(servpos3);
460 GeoTransform *xform5 =
new GeoTransform(servpos5);
462 GeoTransform *xform7 =
new GeoTransform(servpos7);
464 GeoTransform *xform9 =
new GeoTransform(servpos9);
467 mother->add(ringPhysInt);
469 mother->add(ringPhysExt);
471 mother->add(ringPhysInt);
473 mother->add(ringPhysExt);
475 mother->add(ringPhysInt);
477 mother->add(ringPhysExt);
479 mother->add(ringPhysInt);
481 mother->add(ringPhysExt);
483 mother->add(ringPhysInt);
485 mother->add(ringPhysExt);
487 mother->add(ringPhysInt);
489 mother->add(ringPhysExt);
491 mother->add(ringPhysInt);
493 mother->add(ringPhysExt);
495 mother->add(ringPhysInt);
497 mother->add(ringPhysExt);
499 mother->add(ringPhysInt);
501 mother->add(ringPhysExt);
502 mother->add(xform10);
503 mother->add(ringPhysInt);
504 mother->add(xform10);
505 mother->add(ringPhysExt);
509 GeoTrf::Translate3D suppos1(0.,0., zposSupRing+supWid/2.);
511 GeoTransform *sform1 =
new GeoTransform(suppos1);
514 mother->add(ringPhysSup);
516 mother->add(ringPhysSup);
521 GeoTrf::Translate3D ribpos1( 0., 0., zposFirstRing+ribLeng/2.);
522 GeoTrf::Translate3D ribpos2( 0., 0.,-zposFirstRing-ribLeng/2.);
523 GeoTransform *rform1 =
new GeoTransform(ribpos1);
524 GeoTransform *rform2 =
new GeoTransform(ribpos1*GeoTrf::RotateZ3D(
M_PI));
525 GeoTransform *rform3 =
new GeoTransform(ribpos2);
526 GeoTransform *rform4 =
new GeoTransform(ribpos2*GeoTrf::RotateZ3D(
M_PI));
530 mother->add(ribPhysSup);
532 mother->add(ribPhysSup);
534 mother->add(ribPhysSup);
536 mother->add(ribPhysSup);