13 #include "GeoModelKernel/GeoBox.h"
14 #include "GeoModelKernel/GeoTube.h"
15 #include "GeoModelKernel/GeoSimplePolygonBrep.h"
16 #include "GeoModelKernel/GeoLogVol.h"
17 #include "GeoModelKernel/GeoPhysVol.h"
18 #include "GeoModelKernel/GeoMaterial.h"
19 #include "GeoModelKernel/GeoNameTag.h"
21 #include "GeoModelKernel/GeoTransform.h"
22 #include "GaudiKernel/SystemOfUnits.h"
30 GeoModelIO::ReadGeoModel* sqliteReader,
31 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
32 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
37 , m_staveSupport(staveSupport)
38 , m_supportPhysA(nullptr)
39 , m_supportPhysC(nullptr)
40 , m_supportMidRing(nullptr)
41 , m_xformSupportA(nullptr)
42 , m_xformSupportC(nullptr)
43 , m_xformSupportMidRing(nullptr)
79 double dogLegStaveLength=17.87;
80 double halfSupportLength=endblockLength*0.5+dogLegStaveLength*0.5;
83 if((!endblockA) || (!endblockC) || (!endblockFlex) || (!serviceCoolPipe))
85 m_gmt_mgr->
msg(MSG::ERROR) <<
"dynamic_cast failure in "<<__FILE__<<
":"<< __LINE__<<
endmsg;
91 std::ostringstream lnameA;
92 lnameA <<
"Brl0A_StaveRing";
94 GeoNameTag *tagA =
new GeoNameTag(lnameA.str());
97 std::ostringstream lnameC;
98 lnameC <<
"Brl0C_StaveRing";
100 GeoNameTag *tagC =
new GeoNameTag(lnameC.str());
105 double zmin = serviceZpos-(endblockLength*0.5+dogLegStaveLength*0.5);
106 double zmax = serviceZpos+(endblockLength*0.5+dogLegStaveLength*0.5);
111 m_gmt_mgr->
msg(
MSG::DEBUG)<<
"Support assembly : "<<innerRadius<<
" "<<outerRadius<<
" ladderThickP "<<ladderHalfThickP<<
" "<<ladderHalfThickN<<
115 const GeoTube* supportShape =
new GeoTube(innerRadius,outerRadius,endblockLength*0.5+dogLegStaveLength*0.5);
117 GeoLogVol* supportLogVol_A =
new GeoLogVol(
"StaveRingAndEndblocks_A",supportShape,ether);
118 GeoLogVol* supportLogVol_C =
new GeoLogVol(
"StaveRingAndEndblocks_C",supportShape,ether);
127 m_gmt_mgr->
msg(MSG::ERROR)<<
"No phi sectors defined"<<std::endl;
132 GeoTrf::Transform3D transRadiusAndTilt = GeoTrf::TranslateX3D(layerRadius)*GeoTrf::RotateZ3D(ladderTilt);
141 GeoTrf::Transform3D staveTrf = GeoTrf::RotateZ3D(ladderTilt)*GeoTrf::Translate3D(-centerCoolingPipe.x(),-centerCoolingPipe.y(),-centerCoolingPipe.z());
144 transRadiusAndTilt = GeoTrf::TranslateX3D(staveRadius)*staveTrf;
147 for(
int ii = 0; ii < nSectors; ii++) {
150 double phiOfSector = phiOfModuleZero + ii*
angle;
153 GeoTrf::Transform3D ladderTransform = GeoTrf::RotateZ3D(phiOfSector) * transRadiusAndTilt ;
158 std::ostringstream nameTag;
159 nameTag <<
"Endblock" << ii;
160 GeoNameTag *
tag =
new GeoNameTag(nameTag.str());
161 GeoTransform* xformA =
new GeoTransform(ladderTransform*ladderLocalTrf*GeoTrf::TranslateZ3D(endblockZpos-serviceZpos-dogLegStaveLength*0.5));
166 GeoTransform* xformC =
new GeoTransform(ladderTransform*ladderLocalTrf*GeoTrf::TranslateZ3D(-endblockZpos+serviceZpos+dogLegStaveLength*0.5));
174 std::ostringstream nameTagFlex;
175 nameTagFlex <<
"EndblockFlex" << ii;
176 GeoNameTag * tagFlex =
new GeoNameTag(nameTagFlex.str());
177 GeoTransform* xformFlexA =
new GeoTransform(ladderTransform*ladderLocalTrf*(endblockFlexTrf->getTransform())*GeoTrf::TranslateZ3D(-dogLegStaveLength*0.5));
178 GeoTransform* xformFlexB =
new GeoTransform(ladderTransform*ladderLocalTrf*(endblockFlexTrf->getTransform())*GeoTrf::TranslateZ3D(dogLegStaveLength*0.5));
192 std::ostringstream nameTagPipe;
193 nameTagPipe <<
"ServicePipe" << ii;
194 GeoNameTag * tagPipe =
new GeoNameTag(nameTagPipe.str());
195 GeoTransform* xformPipeA =
new GeoTransform(ladderTransform*ladderLocalTrf*(serviceCoolPipeTrfA->getTransform())) ;
200 GeoTransform* xformPipeC =
new GeoTransform(ladderTransform*ladderLocalTrf*(serviceCoolPipeTrfC->getTransform()));
217 double eoStave=halfSupportLength-dogLegStaveLength;
227 double dimX=dimX_lin/
cos(alpha1)-.15;
232 double trX=-dimX_lin*
tan(alpha1)*0.5;
233 double trZ=eoStave+dimX_lin*0.5;
235 std::vector<double> xShape, yShape;
236 xShape.push_back(dimX*0.5); yShape.push_back(dimY*0.5);
237 xShape.push_back(-dimX*0.5); yShape.push_back(dimY*0.5+delta);
238 xShape.push_back(-dimX*0.5); yShape.push_back(-dimY*0.5+delta);
239 xShape.push_back(dimX*0.5); yShape.push_back(-dimY*0.5);
240 GeoSimplePolygonBrep* tmp_shape =
new GeoSimplePolygonBrep(dimZ*0.5);
241 for(
unsigned int iPt=0; iPt<xShape.size(); iPt++) tmp_shape->addVertex(xShape[iPt],yShape[iPt]);
247 GeoLogVol* tmp_logVol =
new GeoLogVol(
"FlexDogLeg1",tmp_shape,tmp_material);
248 GeoPhysVol * tmp_logVolPV =
new GeoPhysVol(tmp_logVol);
249 GeoNameTag* tmp_tag =
new GeoNameTag(
"FlexDogLeg1");
250 GeoTrf::Transform3D trfGblA=ladderTransform*ladderLocalTrf*GeoTrf::TranslateX3D(trX)*GeoTrf::TranslateZ3D(trZ)*(endblockFlexTrf->getTransform())*GeoTrf::RotateY3D(
angle);
251 GeoTransform* tmp_xformA =
new GeoTransform(trfGblA);
257 trX=-dimX_lin*
tan(alpha1)*0.5;
258 trZ=-(eoStave+dimX_lin*0.5);
259 GeoTrf::Transform3D trfGblC=ladderTransform*ladderLocalTrf*GeoTrf::TranslateX3D(trX)*GeoTrf::TranslateZ3D(trZ)*(endblockFlexTrf->getTransform())*GeoTrf::RotateY3D(-
angle);
260 GeoTransform* tmp_xformC =
new GeoTransform(trfGblC);
270 double dimX2=dimX2_lin/
cos(alpha2)-.15;
272 double trX2=trX*2.-dimX2_lin*
tan(alpha2)*0.5;
273 double trZ2=eoStave+dimX_lin+dimX2_lin*0.5;
274 xShape.clear(); yShape.clear();
276 xShape.push_back(dimX2*0.5); yShape.push_back(dimY2*0.5);
277 xShape.push_back(-dimX2*0.5); yShape.push_back(dimY2*0.5);
278 xShape.push_back(-dimX2*0.5); yShape.push_back(-dimY2*0.5);
279 xShape.push_back(dimX2*0.5); yShape.push_back(-dimY2*0.5);
280 GeoSimplePolygonBrep* tmp2_shape =
new GeoSimplePolygonBrep(dimZ*0.5);
281 for(
unsigned int iPt=0; iPt<xShape.size(); iPt++) tmp2_shape->addVertex(xShape[iPt],yShape[iPt]);
284 GeoLogVol* tmp2_logVol =
new GeoLogVol(
"FlexDogLeg2",tmp2_shape,tmp2_material);
285 GeoPhysVol * tmp2_logVolPV =
new GeoPhysVol(tmp2_logVol);
286 GeoNameTag* tmp2_tag =
new GeoNameTag(
"FlexDogLeg2");
288 GeoTransform* tmp2_xformA =
new GeoTransform(ladderTransform*ladderLocalTrf*GeoTrf::TranslateX3D(trX2)*GeoTrf::TranslateZ3D(trZ2)*(endblockFlexTrf->getTransform())*GeoTrf::RotateY3D(
angle)*GeoTrf::TranslateY3D(delta*.75));
293 trZ2=-(eoStave+dimX_lin+dimX2_lin*0.5);
294 GeoTransform* tmp2_xformC =
new GeoTransform(ladderTransform*ladderLocalTrf*GeoTrf::TranslateX3D(trX2)*GeoTrf::TranslateZ3D(trZ2)*(endblockFlexTrf->getTransform())*GeoTrf::RotateY3D(-
angle)*GeoTrf::TranslateY3D(delta*.75));
305 GeoTrf::Translate3D ring_posA(0.0,0.0,staveRing.
GetPositionAlongZAxis()-serviceZpos-dogLegStaveLength*0.5+layerZshift);
306 GeoTransform* xformA =
new GeoTransform(ring_posA);
311 GeoTrf::Translate3D ring_posC(0.0,0.0,-staveRing.
GetPositionAlongZAxis()+serviceZpos+dogLegStaveLength*0.5-layerZshift);
312 GeoTransform* xformC =
new GeoTransform(ring_posC);
318 GeoTrf::Transform3D supportTrfA = GeoTrf::TranslateZ3D(serviceZpos+dogLegStaveLength*0.5+layerZshift);
321 GeoTrf::Transform3D supportTrfC = GeoTrf::TranslateZ3D(-serviceZpos-dogLegStaveLength*0.5+layerZshift);
324 std::ostringstream lnameM;
325 lnameM <<
"Brl0M_StaveRing";
327 GeoTrf::Translate3D ring_posM(0.0,0.0,0.0+layerZshift);