]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx
corrections for single particle distributions in Q cumulants{2}
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFittingFunctionsForQDistribution.cxx
1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
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 **************************************************************************/
15
16 /******************************** 
17  * integrated flow estimate by  *
18  *   fitting q-distribution     * 
19  *                              *
20  * author: Ante Bilandzic       * 
21  *          (anteb@nikhef.nl)   *
22  *                              *
23  * based on the macro written   *
24  *     by Sergei Voloshin       *                        
25  *******************************/ 
26
27 #define AliFittingFunctionsForQDistribution_cxx
28
29 #include "Riostream.h"
30 #include "TChain.h"
31 #include "TFile.h"
32 #include "TList.h"
33 #include "TParticle.h"
34
35 #include "TProfile.h"
36 #include "TF1.h"
37 #include "TAxis.h"
38 #include "TH1.h"
39 #include "TH1D.h"
40 #include "TMath.h"
41
42 #include "AliFlowEventSimple.h"
43 #include "AliFlowTrackSimple.h"
44 #include "AliFittingQDistribution.h"
45 #include "AliFlowCommonConstants.h"
46 #include "AliFlowCommonHistResults.h"
47 #include "AliFittingFunctionsForQDistribution.h"
48
49 ClassImp(AliFittingFunctionsForQDistribution)
50
51 //================================================================================================================_
52
53 AliFittingFunctionsForQDistribution::AliFittingFunctionsForQDistribution():  
54  fAvMultFQD(NULL),
55  fQDistributionFQD(NULL), 
56  fIntFlowResFQD(NULL),
57  fSigma2(NULL),
58  fchrFQD(NULL)
59 {
60  //default constructor 
61 }
62
63 AliFittingFunctionsForQDistribution::~AliFittingFunctionsForQDistribution()
64 {
65  //destructor
66 }
67
68 AliFittingFunctionsForQDistribution::AliFittingFunctionsForQDistribution(TProfile *AvMult, TH1D *QDistribution, TH1D *intFlowRes, TH1D *sigma2, AliFlowCommonHistResults *chr):
69  fAvMultFQD(AvMult),
70  fQDistributionFQD(QDistribution),
71  fIntFlowResFQD(intFlowRes),
72  fSigma2(sigma2),
73  fchrFQD(chr)
74 {
75  //custom constructor 
76 }
77   
78 //================================================================================================================
79
80 void AliFittingFunctionsForQDistribution::Calculate()
81 {
82  //fitting q-distribution
83  
84  Int_t n=2;//harmonic (to be improved)
85  
86  Double_t AvM = fAvMultFQD->GetBinContent(1);
87  
88  Int_t nEvts = (Int_t)(fAvMultFQD->GetBinEntries(1));
89
90  Double_t qmin=(fQDistributionFQD->GetXaxis())->GetXmin();  
91  Double_t qmax=(fQDistributionFQD->GetXaxis())->GetXmax(); 
92  Double_t bin=fQDistributionFQD->GetBinWidth(4);//assuming that all bins have the same width 
93  Double_t ent=fQDistributionFQD->GetEntries();
94  Double_t norm=bin*ent;//assuming that all bins have the same width
95
96  TF1 *fittingFun = new TF1("fittingFun","[2]*(x/[1])*exp(-(x*x+[0]*[0])/(2.*[1]))*TMath::BesselI0(x*[0]/[1])",qmin,qmax); 
97  
98  fittingFun->SetParNames("V","sigma","norm");
99  fittingFun->SetParameters(0.1*pow(AvM,0.5),0.5,norm);
100  
101  fittingFun->SetParLimits(0,0.,10.);//to be improved (limits)
102  fittingFun->SetParLimits(1,0.,5.5);//to be improved (limits)
103  fittingFun->FixParameter(2,norm);  
104
105  Double_t v=0.,errorv=0.,sigma2=0.,errorsigma2=0.;
106  
107  if(fQDistributionFQD->GetEntries()>50)//to be improved (only a pragmatic fix)
108  {
109   fQDistributionFQD->Fit("fittingFun","NQ","",qmin,qmax);
110   if(AvM)
111   { 
112    v = fittingFun->GetParameter(0)/pow(AvM,0.5);
113    errorv = fittingFun->GetParError(0)/pow(AvM,0.5);
114   }
115   sigma2 = fittingFun->GetParameter(1);
116   errorsigma2 = fittingFun->GetParError(1);
117  }
118  
119  cout<<" "<<endl;
120  cout<<"***************************************"<<endl;
121  cout<<"***************************************"<<endl;
122  cout<<"      integrated flow by fitting "<<endl;
123  cout<<"           q-distribution:      "<<endl;
124  cout<<""<<endl;
125  cout<<"   v_"<<n<<"{FQD} = "<<v<<" +/- "<<errorv<<endl;
126  cout<<"   sigma^2  = "<<sigma2<<" +/- "<<errorsigma2<<endl; 
127  //cout<<"vm       = "<<v*pow(AvM,0.5)<<endl;
128  cout<<" "<<endl;
129  cout<<"      nEvts = "<<nEvts<<", AvM = "<<AvM<<endl; 
130  cout<<"***************************************"<<endl;
131  cout<<"***************************************"<<endl;
132  fIntFlowResFQD->SetBinContent(1,v);
133  fIntFlowResFQD->SetBinError(1,errorv);
134  fSigma2->SetBinContent(1,sigma2);
135  fSigma2->SetBinError(1,errorsigma2);
136  
137  //common histograms:
138  fchrFQD->FillIntegratedFlow(v,errorv);
139  fchrFQD->FillChi(v*pow(AvM,0.5));
140  //RP:
141  fchrFQD->FillIntegratedFlowRP(v,errorv);
142  fchrFQD->FillChiRP(v*pow(AvM,0.5));
143  
144  cout<<" "<<endl;
145
146  //fQDistributionFQD->Draw("");
147  //fittingFun->Draw("SAME");
148
149 }//end of Calculate()
150
151   
152
153
154
155
156
157
158
159
160
161
162
163
164