LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
GeoCone.cxx
Go to the documentation of this file.
1 #ifndef BASICTOOL_GEOCONE_CXX
2 #define BASICTOOL_GEOCONE_CXX
3 
4 #include "GeoCone.h"
5 #include <sstream>
6 namespace geoalgo {
7 
9  {
10  _length = 1;
11  _radius = 1;
12  _angle = atan(_radius/_length);
13  }
14 
15  Cone::Cone(const double x, const double y, const double z,
16  const double dirx, const double diry, const double dirz,
17  const double length, const double radius)
18  : HalfLine(x, y, z, dirx, diry, dirz)
19  {
20  if (length == 0){
21  std::ostringstream msg;
22  msg << "<<" << __FUNCTION__ << ">>"
23  << " Cone Length cannot be 0." << std::endl;
24  throw GeoAlgoException(msg.str());
25  }
26  _length = length;
27  _radius = radius;
28  _angle = atan(_radius/_length);
29  }
30 
31  Cone::Cone(const Point_t& start, const Vector_t& dir,
32  const double length, const double radius)
33  : HalfLine( start, dir )
34  {
35  if (length == 0){
36  std::ostringstream msg;
37  msg << "<<" << __FUNCTION__ << ">>"
38  << " Cone Length cannot be 0." << std::endl;
39  throw GeoAlgoException(msg.str());
40  }
41  _length = length;
42  _radius = radius;
43  _angle = atan(_radius/_length);
44  }
45 
46  double Cone::Length() const { return _length; }
47 
48  double Cone::Radius() const { return _radius; }
49 
50  double Cone::Angle() const { return _angle; }
51 
52  void Cone::Length(const double l)
53  {
54  if (l == 0){
55  std::ostringstream msg;
56  msg << "<<" << __FUNCTION__ << ">>"
57  << " Cone Length cannot be 0." << std::endl;
58  throw GeoAlgoException(msg.str());
59  }
60  _length = l;
61  _angle = atan(_radius/_length);
62  }
63 
64  void Cone::Radius(const double r) { _radius = r; _angle = atan(_radius/_length); }
65 }
66 #endif
67 
68 
Float_t x
Definition: compare.C:6
double _radius
Radius of the cone at the base.
Definition: GeoCone.h:62
double _angle
Opening Angle.
Definition: GeoCone.h:63
double _length
Helight (length) of the cone.
Definition: GeoCone.h:61
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
double Length() const
Length getter.
Definition: GeoCone.cxx:46
Class def header for a class HalfLine.
Cone()
Default constructor.
Definition: GeoCone.cxx:8
Double_t radius
Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (P...
Definition: GeoHalfLine.h:26
TDirectory * dir
Definition: macro.C:5
double Angle() const
Angle getter.
Definition: GeoCone.cxx:50
double Radius() const
Length getter.
Definition: GeoCone.cxx:48