]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFittingFunctionsForQDistribution.cxx
Using AliMagWrapCheb
[u/mrichter/AliRoot.git] / PWG2 / FLOW / 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)
102 fittingFun->SetParLimits(1,0.0,5.5);//to be improved (limits)
103 fittingFun->FixParameter(2,norm);
104
105 fQDistributionFQD->Fit("fittingFun","NQ","",qmin,qmax);
106
107 Double_t v=0.,errorv=0.,sigma2=0.,errorsigma2=0.;
108 if(AvM)
109 {
110 v = fittingFun->GetParameter(0)/pow(AvM,0.5);
111 errorv = fittingFun->GetParError(0)/pow(AvM,0.5);
112 }
113
114 sigma2 = fittingFun->GetParameter(1);
115 errorsigma2 = fittingFun->GetParError(1);
116
117 cout<<" "<<endl;
118 cout<<"************************************"<<endl;
119 cout<<"************************************"<<endl;
4b2e3a73 120 cout<<" integrated flow by fitting "<<endl;
9bed2723 121 cout<<" q-distribution: "<<endl;
122 cout<<""<<endl;
123 cout<<" v_"<<n<<"{FQD} = "<<v<<" +/- "<<errorv<<endl;
124 cout<<" sigma^2 = "<<sigma2<<" +/- "<<errorsigma2<<endl;
125 //cout<<"vm = "<<v*pow(AvM,0.5)<<endl;
126 cout<<" "<<endl;
127 cout<<" nEvts = "<<nEvts<<", AvM = "<<AvM<<endl;
128 cout<<"************************************"<<endl;
129 cout<<"************************************"<<endl;
130 fIntFlowResFQD->SetBinContent(1,v);
131 fIntFlowResFQD->SetBinError(1,errorv);
1425a855 132 fSigma2->SetBinContent(1,sigma2);
133 fSigma2->SetBinError(1,errorsigma2);
4b2e3a73 134 //common histograms:
135 fchrFQD->FillIntegratedFlow(v,errorv);
136 fchrFQD->FillChi(v*pow(AvM,0.5));
9bed2723 137 cout<<" "<<endl;
138
139 //fQDistributionFQD->Draw("");
140 //fittingFun->Draw("SAME");
141
142}//end of Calculate()
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157