1 /////////////////////////////////////////////////////////
2 //Class for PID in the ITS //
5 /////////////////////////////////////////////////////////
9 #include "AliITSPidParItem.h"
11 ClassImp(AliITSPidParItem)
12 //____________________________________________________________________
13 AliITSPidParItem::AliITSPidParItem(){
14 // default constructor
17 for(Int_t i=0;i<39;i++){
20 }//____________________________________________________________________
21 AliITSPidParItem::AliITSPidParItem(Float_t center,Float_t width,Double_t *buff){
22 // standard constructor
25 for (Int_t i=0;i<39;i++) fBuff[i]=buff[i];
29 //____________________________________________________________________
30 void AliITSPidParItem::GetParameters(Double_t *buff) const{
31 //get all the parameters
32 for (Int_t i=0;i<39;i++) buff[i]=fBuff[i];
35 //____________________________________________________________________
36 void AliITSPidParItem::GetProtonPar(Double_t *buffp) const{
37 //get the protons' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
46 //____________________________________________________________________
47 void AliITSPidParItem::GetKaonPar(Double_t *buffk) const{
48 //get the kaons' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
57 //____________________________________________________________________
58 void AliITSPidParItem::GetPionPar(Double_t *buffpi) const{
59 //get the pions' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
68 //____________________________________________________________________
69 void AliITSPidParItem::GetPar0(Double_t *buff0) const{
70 //Width Landau for protons, kaons, pions.
75 //____________________________________________________________________
76 void AliITSPidParItem::GetPar1(Double_t *buff1) const{
77 //Most Probable for protons, kaons, pions.
82 //____________________________________________________________________
83 void AliITSPidParItem::GetPar2(Double_t *buff2) const{
84 //Area for protons, kaons, pions.
89 //____________________________________________________________________
90 void AliITSPidParItem::GetPar3(Double_t *buff3) const{
91 //Width Gaussian for protons, kaons, pions.
96 //____________________________________________________________________
97 void AliITSPidParItem::GetChisquare(Double_t *buffchi) const{
98 //Chi2 of the fit for protons, kaons, pions.
100 buffchi[1]=fBuff[21];
101 buffchi[2]=fBuff[34];
103 //____________________________________________________________________
104 void AliITSPidParItem::GetNDF(Double_t *buffndf) const{
105 //NDF of the fit for protons, kaons, pions.
107 buffndf[1]=fBuff[22];
108 buffndf[2]=fBuff[35];
110 //____________________________________________________________________
111 void AliITSPidParItem::GetProParFun(Double_t *pfun) const{
112 //some Protons parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
119 //____________________________________________________________________
120 void AliITSPidParItem::GetKaoParFun(Double_t *kfun) const{
121 //some Kaons parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
128 //____________________________________________________________________
129 void AliITSPidParItem::GetPiParFun(Double_t *pifun) const{
130 //some Pions parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
137 //____________________________________________________________________
138 void AliITSPidParItem::GetRangeLim(Double_t *range) const{
139 //Range limits for the response functions
140 range[0]=fBuff[11];//proton low
141 range[1]=fBuff[12];//proton high
142 range[2]=fBuff[24];//kaon low
143 range[3]=fBuff[25];//kaon high
144 range[4]=fBuff[37];//pion low
145 range[5]=fBuff[38];//pion high
147 //____________________________________________________________________
148 void AliITSPidParItem::GetProtonParErr(Double_t *bufferp)const{
149 //errors on the protons' parameters
155 //____________________________________________________________________
156 void AliITSPidParItem::GetKaonParErr(Double_t *bufferk)const{
157 //errors on the kaons' parameters
158 bufferk[0]=fBuff[17];
159 bufferk[1]=fBuff[18];
160 bufferk[2]=fBuff[19];
161 bufferk[3]=fBuff[20];
163 //____________________________________________________________________
164 void AliITSPidParItem::GetPionParErr(Double_t *bufferpi)const{
165 //errors on the pions' parameters
166 bufferpi[0]=fBuff[30];
167 bufferpi[1]=fBuff[31];
168 bufferpi[2]=fBuff[32];
169 bufferpi[3]=fBuff[33];
171 //____________________________________________________________________
172 void AliITSPidParItem::PrintParameters() const {
173 // Prints the data members of this class
174 cout<<"==============================***************"<<endl;
175 cout<<"Momentum (GeV/c) - center of the bin - "<<fPCenter<<endl;
176 cout<<" Width of momentum bin (GeV/c) "<<fPWidth<<endl;
177 for (Int_t i=0;i<39;i++) cout<<"Parameter"<<i<<" = "<<fBuff[i]<<endl;
181 //_______________________________________________________________________
182 TF1* AliITSPidParItem::CookFunIts(TString namefun,Double_t *par,Double_t rangei,Double_t rangef,TString comment){
186 fun=new TF1(comment,Langaufun2,rangei,rangef,5);
187 fun->SetParameters(par);
190 else {fun=new TF1(namefun,"0");}
194 //_________________________________________________________________________
195 Double_t AliITSPidParItem::Langaufun(Double_t *x, Double_t *par) {
198 //par[0]=Width (scale) parameter of Landau density
199 //par[1]=Most Probable (MP, location) parameter of Landau density
200 //par[2]=Total area (integral -inf to inf, normalization constant)
201 //par[3]=Width (sigma) of convoluted Gaussian function
203 //In the Landau distribution (represented by the CERNLIB approximation),
204 //the maximum is located at x=-0.22278298 with the location parameter=0.
205 //This shift is corrected within this function, so that the actual
206 //maximum is identical to the MP parameter.
209 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
210 Double_t mpshift = -0.22278298; // Landau maximum location
213 Double_t np = 100.0; // number of convolution steps
214 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
226 // MP shift correction
227 mpc = par[1] - mpshift * par[0];
229 // Range of convolution integral
230 xlow = x[0] - sc * par[3];
231 xupp = x[0] + sc * par[3];
233 step = (xupp-xlow) / np;
235 // Convolution integral of Landau and Gaussian by sum
236 for(i=1.0; i<=np/2; i++) {
237 xx = xlow + (i-.5) * step;
238 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
239 sum += fland * TMath::Gaus(x[0],xx,par[3]);
241 xx = xupp - (i-.5) * step;
242 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
243 sum += fland * TMath::Gaus(x[0],xx,par[3]);
246 return (par[2] * step * sum * invsq2pi / par[3]);
248 //_______________________________________________________________________
249 Double_t AliITSPidParItem::Langaufun2(Double_t *x, Double_t *par){
251 return 1/par[4]*Langaufun(x,par);