]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx
small mods for separate task
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFittingFunctionsForQDistribution.cxx
CommitLineData
9bed2723 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"
9bed2723 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"
9bed2723 40#include "TMath.h"
41
42#include "AliFlowEventSimple.h"
43#include "AliFlowTrackSimple.h"
44#include "AliFittingQDistribution.h"
45#include "AliFlowCommonConstants.h"
4b2e3a73 46#include "AliFlowCommonHistResults.h"
9bed2723 47#include "AliFittingFunctionsForQDistribution.h"
48
49ClassImp(AliFittingFunctionsForQDistribution)
50
51//================================================================================================================_
52
53AliFittingFunctionsForQDistribution::AliFittingFunctionsForQDistribution():
54 fAvMultFQD(NULL),
55 fQDistributionFQD(NULL),
4b2e3a73 56 fIntFlowResFQD(NULL),
1425a855 57 fSigma2(NULL),
4b2e3a73 58 fchrFQD(NULL)
9bed2723 59{
60 //default constructor
61}
62
63AliFittingFunctionsForQDistribution::~AliFittingFunctionsForQDistribution()
64{
65 //destructor
66}
67
1425a855 68AliFittingFunctionsForQDistribution::AliFittingFunctionsForQDistribution(TProfile *AvMult, TH1D *QDistribution, TH1D *intFlowRes, TH1D *sigma2, AliFlowCommonHistResults *chr):
9bed2723 69 fAvMultFQD(AvMult),
70 fQDistributionFQD(QDistribution),
4b2e3a73 71 fIntFlowResFQD(intFlowRes),
1425a855 72 fSigma2(sigma2),
4b2e3a73 73 fchrFQD(chr)
9bed2723 74{
75 //custom constructor
76}
77
78//================================================================================================================
79
80void 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)
aa408303 102 fittingFun->SetParLimits(1,0.,5.5);//to be improved (limits)
103 fittingFun->FixParameter(2,norm);
9bed2723 104
9bed2723 105 Double_t v=0.,errorv=0.,sigma2=0.,errorsigma2=0.;
9bed2723 106
aa408303 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 }
9bed2723 118
119 cout<<" "<<endl;
1fca9c90 120 cout<<"***************************************"<<endl;
121 cout<<"***************************************"<<endl;
122 cout<<" integrated flow by fitting "<<endl;
123 cout<<" q-distribution: "<<endl;
9bed2723 124 cout<<""<<endl;
1fca9c90 125 cout<<" v_"<<n<<"{FQD} = "<<v<<" +/- "<<errorv<<endl;
126 cout<<" sigma^2 = "<<sigma2<<" +/- "<<errorsigma2<<endl;
9bed2723 127 //cout<<"vm = "<<v*pow(AvM,0.5)<<endl;
128 cout<<" "<<endl;
1fca9c90 129 cout<<" nEvts = "<<nEvts<<", AvM = "<<AvM<<endl;
130 cout<<"***************************************"<<endl;
131 cout<<"***************************************"<<endl;
9bed2723 132 fIntFlowResFQD->SetBinContent(1,v);
133 fIntFlowResFQD->SetBinError(1,errorv);
1425a855 134 fSigma2->SetBinContent(1,sigma2);
135 fSigma2->SetBinError(1,errorsigma2);
1fca9c90 136
4b2e3a73 137 //common histograms:
138 fchrFQD->FillIntegratedFlow(v,errorv);
139 fchrFQD->FillChi(v*pow(AvM,0.5));
1fca9c90 140 //RP:
141 fchrFQD->FillIntegratedFlowRP(v,errorv);
142 fchrFQD->FillChiRP(v*pow(AvM,0.5));
143
9bed2723 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