50 double thickness_inner ,
double thickness_outer,
Vector3D origin ) :
64 virtual std::vector< std::pair<Vector3D, Vector3D> >
getLines(
unsigned nMax=100){
66 std::vector< std::pair<Vector3D, Vector3D> > lines ;
68 lines.reserve( nMax ) ;
73 unsigned n = nMax / 4 ;
74 double dPhi = 2.* ROOT::Math::Pi() / double( n ) ;
76 for(
unsigned i = 0 ; i < n ; ++i ) {
78 Vector3D rv0( r*sin( i *dPhi ) , r*cos( i *dPhi ) , 0. ) ;
79 Vector3D rv1( r*sin( (i+1)*dPhi ) , r*cos( (i+1)*dPhi ) , 0. ) ;
86 lines.push_back( std::make_pair( pl0, pl1 ) ) ;
87 lines.push_back( std::make_pair( pl1, pl2 ) ) ;
88 lines.push_back( std::make_pair( pl2, pl3 ) ) ;
89 lines.push_back( std::make_pair( pl3, pl0 ) ) ;
109 printout(dd4hep::DEBUG,
"DD4hep_Beampipe",
"Creating Beampipe" ) ;
113 const std::string name = xmlBeampipe.nameStr();
114 bool nocore = xmlBeampipe.nocore(
false);
132 const double phi1 = 0 ;
133 const double phi2 = 360.0*units::degree;
136 dd4hep::xml::Component xmlParameter = xmlBeampipe.child(
_Unicode(parameter));
137 const double crossingAngle = xmlParameter.attr<
double >(
_Unicode(crossingangle))*0.5;
140 double min_radius = 1.e99 ;
147 const double zStart = xmlSection.attr<
double > (
_Unicode(start));
148 const double zEnd = xmlSection.attr<
double > (
_Unicode(end));
149 const double rInnerStart = xmlSection.attr<
double > (
_Unicode(rMin1));
150 const double rInnerEnd = xmlSection.attr<
double > (
_Unicode(rMin2));
151 const double rOuterStart = xmlSection.attr<
double > (
_Unicode(rMax1));
152 const double rOuterEnd = xmlSection.attr<
double > (
_Unicode(rMax2));
153 const double thickness = rOuterStart - rInnerStart;
155 const std::string volName =
"tube_" + xmlSection.nameStr();
157 std::stringstream pipeInfo;
158 pipeInfo << std::setw(8) << zStart /units::mm
159 << std::setw(8) << zEnd /units::mm
160 << std::setw(8) << rInnerStart /units::mm
161 << std::setw(8) << rInnerEnd /units::mm
162 << std::setw(8) << rOuterStart /units::mm
163 << std::setw(8) << rOuterEnd /units::mm
164 << std::setw(8) << thickness /units::mm
165 << std::setw(8) << crossType
166 << std::setw(35) << volName
167 << std::setw(15) << sectionMat.
name();
169 printout(dd4hep::INFO,
"DD4hep_Beampipe", pipeInfo.str() );
172 dd4hep::rec::ConicalSupportData::Section section ;
173 section.rInner = rInnerStart ;
174 section.rOuter = rOuterStart ;
175 section.zPos = zStart ;
176 beampipeData->sections.push_back( section ) ;
180 const double zHalf = fabs(zEnd - zStart) * 0.5;
181 const double zPosition = fabs(zEnd + zStart) * 0.5;
186 if (not checkForSensibleGeometry(crossingAngle, crossType)){
188 throw std::runtime_error(
" Beampipe_o1_v01_geo.cpp : checkForSensibleGeometry() failed " ) ;
191 const double rotateAngle = getCurrentAngle(crossingAngle, crossType);
192 const double mirrorAngle =
M_PI - rotateAngle;
206 ConeSegment tubeSolid( zHalf, 0, rOuterStart, 0, rOuterEnd , phi1, phi2);
210 Volume tubeLog( volName, tubeSolid, coreMaterial ) ;
211 Volume tubeLog2( volName, tubeSolid, coreMaterial ) ;
214 if (rInnerStart != rOuterStart || rInnerEnd != rOuterEnd) {
217 ConeSegment wallSolid( zHalf, rInnerStart, rOuterStart, rInnerEnd, rOuterEnd, phi1, phi2);
220 Volume wallLog ( volName +
"_wall", wallSolid, wallMaterial);
221 Volume wallLog2( volName +
"_wall2", wallSolid, wallMaterial);
226 const bool isCylinder = ( rInnerStart == rInnerEnd );
231 Vector3D ocyl( rInnerStart + thickness/2. , 0. , 0. ) ;
233 VolCylinder cylSurf1( wallLog ,
SurfaceType( SurfaceType::Helper ) , 0.5*thickness , 0.5*thickness , ocyl );
234 VolCylinder cylSurf2( wallLog2,
SurfaceType( SurfaceType::Helper ) , 0.5*thickness , 0.5*thickness , ocyl );
241 const double dr = rInnerEnd - rInnerStart ;
242 const double theta = atan2( dr , 2.* zHalf ) ;
244 Vector3D ocon( rInnerStart + 0.5 * ( dr + thickness ), 0. , 0. );
246 Vector3D v( 1. , 0. , theta, Vector3D::spherical ) ;
248 VolCone conSurf1( wallLog ,
SurfaceType( SurfaceType::Helper ) , 0.5*thickness , 0.5*thickness ,
v, ocon );
249 VolCone conSurf2( wallLog2,
SurfaceType( SurfaceType::Helper ) , 0.5*thickness , 0.5*thickness ,
v, ocon );
256 if( rInnerStart < min_radius ) min_radius = rInnerStart ;
257 if( rOuterStart < min_radius ) min_radius = rOuterStart ;
260 wallLog.setVisAttributes(description,
"TubeVis");
261 wallLog2.setVisAttributes(description,
"TubeVis");
262 tubeLog.setVisAttributes(description,
"VacVis");
263 tubeLog2.setVisAttributes(description,
"VacVis");
290 const double rUpstreamPunch = rInnerStart;
291 const double rDnstreamPunch = rInnerEnd;
302 ConeSegment tubeSolid( zHalf, 0, rOuterStart, 0, rOuterEnd, phi1, phi2);
305 Volume tubeLog0( volName +
"_0", tubeSolid, coreMaterial );
306 Volume tubeLog1( volName +
"_1", tubeSolid, coreMaterial );
309 ConeSegment wholeSolid( zHalf, 0, rOuterStart, 0, rOuterEnd, phi1, phi2);
311 Solid tmpSolid0, tmpSolid1, wallSolid0, wallSolid1;
317 if ( rUpstreamPunch > 1e-6 ) {
318 Tube upstreamPunch( 0, rUpstreamPunch, 5 * zHalf, phi1, phi2);
319 tmpSolid0 =
SubtractionSolid( wholeSolid, upstreamPunch, upstreamTransformer);
320 tmpSolid1 =
SubtractionSolid( wholeSolid, upstreamPunch, dnstreamTransformer);
322 tmpSolid0 = wholeSolid;
323 tmpSolid1 = wholeSolid;
326 if (rDnstreamPunch > 1e-6 ) {
327 Tube dnstreamPunch( 0, rDnstreamPunch, 5 * zHalf, phi1, phi2);
328 wallSolid0 =
SubtractionSolid( tmpSolid0, dnstreamPunch, dnstreamTransformer);
329 wallSolid1 =
SubtractionSolid( tmpSolid1, dnstreamPunch, upstreamTransformer);
331 wallSolid0 = tmpSolid0;
332 wallSolid1 = tmpSolid1;
336 Volume wallLog0( volName +
"_wall_0", wallSolid0, wallMaterial );
337 Volume wallLog1( volName +
"_wall_1", wallSolid1, wallMaterial );
339 wallLog0.setVisAttributes(description,
"TubeVis");
340 wallLog1.setVisAttributes(description,
"TubeVis");
341 tubeLog0.setVisAttributes(description,
"VacVis");
342 tubeLog1.setVisAttributes(description,
"VacVis");
347 envelope.
placeVolume( wallLog0, placementTransformer );
348 envelope.
placeVolume( wallLog1, placementTransmirror );
353 envelope.
placeVolume( tubeLog0, placementTransformer );
354 envelope.
placeVolume( tubeLog1, placementTransmirror );
357 tubeLog0.placeVolume( wallLog0,
Position() );
358 tubeLog1.placeVolume( wallLog1,
Position() );
381 ConeSegment tubeSolid( zHalf, 0, rOuterStart, 0, rOuterEnd, phi1, phi2);
384 Volume tubeLog0( volName +
"_0", tubeSolid, coreMaterial );
385 Volume tubeLog1( volName +
"_1", tubeSolid, coreMaterial );
388 ConeSegment wholeSolid( zHalf, rCenterPunch , rOuterStart, rCenterPunch, rOuterEnd, phi1, phi2);
390 Tube punchSolid( 0, rOffsetPunch, 5 * zHalf, phi1, phi2);
399 Volume wallLog0( volName +
"_wall_0", wallSolid0, wallMaterial );
400 Volume wallLog1( volName +
"_wall_1", wallSolid1, wallMaterial );
402 wallLog0.setVisAttributes(description,
"TubeVis");
403 wallLog1.setVisAttributes(description,
"TubeVis");
405 tubeLog0.setVisAttributes(description,
"VacVis");
406 tubeLog1.setVisAttributes(description,
"VacVis");
412 envelope.
placeVolume( wallLog0, placementTransformer );
413 envelope.
placeVolume( wallLog1, placementTransmirror );
418 envelope.
placeVolume( tubeLog0, placementTransformer );
419 envelope.
placeVolume( tubeLog1, placementTransmirror );
422 tubeLog0.placeVolume( wallLog0 ,
Position() );
423 tubeLog1.placeVolume( wallLog1 ,
Position() );
438 const double clipSize = rOuterStart;
439 Tube clipSolid( 0, 2 * clipSize, clipSize, phi1, phi2);
443 const double clipShift = (zStart - clipSize) / cos(clipAngle) - (zPosition - clipSize / 2);
453 ConeSegment wholeSolid( zHalf + clipSize / 2, 0, rOuterStart, 0, rOuterEnd, phi1, phi2);
460 Volume tubeLog0( volName +
"_0", tubeSolid0, coreMaterial );
461 Volume tubeLog1( volName +
"_1", tubeSolid1, coreMaterial );
465 envelope.
placeVolume( tubeLog0, placementTransformer );
466 envelope.
placeVolume( tubeLog1, placementTransmirror );
469 if (rInnerStart != rOuterStart || rInnerEnd != rOuterEnd) {
471 ConeSegment wallWholeSolid( zHalf + clipSize / 2, rInnerStart, rOuterStart, rInnerEnd, rOuterEnd, phi1, phi2);
478 Volume wallLog0( volName +
"_wall_0", wallSolid0, wallMaterial );
479 Volume wallLog1( volName +
"_wall_1", wallSolid1, wallMaterial );
481 wallLog0.setVisAttributes(description,
"TubeVis");
482 wallLog1.setVisAttributes(description,
"TubeVis");
484 tubeLog0.setVisAttributes(description,
"VacVis");
485 tubeLog1.setVisAttributes(description,
"VacVis");
488 tubeLog0.placeVolume( wallLog0,
Position() );
489 tubeLog1.placeVolume( wallLog1,
Position() );
491 envelope.
placeVolume( wallLog0, placementTransformer );
492 envelope.
placeVolume( wallLog1, placementTransmirror );
507 const double clipSize = rOuterEnd;
508 Tube clipSolid( 0, 2 * clipSize, clipSize, phi1, phi2);
512 const double clipShift = (zEnd + clipSize) / cos(clipAngle) - (zPosition + clipSize / 2);
521 ConeSegment wholeSolid( 0, rOuterStart, 0, rOuterEnd, zHalf + clipSize / 2, phi1, phi2);
528 Volume tubeLog0( volName +
"_0", tubeSolid0, coreMaterial );
529 Volume tubeLog1( volName +
"_1", tubeSolid1, coreMaterial );
533 envelope.
placeVolume( tubeLog0, placementTransformer );
534 envelope.
placeVolume( tubeLog1, placementTransmirror );
537 if (rInnerStart != rOuterStart || rInnerEnd != rOuterEnd) {
539 ConeSegment wallWholeSolid( rInnerStart, rOuterStart, rInnerEnd, rOuterEnd, zHalf + clipSize / 2, phi1, phi2);
546 Volume wallLog0( volName +
"_wall_0", wallSolid0, wallMaterial );
547 Volume wallLog1( volName +
"_wall_1", wallSolid1, wallMaterial );
549 wallLog0.setVisAttributes(description,
"TubeVis");
550 wallLog1.setVisAttributes(description,
"TubeVis");
552 tubeLog0.setVisAttributes(description,
"VacVis");
553 tubeLog1.setVisAttributes(description,
"VacVis");
560 envelope.
placeVolume( wallLog0, placementTransformer );
561 envelope.
placeVolume( wallLog1, placementTransmirror );
576 const double clipSize = rOuterEnd;
577 Tube clipSolid( 0, 2 * clipSize, clipSize, phi1, phi2);
581 const double clipShiftFrnt = (zStart - clipSize) / cos(clipAngle) - zPosition;
582 const double clipShiftRear = (zEnd + clipSize) / cos(clipAngle) - zPosition;
593 ConeSegment wholeSolid( 0, rOuterStart, 0, rOuterEnd, zHalf + clipSize, phi1, phi2);
602 Volume tubeLog0( volName +
"_0", tubeSolid0, coreMaterial );
603 Volume tubeLog1( volName +
"_1", tubeSolid1, coreMaterial );
607 envelope.
placeVolume( tubeLog0, placementTransformer );
608 envelope.
placeVolume( tubeLog1, placementTransmirror );
611 if (rInnerStart != rOuterStart || rInnerEnd != rOuterEnd) {
613 ConeSegment wallWholeSolid( rInnerStart, rOuterStart, rInnerEnd, rOuterEnd, zHalf + clipSize, phi1, phi2);
616 SubtractionSolid wallTmpSolid0( wallWholeSolid, clipSolid, clipTransformerFrnt);
617 SubtractionSolid wallTmpSolid1( wallWholeSolid, clipSolid, clipTransmirrorFrnt);
618 SubtractionSolid wallSolid0 ( wallTmpSolid0, clipSolid, clipTransformerRear);
619 SubtractionSolid wallSolid1 ( wallTmpSolid1, clipSolid, clipTransmirrorRear);
622 Volume wallLog0(volName +
"_wall_0", wallSolid0, wallMaterial );
623 Volume wallLog1(volName +
"_wall_1", wallSolid1, wallMaterial );
625 wallLog0.setVisAttributes(description,
"TubeVis");
626 wallLog1.setVisAttributes(description,
"TubeVis");
628 tubeLog0.setVisAttributes(description,
"VacVis");
629 tubeLog1.setVisAttributes(description,
"VacVis");
636 envelope.
placeVolume( wallLog0, placementTransformer );
637 envelope.
placeVolume( wallLog1, placementTransmirror );
643 throw std::runtime_error(
" Beampipe_o1_v01_geo.cpp : fatal failure !! ?? " ) ;
656 Vector3D oIPCyl( (min_radius-1.e-3) , 0. , 0. ) ;
659 ipCylSurf->setHalfLength( 100*units::cm ) ;
667 tube.setVisAttributes( description, xmlBeampipe.visStr(), envelope );