#include <Ellipsoid.h>
Public Member Functions | |
Ellipsoid (double xSemiAxis, double ySemiAxis, double zSemiAxis, double zBottomCut=0, double zTopCut=0) | |
double | halfVol (double dz, double maxz) const |
void | stream (std::ostream &os) const |
double | volume () const |
Not as flexible and possibly less accurate than G4 volume. | |
~Ellipsoid () |
Definition at line 10 of file Ellipsoid.h.
DDI::Ellipsoid::Ellipsoid | ( | double | xSemiAxis, |
double | ySemiAxis, | ||
double | zSemiAxis, | ||
double | zBottomCut = 0 , |
||
double | zTopCut = 0 |
||
) | [inline] |
Definition at line 13 of file Ellipsoid.h.
References DDI::Solid::p_.
DDI::Ellipsoid::~Ellipsoid | ( | ) | [inline] |
Definition at line 27 of file Ellipsoid.h.
{ }
double DDI::Ellipsoid::halfVol | ( | double | dz, |
double | maxz | ||
) | const |
Definition at line 16 of file Ellipsoid.cc.
References gather_cfg::cout, cmsRelvalreport::exit, pi, mathSSE::sqrt(), ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.
{ double volume(0.); double z(0.); double x(p_[0]), y(p_[1]); double c2 = p_[2] * p_[2]; for (;z <= maxz; z=z+dz) { // what is x here? what is y? This assumes a TRIANGLE approximation // This assumes that I can estimate the decrease in x and y at current z // at current z, x is the projection down to the x axis. // x = a * sqrt(1-z^2 / c^2 ) // unneccesary paranoia? if ( z*z / c2 > 1.0 ) { std::cout << "error!" << std::endl; exit(0); } x = p_[0] * sqrt( 1 - z*z/c2); y = p_[1] * sqrt( 1 - z*z/c2); // if (dispcount < 100) // std::cout << "x = " << x << " y = " << y << " z = " << z << std::endl; // ++dispcount; volume = volume + Geom::pi() * dz * x * y; } // std::cout << " x = " << x; // std::cout << " y = " << y; // std::cout << " z = " << z; // std::cout << " vol = " << volume << std::endl; return volume; }
void DDI::Ellipsoid::stream | ( | std::ostream & | os | ) | const [virtual] |
Reimplemented from DDI::Solid.
Definition at line 7 of file Ellipsoid.cc.
References DDI::Solid::p_.
double DDI::Ellipsoid::volume | ( | ) | const [virtual] |
Not as flexible and possibly less accurate than G4 volume.
Reimplemented from DDI::Solid.
Definition at line 45 of file Ellipsoid.cc.
References gather_cfg::cout, and pi.
{ double volume(0.); // default if both p_[3] and p_[4] are 0 volume = 4./3. * Geom::pi() * p_[0] * p_[1] * p_[2]; if ( p_[3] > 0.0 ) { //fail std::cout << "FAIL: p_[3] > 0.0" <<std::endl; } else if ( p_[4] < 0.0 ) { //fail std::cout << "FAIL: p_[4] < 0.0" <<std::endl; } else if ( p_[3] < 0. && p_[4] > 0. ) { volume = halfVol (p_[4]/100000., p_[4]) + halfVol (std::fabs(p_[3]/100000.), std::fabs(p_[3])); } else if ( p_[3] < 0. ) { volume = volume / 2 + halfVol(std::fabs(p_[3]/100000.), std::fabs(p_[3])); } else if ( p_[4] > 0. ) { volume = volume / 2 + halfVol (p_[4]/100000., p_[4]); } return volume; }