Geant4  10.02.p03
G4VParameterisationPolyhedra Class Reference

#include <G4ParameterisationPolyhedra.hh>

Inheritance diagram for G4VParameterisationPolyhedra:
Collaboration diagram for G4VParameterisationPolyhedra:

Public Member Functions

 G4VParameterisationPolyhedra (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *msolid, DivisionType divType)
 
virtual ~G4VParameterisationPolyhedra ()
 
- Public Member Functions inherited from G4VDivisionParameterisation
 G4VDivisionParameterisation (EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=0)
 
virtual ~G4VDivisionParameterisation ()
 
virtual G4VSolidComputeSolid (const G4int, G4VPhysicalVolume *)
 
virtual void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const =0
 
const G4StringGetType () const
 
EAxis GetAxis () const
 
G4int GetNoDiv () const
 
G4double GetWidth () const
 
G4double GetOffset () const
 
G4VSolidGetMotherSolid () const
 
void SetType (const G4String &type)
 
G4int VolumeFirstCopyNo () const
 
void SetHalfGap (G4double hg)
 
G4double GetHalfGap () const
 
- Public Member Functions inherited from G4VPVParameterisation
 G4VPVParameterisation ()
 
virtual ~G4VPVParameterisation ()
 
virtual G4MaterialComputeMaterial (const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
 
virtual G4bool IsNested () const
 
virtual G4VVolumeMaterialScannerGetMaterialScanner ()
 
virtual void ComputeDimensions (G4Box &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Tubs &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Trd &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Trap &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Cons &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Sphere &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Orb &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Ellipsoid &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Torus &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Para &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Polycone &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Polyhedra &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Hype &, const G4int, const G4VPhysicalVolume *) const
 

Private Member Functions

G4double ConvertRadiusFactor (const G4Polyhedra &phedra) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VDivisionParameterisation
void ChangeRotMatrix (G4VPhysicalVolume *physVol, G4double rotZ=0.) const
 
G4int CalculateNDiv (G4double motherDim, G4double width, G4double offset) const
 
G4double CalculateWidth (G4double motherDim, G4int nDiv, G4double offset) const
 
virtual void CheckParametersValidity ()
 
void CheckOffset (G4double maxPar)
 
void CheckNDivAndWidth (G4double maxPar)
 
virtual G4double GetMaxParameter () const =0
 
G4double OffsetZ () const
 
- Protected Attributes inherited from G4VDivisionParameterisation
G4String ftype
 
EAxis faxis
 
G4int fnDiv
 
G4double fwidth
 
G4double foffset
 
DivisionType fDivisionType
 
G4VSolidfmotherSolid
 
G4bool fReflectedSolid
 
G4bool fDeleteSolid
 
G4int theVoluFirstCopyNo
 
G4double kCarTolerance
 
G4double fhgap
 
- Static Protected Attributes inherited from G4VDivisionParameterisation
static G4ThreadLocal G4RotationMatrixfRot = 0
 
static const G4int verbose = 5
 

Detailed Description

Definition at line 65 of file G4ParameterisationPolyhedra.hh.

Constructor & Destructor Documentation

◆ G4VParameterisationPolyhedra()

G4VParameterisationPolyhedra::G4VParameterisationPolyhedra ( EAxis  axis,
G4int  nCopies,
G4double  offset,
G4double  step,
G4VSolid msolid,
DivisionType  divType 
)

Definition at line 49 of file G4ParameterisationPolyhedra.cc.

52  : G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
53 {
54  std::ostringstream message;
55 #ifdef G4MULTITHREADED
56  message << "Divisions for G4Polyhedra currently NOT supported in MT-mode."
57  << G4endl
58  << "Sorry! Solid: " << msolid->GetName();
59  G4Exception("G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()",
60  "GeomDiv0001", FatalException, message);
61 #endif
62 
63  G4Polyhedra* msol = (G4Polyhedra*)(msolid);
64  if ((msolid->GetEntityType() != "G4ReflectedSolid") && (msol->IsGeneric()))
65  {
66  message << "Generic construct for G4Polyhedra NOT supported." << G4endl
67  << "Sorry! Solid: " << msol->GetName();
68  G4Exception("G4VParameterisationPolyhedra::G4VParameterisationPolyhedra()",
69  "GeomDiv0001", FatalException, message);
70  }
71  if (msolid->GetEntityType() == "G4ReflectedSolid")
72  {
73  // Get constituent solid
74  G4VSolid* mConstituentSolid
75  = ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
76  msol = (G4Polyhedra*)(mConstituentSolid);
77 
78  // Get parameters
79  G4int nofSides = msol->GetOriginalParameters()->numSide;
80  G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
81  G4double* zValues = msol->GetOriginalParameters()->Z_values;
82  G4double* rminValues = msol->GetOriginalParameters()->Rmin;
83  G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
84 
85  // Invert z values,
86  // convert radius parameters
87  G4double* rminValues2 = new G4double[nofZplanes];
88  G4double* rmaxValues2 = new G4double[nofZplanes];
89  G4double* zValuesRefl = new G4double[nofZplanes];
90  for (G4int i=0; i<nofZplanes; i++)
91  {
92  rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
93  rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
94  zValuesRefl[i] = - zValues[i];
95  }
96 
97  G4Polyhedra* newSolid
98  = new G4Polyhedra(msol->GetName(),
99  msol->GetStartPhi(),
100  msol->GetEndPhi() - msol->GetStartPhi(),
101  nofSides,
102  nofZplanes, zValuesRefl, rminValues2, rmaxValues2);
103 
104  delete [] rminValues2;
105  delete [] rmaxValues2;
106  delete [] zValuesRefl;
107 
108  msol = newSolid;
109  fmotherSolid = newSolid;
110  fReflectedSolid = true;
111  fDeleteSolid = true;
112  }
113 }
G4bool IsGeneric() const
G4double GetStartPhi() const
#define width
virtual G4GeometryType GetEntityType() const =0
int G4int
Definition: G4Types.hh:78
G4String GetName() const
G4double ConvertRadiusFactor(const G4Polyhedra &phedra) const
G4PolyhedraHistorical * GetOriginalParameters() const
G4VDivisionParameterisation(EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=0)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double GetEndPhi() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ ~G4VParameterisationPolyhedra()

G4VParameterisationPolyhedra::~G4VParameterisationPolyhedra ( )
virtual

Definition at line 116 of file G4ParameterisationPolyhedra.cc.

117 {
118 }
Here is the call graph for this function:

Member Function Documentation

◆ ConvertRadiusFactor()

G4double G4VParameterisationPolyhedra::ConvertRadiusFactor ( const G4Polyhedra phedra) const
private

Definition at line 123 of file G4ParameterisationPolyhedra.cc.

124 {
125  G4double phiTotal = phedra.GetEndPhi() - phedra.GetStartPhi();
126  G4int nofSides = phedra.GetOriginalParameters()->numSide;
127 
128  if ( (phiTotal <=0) || (phiTotal >
129  2*pi+G4GeometryTolerance::GetInstance()->GetAngularTolerance()) )
130  { phiTotal = 2*pi; }
131 
132  return std::cos(0.5*phiTotal/nofSides);
133 }
G4double GetStartPhi() const
int G4int
Definition: G4Types.hh:78
G4PolyhedraHistorical * GetOriginalParameters() const
static const double pi
Definition: G4SIunits.hh:74
G4double GetEndPhi() const
double G4double
Definition: G4Types.hh:76
static G4GeometryTolerance * GetInstance()
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: