32 GeoModelIO::ReadGeoModel* sqliteReader,
33 std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
34 std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX,
50 double safety = 0.01*Gaudi::Units::mm;
68 const GeoShape * ladderShape =
nullptr;
76 ladderShape =
new GeoBox(halfThickness,
m_width/2.,
length/2.);
79 else if (
m_gmt_mgr->PixelBentStaveNModule() != 0) {
81 double angle =
m_gmt_mgr->PixelLadderBentStaveAngle() * Gaudi::Units::pi / 180.0;
82 double BentStaveThickness = double(
m_gmt_mgr->PixelBentStaveNModule()) *
m_gmt_mgr->PixelLadderModuleDeltaZ() * sin(
angle);
93 double shift = 0.5*BentStaveThickness;
94 if (
angle > 0) shift *= -1.0;
95 const GeoShape & shiftedBox = (*box) << GeoTrf::TranslateX3D(shift);
96 ladderShape = &shiftedBox;
103 GeoBox * box =
new GeoBox(halfThickness,
m_width/2.,
length/2.);
104 const GeoShape & shiftedBox = (*box) << GeoTrf::TranslateX3D(shift);
105 ladderShape = &shiftedBox;
110 GeoSimplePolygonBrep* staveSupportShape=
m_staveSupport->computeStaveEnvelopShape(safety);
111 const GeoShape & staveShape = (*staveSupportShape);
112 ladderShape = &staveShape;
116 m_gmt_mgr->msg(MSG::ERROR)<<
"No ladder shape could be defined "<<
endmsg;
120 if(not ladderShape) {
121 m_gmt_mgr->msg(MSG::ERROR)<<
"No ladder shape could be defined in "<<__FILE__<<
endmsg;
125 const GeoMaterial* air =
m_mat_mgr->getMaterial(
"std::Air");
126 m_theLadder =
new GeoLogVol(
"Ladder",ladderShape,air);
172 bool isModule3D=
true;
173 if (
m_gmt_mgr->PixelStaveLayout()<5) isModule3D=
false;
179 int staveLayout =
m_gmt_mgr->PixelStaveLayout();
180 int nbPixelModule=
m_gmt_mgr->PixelNModule();
181 int nbPixelPlanarModule=0;
182 int nbPixel3DModule=0;
183 bool bDetailedStaveLayout=
false;
184 double pixelModuleGap=
m_gmt_mgr->IBLStaveModuleGap();
185 double zNegStavePos= 0.0;
186 double planarLength=0.0;
187 double v3DHalfLength=0.0;
188 double v3DLength=0.0;
190 bool bVerbose= (
m_gmt_mgr->msgLvl(MSG::DEBUG));
193 double Si3DRadialShift=0.;
194 double Si3DLateralShift=0.;
199 if(Si3DThick>SiPlThick) Si3DRadialShift=-(Si3DThick-SiPlThick);
202 double MechanicalStaveOffset =
m_gmt_mgr->IBLStaveMechanicalStaveOffset();
203 double MechanicalStaveOffset3D =
m_gmt_mgr->IBLStaveMechanicalStaveOffset(
true);
204 Si3DLateralShift= -(MechanicalStaveOffset3D-MechanicalStaveOffset);
212 nbPixelModule=
m_gmt_mgr->IBLStaveModuleNumber_AllPlanar();
213 bDetailedStaveLayout=
true;
214 nbPixelPlanarModule=nbPixelModule;
217 else if(staveLayout==5||staveLayout==6)
219 bDetailedStaveLayout=
true;
226 planarLength=nbPixelPlanarModule*pm.
Length()+(nbPixelPlanarModule-1)*pixelModuleGap;
227 v3DHalfLength=(nbPixel3DModule/2)*pm3D.
Length()+(nbPixel3DModule/2)*pixelModuleGap;
228 zNegStavePos=-planarLength*0.5-v3DHalfLength;
232 planarLength=nbPixelPlanarModule*pm.
Length()+(nbPixelPlanarModule-1)*pixelModuleGap;
233 v3DLength=(nbPixel3DModule)*pm3D.
Length()+(nbPixel3DModule-1)*pixelModuleGap+pixelModuleGap*0.5;
234 zNegStavePos=-v3DLength;
241 for(
int ii = 0; ii < nbPixelModule; ii++) {
243 int etaModule =
m_gmt_mgr->PixelModuleEtaFromIndex(ii);
252 double xpos =
m_gmt_mgr->PixelModuleStaggerDistance() *
m_gmt_mgr->PixelModuleStaggerSign(etaModule)
257 double zpos =
m_gmt_mgr->PixelModuleZPosition(etaModule);
258 bool b3DModule=
false;
265 int moduleIndex =
m_gmt_mgr->PixelModuleIndexFromEta(etaModule);
268 zpos=(pm.
Length()+
m_gmt_mgr->IBLStaveModuleGap()) * (moduleIndex - 0.5*(
m_gmt_mgr->IBLStaveModuleNumber_AllPlanar()-1));
269 else if(
m_gmt_mgr->PixelStaveLayout()==5)
272 if(bVerbose)
m_gmt_mgr->msg(MSG::DEBUG)<<
"Eta : cmpt/index "<<ii<<
" "<<moduleIndex<<
endmsg;
274 if(ii<nbPixel3DModule/2)
279 xposShift=Si3DRadialShift;
280 yposShift=Si3DLateralShift;
283 else if(ii>nbPixelPlanarModule+nbPixel3DModule/2-1)
287 zpos=v3DHalfLength+planarLength+
m_gmt_mgr->IBLStaveModuleGap();
288 zpos+=(pm3D.
Length()+
m_gmt_mgr->IBLStaveModuleGap()) * (moduleIndex - nbPixel3DModule/2 - nbPixelPlanarModule);
290 xposShift=Si3DRadialShift;
291 yposShift=Si3DLateralShift;
295 zpos=v3DHalfLength+(pm.
Length()+
m_gmt_mgr->IBLStaveModuleGap()) * (moduleIndex - nbPixel3DModule/2);
302 zpos=zNegStavePos+zpos;
305 else if(
m_gmt_mgr->PixelStaveLayout()==6)
308 if(ii<nbPixel3DModule)
312 zpos=(pm3D.
Length()+pixelModuleGap) * moduleIndex;
313 zpos=zNegStavePos+zpos+pm3D.
Length()*0.5;
314 xposShift=Si3DRadialShift;
315 yposShift=Si3DLateralShift;
319 if(bVerbose)
m_gmt_mgr->msg(MSG::DEBUG)<<
"right plannar module "<<pm.
Length()<<
" "<<moduleIndex<<
endmsg;
320 zpos=(pm.
Length()+
m_gmt_mgr->IBLStaveModuleGap()) * (moduleIndex - nbPixel3DModule);
321 zpos+=pm.
Length()*0.5+pixelModuleGap*0.5;
327 GeoTrf::Translation3D modulepos(xpos+xposShift,yposShift,zpos);
331 GeoTrf::RotateY3D rm(
m_gmt_mgr->PixelModuleAngle()*
m_gmt_mgr->PixelModuleAngleSign(etaModule) );
335 GeoVPhysVol* modulephys{
nullptr};
338 modulephys = pm.
Build();
340 modulephys = pm3D.
Build();
343 std::string key=
"ModuleBrl_"+std::to_string(
m_gmt_mgr->GetLD())+
"_"+std::to_string(
m_gmt_mgr->Phi())+
"_"+std::to_string(
m_gmt_mgr->Eta());
346 else id = theSensor3D.
getID();
350 std::ostringstream nameTag;
351 nameTag <<
"ModuleBrl" <<
m_gmt_mgr->Eta();
352 GeoNameTag * tag =
new GeoNameTag(nameTag.str());
353 GeoAlignableTransform* xform;
355 xform =
new GeoAlignableTransform(GeoTrf::Transform3D(modulepos*rm));
356 ladderPhys->add(tag);
357 ladderPhys->add(
new GeoIdentifierTag(
m_gmt_mgr->Eta() ) );
358 ladderPhys->add(xform);
359 ladderPhys->add(modulephys );
364 else id = theSensor3D.
getID();
365 m_DDmgr->addAlignableTransform(0,
id,xform,modulephys);
380 double xOffset =
m_gmt_mgr->PixelLadderServicesX();
385 double bentStaveHalfLength = 0.5 * double(
m_gmt_mgr->PixelBentStaveNModule()) *
m_gmt_mgr->PixelLadderModuleDeltaZ();
388 GeoBox * shapeSupBent =
new GeoBox(0.5*
thickness, 0.5*
width, bentStaveHalfLength);
393 const GeoMaterial* materialSup =
m_mat_mgr->getMaterial(
"pix::StaveSupportBase");
395 double ang =
m_gmt_mgr->PixelLadderBentStaveAngle() * Gaudi::Units::pi / 180.0;
396 double xst = xOffset - (bentStaveHalfLength * sin(ang));
399 GeoLogVol* logVolBentNeg =
new GeoLogVol(
"StaveSupportBentNeg2",shapeSupBent,materialSup);
400 GeoPhysVol* physVolBentNeg =
new GeoPhysVol(logVolBentNeg);
401 GeoTrf::RotateY3D rmNeg(ang);
402 double zstneg = -
length/2.0 - (bentStaveHalfLength * cos(ang));
403 GeoTrf::Translation3D stavePosNeg(xst,0.,zstneg);
404 ladderPhys->add(
new GeoTransform(GeoTrf::Transform3D(stavePosNeg*rmNeg)));
405 ladderPhys->add(physVolBentNeg);
408 GeoLogVol* logVolBentPos =
new GeoLogVol(
"StaveSupportBentPos2",shapeSupBent,materialSup);
409 GeoPhysVol* physVolBentPos =
new GeoPhysVol(logVolBentPos);
410 GeoTrf::RotateY3D rmPos(-ang);
411 double zstpos =
length/2.0 + (bentStaveHalfLength * cos(ang));
412 GeoTrf::Translation3D stavePosPos(xst,0.,zstpos);
413 ladderPhys->add(
new GeoTransform(GeoTrf::Transform3D(stavePosPos*rmPos)));
414 ladderPhys->add(physVolBentPos);
428 const double safety = 0.01*Gaudi::Units::mm;
429 double clearance =
m_gmt_mgr->PixelLadderThicknessClearance();
430 clearance = std::max(clearance, safety);
432 double thickn = 0.5 *
m_gmt_mgr->PixelBoardThickness() +
m_gmt_mgr->PixelHybridThickness() + clearance;
434 double thick = std::max(thickn, thickp);
437 double tiltThick = 0.5*
length * sin(std::abs(
m_gmt_mgr->PixelModuleAngle())) + thick * cos(
m_gmt_mgr->PixelModuleAngle());
441 double thick1 = std::max(thick + 0.5*
m_gmt_mgr->PixelModuleDrDistance(), thick - 0.5*
m_gmt_mgr->PixelModuleDrDistance());
442 double thick2 = tiltThick +
m_gmt_mgr->PixelModuleStaggerDistance();
444 thick = std::max(thick1,thick2);