AMSDST
myBetaH.cxx
Go to the documentation of this file.
1 // Authors: M.Duranti - INFN di Perugia
2 #include "myBetaH.h"
3 #include "debug.h"
4 #include "TClass.h"
5 
6 using namespace std;
7 
8 //--------------------------------------------------------------------
9 
11 #ifdef _WITHGBATCH_
12 ClassImp(myBetaHFiller);
13 #endif //#ifdef _WITHGBATCH_
14 
15 //--------------------------------------------------------------------
16 
18 #ifdef PDEBUG
19  printf("In myBetaH::myBetaH\n");
20 #endif
21  PRINTDEBUG;
22  init();
23  PRINTDEBUG;
24 }
25 
27 #ifdef PDEBUG
28  printf("In myBetaH::~myBetaH\n");
29 #endif
30  PRINTDEBUG;
31 }
32 
33 void myBetaH::Clear(Option_t* option){
34 #ifdef PDEBUG
35  printf("In myBetaH::Clear\n");
36 #endif
37  PRINTDEBUG;
38  Q = -999999;
39  QRMS = -999999;
40  Beta = -999999;
41  Chi2T = 9999;
42  Chi2C = 9999;
43  EBetaV = -999999;
44  BetaPattern = 999999;
45  Status=-999999;
46  PRINTDEBUG;
47  SumHit = -999;
48  UseHit = -999;
49  PRINTDEBUG;
50  _iTrTrack = -9999;
51  _iEcalShower = -9999;
52  _iTrdTrack = -9999;
53  PRINTDEBUG;
54  fill_n(TofTimeOnLayer, 9, 0);
55  fill_n(TofXOnLayer, 9, 0);
56  fill_n(TofYOnLayer, 9, 0);
57  PRINTDEBUG;
58  return;
59 }
60 
62 #ifdef PDEBUG
63  printf("In myBetaH::init\n");
64 #endif
65  PRINTDEBUG;
66  Clear();
67  PRINTDEBUG;
68  return;
69 }
70 
71 //----------------------------------------------------------------
72 
73 #ifdef _WITHGBATCH_
74 
75 myBetaHFiller::myBetaHFiller(){
76 #ifdef PDEBUG
77  printf("In myBetaHFiller::myBetaHFiller\n");
78 #endif
79  PRINTDEBUG;
80  init();
81  PRINTDEBUG;
82 }
83 
84 myBetaHFiller::~myBetaHFiller(){
85 #ifdef PDEBUG
86  printf("In myBetaHFiller::~myBetaHFiller\n");
87 #endif
88  PRINTDEBUG;
89 }
90 
91 void myBetaHFiller::Clear(Option_t* option){
92 #ifdef PDEBUG
93  printf("In myBetaHFiller::Clear\n");
94 #endif
95  PRINTDEBUG;
96  betah=0;
97  PRINTDEBUG;
98  return;
99 }
100 
101 void myBetaHFiller::init(){
102 #ifdef PDEBUG
103  printf("In myBetaHFiller::init\n");
104 #endif
105  PRINTDEBUG;
106  Clear();
107  PRINTDEBUG;
108  return;
109 }
110 
111 void myBetaHFiller::Fill(BetaHR* _betah){
112 #ifdef PDEBUG
113  printf("In myBetaHFiller::Fill\n");
114 #endif
115  PRINTDEBUG;
116 
117  betah = _betah;
118 
119  //--------------------------TOF-------------------------------
120  if (betah) {
121 
122  int QNPoints = -999999;
123  Q = betah->GetQ(QNPoints, QRMS);
124 
125  Beta = betah->GetBeta();
126  EBetaV = betah->GetEBetaV();
127  BetaPattern = betah->GetBetaPattern();
128  Status = betah->GetStatus();
129  Chi2T = betah->GetChi2T();
130  Chi2C = betah->GetChi2C();
131 
132  SumHit = betah->GetSumHit();
133  UseHit = betah->GetUseHit();
134 
135 
136  _iTrTrack = betah->iTrTrack();
137  PRINTDEBUG;
138 
139  _iEcalShower = betah->iEcalShower();
140  PRINTDEBUG;
141 
142  _iTrdTrack = betah->iTrdTrack();
143  PRINTDEBUG;
144  double toftime=0.;
145  for (int jlayer=1; jlayer<=9; jlayer++) {
146  static AMSPoint global;
147  static AMSDir dir;
148 
149  double zA=TkDBc::Head->GetZlayerAJ (jlayer);
150  double z= TkDBc::Head->GetZlayerJ (jlayer);
151 
152  betah->TInterpolate (zA, global, dir, toftime, false);
153  TofTimeOnLayer[jlayer-1]= (Double32_t )toftime;
154  TofXOnLayer[jlayer-1]=global.x();
155  TofYOnLayer[jlayer-1]=global.y();
156  }
157 
158 
159 
160 
161  }
162 
163  PRINTDEBUG;
164 
165  return;
166 }
167 
168 Double_t myBetaHFiller::GetTofCharge(int pattern){
169  //pattern =0 ALL Tof Layer
170  //pattern =1 Upper Tof
171  //pattern =2 Lower Tof
172 #ifdef PDEBUG
173  printf("In myBetaHFiller::GetTofCharge\n");
174 #endif
175  PRINTDEBUG;
176  if(!betah) return 0;
177  int first_layer=0;
178  int last_layer=4;
179  if (pattern==1){
180  first_layer=0;
181  last_layer=2;
182  }else if (pattern==2){
183  first_layer=2;
184  last_layer=4;
185  }
186 
187  Double_t tofh_q_upp = 0;
188  Double_t tofh_n_upp = 0;
189  Double_t tofh_r_upp = 0;
190  AMSPoint pnt;AMSDir dir; double time;
191  for (int ilay=first_layer; ilay<last_layer; ilay++) {
192  if(!betah->GetClusterHL(ilay)) continue;
193  betah->TInterpolate(betah->GetClusterHL(ilay)->Coo[2],pnt,dir,time);
194  if (!TOFGeom::IsGoodQGeom(ilay,betah->GetClusterHL(ilay)->Bar,pnt)) continue;
195  Double_t q = betah->GetQL(ilay,2);
196  if (q<=1e-6) continue;
197  tofh_q_upp += q;
198  tofh_r_upp += q*q;
199  tofh_n_upp++;
200  }
201 
202  if (tofh_n_upp>0) {
203  tofh_q_upp /= tofh_n_upp;
204  tofh_r_upp /= tofh_n_upp;
205  tofh_r_upp = sqrt(tofh_r_upp - tofh_q_upp*tofh_q_upp);
206  }
207 
208  return tofh_q_upp;
209 }
210 
211 #endif //#ifdef _WITHGBATCH_