226 static const GeoIntrusivePtr<const GeoBox> box1 =
new GeoBox(1.*GeoModelKernelUnits::km,1*GeoModelKernelUnits::km,1*GeoModelKernelUnits::km);
227 static const GeoIntrusivePtr<const GeoShape> s1 = [&] {
228 GeoTrf::Vector3D v1(0,0,-1*GeoModelKernelUnits::km);
229 GeoTrf::Transform3D ttt1 = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(v1);
230 return new GeoShapeShift (&*box1, ttt1);
232 static const GeoIntrusivePtr<const GeoShape> s2 = [&] {
233 GeoTrf::Vector3D v2(0,0,+1*GeoModelKernelUnits::km);
234 GeoTrf::Transform3D ttt2 = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(v2);
235 return new GeoShapeShift (&*box1, ttt2);
238 double radius=v->Radius();
239 GeoTrf::Vector3D axis0(v->GetPoint(0)-v->GetPoint(1));
240 GeoTrf::Vector3D axis(v->GetPoint(1)-v->GetPoint(0));
241 GeoTrf::Vector3D axis1 = GeoTrf::Vector3D::Identity();
242 GeoTrf::Vector3D axis2(v->GetPoint(2)-v->GetPoint(1));
243 double length=axis.norm();
245 double angle2=std::abs(std::atan2(axis.cross(axis2).norm(), axis.dot(axis2)))/2;
247 double delta_l2=radius*std::tan(angle2);
248 double lengthnew=
length+delta_l2;
249 GeoShape*
solid=
new GeoTubs(0.,radius,lengthnew/2.,0.,2.0*
M_PI);
251 const GeoTrf::Vector3D vt(0.,0.,-lengthnew/2.+delta_l2+2.);
252 GeoTrf::Transform3D rrr = GeoTrf::RotateY3D(angle2)*GeoTrf::RotateZ3D(
phi(axis2));
253 GeoShape *ssnew=
new GeoShapeShift(&*s1,GeoTrf::Translation3D(vt)*rrr);
257 GeoTrf::Vector3D vref(0.,0.,-lengthnew/2.);
258 GeoTrf::Transform3D tref = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(vref);
260 GeoTrf::Transform3D r1 = GeoTrf::RotateZ3D(
phi(axis0))*GeoTrf::RotateY3D(
theta(axis0));
261 GeoTrf::Vector3D vtt(v->GetPoint(0).x(),v->GetPoint(0).y(),v->GetPoint(0).z());
262 solid=
new GeoShapeShift(
solid,GeoTrf::Translation3D(vtt)*r1);
264 for (
int i=1;i<v->NrOfPoints()-1;i++)
266 axis0=v->GetPoint(i)-v->GetPoint(i+1);
267 axis=v->GetPoint(i+1)-v->GetPoint(i);
268 axis1=v->GetPoint(i)-v->GetPoint(i-1);
271 angle1=std::abs(std::atan2(axis.cross(axis1).norm(), axis.dot(axis1)))/2;
272 delta_l1=radius*std::tan(angle1);
274 if (i<(v->NrOfPoints()-2))
276 axis2=v->GetPoint(i+2)-v->GetPoint(i+1);
277 angle2=std::abs(std::atan2(axis.cross(axis2).norm(), axis.dot(axis2)))/2;
278 delta_l2=radius*std::tan(angle2);
281 lengthnew=
length+delta_l1+delta_l2;
283 GeoTrf::Vector3D vvref(0.,0.,-lengthnew/2+delta_l1);
284 GeoTrf::Transform3D ttref = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(vvref);
286 GeoShape*
ss=
new GeoTubs(0.,radius,lengthnew/2.,0.,2.0*
M_PI);
288 const GeoTrf::Vector3D vt1(0.,0.,+lengthnew/2.-delta_l1-2.);
289 const GeoTrf::Vector3D vt2(0.,0.,-lengthnew/2.+delta_l2+2.);
290 GeoTrf::Transform3D rrr1 = GeoTrf::RotateZ3D(-
phi(axis1))*GeoTrf::RotateY3D(angle1);
291 GeoTrf::Transform3D rrr2 = GeoTrf::RotateZ3D(
phi(axis2))*GeoTrf::RotateY3D(-angle2);
292 GeoTrf::Transform3D ttt1 = rrr1*GeoTrf::Translation3D(vt1);
293 GeoTrf::Transform3D ttt2 = rrr2*GeoTrf::Translation3D(vt2);
294 GeoShape *ssnew1=
new GeoShapeShift(&*s2,ttt1);
295 ss =
new GeoShapeSubtraction(
ss,ssnew1);
296 if (i<(v->NrOfPoints()-2))
298 GeoShape *ssnew2=
new GeoShapeShift(&*s1,ttt2);
299 ss =
new GeoShapeSubtraction(
ss,ssnew2);
302 ss=
new GeoShapeShift(
ss,ttref);
304 GeoTrf::Transform3D rr1 = GeoTrf::RotateZ3D(
phi(axis0))*GeoTrf::RotateY3D(
theta(axis0));
305 const GeoTrf::Vector3D vv(v->GetPoint(i).x(),v->GetPoint(i).y(),v->GetPoint(i).z());
306 ss=
new GeoShapeShift(
ss,GeoTrf::Translation3D(vv)*rr1);
471 static const GeoMaterial *
const ether =
GetMMMaterial(
"special::Ether");
472 static const GeoIntrusivePtr<const GeoShape> fakeVol =
new GeoTubs(0.,500.,1000.,0.,2.0*
M_PI);
476 GeoLogVol *
a=
new GeoLogVol(v->GetName(),&*fakeVol,ether);
477 GeoPhysVol *a_phys=
new GeoPhysVol(
a);
478 v->SetVolume(a_phys);
480 for (
int i=0;i<v->NrOfDaughter();i++)
484 const std::string volName = vol->
GetName();
489 std::string detFullTag=
"";
492 d=
m_ds.GetDetector(volName);
495 log<<MSG::WARNING<<
"CreateComposition() - Cannot retrieve Detector element for "<<volName<<
endmsg;
498 if (p) detFullTag=p->ID.detectorAddress;
501 log<<MSG::WARNING<<
"CreateComposition() - AGDDDetectorPositioner is nullptr"<<
endmsg;
504 GeoTrf::Transform3D trf=pos->Transform();
505 GeoTransform *geotrf=
new GeoTransform(trf);
509 GeoFullPhysVol* detVol=NULL;
515 detVol=(GeoFullPhysVol*)(vol->
GetVolume());
516 if (p) p->theVolume=detVol;
525 detVol=(GeoFullPhysVol*)temp;
526 detVol=detVol->clone();
527 if (p) p->theVolume=detVol;
532 if (isDetElement) a_phys->add(detVol);
533 else a_phys->add((GeoPhysVol*)(vol->
GetVolume()));
708 void *p=b->GetSolid();
711 GeoSimplePolygonBrep*
solid;
712 solid =
new GeoSimplePolygonBrep(b->GetLength()/2.);
713 solid->addVertex(b->m_width/2.,b->m_height/2);
714 solid->addVertex(-b->m_width/2.,b->m_height/2);
715 solid->addVertex(-b->m_width/2.,b->m_smallHeight/2);
716 solid->addVertex(-b->m_smallWidth/2.,b->m_smallHeight/2);
717 solid->addVertex(-b->m_smallWidth/2.,-b->m_smallHeight/2);
718 solid->addVertex(-b->m_width/2.,-b->m_smallHeight/2);
719 solid->addVertex(-b->m_width/2.,-b->m_height/2);
720 solid->addVertex(b->m_width/2.,-b->m_height/2);
721 solid->addVertex(b->m_width/2.,-b->m_smallHeight/2);
722 solid->addVertex(b->m_smallWidth/2.,-b->m_smallHeight/2);
723 solid->addVertex(b->m_smallWidth/2.,b->m_smallHeight/2);
724 solid->addVertex(b->m_width/2.,b->m_smallHeight/2);
731 void *p=b->GetSolid();
734 GeoSimplePolygonBrep*
solid;
735 solid =
new GeoSimplePolygonBrep(b->GetLength()/2.);
736 solid->addVertex(b->m_width/2.,b->m_smallHeight/2.);
737 solid->addVertex(-b->m_width/2.,b->m_smallHeight/2.);
738 solid->addVertex(-b->m_width/2.,-b->m_height+b->m_smallHeight/2.);
739 solid->addVertex(-b->m_width/2.+b->m_smallWidth,-b->m_height+b->m_smallHeight/2.);
740 solid->addVertex(-b->m_width/2.+b->m_smallWidth,-b->m_smallHeight/2.);
741 solid->addVertex(b->m_width/2.-b->m_smallWidth,-b->m_smallHeight/2.);
742 solid->addVertex(b->m_width/2.-b->m_smallWidth,-b->m_height+b->m_smallHeight/2.);
743 solid->addVertex(b->m_width/2.,-b->m_height+b->m_smallHeight/2.);