1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 /////////////////////////////////////////////////////////
19 //Class for PID in the ITS //
22 /////////////////////////////////////////////////////////
24 #include <Riostream.h>
28 #include "AliITSPidParItem.h"
30 ClassImp(AliITSPidParItem)
31 //____________________________________________________________________
32 AliITSPidParItem::AliITSPidParItem():
36 // default constructor
37 for(Int_t i=0;i<39;i++){
40 }//____________________________________________________________________
41 AliITSPidParItem::AliITSPidParItem(Float_t center,Float_t width,Double_t *buff):
45 // standard constructor
46 for (Int_t i=0;i<39;i++) fBuff[i]=buff[i];
50 //____________________________________________________________________
51 void AliITSPidParItem::GetParameters(Double_t *buff) const{
52 //get all the parameters
53 for (Int_t i=0;i<39;i++) buff[i]=fBuff[i];
56 //____________________________________________________________________
57 void AliITSPidParItem::GetProtonPar(Double_t *buffp) const{
58 //get the protons' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
67 //____________________________________________________________________
68 void AliITSPidParItem::GetKaonPar(Double_t *buffk) const{
69 //get the kaons' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
78 //____________________________________________________________________
79 void AliITSPidParItem::GetPionPar(Double_t *buffpi) const{
80 //get the pions' parameters (Width Landau, Most Probable, Area, Width Gaussian, Chi2 fit, NDF fit, Integral fit)
89 //____________________________________________________________________
90 void AliITSPidParItem::GetPar0(Double_t *buff0) const{
91 //Width Landau for protons, kaons, pions.
96 //____________________________________________________________________
97 void AliITSPidParItem::GetPar1(Double_t *buff1) const{
98 //Most Probable for protons, kaons, pions.
103 //____________________________________________________________________
104 void AliITSPidParItem::GetPar2(Double_t *buff2) const{
105 //Area for protons, kaons, pions.
110 //____________________________________________________________________
111 void AliITSPidParItem::GetPar3(Double_t *buff3) const{
112 //Width Gaussian for protons, kaons, pions.
117 //____________________________________________________________________
118 void AliITSPidParItem::GetChisquare(Double_t *buffchi) const{
119 //Chi2 of the fit for protons, kaons, pions.
121 buffchi[1]=fBuff[21];
122 buffchi[2]=fBuff[34];
124 //____________________________________________________________________
125 void AliITSPidParItem::GetNDF(Double_t *buffndf) const{
126 //NDF of the fit for protons, kaons, pions.
128 buffndf[1]=fBuff[22];
129 buffndf[2]=fBuff[35];
131 //____________________________________________________________________
132 void AliITSPidParItem::GetProParFun(Double_t *pfun) const{
133 //some Protons parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
140 //____________________________________________________________________
141 void AliITSPidParItem::GetKaoParFun(Double_t *kfun) const{
142 //some Kaons parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
149 //____________________________________________________________________
150 void AliITSPidParItem::GetPiParFun(Double_t *pifun) const{
151 //some Pions parameters: Width Landau, Most Probable, Area, Width Gaussian, Integral fit
158 //____________________________________________________________________
159 void AliITSPidParItem::GetRangeLim(Double_t *range) const{
160 //Range limits for the response functions
161 range[0]=fBuff[11];//proton low
162 range[1]=fBuff[12];//proton high
163 range[2]=fBuff[24];//kaon low
164 range[3]=fBuff[25];//kaon high
165 range[4]=fBuff[37];//pion low
166 range[5]=fBuff[38];//pion high
168 //____________________________________________________________________
169 void AliITSPidParItem::GetProtonParErr(Double_t *bufferp)const{
170 //errors on the protons' parameters
176 //____________________________________________________________________
177 void AliITSPidParItem::GetKaonParErr(Double_t *bufferk)const{
178 //errors on the kaons' parameters
179 bufferk[0]=fBuff[17];
180 bufferk[1]=fBuff[18];
181 bufferk[2]=fBuff[19];
182 bufferk[3]=fBuff[20];
184 //____________________________________________________________________
185 void AliITSPidParItem::GetPionParErr(Double_t *bufferpi)const{
186 //errors on the pions' parameters
187 bufferpi[0]=fBuff[30];
188 bufferpi[1]=fBuff[31];
189 bufferpi[2]=fBuff[32];
190 bufferpi[3]=fBuff[33];
192 //____________________________________________________________________
193 void AliITSPidParItem::PrintParameters() const {
194 // Prints the data members of this class
195 cout<<"==============================***************"<<endl;
196 cout<<"Momentum (GeV/c) - center of the bin - "<<fPCenter<<endl;
197 cout<<" Width of momentum bin (GeV/c) "<<fPWidth<<endl;
198 for (Int_t i=0;i<39;i++) cout<<"Parameter"<<i<<" = "<<fBuff[i]<<endl;
202 //_______________________________________________________________________
203 TF1* AliITSPidParItem::CookFunIts(TString namefun,Double_t *par,Double_t rangei,Double_t rangef,TString comment){
207 fun=new TF1(comment,Langaufun2,rangei,rangef,5);
208 fun->SetParameters(par);
211 else {fun=new TF1(namefun,"0");}
215 //_________________________________________________________________________
216 Double_t AliITSPidParItem::Langaufun(Double_t *x, Double_t *par) {
219 //par[0]=Width (scale) parameter of Landau density
220 //par[1]=Most Probable (MP, location) parameter of Landau density
221 //par[2]=Total area (integral -inf to inf, normalization constant)
222 //par[3]=Width (sigma) of convoluted Gaussian function
224 //In the Landau distribution (represented by the CERNLIB approximation),
225 //the maximum is located at x=-0.22278298 with the location parameter=0.
226 //This shift is corrected within this function, so that the actual
227 //maximum is identical to the MP parameter.
230 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
231 Double_t mpshift = -0.22278298; // Landau maximum location
234 Double_t np = 100.0; // number of convolution steps
235 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
247 // MP shift correction
248 mpc = par[1] - mpshift * par[0];
250 // Range of convolution integral
251 xlow = x[0] - sc * par[3];
252 xupp = x[0] + sc * par[3];
254 step = (xupp-xlow) / np;
256 // Convolution integral of Landau and Gaussian by sum
257 for(i=1.0; i<=np/2; i++) {
258 xx = xlow + (i-.5) * step;
259 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
260 sum += fland * TMath::Gaus(x[0],xx,par[3]);
262 xx = xupp - (i-.5) * step;
263 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
264 sum += fland * TMath::Gaus(x[0],xx,par[3]);
267 return (par[2] * step * sum * invsq2pi / par[3]);
269 //_______________________________________________________________________
270 Double_t AliITSPidParItem::Langaufun2(Double_t *x, Double_t *par){
272 return 1/par[4]*Langaufun(x,par);