30#include "G4Polyhedra.hh"
31#include "G4ReflectedSolid.hh"
33const int Geant4GM::Polyhedra::fgkMaxNofZPlanes = 50;
34double* Geant4GM::Polyhedra::fgZBuffer = 0;
35double* Geant4GM::Polyhedra::fgRinBuffer = 0;
36double* Geant4GM::Polyhedra::fgRoutBuffer = 0;
40 double dphi,
int nofSides,
int nofZplanes,
double* z,
double* rin,
62 double* z2 =
new double[nofZplanes];
63 double* rin2 =
new double[nofZplanes];
64 double* rout2 =
new double[nofZplanes];
66 for (
int i = 0; i < nofZplanes; i++) {
86 G4Polyhedra* phedra, G4ReflectedSolid* reflPhedra)
97 int nofZplanes = phedra->GetOriginalParameters()->Num_z_planes;
98 double* zValues = phedra->GetOriginalParameters()->Z_values;
99 fZValuesRefl =
new double[nofZplanes];
100 for (
int i = 0; i < nofZplanes; i++) fZValuesRefl[i] = -zValues[i];
120 :
VGM::ISolid(rhs),
VGM::IPolyhedra(rhs),
BaseVGM::VPolyhedra(rhs)
129 delete[] fZValuesRefl;
133void Geant4GM::Polyhedra::CreateBuffers()
135 if (!fgZBuffer) fgZBuffer =
new double[fgkMaxNofZPlanes];
136 if (!fgRinBuffer) fgRinBuffer =
new double[fgkMaxNofZPlanes];
137 if (!fgRoutBuffer) fgRoutBuffer =
new double[fgkMaxNofZPlanes];
152 double deltaPhi = fPolyhedra->GetEndPhi() - fPolyhedra->GetStartPhi();
160 return fPolyhedra->GetOriginalParameters()->numSide;
166 return fPolyhedra->GetOriginalParameters()->Num_z_planes;
172 int nofZPlanes = NofZPlanes();
173 if (nofZPlanes > fgkMaxNofZPlanes) {
174 nofZPlanes = fgkMaxNofZPlanes;
175 std::cerr <<
"+++ Warning +++" << std::endl;
176 std::cerr <<
" Number of Zplanes > size of buffer." << std::endl;
177 std::cerr <<
" only " << nofZPlanes <<
" values are returned."
181 for (
int i = 0; i < nofZPlanes; i++)
183 fgZBuffer[i] = fPolyhedra->GetOriginalParameters()->Z_values[i];
195 int nofZPlanes = NofZPlanes();
196 if (nofZPlanes > fgkMaxNofZPlanes) {
197 nofZPlanes = fgkMaxNofZPlanes;
198 std::cerr <<
"+++ Warning +++" << std::endl;
199 std::cerr <<
" Number of Zplanes > size of buffer." << std::endl;
200 std::cerr <<
" only " << nofZPlanes <<
" values are returned."
204 for (
int i = 0; i < nofZPlanes; i++) {
205 fgRinBuffer[i] = fPolyhedra->GetOriginalParameters()->Rmin[i];
206 fgRinBuffer[i] *= ConvertRadiusFactor();
216 int nofZPlanes = NofZPlanes();
217 if (nofZPlanes > fgkMaxNofZPlanes) {
218 nofZPlanes = fgkMaxNofZPlanes;
219 std::cerr <<
"+++ Warning +++" << std::endl;
220 std::cerr <<
" Number of Zplanes > size of buffer." << std::endl;
221 std::cerr <<
" only " << nofZPlanes <<
" values are returned."
225 for (
int i = 0; i < nofZPlanes; i++) {
226 fgRoutBuffer[i] = fPolyhedra->GetOriginalParameters()->Rmax[i];
227 fgRoutBuffer[i] *= ConvertRadiusFactor();
static double Length()
Return CLHEP default length unit in VGM units.
static double Angle()
Return CLHEP default angle unit in VGM units.
VGM implementation for Geant4 polyhedra solid.
virtual double * OuterRadiusValues() const
Return the array of outer radius of the planes in mm.
virtual int NofSides() const
Return number of sides of the cross section between the given phi limits.
virtual double * ZValues() const
Return the array of z positions of the planes in mm.
virtual double DeltaPhi() const
Return opening phi angle of the segment in deg.
virtual double StartPhi() const
Return starting phi angle of the segment in deg.
virtual int NofZPlanes() const
Return number of planes perpendicular to the z axis.
virtual std::string Name() const
Return the name of this solid.
virtual double * InnerRadiusValues() const
Return the array of innner radius of the planes in mm.
static SolidMap * Instance()
void AddSolid(VGM::ISolid *, G4VSolid *)