29 GeoModelIO::ReadGeoModel* sqliteReader,
30 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
31 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
44 const GeoMaterial* air =
m_mat_mgr->getMaterial(
"std::Air");
48 double safety = 0.01*Gaudi::Units::mm;
54 double xOffsetConnA = xBase +
m_gmt_mgr->PixelLadderCableOffsetX() -
m_gmt_mgr->PixelLadderServicesX();
55 double xOffsetConnC = xOffsetConnA;
62 double xMaxConnA =
m_gmt_mgr->PixelConnectorPosX(1) + 0.5*
m_gmt_mgr->PixelConnectorWidthX(1) + xOffsetConnA + safety;
63 double xMaxConnC = 1.25 * Gaudi::Units::cm + 0.5* 0.0125*Gaudi::Units::cm + xOffsetConnC + safety;
64 double xMaxOmegaBase = 0.055 * Gaudi::Units::cm + xBase + 1*Gaudi::Units::mm;
65 double yWidthConnA = 1.0 * Gaudi::Units::cm;
66 double yWidthConnC = 0.2 * Gaudi::Units::cm;
67 double yPosConnA =
m_gmt_mgr->PixelLadderCableOffsetY() -
m_gmt_mgr->PixelLadderServicesY();
68 double yPosConnC = yPosConnA;
70 double xWidthOmegaBase = xMaxOmegaBase - xBase;
71 double xWidthConnA = xMaxConnA - xBase;
72 double xWidthConnC = xMaxConnC - xBase;
73 double yWidthOmega = 1.2*Gaudi::Units::cm +
m_epsilon;
75 const GeoBox* omegaBaseEnv =
new GeoBox(0.5*xWidthOmegaBase, 0.5*yWidthOmega, halflength);
76 const GeoBox* connAEnv =
new GeoBox(0.5*xWidthConnA, 0.5*yWidthConnA + safety, halflength);
77 const GeoBox* connCEnv =
new GeoBox(0.5*xWidthConnC, 0.5*yWidthConnC + safety, halflength);
78 GeoTrf::Transform3D omegaBaseShift = GeoTrf::Translate3D(xBase + 0.5*xWidthOmegaBase - xCenter, 0., 0.);
79 GeoTrf::Transform3D connAShift = GeoTrf::Translate3D(xBase + 0.5*xWidthConnA - xCenter, yPosConnA, 0.);
80 GeoTrf::Transform3D connCShift = GeoTrf::Translate3D(xBase + 0.5*xWidthConnC - xCenter, yPosConnC, 0.);
82 const GeoShape & ladderSvcShape = ((*omegaBaseEnv) << omegaBaseShift)
83 .
add(*connAEnv << connAShift)
84 .add(*connCEnv << connCShift);
88 m_envelopeCornerA1 = GeoTrf::Vector3D(xMaxConnA - xCenter, yPosConnA + 0.5* yWidthConnA + safety, 0.);
89 m_envelopeCornerA2 = GeoTrf::Vector3D(xMaxConnA - xCenter, yPosConnA - 0.5* yWidthConnA + safety, 0.);
90 m_envelopeCornerC1 = GeoTrf::Vector3D(xMaxConnC - xCenter, yPosConnC + 0.5* yWidthConnC + safety, 0.);
91 m_envelopeCornerC2 = GeoTrf::Vector3D(xMaxConnC - xCenter, yPosConnC - 0.5* yWidthConnC + safety, 0.);
125 double zpos = fluid.
posZ();
127 GeoVPhysVol* fluidPhys = fluid.
Build();
128 GeoTransform* xform =
new GeoTransform(GeoTrf::Translate3D(xpos,ypos,zpos));
129 ladderSvcPhys->add(xform);
130 ladderSvcPhys->add(fluidPhys);
144 GeoVPhysVol* phys = cable.
Build();
147 double zpos = cable.
zpos();
148 GeoTransform* xform =
new GeoTransform(GeoTrf::Translate3D(xpos,ypos,zpos));
149 ladderSvcPhys->add(xform);
150 ladderSvcPhys->add(phys);
153 return ladderSvcPhys;
173 double xUpperBend = xOffset +
m_gmt_mgr->PixelOmegaUpperBendX();
174 double yUpperBend = yOffset +
m_gmt_mgr->PixelOmegaUpperBendY();
175 double radUpperBend =
m_gmt_mgr->PixelOmegaUpperBendRadius();
176 double xLowerBend = xOffset +
m_gmt_mgr->PixelOmegaLowerBendX();
177 double yLowerBend = yOffset +
m_gmt_mgr->PixelOmegaLowerBendY();
178 double radLowerBend =
m_gmt_mgr->PixelOmegaLowerBendRadius();
179 double yStart= yOffset +
m_gmt_mgr->PixelOmegaStartY();
180 double yEnd = yOffset +
m_gmt_mgr->PixelOmegaEndY();
181 double thick =
m_gmt_mgr->PixelOmegaWallThickness();
185 double sepX = (xUpperBend - xLowerBend);
186 double sepY = (yUpperBend - yLowerBend);
187 double sep2 = sepX*sepX+sepY*sepY;
188 double sep = sqrt(sep2);
189 double radDist = radUpperBend+radLowerBend-thick;
190 double alpha = atan(-sepY/sepX) - asin(radDist/sep);
191 double upperStraightLength = sqrt(sep2 - radDist*radDist);
192 double xLowerStraight = xLowerBend - (radLowerBend-0.5*thick)*sin(alpha);
193 double yLowerStraight = yLowerBend - (radLowerBend-0.5*thick)*cos(alpha);
194 double xUpperStraight = xUpperBend + (radUpperBend-0.5*thick)*sin(alpha);
195 double yUpperStraight = yUpperBend + (radUpperBend-0.5*thick)*cos(alpha);
199 GeoTubs * upperBendShape =
new GeoTubs(radUpperBend - thick, radUpperBend, 0.5*
length, alpha-0.5*Gaudi::Units::pi, Gaudi::Units::pi - 2*alpha);
202 GeoTubs * lowerBendShapeP =
new GeoTubs(radLowerBend - thick, radLowerBend, 0.5*
length, Gaudi::Units::pi, 0.5*Gaudi::Units::pi-alpha);
205 GeoTubs * lowerBendShapeM =
new GeoTubs(radLowerBend - thick, radLowerBend, 0.5*
length, 0.5*Gaudi::Units::pi + alpha, 0.5*Gaudi::Units::pi-alpha);
208 GeoBox * lowerStraightBoxP =
new GeoBox(0.5*thick, 0.5*(yStart - yLowerBend), 0.5*
length);
211 GeoBox * lowerStraightBoxM =
new GeoBox(0.5*thick, 0.5*(-yLowerBend - yEnd), 0.5*
length);
214 GeoBox * upperStraightBox =
new GeoBox(0.5*thick, 0.5*upperStraightLength, 0.5*
length);
217 const GeoShape & omegaShape =
218 (*lowerStraightBoxP << GeoTrf::Translate3D(xLowerBend-radLowerBend+0.5*thick,0.5*(yLowerBend+yStart),zOffset) )
219 .
add(*lowerBendShapeP << GeoTrf::Translate3D(xLowerBend,yLowerBend,zOffset) )
220 .add(*upperStraightBox << GeoTrf::Translate3D(0.5*(xLowerStraight+xUpperStraight),0.5*(yLowerStraight+yUpperStraight),zOffset)*GeoTrf::RotateZ3D(0.5*Gaudi::Units::pi-alpha) )
221 .add(*upperBendShape << GeoTrf::Translate3D(xUpperBend,yUpperBend,zOffset) )
222 .add(*upperStraightBox << GeoTrf::Translate3D(0.5*(xLowerStraight+xUpperStraight),-0.5*(yLowerStraight+yUpperStraight),zOffset)*GeoTrf::RotateZ3D(0.5*Gaudi::Units::pi+alpha) )
223 .add(*lowerBendShapeM << GeoTrf::Translate3D(xLowerBend,-yLowerBend,zOffset) )
224 .add(*lowerStraightBoxM << GeoTrf::Translate3D(xLowerBend-radLowerBend+0.5*thick,0.5*(-yLowerBend+yEnd),zOffset) );
227 lowerStraightBoxP->volume()
228 + lowerBendShapeP->volume()
229 + 2*upperStraightBox->volume()
230 + upperBendShape->volume()
231 + lowerBendShapeM->volume()
232 + lowerStraightBoxM->volume();
235 const GeoMaterial* omegaMat =
m_mat_mgr->getMaterialForVolume(matName,totVolume);
236 GeoLogVol* omegaLV =
new GeoLogVol(
"Omega",&omegaShape,omegaMat);
237 return new GeoPhysVol(omegaLV);
258 double xUpperBend = xOffset +
m_gmt_mgr->PixelAlTubeUpperBendX();
259 double yUpperBend = yOffset +
m_gmt_mgr->PixelAlTubeUpperBendY();
260 double radUpperBend =
m_gmt_mgr->PixelAlTubeUpperBendRadius();
261 double xLowerBend = xOffset +
m_gmt_mgr->PixelAlTubeLowerBendX();
262 double yLowerBend = yOffset +
m_gmt_mgr->PixelAlTubeLowerBendY();
263 double radLowerBend =
m_gmt_mgr->PixelAlTubeLowerBendRadius();
264 double thick =
m_gmt_mgr->PixelAlTubeWallThickness();
268 double sepX = (xUpperBend - xLowerBend);
269 double sepY = (yUpperBend - yLowerBend);
270 double sep2 = sepX*sepX+sepY*sepY;
271 double sep = sqrt(sep2);
272 double radDist = radUpperBend-radLowerBend;
273 double alpha = atan(-sepY/sepX) - asin(radDist/sep);
274 double upperStraightLength = sqrt(sep2 - radDist*radDist);
275 double xLowerStraight = xLowerBend + (radLowerBend-0.5*thick)*sin(alpha);
276 double yLowerStraight = yLowerBend + (radLowerBend-0.5*thick)*cos(alpha);
277 double xUpperStraight = xUpperBend + (radUpperBend-0.5*thick)*sin(alpha);
278 double yUpperStraight = yUpperBend + (radUpperBend-0.5*thick)*cos(alpha);
282 GeoTubs * upperBendShape =
new GeoTubs(radUpperBend - thick, radUpperBend, 0.5*
length, alpha-0.5*Gaudi::Units::pi, Gaudi::Units::pi - 2*alpha);
285 GeoTubs * lowerBendShapeP =
new GeoTubs(radLowerBend - thick, radLowerBend, 0.5*
length, 0.5*Gaudi::Units::pi-alpha, 0.5*Gaudi::Units::pi+alpha);
288 GeoTubs * lowerBendShapeM =
new GeoTubs(radLowerBend - thick, radLowerBend, 0.5*
length, Gaudi::Units::pi, 0.5*Gaudi::Units::pi+alpha);
291 GeoBox * lowerStraightBox =
new GeoBox(0.5*thick, yLowerBend, 0.5*
length);
294 GeoBox * upperStraightBox =
new GeoBox(0.5*thick, 0.5*upperStraightLength, 0.5*
length);
297 const GeoShape & alTubeShape =
298 (*lowerStraightBox << GeoTrf::Translate3D(xLowerBend-radLowerBend+0.5*thick,0,zOffset) )
299 .
add(*lowerBendShapeP << GeoTrf::Translate3D(xLowerBend,yLowerBend,zOffset) )
300 .add(*upperStraightBox << GeoTrf::Translate3D(0.5*(xLowerStraight+xUpperStraight),0.5*(yLowerStraight+yUpperStraight),zOffset)*GeoTrf::RotateZ3D(0.5*Gaudi::Units::pi-alpha) )
301 .add(*upperBendShape << GeoTrf::Translate3D(xUpperBend,yUpperBend,zOffset) )
302 .add(*upperStraightBox << GeoTrf::Translate3D(0.5*(xLowerStraight+xUpperStraight),-0.5*(yLowerStraight+yUpperStraight),zOffset)*GeoTrf::RotateZ3D(0.5*Gaudi::Units::pi+alpha) )
303 .add(*lowerBendShapeM << GeoTrf::Translate3D(xLowerBend,-yLowerBend,zOffset) );
306 lowerStraightBox->volume()
307 + lowerBendShapeP->volume()
308 + 2*upperStraightBox->volume()
309 + upperBendShape->volume()
310 + lowerBendShapeM->volume();
314 const GeoMaterial* alMat =
m_mat_mgr->getMaterialForVolume(matName,totVolume);
315 GeoLogVol* tubeLV =
new GeoLogVol(
"AlTube",&alTubeShape,alMat);
316 return new GeoPhysVol(tubeLV);
324 int nGlueElements =
m_gmt_mgr->PixelNumOmegaGlueElements();
325 for (
int i = 0; i < nGlueElements; ++i) {
326 double x1 =
m_gmt_mgr->PixelOmegaGlueStartX(i);
327 double thickness =
m_gmt_mgr->PixelOmegaGlueThickness(i);
328 double y1 =
m_gmt_mgr->PixelOmegaGlueStartY(i);
329 double y2 =
m_gmt_mgr->PixelOmegaGlueEndY(i);
331 double zOffset =
m_gmt_mgr->PixelOmegaGluePosZ(i);
332 int typeNum =
m_gmt_mgr->PixelOmegaGlueTypeNum(i);
334 GeoBox * glueShape =
new GeoBox(0.5*thickness, 0.5*std::abs(y1-y2), 0.5*
length);
335 std::string matName =
m_gmt_mgr->getMaterialName(
"GlueOmegaStave",
m_gmt_mgr->GetLD(), typeNum);
336 const GeoMaterial* glueMat =
m_mat_mgr->getMaterialForVolume(matName, glueShape->volume());
337 GeoLogVol* glueLV =
new GeoLogVol(
"Glue",glueShape,glueMat);
338 GeoPhysVol* gluePV =
new GeoPhysVol(glueLV);
340 GeoTransform * xform =
new GeoTransform(GeoTrf::Translate3D(
m_xOffset+x1+0.5*thickness,
m_yOffset-0.5*(y1+y2), zOffset));
354 double xPosPigtail = xOffset +
m_gmt_mgr->PixelPigtailPosX();
355 double yPosPigtail = yOffset + 0.5*(
m_gmt_mgr->PixelPigtailStartY() +
m_gmt_mgr->PixelPigtailEndY());
356 double zPosPigtail =
m_gmt_mgr->PixelPigtailPosZ();
357 double xWidthPigtail =
m_gmt_mgr->PixelPigtailThickness();
358 double yWidthPigtail = std::abs(
m_gmt_mgr->PixelPigtailStartY() -
m_gmt_mgr->PixelPigtailEndY());
359 double zWidthPigtail =
m_gmt_mgr->PixelPigtailFlatWidthZ();
360 std::string matNamePigtail =
m_gmt_mgr->getMaterialName(
"PigtailFlat",
m_gmt_mgr->GetLD());
361 GeoBox * pigtailShape =
new GeoBox(0.5*xWidthPigtail, 0.5*yWidthPigtail, 0.5*zWidthPigtail);
362 const GeoMaterial* pigtailMat =
m_mat_mgr->getMaterialForVolume(matNamePigtail,pigtailShape->volume());
363 GeoLogVol * pigtailLV =
new GeoLogVol(
"PigtailFlat",pigtailShape,pigtailMat);
364 GeoPhysVol * pigtailPhys =
new GeoPhysVol(pigtailLV);
367 int numConn =
m_gmt_mgr->PixelNumConnectorElements();
368 std::vector<GeoPhysVol *> connectorPhysVols(numConn);
369 std::vector<GeoTrf::Transform3D> connectorTransforms(numConn);
370 for (
int iConn = 0; iConn < numConn; iConn++) {
371 double xPosConnector = xOffset +
m_gmt_mgr->PixelConnectorPosX(iConn);
372 double yPosConnector = yOffset +
m_gmt_mgr->PixelConnectorPosY(iConn);
373 double zPosConnector =
m_gmt_mgr->PixelConnectorPosZ(iConn);
374 double xWidthConnector =
m_gmt_mgr->PixelConnectorWidthX(iConn);
375 double yWidthConnector =
m_gmt_mgr->PixelConnectorWidthY(iConn);
376 double zWidthConnector =
m_gmt_mgr->PixelConnectorWidthZ(iConn);
377 std::string matNameConnector =
m_gmt_mgr->getMaterialName(
"Connector",
m_gmt_mgr->GetLD(), iConn);
378 GeoBox * connectorShape =
new GeoBox(0.5*xWidthConnector, 0.5*yWidthConnector, 0.5*zWidthConnector);
379 const GeoMaterial* connectorMat =
m_mat_mgr->getMaterialForVolume(matNameConnector,connectorShape->volume());
380 GeoLogVol * connectorLV =
new GeoLogVol(
"Connector",connectorShape,connectorMat);
381 connectorPhysVols[iConn] =
new GeoPhysVol(connectorLV);
382 connectorTransforms[iConn] = GeoTrf::Translate3D(xPosConnector, yPosConnector, zPosConnector);
385 for (
int iModule = 0; iModule<
m_gmt_mgr->PixelNModule(); iModule++) {
386 int moduleEta =
m_gmt_mgr->PixelModuleEtaFromIndex(iModule);
387 double zShift =
m_gmt_mgr->PixelModuleZPosition(moduleEta);
390 GeoTransform * xformPigtail =
new GeoTransform(GeoTrf::Translate3D(xPosPigtail, yPosPigtail, zShift+zPosPigtail));
391 parent->add(xformPigtail);
392 parent->add(pigtailPhys);
395 for (
int iConn = 0; iConn < numConn; iConn++) {
396 GeoTransform * xformConnector =
new GeoTransform(GeoTrf::TranslateZ3D(zShift)*connectorTransforms[iConn]);
397 parent->add(xformConnector);
398 parent->add(connectorPhysVols[iConn]);