43 const G4int handedness,
54 axis0min, axis1min, axis0max, axis1max),
55 fKappa(kappa), fTanStereo(tanstereo),
56 fTan2Stereo(tanstereo*tanstereo), fR0(r0), fR02(r0*r0), fDPhi(
twopi)
60 G4Exception(
"G4TwistTubsHypeSide::G4TwistTubsHypeSide()",
62 "Should swap axis0 and axis1!");
115 SetCorners(EndInnerRadius, EndOuterRadius, DPhi, EndPhi, EndZ) ;
125 fR0(0.), fR02(0.), fDPhi(0.)
168 normal = normal.unit();
209 if (distanceToOut < -halftol)
226 if (distanceToOut <= halftol)
237 G4cout <<
"WARNING - G4TwistTubsHypeSide::Inside()" <<
G4endl
238 <<
" Invalid option !" <<
G4endl
239 <<
" name, areacode, distanceToOut = "
240 <<
GetName() <<
", " << std::hex << areacode
241 << std::dec <<
", " << distanceToOut <<
G4endl;
310 for (
auto i=0; i<2; ++i)
345 if (vrho == 0 || (vrho/absvz) <= (absvz*std::fabs(
fTanStereo)/absvz))
350 isvalid[0], 0, validate, &gp, &gv);
357 * (vz / std::fabs(vz)) ;
359 xx[0].
set(t*v.
x(), t*v.
y(), xxz);
366 distance[0] = xx[0].
mag();
374 if (distance[0] >= 0) isvalid[0] =
true;
382 if (distance[0] >= 0) isvalid[0] =
true;
388 if (distance[0] >= 0) isvalid[0] =
true;
392 isvalid[0], 1, validate, &gp, &gv);
412 xx[0] = p + distance[0]*
v;
420 if (distance[0] >= 0) isvalid[0] =
true;
428 if (distance[0] >= 0) isvalid[0] =
true;
434 if (distance[0] >= 0) isvalid[0] =
true;
438 isvalid[0], 1, validate, &gp, &gv);
448 isvalid[0], 0, validate, &gp, &gv);
459 G4bool tmpisvalid[2] = {
false,
false};
461 for (
auto i=0; i<2; ++i)
463 tmpdist[i] = factor*(-b -
D);
465 tmpxx[i] = p + tmpdist[i]*
v;
472 if (tmpdist[i] >= 0) tmpisvalid[i] =
true;
481 if (tmpdist[i] >= 0) tmpisvalid[i] =
true;
488 if (tmpdist[i] >= 0) tmpisvalid[i] =
true;
493 if (tmpdist[0] <= tmpdist[1])
495 distance[0] = tmpdist[0];
496 distance[1] = tmpdist[1];
501 areacode[0] = tmpareacode[0];
502 areacode[1] = tmpareacode[1];
503 isvalid[0] = tmpisvalid[0];
504 isvalid[1] = tmpisvalid[1];
508 distance[0] = tmpdist[1];
509 distance[1] = tmpdist[0];
514 areacode[0] = tmpareacode[1];
515 areacode[1] = tmpareacode[0];
516 isvalid[0] = tmpisvalid[1];
517 isvalid[1] = tmpisvalid[0];
521 isvalid[0], 2, validate, &gp, &gv);
523 isvalid[1], 2, validate, &gp, &gv);
532 isvalid[0], 0, validate, &gp, &gv);
571 for (
auto i=0; i<2; ++i)
588 for (
auto i=0; i<2; ++i)
593 if ((gp - lastgxx[0]).mag() < halftol || (gp - lastgxx[1]).mag() < halftol)
616 if (prho > r1 + halftol)
633 distance[0] = (pabsz - xx1).mag();
642 else if (prho < r1 - halftol)
649 xx1.
set(r1, 0. , pz);
654 xx1.
set(t * pabsz.x(), t * pabsz.y() , pz);
670 xx2.
set(r2, 0. , 0.);
675 xx2.
set(t * pabsz.x(), t * pabsz.y() , 0.);
685 xx.
set(p.
x(), p.
y(), pz);
723 if ((phiareacode &
sAxisMin) == sAxisMin)
726 if (isoutsideinphi) isoutside =
true;
731 if (isoutsideinphi) isoutside =
true;
742 if (xx.
z() <=
fAxisMin[zaxis] - ctol) isoutside =
true;
745 else if (xx.
z() >
fAxisMax[zaxis] - ctol)
751 if (xx.
z() >=
fAxisMax[zaxis] + ctol) isoutside =
true;
760 areacode = tmpareacode;
813 message <<
"Feature NOT implemented !" <<
G4endl
815 <<
" fAxis[1] = " <<
fAxis[1];
856 areacode = tmpareacode;
890 for (
auto i=0; i<2; ++i)
892 endRad[i] = (
fHandedness == 1 ? EndOuterRadius[i] : EndInnerRadius[i]);
901 x = endRad[zmin]*std::cos(endPhi[zmin] - halfdphi);
902 y = endRad[zmin]*std::sin(endPhi[zmin] - halfdphi);
907 x = endRad[zmin]*std::cos(endPhi[zmin] + halfdphi);
908 y = endRad[zmin]*std::sin(endPhi[zmin] + halfdphi);
913 x = endRad[zmax]*std::cos(endPhi[zmax] + halfdphi);
914 y = endRad[zmax]*std::sin(endPhi[zmax] + halfdphi);
919 x = endRad[zmax]*std::cos(endPhi[zmax] - halfdphi);
920 y = endRad[zmax]*std::sin(endPhi[zmax] - halfdphi);
928 message <<
"Feature NOT implemented !" <<
G4endl
930 <<
" fAxis[1] = " <<
fAxis[1];
943 "Method NOT implemented !");
960 direction = direction.
unit();
966 direction = direction.
unit();
972 direction = direction.
unit();
978 direction = direction.
unit();
985 message <<
"Feature NOT implemented !" <<
G4endl
987 <<
" fAxis[1] = " <<
fAxis[1];
988 G4Exception(
"G4TwistTubsHypeSide::SetBoundaries()",
1009 for (
G4int i = 0 ; i<
n ; ++i )
1013 for (
G4int j = 0 ; j<
k ; ++j )
1015 nnode =
GetNode(i,j,k,n,iside) ;
1022 x = xmin + j*(xmax-
xmin)/(k-1) ;
1026 x = xmax - j*(xmax-
xmin)/(k-1) ;
1031 xyz[nnode][0] = p.
x() ;
1032 xyz[nnode][1] = p.
y() ;
1033 xyz[nnode][2] = p.
z() ;
1035 if ( i<n-1 && j<k-1 )
1037 nface =
GetFace(i,j,k,n,iside) ;
1039 * (
GetNode(i ,j ,k,n,iside)+1) ;
1041 * (
GetNode(i+1,j ,k,n,iside)+1) ;
1043 * (
GetNode(i+1,j+1,k,n,iside)+1) ;
1045 * (
GetNode(i ,j+1,k,n,iside)+1) ;