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" );
149 - original_pars->
Rmin[0], width, offset );
154 - original_pars->
Rmin[0], nDiv, offset );
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;
431 fOrigParamMother(((
G4Polyhedra*)fmotherSolid)->GetOriginalParameters())
434 SetType(
"DivisionPolyhedraZ" );
440 - fOrigParamMother->
Z_values[0] , width, offset);
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 ) ;
483 fOrigParamMother->
Rmin[nseg],
485 fOrigParamMother->
Rmin[nseg+1]);
495 fOrigParamMother->
Rmax[nseg],
497 fOrigParamMother->
Rmax[nseg+1]);
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 :"
525 G4Exception(
"G4ParameterisationPolyhedraZ::CheckParametersValidity()",
538 G4int isegstart = -1;
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] )
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];
643 G4cout <<
" G4ParameterisationPolyhedraZ - position: " << posi <<
G4endl
644 <<
" copyNo: " << copyNo <<
" - foffset: " <<
foffset/CLHEP::deg
654 G4cout << std::setprecision(8) <<
" G4ParameterisationPolyhedraZ "
656 <<
" Position: (0,0,0) - Width: " <<
fwidth
690 + fOrigParamMother->
Z_values[copyNo+1])/2;
694 origparam.
Rmin[0] = fOrigParamMother->
Rmin[copyNo];
695 origparam.
Rmin[1] = fOrigParamMother->
Rmin[copyNo+1];
696 origparam.
Rmax[0] = fOrigParamMother->
Rmax[copyNo];
697 origparam.
Rmax[1] = fOrigParamMother->
Rmax[copyNo+1];
715 origparam.
Rmin[0] = GetRmin(zstart, fNSegment);
716 origparam.
Rmax[0] = GetRmax(zstart, fNSegment);
717 origparam.
Rmin[1] = GetRmin(zend, fNSegment);
718 origparam.
Rmax[1] = GetRmax(zend, fNSegment);
734 origparam.
Rmin[0] = GetRmin(zstart, fNSegment);
735 origparam.
Rmax[0] = GetRmax(zstart, fNSegment);
736 origparam.
Rmin[1] = GetRmin(zend, fNSegment);
737 origparam.
Rmax[1] = GetRmax(zend, fNSegment);
742 if ( origparam.
Rmin[0] < 0.0 ) origparam.
Rmin[0] = 0.0;
743 if ( origparam.
Rmin[nz-1] < 0.0 ) origparam.
Rmin[1] = 0.0;
752 G4cout <<
"G4ParameterisationPolyhedraZ::ComputeDimensions()" <<
G4endl
753 <<
"-- Parametrised phedra copy-number: " << copyNo <<
G4endl;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
static G4GeometryTolerance * GetInstance()
G4ParameterisationPolyhedraPhi(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *motherSolid, DivisionType divType)
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const override
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 *motherSolid, 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 *motherSolid, DivisionType divType)
void ComputeDimensions(G4Polyhedra &phedra, const G4int copyNo, const G4VPhysicalVolume *physVol) const override
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
void ChangeRotMatrix(G4VPhysicalVolume *physVol, G4double rotZ=0.0) const
G4VParameterisationPolyhedra(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *msolid, DivisionType divType)
~G4VParameterisationPolyhedra() override
void SetTranslation(const G4ThreeVector &v)
virtual G4GeometryType GetEntityType() const =0