]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFittingQDistribution.cxx
Using common results histograms
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFittingQDistribution.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
24 #define AliFittingQDistribution_cxx
25
26 #include "Riostream.h"
27 #include "AliFlowCommonConstants.h"
28 #include "AliFlowCommonHist.h"
29 #include "AliFlowCommonHistResults.h"
30 #include "TChain.h"
31 #include "TFile.h"
32 #include "TList.h" 
33 #include "TParticle.h"
34 #include "TProfile.h"
35 #include "AliFlowEventSimple.h"
36 #include "AliFlowTrackSimple.h"
37 #include "AliFittingQDistribution.h"
38 #include "AliFittingFunctionsForQDistribution.h"
39
40 class TH1;
41 class TGraph;
42 class TPave;
43 class TLatex;
44 class TMarker;
45 class TObjArray;
46 class TList;
47 class TCanvas;
48 class TSystem;
49 class TROOT;
50 class AliFlowVector;
51 class TVector;
52
53 //================================================================================================================
54
55 ClassImp(AliFittingQDistribution)
56
57 AliFittingQDistribution::AliFittingQDistribution():  
58  fTrack(NULL),
59  fHistList(NULL),
60  fAvMultIntFlowFQD(NULL),
61  fIntFlowResultsFQD(NULL),
62  fCommonHists(NULL),
63  fCommonHistsResults(NULL),
64  fQDistributionFQD(NULL)
65 {
66  //constructor 
67  fHistList = new TList(); 
68 }
69
70 AliFittingQDistribution::~AliFittingQDistribution()
71 {
72  //desctructor
73  delete fHistList; 
74 }
75
76 //================================================================================================================
77
78 void AliFittingQDistribution::CreateOutputObjects()
79 {
80  //various output histograms
81  
82  //avarage multiplicity 
83  fAvMultIntFlowFQD = new TProfile("fAvMultIntFlowFQD","Average Multiplicity",1,0,1,"s");
84  fAvMultIntFlowFQD->SetXTitle("");
85  fAvMultIntFlowFQD->SetYTitle("");
86  fAvMultIntFlowFQD->SetLabelSize(0.06);
87  fAvMultIntFlowFQD->SetMarkerStyle(25);
88  fAvMultIntFlowFQD->SetLabelOffset(0.02);
89  (fAvMultIntFlowFQD->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
90  fHistList->Add(fAvMultIntFlowFQD);
91  
92  //final result for integrated flow 
93  fIntFlowResultsFQD = new TH1D("fIntFlowResultsFQD","Integrated Flow By Fitting q-distribution",1,0,1);
94  fIntFlowResultsFQD->SetXTitle("");
95  fIntFlowResultsFQD->SetYTitle("");
96  fIntFlowResultsFQD->SetMarkerStyle(25);
97  fIntFlowResultsFQD->SetLabelSize(0.06);
98  fAvMultIntFlowFQD->SetLabelOffset(0.02);
99  (fIntFlowResultsFQD->GetXaxis())->SetBinLabel(1,"v_{n}{FQD}");
100  fHistList->Add(fIntFlowResultsFQD);
101  
102  //q-distribution 
103  fQDistributionFQD = new TH1D("fQDistributionFQD","q-distribution",100,0,10);
104  fQDistributionFQD->SetXTitle("q_{n}=Q_{n}/#sqrt{M}");
105  fQDistributionFQD->SetYTitle("Counts");
106  fHistList->Add(fQDistributionFQD);
107   
108  //common control histograms
109  fCommonHists = new AliFlowCommonHist("AliFlowCommonHistFQD");
110  fHistList->Add(fCommonHists);  
111  
112  //common histograms for final results (2nd order)
113  fCommonHistsResults= new AliFlowCommonHistResults("AliFlowCommonHistResultsFQD");
114  fHistList->Add(fCommonHistsResults); 
115  
116 }//end of CreateOutputObjects()
117
118 //================================================================================================================
119
120 void AliFittingQDistribution::Make(AliFlowEventSimple* anEvent)
121 {
122  
123  //Int_t nPrim = anEvent->NumberOfTracks();//total multiplicity
124   
125  Int_t n=2;//harmonic (to be improved)  
126    
127  //fill the common control histograms
128  fCommonHists->FillControlHistograms(anEvent);   
129
130  //calculating Q-vector of event
131  AliFlowVector fQVector;
132  fQVector.Set(0.,0.);
133  fQVector.SetMult(0);
134  fQVector=anEvent->GetQ(n);                                                                                  
135                                                                                                                                                                       
136  //multiplicity
137  fAvMultIntFlowFQD->Fill(0.,fQVector.GetMult(),1.);
138  
139  //q = Q/sqrt(M)
140  Double_t q=0.;
141  
142  if(fQVector.GetMult()!=0)
143  {
144   q = fQVector.Mod()/sqrt(fQVector.GetMult());
145   fQDistributionFQD->Fill(q,1.);
146  }  
147 }//end of Make()
148
149 //================================================================================================================
150
151 void AliFittingQDistribution::Finish()
152 {
153  //calculate the final results
154  AliFittingFunctionsForQDistribution finalFitting(fAvMultIntFlowFQD,fQDistributionFQD,fIntFlowResultsFQD,fCommonHistsResults);
155          
156  finalFitting.Calculate();            
157 }
158
159 //================================================================================================================
160
161 void AliFittingQDistribution::WriteHistograms(TString* outputFileName)
162 {
163  //store the final results in output .root file
164  TFile *output = new TFile(outputFileName->Data(),"RECREATE");
165  fHistList->Write(); 
166  delete output;
167 }
168
169 //================================================================================================================
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187