30#include "G4Polycone.hh"
31#include "G4ReflectedSolid.hh"
34const int Geant4GM::Polycone::fgkMaxNofZPlanes = 50;
35double* Geant4GM::Polycone::fgZBuffer = 0;
36double* Geant4GM::Polycone::fgRinBuffer = 0;
37double* Geant4GM::Polycone::fgRoutBuffer = 0;
41 int nofZplanes,
double* z,
double* rin,
double* rout)
60 double* z2 =
new double[nofZplanes];
61 double* rin2 =
new double[nofZplanes];
62 double* rout2 =
new double[nofZplanes];
64 for (
int i = 0; i < nofZplanes; i++) {
84 G4Polycone* polycone, G4ReflectedSolid* reflPolycone)
95 int nofZplanes = polycone->GetOriginalParameters()->Num_z_planes;
96 double* zValues = polycone->GetOriginalParameters()->Z_values;
97 fZValuesRefl =
new double[nofZplanes];
98 for (
int i = 0; i < nofZplanes; i++) fZValuesRefl[i] = -zValues[i];
121 double* z =
new double[2];
122 double* rin =
new double[2];
123 double* rout =
new double[2];
124 z[0] = -cons->GetZHalfLength();
125 z[1] = cons->GetZHalfLength();
126 rin[0] = cons->GetInnerRadiusMinusZ();
127 rin[1] = cons->GetInnerRadiusPlusZ();
128 rout[0] = cons->GetOuterRadiusMinusZ();
129 rout[1] = cons->GetOuterRadiusPlusZ();
131 fPolycone =
new G4Polycone(cons->GetName(), cons->GetStartPhiAngle(),
132 cons->GetDeltaPhiAngle(), 2, z, rin, rout);
149 double* z =
new double[2];
150 double* rin =
new double[2];
151 double* rout =
new double[2];
152 z[0] = -tubs->GetZHalfLength();
153 z[1] = tubs->GetZHalfLength();
154 rin[0] = tubs->GetInnerRadius();
155 rin[1] = tubs->GetInnerRadius();
156 rout[0] = tubs->GetOuterRadius();
157 rout[1] = tubs->GetOuterRadius();
159 fPolycone =
new G4Polycone(tubs->GetName(), tubs->GetStartPhiAngle(),
160 tubs->GetDeltaPhiAngle(), 2, z, rin, rout);
174 :
VGM::ISolid(rhs),
VGM::IPolycone(rhs),
BaseVGM::VPolycone(rhs)
183 delete[] fZValuesRefl;
187void Geant4GM::Polycone::CreateBuffers()
189 if (!fgZBuffer) fgZBuffer =
new double[fgkMaxNofZPlanes];
190 if (!fgRinBuffer) fgRinBuffer =
new double[fgkMaxNofZPlanes];
191 if (!fgRoutBuffer) fgRoutBuffer =
new double[fgkMaxNofZPlanes];
206 double deltaPhi = fPolycone->GetEndPhi() - fPolycone->GetStartPhi();
214 return fPolycone->GetOriginalParameters()->Num_z_planes;
220 int nofZPlanes = NofZPlanes();
221 if (nofZPlanes > fgkMaxNofZPlanes) {
222 nofZPlanes = fgkMaxNofZPlanes;
223 std::cerr <<
"+++ Warning +++" << std::endl;
224 std::cerr <<
" Number of Zplanes > size of buffer." << std::endl;
225 std::cerr <<
" only " << nofZPlanes <<
" values are returned."
229 for (
int i = 0; i < nofZPlanes; i++)
231 fgZBuffer[i] = fPolycone->GetOriginalParameters()->Z_values[i];
243 int nofZPlanes = NofZPlanes();
244 if (nofZPlanes > fgkMaxNofZPlanes) {
245 nofZPlanes = fgkMaxNofZPlanes;
246 std::cerr <<
"+++ Warning +++" << std::endl;
247 std::cerr <<
" Number of Zplanes > size of buffer." << std::endl;
248 std::cerr <<
" only " << nofZPlanes <<
" values are returned."
252 for (
int i = 0; i < nofZPlanes; i++) {
253 fgRinBuffer[i] = fPolycone->GetOriginalParameters()->Rmin[i];
263 int nofZPlanes = NofZPlanes();
264 if (nofZPlanes > fgkMaxNofZPlanes) {
265 nofZPlanes = fgkMaxNofZPlanes;
266 std::cerr <<
"+++ Warning +++" << std::endl;
267 std::cerr <<
" Number of Zplanes > size of buffer." << std::endl;
268 std::cerr <<
" only " << nofZPlanes <<
" values are returned."
272 for (
int i = 0; i < nofZPlanes; i++) {
273 fgRoutBuffer[i] = fPolycone->GetOriginalParameters()->Rmax[i];
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 polycone solid.
virtual double DeltaPhi() const
Return opening phi angle of the segment in deg.
virtual std::string Name() const
Return the name of this solid.
virtual double * InnerRadiusValues() const
Return the array of inner radius of the planes in mm.
virtual double * ZValues() const
Return the array of z positions of the planes in mm.
virtual double * OuterRadiusValues() const
Return the array of outer radius of the planes in mm.
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.
static SolidMap * Instance()
void AddSolid(VGM::ISolid *, G4VSolid *)