AMSDST
myPoint.h
Go to the documentation of this file.
1 // Authors: M.Duranti - INFN di Perugia
2 #ifndef myPoint_h
3 #define myPoint_h
4 
5 #include "TObject.h"
6 #ifdef _WITHGBATCH_
7 
8 #include "root_RVSP.h"
9 #endif
10 
11 #include "TMath.h"
12 
13 #define PI TMath::Pi()
14 class myPoint: public TObject {
15  protected:
16  Float_t _x;
17  Float_t _y;
18  Float_t _z;
19 
20  public:
22  myPoint(float x=0, float y=0, float z=0, bool ignstream=true);
24  myPoint(const myPoint& pt, bool ignstream=true);
26  ~myPoint();
27 #ifdef _WITHGBATCH_
28 
29  myPoint(const AMSPoint& apt, bool ignstream=true);
31  void CopyAMSPoint(const AMSPoint& apt);
32 #endif
33 
34 #ifdef _WITHGBATCH_
35 
36  AMSPoint GetAMSPoint() const;
37 #endif
38 
39  void setp(float x=0, float y=0, float z=0);
40 
41  inline float x() const {return _x;}
42  inline float y() const {return _y;}
43  inline float z() const {return _z;}
44 
46  float & operator[](int i){
47  if(i<=0)return _x;else if(i==1)return _y; else return _z;}
49  float operator[](int i) const{
50  if(i<=0)return _x;else if(i==1)return _y; else return _z;}
51 
52 
53  void Print(Option_t* option="") const;
54 
55  public:
56  ClassDef(myPoint,5);
57 };
58 
59 class myDir: public myPoint {
60  protected:
61  Float_t _theta;
62  Float_t _phi;
63 
64  public:
66  myDir(float theta=PI/2.0, float phi=0, bool ignstream=true);
68  myDir(const myDir& dir, bool ignstream=true);
70  ~myDir();
71 #ifdef _WITHGBATCH_
72 
73  myDir(const myPoint& pt, bool ignstream=true);
75  myDir(const AMSPoint& apt, bool ignstream=true);
77  myDir(const AMSDir& adir, bool ignstream=true);
79  void CopyAMSPoint(const AMSPoint& apt);
81  void CopyAMSDir(const AMSDir& apt);
82 #endif
83 
84 #ifdef _WITHGBATCH_
85 
86  AMSDir GetAMSDir() const;
87 #endif
88 
89  void setd(float theta=PI/2.0, float phi=0);
90 
91  inline float theta() const {return _theta;}
92  inline float phi() const {return _phi;}
93  inline float gettheta() const {return _theta;}
94  inline float getphi() const {return _phi;}
95 
96  public:
97  ClassDef(myDir,4);
98 };
99 #endif