CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
DDI::Ellipsoid Class Reference

#include <Ellipsoid.h>

Inheritance diagram for DDI::Ellipsoid:
DDI::Solid

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. More...
 
 ~Ellipsoid ()
 
- Public Member Functions inherited from DDI::Solid
const std::vector< double > & parameters () const
 
void setParameters (std::vector< double > const &p)
 
DDSolidShape shape () const
 
 Solid ()
 
 Solid (DDSolidShape shape)
 
virtual ~Solid ()
 

Additional Inherited Members

- Protected Attributes inherited from DDI::Solid
std::vector< double > p_
 
DDSolidShape shape_
 

Detailed Description

Definition at line 10 of file Ellipsoid.h.

Constructor & Destructor Documentation

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_.

20  {
21  p_.push_back(xSemiAxis);
22  p_.push_back(ySemiAxis);
23  p_.push_back(zSemiAxis);
24  p_.push_back(zBottomCut);
25  p_.push_back(zTopCut);
26  }
Solid()
Definition: Solid.h:14
std::vector< double > p_
Definition: Solid.h:32
DDI::Ellipsoid::~Ellipsoid ( )
inline

Definition at line 27 of file Ellipsoid.h.

27 { }

Member Function Documentation

double DDI::Ellipsoid::halfVol ( double  dz,
double  maxz 
) const

Definition at line 15 of file Ellipsoid.cc.

References gather_cfg::cout, cmsRelvalreport::exit, Geom::pi(), mathSSE::sqrt(), vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

15  {
16  double volume(0.);
17  double z(0.);
18  double x(p_[0]), y(p_[1]);
19  double c2 = p_[2] * p_[2];
20  for (;z <= maxz; z=z+dz) {
21  // what is x here? what is y? This assumes a TRIANGLE approximation
22  // This assumes that I can estimate the decrease in x and y at current z
23  // at current z, x is the projection down to the x axis.
24  // x = a * sqrt(1-z^2 / c^2 )
25  // unneccesary paranoia?
26  if ( z*z / c2 > 1.0 ) {
27  std::cout << "error!" << std::endl;
28  exit(0);
29  }
30  x = p_[0] * sqrt( 1 - z*z/c2);
31  y = p_[1] * sqrt( 1 - z*z/c2);
32 // if (dispcount < 100)
33 // std::cout << "x = " << x << " y = " << y << " z = " << z << std::endl;
34 // ++dispcount;
35  volume = volume + Geom::pi() * dz * x * y;
36  }
37 // std::cout << " x = " << x;
38 // std::cout << " y = " << y;
39 // std::cout << " z = " << z;
40 // std::cout << " vol = " << volume << std::endl;
41  return volume;
42 }
double volume() const
Not as flexible and possibly less accurate than G4 volume.
Definition: Ellipsoid.cc:44
double double double z
T sqrt(T t)
Definition: SSEVec.h:46
double pi()
Definition: Pi.h:31
std::vector< double > p_
Definition: Solid.h:32
tuple cout
Definition: gather_cfg.py:121
x
Definition: VDTMath.h:216
void DDI::Ellipsoid::stream ( std::ostream &  os) const
virtual

Reimplemented from DDI::Solid.

Definition at line 6 of file Ellipsoid.cc.

References DDI::Solid::p_.

7 {
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;
13 }
std::vector< double > p_
Definition: Solid.h:32
double DDI::Ellipsoid::volume ( void  ) const
virtual

Not as flexible and possibly less accurate than G4 volume.

Reimplemented from DDI::Solid.

Definition at line 44 of file Ellipsoid.cc.

References gather_cfg::cout, and Geom::pi().

44  {
45  double volume(0.);
46  // default if both p_[3] and p_[4] are 0
47  volume = 4./3. * Geom::pi() * p_[0] * p_[1] * p_[2];
48  if ( p_[3] > 0.0 ) {
49  //fail
50  std::cout << "FAIL: p_[3] > 0.0" <<std::endl;
51  } else if ( p_[4] < 0.0 ) {
52  //fail
53  std::cout << "FAIL: p_[4] < 0.0" <<std::endl;
54  } else if ( p_[3] < 0. && p_[4] > 0. ) {
55  volume = halfVol (p_[4]/100000., p_[4]) + halfVol (std::fabs(p_[3]/100000.), std::fabs(p_[3]));
56  } else if ( p_[3] < 0. ) {
57  volume = volume / 2 + halfVol(std::fabs(p_[3]/100000.), std::fabs(p_[3]));
58  } else if ( p_[4] > 0. ) {
59  volume = volume / 2 + halfVol (p_[4]/100000., p_[4]);
60  }
61  return volume;
62 
63 }
double volume() const
Not as flexible and possibly less accurate than G4 volume.
Definition: Ellipsoid.cc:44
double halfVol(double dz, double maxz) const
Definition: Ellipsoid.cc:15
double pi()
Definition: Pi.h:31
std::vector< double > p_
Definition: Solid.h:32
tuple cout
Definition: gather_cfg.py:121