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