51 std::ostringstream message;
61 if ((msolid->
GetEntityType() !=
"G4ReflectedSolid") && (msol->IsGeneric()))
63 message <<
"Generic construct for G4Polyhedra NOT supported." << G4endl
64 <<
"Sorry! Solid: " << msol->GetName();
65 G4Exception(
"G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()",
66 "GeomDiv0001", FatalException, message);
72 G4VSolid* mConstituentSolid
73 = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
74 msol = (G4Polyhedra*)(mConstituentSolid);
78 G4int nofSides = msol->GetOriginalParameters()->numSide;
79 G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
80 G4double* zValues = msol->GetOriginalParameters()->Z_values;
81 G4double* rminValues = msol->GetOriginalParameters()->Rmin;
82 G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
86 auto rminValues2 = new G4double[nofZplanes];
87 auto rmaxValues2 = new G4double[nofZplanes];
88 auto zValuesRefl = new G4double[nofZplanes];
89 for (G4int i=0; i<nofZplanes; ++i)
91 rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
92 rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
93 zValuesRefl[i] = - zValues[i];
99 msol->GetEndPhi() - msol->GetStartPhi(),
101 nofZplanes, zValuesRefl, rminValues2, rmaxValues2);
103 delete [] rminValues2;
104 delete [] rmaxValues2;
105 delete [] zValuesRefl;
119G4VParameterisationPolyhedra::
120ConvertRadiusFactor(
const G4Polyhedra& phedra)
const
125 if ( (phiTotal <=0) || (phiTotal >
129 return std::cos(0.5*phiTotal/nofSides);
141 SetType(
"DivisionPolyhedraRho" );
160 G4cout <<
" G4ParameterisationPolyhedraRho - # divisions " <<
fnDiv
161 <<
" = " << nDiv <<
G4endl
180 std::ostringstream message;
181 message <<
"In solid " << msol->GetName() <<
G4endl
182 <<
"Division along R will be done with a width "
183 <<
"different for each solid section." <<
G4endl
184 <<
"WIDTH will not be used !";
185 G4Exception(
"G4ParameterisationPolyhedraRho::CheckParametersValidity()",
190 std::ostringstream message;
191 message <<
"In solid " << msol->GetName() <<
G4endl
192 <<
"Division along R will be done with a width "
193 <<
"different for each solid section." <<
G4endl
194 <<
"OFFSET will not be used !";
195 G4Exception(
"G4ParameterisationPolyhedraRho::CheckParametersValidity()",
205 return original_pars->
Rmax[0] - original_pars->
Rmin[0];
225 <<
" foffset: " <<
foffset/CLHEP::deg
235 G4cout << std::setprecision(8) <<
" G4ParameterisationPolyhedraRho "
237 <<
" Position: " << origin
257 for(
G4int ii = 0; ii < nZplanes; ++ii )
262 origparam.
Rmax[ii] = origparamMother->
Rmin[ii]+
foffset+width*(copyNo+1);
271 G4cout <<
"G4ParameterisationPolyhedraRho::ComputeDimensions()" <<
G4endl
272 <<
"-- Parametrised phedra copy-number: " << copyNo <<
G4endl;
286 SetType(
"DivisionPolyhedraPhi" );
289 G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
293 fnDiv = msol->GetNumSide();
301 G4cout <<
" G4ParameterisationPolyhedraPhi - # divisions " <<
fnDiv
302 <<
" = " << nDiv <<
G4endl
316 return msol->GetEndPhi() - msol->GetStartPhi();
328 std::ostringstream message;
329 message <<
"In solid " << msol->GetName() <<
G4endl
330 <<
" Division along PHI will be done splitting "
331 <<
"in the defined numSide." <<
G4endl
332 <<
"WIDTH will not be used !";
333 G4Exception(
"G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
338 std::ostringstream message;
339 message <<
"In solid " << msol->GetName() <<
G4endl
340 <<
"Division along PHI will be done splitting "
341 <<
"in the defined numSide." <<
G4endl
342 <<
"OFFSET will not be used !";
343 G4Exception(
"G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
351 std::ostringstream message;
352 message <<
"Configuration not supported." <<
G4endl
353 <<
"Division along PHI will be done splitting in the defined"
355 <<
"numSide, i.e, the number of division would be :"
356 << origparamMother->
numSide <<
" instead of " <<
fnDiv <<
" !";
357 G4Exception(
"G4ParameterisationPolyhedraPhi::CheckParametersValidity()",
378 G4cout <<
" G4ParameterisationPolyhedraPhi - position: " << posi/CLHEP::deg
380 <<
" copyNo: " << copyNo
390 G4cout << std::setprecision(8) <<
" G4ParameterisationPolyhedraPhi "
392 <<
" Position: " << origin <<
" - Width: " <<
fwidth
419 G4cout <<
"G4ParameterisationPolyhedraPhi::ComputeDimensions():" <<
G4endl;
434 SetType(
"DivisionPolyhedraZ" );
439 CalculateNDiv(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
440 - fOrigParamMother->Z_values[0] , width,
offset);
445 CalculateNDiv(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
446 - fOrigParamMother->Z_values[0] , nDiv,
offset);
452 G4cout <<
" G4ParameterisationPolyhedraZ - # divisions " <<
fnDiv <<
" = "
473 return (r1-r2)/(z1-z2)*z + ( r1 - (r1-r2)/(z1-z2)*z1 ) ;
482 fOrigParamMother->Z_values[nseg],
483 fOrigParamMother->Rmin[nseg],
484 fOrigParamMother->Z_values[nseg+1],
485 fOrigParamMother->Rmin[nseg+1]);
494 fOrigParamMother->Z_values[nseg],
495 fOrigParamMother->Rmax[nseg],
496 fOrigParamMother->Z_values[nseg+1],
497 fOrigParamMother->Rmax[nseg+1]);
503 return std::abs(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
504 -fOrigParamMother->Z_values[0]);
516 if( fOrigParamMother->Num_z_planes-1 !=
fnDiv )
518 std::ostringstream message;
519 message <<
"Configuration not supported." <<
G4endl
520 <<
"Division along Z will be done splitting in the defined"
522 <<
"Z planes, i.e, the number of division would be :"
523 << fOrigParamMother->Num_z_planes-1 <<
" instead of "
525 G4Exception(
"G4ParameterisationPolyhedraZ::CheckParametersValidity()",
538 G4int isegstart = -1;
546 G4double zend = fOrigParamMother->Z_values[0]
550 while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
553 if ( zstart >= fOrigParamMother->Z_values[
counter] &&
554 zstart < fOrigParamMother->Z_values[
counter+1] )
559 if ( zend > fOrigParamMother->Z_values[
counter] &&
560 zend <= fOrigParamMother->Z_values[
counter+1] )
572 G4double zend = fOrigParamMother->Z_values[0]
576 while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
579 if ( zstart <= fOrigParamMother->Z_values[
counter] &&
580 zstart > fOrigParamMother->Z_values[
counter+1] )
585 if ( zend < fOrigParamMother->Z_values[
counter] &&
586 zend >= fOrigParamMother->Z_values[
counter+1] )
594 if ( isegstart != isegend )
596 std::ostringstream message;
597 message <<
"Configuration not supported." <<
G4endl
598 <<
"Division with user defined width." <<
G4endl
600 <<
"Divided region is not between two Z planes.";
601 G4Exception(
"G4ParameterisationPolyhedraZ::CheckParametersValidity()",
605 fNSegment = isegstart;
619 posi = ( fOrigParamMother->Z_values[copyNo]
620 + fOrigParamMother->Z_values[copyNo+1])/2;
628 posi = fOrigParamMother->Z_values[0];
647 G4cout <<
" G4ParameterisationPolyhedraZ - position: " << posi <<
G4endl
648 <<
" copyNo: " << copyNo <<
" - foffset: " <<
foffset/CLHEP::deg
658 G4cout << std::setprecision(8) <<
" G4ParameterisationPolyhedraZ "
660 <<
" Position: (0,0,0) - Width: " <<
fwidth
677 origparam.
numSide = fOrigParamMother->numSide;
678 origparam.
Start_angle = fOrigParamMother->Start_angle;
693 G4double posi = ( fOrigParamMother->Z_values[copyNo]
694 + fOrigParamMother->Z_values[copyNo+1])/2;
696 origparam.
Z_values[0] = fOrigParamMother->Z_values[copyNo] - posi;
697 origparam.
Z_values[1] = fOrigParamMother->Z_values[copyNo+1] - posi;
698 origparam.
Rmin[0] = fOrigParamMother->Rmin[copyNo];
699 origparam.
Rmin[1] = fOrigParamMother->Rmin[copyNo+1];
700 origparam.
Rmax[0] = fOrigParamMother->Rmax[copyNo];
701 origparam.
Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
713 G4double posi = fOrigParamMother->Z_values[0]
719 origparam.
Rmin[0] = GetRmin(zstart, fNSegment);
720 origparam.
Rmax[0] = GetRmax(zstart, fNSegment);
721 origparam.
Rmin[1] = GetRmin(zend, fNSegment);
722 origparam.
Rmax[1] = GetRmax(zend, fNSegment);
731 G4double posi = fOrigParamMother->Z_values[0]
738 origparam.
Rmin[0] = GetRmin(zstart, fNSegment);
739 origparam.
Rmax[0] = GetRmax(zstart, fNSegment);
740 origparam.
Rmin[1] = GetRmin(zend, fNSegment);
741 origparam.
Rmax[1] = GetRmax(zend, fNSegment);
746 if ( origparam.
Rmin[0] < 0.0 ) { origparam.
Rmin[0] = 0.0; }
747 if ( origparam.
Rmin[nz-1] < 0.0 ) { origparam.
Rmin[1] = 0.0; }
756 G4cout <<
"G4ParameterisationPolyhedraZ::ComputeDimensions()" <<
G4endl
757 <<
"-- Parametrised phedra copy-number: " << copyNo <<
G4endl;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4ThreadLocal T * G4GeomSplitter< T >::offset
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
static G4GeometryTolerance * GetInstance()
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const override
G4ParameterisationPolyhedraPhi(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
G4double GetMaxParameter() const override
void CheckParametersValidity() override
~G4ParameterisationPolyhedraPhi() override
void ComputeDimensions(G4Polyhedra &phedra, const G4int copyNo, const G4VPhysicalVolume *physVol) const override
void ComputeDimensions(G4Polyhedra &phedra, const G4int copyNo, const G4VPhysicalVolume *physVol) const override
G4double GetMaxParameter() const override
void CheckParametersValidity() override
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const override
G4ParameterisationPolyhedraRho(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
~G4ParameterisationPolyhedraRho() override
G4double GetMaxParameter() const override
~G4ParameterisationPolyhedraZ() override
void CheckParametersValidity() override
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const override
G4ParameterisationPolyhedraZ(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
void ComputeDimensions(G4Polyhedra &phedra, const G4int copyNo, const G4VPhysicalVolume *physVol) const override
G4PolyhedraHistorical is a data structure for use in G4Polyhedra.
G4Polyhedra represents a composed closed polyhedra (PGON) made of planar sizes along the Z axis,...
G4double GetEndPhi() const
void SetOriginalParameters(G4PolyhedraHistorical *pars)
G4PolyhedraHistorical * GetOriginalParameters() const
G4double GetStartPhi() const
virtual void CheckParametersValidity()
void SetType(const G4String &type)
G4double CalculateWidth(G4double motherDim, G4int nDiv, G4double offset) const
G4int CalculateNDiv(G4double motherDim, G4double width, G4double offset) const
static const G4int verbose
DivisionType fDivisionType
G4VDivisionParameterisation(EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=nullptr)
void ChangeRotMatrix(G4VPhysicalVolume *physVol, G4double rotZ=0.0) const
~G4VParameterisationPolyhedra() override
G4VParameterisationPolyhedra(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
void SetTranslation(const G4ThreeVector &v)
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
virtual G4GeometryType GetEntityType() const =0
const axis_t axis_to_type< N >::axis