2 #include "CLHEP/Units/GlobalSystemOfUnits.h"
8 os <<
" xSemiAxis[cm]=" <<
p_[0]/cm
9 <<
" ySemiAxis[cm]=" <<
p_[1]/cm
10 <<
" zSemiAxis" <<
p_[2]/cm
11 <<
" zBottomCut" <<
p_[3]/cm
12 <<
" zTopCut" <<
p_[4]/cm;
20 double c2 = p_[2] * p_[2];
21 for (;z <= maxz; z=z+dz) {
27 if ( z*z / c2 > 1.0 ) {
31 x = p_[0] *
sqrt( 1 - z*z/c2);
32 y = p_[1] *
sqrt( 1 - z*z/c2);
36 volume = volume +
Geom::pi() * dz * x * y;
48 volume = 4./3. *
Geom::pi() * p_[0] * p_[1] * p_[2];
51 std::cout <<
"FAIL: p_[3] > 0.0" <<std::endl;
52 }
else if ( p_[4] < 0.0 ) {
54 std::cout <<
"FAIL: p_[4] < 0.0" <<std::endl;
55 }
else if ( p_[3] < 0. && p_[4] > 0. ) {
56 volume = halfVol (p_[4]/100000., p_[4]) + halfVol (std::fabs(p_[3]/100000.), std::fabs(p_[3]));
57 }
else if ( p_[3] < 0. ) {
58 volume = volume / 2 + halfVol(std::fabs(p_[3]/100000.), std::fabs(p_[3]));
59 }
else if ( p_[4] > 0. ) {
60 volume = volume / 2 + halfVol (p_[4]/100000., p_[4]);
double volume() const
Not as flexible and possibly less accurate than G4 volume.
double halfVol(double dz, double maxz) const
T x() const
Cartesian x coordinate.
void stream(std::ostream &os) const