HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hgeomvector2.h
Go to the documentation of this file.
1 #ifndef HGEOMVECTOR2_H
2 #define HGEOMVECTOR2_H
3 using namespace std;
4 #include "TObject.h"
5 #include "TMath.h"
6 #include <math.h>
7 #include <iostream>
8 #include <iomanip>
9 #include "hgeomvector.h"
10 
11 
12 class HGeomVector2 : public HGeomVector {
13 protected:
14  Double_t Rad;
15  Double_t Phi;
16  Double_t Theta;
17 public:
18  HGeomVector2(Double_t dx=0,Double_t dy=0,Double_t dz=0):
19  HGeomVector(dx,dy,dz)
20  {
21  Rad=Phi=Theta=0.0;
22  }
24  {
25  Rad=Phi=Theta=0.0;
26  }
28  Double_t getRad() const {return Rad;}
29  Double_t getPhi() const {return Phi;}
30  Double_t getTheta() const {return Theta;}
31  void setRad(const Double_t a) {Rad=a;}
32  void setPhi(const Double_t a) {Phi=a;}
33  void setTheta(const Double_t a) {Theta=a;}
34  void sphereCoord(Float_t& rad, Float_t& theta, Float_t& phi);
35 // friend ostream& operator << (ostream& put,const HGeomVector& v);
36 // friend istream& operator >> (istream& get,HGeomVector& v);
37 
38  ClassDef(HGeomVector2,1) // vector with 3 spherical components
39 };
40 
41 // -------------------- inlines ---------------------------
42 
43 inline void HGeomVector2::sphereCoord(Float_t& rad, Float_t& theta, Float_t& phi) {
44  Double_t r,k;
45 
46  rad = length();
47  k = 180./(TMath::Pi());
48 
49  theta = k*(TMath::ACos(z/rad));
50 
51  r = TMath::Sqrt(x*x+y*y);
52  phi = k*(TMath::ACos(x/r));
53  if (y<0) phi = 360. - phi;
54 }
55 
56 /*
57 inline ostream& operator << (ostream& put,const HGeomVector& v) {
58  return put<<v(0)<<" "<<v(1)<<" "<<v(2)<<'\n';
59 }
60 
61 inline istream& operator >> (istream& get,HGeomVector& v) {
62  Double_t x[3];
63  get>>x[0]>>x[1]>>x[2];
64  v.setVector(x);
65  return get;
66 }
67 */
68 
69 #endif /* !HGEOMVECTOR_H */
70 
HGeomVector2(Double_t dx=0, Double_t dy=0, Double_t dz=0)
Definition: hgeomvector2.h:18
Double_t getRad() const
Definition: hgeomvector2.h:28
Double_t Theta
Definition: hgeomvector2.h:16
void setRad(const Double_t a)
Definition: hgeomvector2.h:31
Double_t getPhi() const
Definition: hgeomvector2.h:29
Double_t theta
void setTheta(const Double_t a)
Definition: hgeomvector2.h:33
void sphereCoord(Float_t &rad, Float_t &theta, Float_t &phi)
Definition: hgeomvector2.h:43
Double_t Rad
Definition: hgeomvector2.h:14
void setPhi(const Double_t a)
Definition: hgeomvector2.h:32
HGeomVector2(const HGeomVector &v)
Definition: hgeomvector2.h:23
Float_t phi
Definition: drawAccCuts.C:15
Double_t getTheta() const
Definition: hgeomvector2.h:30
Double_t Phi
Definition: hgeomvector2.h:15