GRUTinizer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TGretinaHit.h
Go to the documentation of this file.
1 #ifndef TGRETINAHIT_H
2 #define TGRETINAHIT_H
3 
4 #include <TObject.h>
5 #include <Rtypes.h>
6 #include <TVector3.h>
7 #include <TMath.h>
8 
9 #include <cmath>
10 
11 #include "TGEBEvent.h"
12 #include "TDetectorHit.h"
13 
14 #define MAXHPGESEGMENTS 36
15 
16 class TGretinaHit : public TDetectorHit {
17 
18 public:
19  TGretinaHit();
20  ~TGretinaHit();
21 
22  void Copy(TObject& obj) const;
23 
24  void BuildFrom(const TRawEvent::GEBBankType1& raw);
25 
26  Long_t GetTimestamp() const { return fTimeStamp; }
27  Double_t GetTime() const { return (double)fTimeStamp - (double)fWalkCorrection; }
28  Int_t GetAddress() const { return fAddress; }
29  Int_t GetCrystalId() const { return fCrystalId; }
30  Int_t GetHoleNumber() const { return fCrystalId/4-1; }
31  Int_t GetCrystalNumber() const { return fCrystalId%4; }
32  Float_t GetCoreEnergy() const { return fCoreEnergy; }
33  Int_t GetCoreCharge(int i) const { return fCoreCharge[i]; }
34  virtual Int_t Charge() const { return fCoreCharge[3]; }
35 
36 
37  void Print(Option_t *opt="") const;
38  void Clear(Option_t *opt="");
39  const Int_t Size() { return fNumberOfInteractions; }//fSegmentNumber.size(); }
40 
41  double GetX() { return GetPosition().X(); }
42  double GetY() { return GetPosition().Y(); }
43  double GetZ() { return GetPosition().Z(); }
44 
45  double GetPhi() {
46  double phi = GetPosition().Phi();
47  if(phi<0) {
48  return TMath::TwoPi()+phi;
49  } else {
50  return phi;
51  }
52  }
53  double GetTheta() { return GetPosition().Theta(); }
54  double GetPhiDeg() { return GetPhi()*TMath::RadToDeg(); }
55  double GetThetaDeg() { return GetTheta()*TMath::RadToDeg(); }
56 
57 
59  //TGretinaHit& operator+=(const TGretinaHit&);
60  //TGretinaHit& operator+(const TGretinaHit&);
61 
62 
63  double GetDoppler(double beta,const TVector3 *vec=0) {
64  if(Size()<1)
65  return 0.0;
66  bool madevec = false;
67  if(vec==0) {
68  vec = &BeamUnitVec;
69  }
70  double tmp = 0.0;
71  double gamma = 1/(sqrt(1-pow(beta,2)));
72  tmp = fCoreEnergy*gamma *(1 - beta*TMath::Cos(GetPosition().Angle(*vec)));
73  return tmp;
74  }
75 
76  double GetDoppler_dB(double beta,const TVector3 *vec=0, double Dta=0);
77 
78 
79 
80  Int_t GetFirstIntPoint() const { return fFirstInteraction; }
81  Int_t GetSecondIntPoint() const { return fSecondInteraction; }
82  Int_t NumberOfInteractions() const { return fNumberOfInteractions; }
83  Int_t GetSegmentId(const int &i) const { return fSegmentNumber[i]; }
84  Float_t GetSegmentEng(const int &i) const { return fInteractionEnergy[i]; }
85  TVector3 GetInteractionPosition(int i) const; //{ return fGlobalInteractionPosition[i]; }
86  TVector3 GetLocalPosition(int i) const;
87  //TVector3 GetCrystalPosition(int i) const { return TVector3(0,0,1): }
88  TVector3 GetPosition() const { return GetFirstIntPosition(); }
89 
90  TVector3 GetFirstIntPosition() const;
91  TVector3 GetSecondIntPosition() const;
92 
93  bool CheckAddback(const TGretinaHit&) const;
94  void AddToSelf(const TGretinaHit& other, double& max_energy);
95 
96  //void SetPosition(TVector3 &vec) { fCorePosition = vec; }
97 
98 private:
99  void SortHits();
100 
101  Long_t fTimeStamp;
103 
104  Int_t fAddress;
105  Int_t fCrystalId;
106  Float_t fCoreEnergy;
107  Int_t fCoreCharge[4];
108 
111 
113 
115 
119  Int_t fSegmentNumber[MAXHPGESEGMENTS]; //[fNumberOfInteractions]
120 
122 
127  TVector3 fGlobalInteractionPosition[MAXHPGESEGMENTS]; //[fNumberOfInteractions]
128  TVector3 fLocalInteractionPosition[MAXHPGESEGMENTS]; //[fNumberOfInteractions]
129  Float_t fInteractionEnergy[MAXHPGESEGMENTS]; //[fNumberOfInteractions]
130  Float_t fInteractionFraction[MAXHPGESEGMENTS]; //[fNumberOfInteractions]
131 
133 };
134 
135 
136 #endif