1 /////////////////////////////////////////////////////////
2 //Class for PID in the ITS //
5 /////////////////////////////////////////////////////////
9 #include "AliITSPidParItem.h"
11 ClassImp(AliITSPidParItem)
12 //____________________________________________________________________
13 AliITSPidParItem::AliITSPidParItem():
17 // default constructor
18 for(Int_t i=0;i<39;i++){
21 }//____________________________________________________________________
22 AliITSPidParItem::AliITSPidParItem(Float_t center,Float_t width,Double_t *buff):
26 // standard constructor
27 for (Int_t i=0;i<39;i++) fBuff[i]=buff[i];
31 //____________________________________________________________________
32 void AliITSPidParItem::GetParameters(Double_t *buff) const{
33 //get all the parameters
34 for (Int_t i=0;i<39;i++) buff[i]=fBuff[i];
37 //____________________________________________________________________
38 void AliITSPidParItem::GetProtonPar(Double_t *buffp) const{
39 //get the protons' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
48 //____________________________________________________________________
49 void AliITSPidParItem::GetKaonPar(Double_t *buffk) const{
50 //get the kaons' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
59 //____________________________________________________________________
60 void AliITSPidParItem::GetPionPar(Double_t *buffpi) const{
61 //get the pions' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
70 //____________________________________________________________________
71 void AliITSPidParItem::GetPar0(Double_t *buff0) const{
72 //Width Landau for protons, kaons, pions.
77 //____________________________________________________________________
78 void AliITSPidParItem::GetPar1(Double_t *buff1) const{
79 //Most Probable for protons, kaons, pions.
84 //____________________________________________________________________
85 void AliITSPidParItem::GetPar2(Double_t *buff2) const{
86 //Area for protons, kaons, pions.
91 //____________________________________________________________________
92 void AliITSPidParItem::GetPar3(Double_t *buff3) const{
93 //Width Gaussian for protons, kaons, pions.
98 //____________________________________________________________________
99 void AliITSPidParItem::GetChisquare(Double_t *buffchi) const{
100 //Chi2 of the fit for protons, kaons, pions.
102 buffchi[1]=fBuff[21];
103 buffchi[2]=fBuff[34];
105 //____________________________________________________________________
106 void AliITSPidParItem::GetNDF(Double_t *buffndf) const{
107 //NDF of the fit for protons, kaons, pions.
109 buffndf[1]=fBuff[22];
110 buffndf[2]=fBuff[35];
112 //____________________________________________________________________
113 void AliITSPidParItem::GetProParFun(Double_t *pfun) const{
114 //some Protons parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
121 //____________________________________________________________________
122 void AliITSPidParItem::GetKaoParFun(Double_t *kfun) const{
123 //some Kaons parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
130 //____________________________________________________________________
131 void AliITSPidParItem::GetPiParFun(Double_t *pifun) const{
132 //some Pions parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
139 //____________________________________________________________________
140 void AliITSPidParItem::GetRangeLim(Double_t *range) const{
141 //Range limits for the response functions
142 range[0]=fBuff[11];//proton low
143 range[1]=fBuff[12];//proton high
144 range[2]=fBuff[24];//kaon low
145 range[3]=fBuff[25];//kaon high
146 range[4]=fBuff[37];//pion low
147 range[5]=fBuff[38];//pion high
149 //____________________________________________________________________
150 void AliITSPidParItem::GetProtonParErr(Double_t *bufferp)const{
151 //errors on the protons' parameters
157 //____________________________________________________________________
158 void AliITSPidParItem::GetKaonParErr(Double_t *bufferk)const{
159 //errors on the kaons' parameters
160 bufferk[0]=fBuff[17];
161 bufferk[1]=fBuff[18];
162 bufferk[2]=fBuff[19];
163 bufferk[3]=fBuff[20];
165 //____________________________________________________________________
166 void AliITSPidParItem::GetPionParErr(Double_t *bufferpi)const{
167 //errors on the pions' parameters
168 bufferpi[0]=fBuff[30];
169 bufferpi[1]=fBuff[31];
170 bufferpi[2]=fBuff[32];
171 bufferpi[3]=fBuff[33];
173 //____________________________________________________________________
174 void AliITSPidParItem::PrintParameters() const {
175 // Prints the data members of this class
176 cout<<"==============================***************"<<endl;
177 cout<<"Momentum (GeV/c) - center of the bin - "<<fPCenter<<endl;
178 cout<<" Width of momentum bin (GeV/c) "<<fPWidth<<endl;
179 for (Int_t i=0;i<39;i++) cout<<"Parameter"<<i<<" = "<<fBuff[i]<<endl;
183 //_______________________________________________________________________
184 TF1* AliITSPidParItem::CookFunIts(TString namefun,Double_t *par,Double_t rangei,Double_t rangef,TString comment){
188 fun=new TF1(comment,Langaufun2,rangei,rangef,5);
189 fun->SetParameters(par);
192 else {fun=new TF1(namefun,"0");}
196 //_________________________________________________________________________
197 Double_t AliITSPidParItem::Langaufun(Double_t *x, Double_t *par) {
200 //par[0]=Width (scale) parameter of Landau density
201 //par[1]=Most Probable (MP, location) parameter of Landau density
202 //par[2]=Total area (integral -inf to inf, normalization constant)
203 //par[3]=Width (sigma) of convoluted Gaussian function
205 //In the Landau distribution (represented by the CERNLIB approximation),
206 //the maximum is located at x=-0.22278298 with the location parameter=0.
207 //This shift is corrected within this function, so that the actual
208 //maximum is identical to the MP parameter.
211 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
212 Double_t mpshift = -0.22278298; // Landau maximum location
215 Double_t np = 100.0; // number of convolution steps
216 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
228 // MP shift correction
229 mpc = par[1] - mpshift * par[0];
231 // Range of convolution integral
232 xlow = x[0] - sc * par[3];
233 xupp = x[0] + sc * par[3];
235 step = (xupp-xlow) / np;
237 // Convolution integral of Landau and Gaussian by sum
238 for(i=1.0; i<=np/2; i++) {
239 xx = xlow + (i-.5) * step;
240 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
241 sum += fland * TMath::Gaus(x[0],xx,par[3]);
243 xx = xupp - (i-.5) * step;
244 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
245 sum += fland * TMath::Gaus(x[0],xx,par[3]);
248 return (par[2] * step * sum * invsq2pi / par[3]);
250 //_______________________________________________________________________
251 Double_t AliITSPidParItem::Langaufun2(Double_t *x, Double_t *par){
253 return 1/par[4]*Langaufun(x,par);