]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEERBase/AliTPCdEdxInfo.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTPCdEdxInfo.cxx
1
2 //##################################################################
3 //
4 // Simple class to store TPC dE/dx info for different pad regions.
5 //
6 // Origin: Marian Ivanov, Alexander Kalweit 
7 //
8 //##################################################################
9
10 #include "AliTPCdEdxInfo.h"
11 #include "TObjArray.h"
12 #include "TGraphErrors.h"
13 #include "AliExternalTrackParam.h"
14
15
16 TObjArray * AliTPCdEdxInfo::fArraySectorCalibration=0;
17
18 ClassImp(AliTPCdEdxInfo)
19
20 AliTPCdEdxInfo::AliTPCdEdxInfo():
21   TObject(),
22   fTPCsignalRegion(),
23   fTPCsignalRegionQmax(),
24   fTPCsignalNRegion(),
25   fTPCsignalNRowRegion()
26 {
27   // Default constructor
28   for (Int_t i=0;i<3; i++){
29     fTPCsignalRegion[i]=0;
30     fTPCsignalRegionQmax[i]=0;
31     fTPCsignalNRegion[i]=0;
32     fTPCsignalNRowRegion[i]=0;
33   }
34   fTPCsignalRegion[3]=0;
35   fTPCsignalRegionQmax[3]=0;
36   
37 }
38
39 //_______________________________________________________________________________________________
40 AliTPCdEdxInfo::AliTPCdEdxInfo(const AliTPCdEdxInfo& source):
41     TObject(),
42     fTPCsignalRegion(),
43     fTPCsignalRegionQmax(),
44     fTPCsignalNRegion(),
45     fTPCsignalNRowRegion()
46 {
47     //
48     // copy constructor
49     //
50     for (Int_t i=0;i<3; i++){
51       fTPCsignalRegion[i]     = source.fTPCsignalRegion[i];
52       fTPCsignalRegionQmax[i] = source.fTPCsignalRegionQmax[i];
53       fTPCsignalNRegion[i]    = source.fTPCsignalNRegion[i];
54       fTPCsignalNRowRegion[i] = source.fTPCsignalNRowRegion[i];
55     }
56     fTPCsignalRegion[3]       = source.fTPCsignalRegion[3];
57     fTPCsignalRegionQmax[3]   = source.fTPCsignalRegionQmax[3];
58     
59 }
60
61 //_______________________________________________________________________________________________
62 AliTPCdEdxInfo& AliTPCdEdxInfo::operator=(const AliTPCdEdxInfo& source)
63 {
64     //
65     // assignment operator
66     //
67
68   if (&source == this) return *this;
69   TObject::operator=(source);
70
71   for (Int_t i=0;i<3; i++){
72     fTPCsignalRegion[i]     = source.fTPCsignalRegion[i];
73     fTPCsignalRegionQmax[i] = source.fTPCsignalRegionQmax[i];
74     fTPCsignalNRegion[i]    = source.fTPCsignalNRegion[i];
75     fTPCsignalNRowRegion[i] = source.fTPCsignalNRowRegion[i];
76   }
77   fTPCsignalRegion[3]       = source.fTPCsignalRegion[3];
78   fTPCsignalRegionQmax[3]   = source.fTPCsignalRegionQmax[3];
79   
80   return *this;
81
82 }
83
84 //_______________________________________________________________________________________________
85 void  AliTPCdEdxInfo::GetTPCSignalRegionInfo(Double_t signal[4], Char_t ncl[3], Char_t nrows[3]) const {
86   //
87   // Get the TPC dEdx variables per region
88   //
89   // Double32_t  fTPCsignalRegion[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)  
90   // Char_t      fTPCsignalNRegion[3]; // number of clusters above threshold used in the dEdx calculation
91   // Char_t      fTPCsignalNRowRegion[3]; // number of crosed rows used in the dEdx calculation - signal below threshold included
92   //
93   for (Int_t i=0; i<3; i++){
94     signal[i]=fTPCsignalRegion[i];
95     ncl[i]=fTPCsignalNRegion[i];
96     nrows[i]=fTPCsignalNRowRegion[i];
97   }
98   signal[3]=fTPCsignalRegion[3];
99   return; 
100 }
101
102 //_______________________________________________________________________________________________
103 void  AliTPCdEdxInfo::GetTPCSignals(Double_t signal[4]) const {
104   //
105   // Set the TPC dEdx variables per region
106   //
107   // Double32_t  fTPCsignalRegionQmax[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)
108   //
109   for (Int_t i=0;i<4; i++){
110     signal[i]=fTPCsignalRegion[i];
111   }
112 }
113
114 //_______________________________________________________________________________________________
115 void  AliTPCdEdxInfo::SetTPCSignalRegionInfo(Double_t signal[4], Char_t ncl[3], Char_t nrows[3]){
116   //
117   // Set the TPC dEdx variables per region
118   //
119   // Double32_t  fTPCsignalRegion[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)  
120   // Char_t      fTPCsignalNRegion[3]; // number of clusters above threshold used in the dEdx calculation
121   // Char_t      fTPCsignalNRowRegion[3]; // number of crosed rows used in the dEdx calculation - signal below threshold included
122   //
123   for (Int_t i=0;i<3; i++){
124     fTPCsignalRegion[i]=signal[i];
125     fTPCsignalNRegion[i]=ncl[i];
126     fTPCsignalNRowRegion[i]=nrows[i];
127   }
128   fTPCsignalRegion[3]=signal[3];
129   return;
130 }
131
132 //_______________________________________________________________________________________________
133 void  AliTPCdEdxInfo::SetTPCSignals(Double_t signal[4]){
134   //
135   // Set the TPC dEdx variables per region
136   //
137   // Double32_t  fTPCsignalRegionQmax[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)
138   //
139   for (Int_t i=0;i<4; i++){
140     fTPCsignalRegion[i]=signal[i];
141   }
142 }
143
144 //_______________________________________________________________________________________________
145 void  AliTPCdEdxInfo::GetTPCSignalRegionInfoQmax(Double_t signal[4], Char_t ncl[3], Char_t nrows[3]) const {
146   //
147   // Get the TPC dEdx variables per region
148   //
149   // Double32_t  fTPCsignalRegionQmax[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)
150   // Char_t      fTPCsignalNRegion[3]; // number of clusters above threshold used in the dEdx calculation
151   // Char_t      fTPCsignalNRowRegion[3]; // number of crosed rows used in the dEdx calculation - signal below threshold included
152   //
153   for (Int_t i=0; i<3; i++){
154     signal[i]=fTPCsignalRegionQmax[i];
155     ncl[i]=fTPCsignalNRegion[i];
156     nrows[i]=fTPCsignalNRowRegion[i];
157   }
158   signal[3]=fTPCsignalRegionQmax[3];
159   return;
160 }
161
162 //_______________________________________________________________________________________________
163 void  AliTPCdEdxInfo::GetTPCSignalsQmax(Double_t signal[4]) const {
164   //
165   // Set the TPC dEdx variables per region
166   //
167   // Double32_t  fTPCsignalRegionQmax[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)
168   //
169   for (Int_t i=0;i<4; i++){
170     signal[i]=fTPCsignalRegionQmax[i];
171   }
172 }
173
174 //_______________________________________________________________________________________________
175 void  AliTPCdEdxInfo::SetTPCSignalRegionInfoQmax(Double_t signal[4], Char_t ncl[3], Char_t nrows[3]){
176   //
177   // Set the TPC dEdx variables per region
178   //
179   // Double32_t  fTPCsignalRegionQmax[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)
180   // Char_t      fTPCsignalNRegion[3]; // number of clusters above threshold used in the dEdx calculation
181   // Char_t      fTPCsignalNRowRegion[3]; // number of crosed rows used in the dEdx calculation - signal below threshold included
182   //
183   for (Int_t i=0;i<3; i++){
184     fTPCsignalRegionQmax[i]=signal[i];
185     fTPCsignalNRegion[i]=ncl[i];
186     fTPCsignalNRowRegion[i]=nrows[i];
187   }
188   fTPCsignalRegionQmax[3]=signal[3];
189   return;
190 }
191
192 //_______________________________________________________________________________________________
193 void  AliTPCdEdxInfo::SetTPCSignalsQmax(Double_t signal[4]){
194   //
195   // Set the TPC dEdx variables per region
196   //
197   // Double32_t  fTPCsignalRegionQmax[4]; // TPC dEdx signal in 4 different regions - 0 - IROC, 1- OROC medium, 2 - OROC long, 3- OROC all, (default truncation used)
198   //
199   for (Int_t i=0;i<4; i++){
200     fTPCsignalRegionQmax[i]=signal[i];
201   }
202 }
203
204
205 Double_t AliTPCdEdxInfo::GetWeightedMean(Int_t qType, Int_t wType, Double_t w0, Double_t w1, Double_t w2){
206   //
207   // Get weighted mean of the dEdx information
208   //
209   Double_t *info = (qType==0)? fTPCsignalRegion :  fTPCsignalRegionQmax;
210   Char_t *ninfo = (wType==0)? fTPCsignalNRegion:  fTPCsignalNRowRegion;
211   Double_t weight[3]={w0,w1,w2};
212   Double_t sum=0;
213   Double_t sumw=0;
214   for (Int_t i=0; i<3; i++){
215     sum+= info[i]*Double_t(ninfo[i])*weight[i];
216     sumw+= ninfo[i]*weight[i];
217   }
218   Double_t result = (sumw>0) ? sum/sumw:0;
219   return result;
220 }
221
222 //
223 // Apply second order calibration  of the dEdx
224 //
225
226 void  AliTPCdEdxInfo::RegisterSectorCalibration(TGraphErrors* gainSector, Int_t regionID, Int_t calibID){
227   //
228   // Register sector calibration
229   //
230   // create if arrray does not exist
231   if (!fArraySectorCalibration) fArraySectorCalibration= new TObjArray((calibID+1)*3*10); // boook space for calibration pointer
232   // resize if not enough booked
233   if (fArraySectorCalibration->GetSize()<(calibID+1)*3) fArraySectorCalibration->Expand((calibID+1)*3);
234   //
235   fArraySectorCalibration->AddAt(gainSector, 3*calibID+regionID);
236 }
237
238 // Double_t AliTPCdEdxInfo::GetNormalizeddEdx(AliExternalTrackParam *param, Double_t bz,  Int_t regionID, Int_t calibID, Int_t qID){
239 //   //
240 //   //
241 //   // 
242 //   static AliTPCParamSR paramSR;
243 //   static Double_t radius[3] ={0.5*(paramSR.GetInnerRadiusLow()+paramSR.GetInnerRadiusUp()),
244 //                            0.5*(paramSR.GetPadRowRadii(36,0)+paramSR.GetPadRowRadii(36,paramSR.GetNRowUp1()-1)),
245 //                            0.5*(paramSR.GetPadRowRadii(36,0)+paramSR.GetPadRowRadii(36,paramSR.GetNRowUp()-1))};
246 //   Double_t phi= param->GetParameterAtRadius(radius[regionID],bz,7);
247
248 //   TGraphErrors * graphSectorCorection = fArraySectorCalibration->At(regionID+3*calibID);
249 //   Double_t dEdx = 0;
250 //   if (qID==0) dEdx = fTPCsignalRegion[regionID];
251 //   if (qID==1) dEdx = fTPCsignalRegionQmax[regionID];
252 //   if (graphSectorCorection) dEdx /=graphSectorCorection->EvalAt(sector);
253 //   return dEdx;
254 // }
255
256
257
258 Double_t   AliTPCdEdxInfo::GetdEdxInfo(AliExternalTrackParam *param, Int_t regionID, Int_t calibID, Int_t qID, Int_t valueID){
259   //
260   //
261   //
262
263   return param->GetParameter()[regionID];
264 }
265
266