]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Base/AliFlowCommonHistResults.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowCommonHistResults.cxx
CommitLineData
f1d945a1 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
9ba489f7 15
16 /*************************************
17 * AliFlowCommonHistResults: *
18 * class to organize the common *
19 * histograms for Flow Analysis *
20 * *
21 * authors: Naomi van der Kolk *
22 * (kolk@nikhef.nl) *
23 * Raimond Snellings *
24 * (snelling@nikhef.nl) *
25 * Ante Bilandzic *
26 * (anteb@nikhef.nl) *
27 * **********************************/
f1d945a1 28
f1d945a1 29#include "Riostream.h" //needed as include
30#include "AliFlowCommonConstants.h" //needed as include
31#include "AliFlowCommonHistResults.h"
32
33#include "TString.h"
34#include "TH1D.h" //needed as include
35#include "TMath.h" //needed as include
8de6876d 36#include "TList.h"
9d062fe3 37#include "TBrowser.h"
f1d945a1 38
39class TH1F;
40class AliFlowVector;
41class AliFlowCommonHist;
42
f1d945a1 43ClassImp(AliFlowCommonHistResults)
44
45//-----------------------------------------------------------------------
46
8de6876d 47 AliFlowCommonHistResults::AliFlowCommonHistResults():
9d062fe3 48 TNamed(),
62e36168 49 fHistIntFlow(NULL),
50 fHistChi(NULL),
9ba489f7 51 fHistIntFlowRP(NULL),
9ba489f7 52 fHistDiffFlowPtRP(NULL),
53 fHistDiffFlowEtaRP(NULL),
54 fHistIntFlowPOI(NULL),
9ba489f7 55 fHistDiffFlowPtPOI(NULL),
56 fHistDiffFlowEtaPOI(NULL),
8de6876d 57 fHistList(NULL)
58{
59 //default constructor
60}
61
62//-----------------------------------------------------------------------
63
62e36168 64 AliFlowCommonHistResults::AliFlowCommonHistResults(const char *anInput, const char *title, Int_t harmonic):
9d062fe3 65 TNamed(anInput,title),
62e36168 66 fHistIntFlow(NULL),
67 fHistChi(NULL),
9ba489f7 68 fHistIntFlowRP(NULL),
9ba489f7 69 fHistDiffFlowPtRP(NULL),
70 fHistDiffFlowEtaRP(NULL),
71 fHistIntFlowPOI(NULL),
9ba489f7 72 fHistDiffFlowPtPOI(NULL),
73 fHistDiffFlowEtaPOI(NULL),
8de6876d 74 fHistList(NULL)
75{
f1d945a1 76 //constructor creating histograms
9ba489f7 77 //Pt:
bee2efdc 78 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
79 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
80 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
9ba489f7 81 //eta:
bee2efdc 82 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
83 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
84 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
9ba489f7 85
f1d945a1 86 TString name;
87
62e36168 88 // Reference flow: (TBI: rename eventually integrated flow => reference flow)
f1d945a1 89 name = "Flow_Integrated_";
9d062fe3 90 name += anInput;
62e36168 91 fHistIntFlow = new TH1D(name.Data(),"Reference Flow",1,0.5,1.5);
92 fHistIntFlow->SetStats(kFALSE);
93 fHistIntFlow->SetMarkerStyle(kOpenSquare);
94 fHistIntFlow->SetLabelSize(0.06,"X");
95 fHistIntFlow->SetLabelOffset(0.015,"X");
96 fHistIntFlow->GetXaxis()->SetBinLabel(1,Form("v_{%d}",harmonic));
97
98 // chi (resolution):
f1d945a1 99 name = "Flow_Chi_";
9d062fe3 100 name += anInput;
62e36168 101 fHistChi = new TH1D(name.Data(),"Resolution",1,0.5,1.5);
102 fHistChi->SetStats(kFALSE);
103 fHistChi->SetMarkerStyle(kOpenSquare);
104 fHistChi->SetLabelSize(0.06,"X");
105 fHistChi->SetLabelOffset(0.015,"X");
106 fHistChi->GetXaxis()->SetBinLabel(1,"#chi");
9ba489f7 107
62e36168 108 // Integrated flow of RPs:
9ba489f7 109 name = "Flow_Integrated_RP_";
110 name += anInput;
62e36168 111 fHistIntFlowRP = new TH1D(name.Data(),"Integrated Flow (RP)",1,0.5,1.5);
112 fHistIntFlowRP->SetStats(kFALSE);
113 fHistIntFlowRP->SetMarkerStyle(kOpenSquare);
114 fHistIntFlowRP->SetLabelSize(0.06,"X");
115 fHistIntFlowRP->SetLabelOffset(0.015,"X");
116 fHistIntFlowRP->GetXaxis()->SetBinLabel(1,Form("v_{%d}",harmonic));
117
118 // Differential flow (Pt) of RPs:
9ba489f7 119 name = "Flow_Differential_Pt_RP_";
120 name += anInput;
62e36168 121 fHistDiffFlowPtRP = new TH1D(name.Data(),"Differential Flow vs p_{t} (RP)",iNbinsPt,dPtMin,dPtMax);
122 fHistDiffFlowPtRP->SetStats(kFALSE);
123 fHistDiffFlowPtRP->SetXTitle("p_{t}");
124 fHistDiffFlowPtRP->SetYTitle(Form("v_{%d}",harmonic));
9ba489f7 125
62e36168 126 // Differential flow (eta) of RPs:
9ba489f7 127 name = "Flow_Differential_Eta_RP_";
128 name += anInput;
62e36168 129 fHistDiffFlowEtaRP = new TH1D(name.Data(),"Differential Flow vs #eta (RP)",iNbinsEta,dEtaMin,dEtaMax);
130 fHistDiffFlowEtaRP->SetStats(kFALSE);
9ba489f7 131 fHistDiffFlowEtaRP->SetXTitle("#eta");
62e36168 132 fHistDiffFlowEtaRP->SetYTitle(Form("v_{%d}",harmonic));
9ba489f7 133
62e36168 134 // Integrated flow of POIs:
9ba489f7 135 name = "Flow_Integrated_POI_";
136 name += anInput;
62e36168 137 fHistIntFlowPOI = new TH1D(name.Data(),"Integrated Flow (POI)",1,0.5,1.5);
138 fHistIntFlowPOI->SetStats(kFALSE);
139 fHistIntFlowPOI->SetMarkerStyle(kOpenSquare);
140 fHistIntFlowPOI->SetLabelSize(0.06,"X");
141 fHistIntFlowPOI->SetLabelOffset(0.015,"X");
142 fHistIntFlowPOI->GetXaxis()->SetBinLabel(1,Form("v_{%d}",harmonic));
143
144 // Differential flow (Pt) of POIs:
9ba489f7 145 name = "Flow_Differential_Pt_POI_";
146 name += anInput;
62e36168 147 fHistDiffFlowPtPOI = new TH1D(name.Data(),"Differential Flow vs p_{t} (POI)",iNbinsPt,dPtMin,dPtMax);
148 fHistDiffFlowPtPOI->SetXTitle("p_{t}");
149 fHistDiffFlowPtPOI->SetYTitle(Form("v_{%d}",harmonic));
9ba489f7 150
62e36168 151 // Differential flow (eta) of POIs:
9ba489f7 152 name = "Flow_Differential_Eta_POI_";
153 name += anInput;
62e36168 154 fHistDiffFlowEtaPOI = new TH1D(name.Data(),"Differential Flow vs #eta (POI)",iNbinsEta,dEtaMin,dEtaMax);
155 fHistDiffFlowEtaPOI->SetStats(kFALSE);
9ba489f7 156 fHistDiffFlowEtaPOI->SetXTitle("#eta");
62e36168 157 fHistDiffFlowEtaPOI->SetYTitle(Form("v_{%d}",harmonic));
9ba489f7 158
62e36168 159 // List of histograms:
8de6876d 160 fHistList = new TList();
62e36168 161 fHistList-> Add(fHistIntFlow);
162 fHistList-> Add(fHistChi);
9ba489f7 163 fHistList->Add(fHistIntFlowRP);
9ba489f7 164 fHistList->Add(fHistDiffFlowPtRP);
165 fHistList->Add(fHistDiffFlowEtaRP);
166 fHistList->Add(fHistIntFlowPOI);
9ba489f7 167 fHistList->Add(fHistDiffFlowPtPOI);
62e36168 168 fHistList->Add(fHistDiffFlowEtaPOI);
9ba489f7 169 }
f1d945a1 170
171//-----------------------------------------------------------------------
172
173AliFlowCommonHistResults::~AliFlowCommonHistResults()
174{
62e36168 175 // Deletes histograms:
176 delete fHistIntFlow;
177 delete fHistChi;
178 delete fHistIntFlowRP;
179 delete fHistDiffFlowPtRP;
180 delete fHistDiffFlowEtaRP;
181 delete fHistIntFlowPOI;
182 delete fHistDiffFlowPtPOI;
183 delete fHistDiffFlowEtaPOI;
184 delete fHistList;
f1d945a1 185}
186
187//-----------------------------------------------------------------------
188
0b4cb25b 189Bool_t AliFlowCommonHistResults::FillIntegratedFlow(Double_t aV, Double_t anError)
f1d945a1 190{
62e36168 191 // Fill fHistIntFlow:
192 fHistIntFlow -> SetBinContent(1,aV);
193 fHistIntFlow -> SetBinError(1,anError);
f1d945a1 194
62e36168 195 return kTRUE;
f1d945a1 196}
197
198//-----------------------------------------------------------------------
199
0b4cb25b 200Bool_t AliFlowCommonHistResults::FillChi(Double_t aChi)
f1d945a1 201{
202 //Fill fHistChi
0b4cb25b 203 fHistChi -> SetBinContent(1,aChi);
f1d945a1 204
205 return kTRUE;
206}
9ba489f7 207
208//-----------------------------------------------------------------------
209
210Bool_t AliFlowCommonHistResults::FillIntegratedFlowRP(Double_t aV, Double_t anError)
211{
212 //Fill fHistIntFlowRP
213 fHistIntFlowRP->SetBinContent(1,aV);
214 fHistIntFlowRP->SetBinError(1,anError);
215
216 return kTRUE;
217}
f1d945a1 218
0683b7d5 219//-----------------------------------------------------------------------
9ba489f7 220
9ba489f7 221Bool_t AliFlowCommonHistResults::FillDifferentialFlowPtRP(Int_t aBin, Double_t av, Double_t anError)
222{
223 //Fill fHistDiffFlowPtRP
224 fHistDiffFlowPtRP->SetBinContent(aBin,av);
225 fHistDiffFlowPtRP->SetBinError(aBin,anError);
226
227 return kTRUE;
228}
229
230//-----------------------------------------------------------------------
231
232Bool_t AliFlowCommonHistResults::FillDifferentialFlowEtaRP(Int_t aBin, Double_t av, Double_t anError)
233{
234 //Fill fHistDiffFlowEtaRP
235 fHistDiffFlowEtaRP->SetBinContent(aBin,av);
236 fHistDiffFlowEtaRP->SetBinError(aBin,anError);
237
238 return kTRUE;
239}
240
241//-----------------------------------------------------------------------
242
243Bool_t AliFlowCommonHistResults::FillIntegratedFlowPOI(Double_t aV, Double_t anError)
244{
245 //Fill fHistIntFlowPOI
246 fHistIntFlowPOI->SetBinContent(1,aV);
247 fHistIntFlowPOI->SetBinError(1,anError);
248
249 return kTRUE;
250}
251
252//-----------------------------------------------------------------------
253
9ba489f7 254Bool_t AliFlowCommonHistResults::FillDifferentialFlowPtPOI(Int_t aBin, Double_t av, Double_t anError)
255{
256 //Fill fHistDiffFlowPtPOI
257 fHistDiffFlowPtPOI->SetBinContent(aBin,av);
258 fHistDiffFlowPtPOI->SetBinError(aBin,anError);
259
260 return kTRUE;
261}
262
263//-----------------------------------------------------------------------
264
265Bool_t AliFlowCommonHistResults::FillDifferentialFlowEtaPOI(Int_t aBin, Double_t av, Double_t anError)
266{
267 //Fill fHistDiffFlowEtaPOI
268 fHistDiffFlowEtaPOI->SetBinContent(aBin,av);
269 fHistDiffFlowEtaPOI->SetBinError(aBin,anError);
270
271 return kTRUE;
272}
273
274//-----------------------------------------------------------------------
275
8de6876d 276 Double_t AliFlowCommonHistResults::Merge(TCollection *aList)
277{
278 //merge fuction
567b3738 279 //cout<<"entering merge function"<<endl;
8de6876d 280 if (!aList) return 0;
281 if (aList->IsEmpty()) return 0; //no merging is needed
282
283 Int_t iCount = 0;
284 TIter next(aList); // list is supposed to contain only objects of the same type as this
285 AliFlowCommonHistResults *toMerge;
286 // make a temporary list
287 TList *pTemp = new TList();
288 while ((toMerge=(AliFlowCommonHistResults*)next())) {
289 pTemp->Add(toMerge->GetHistList());
290 iCount++;
291 }
292 // Now call merge for fHistList providing temp list
293 fHistList->Merge(pTemp);
294 // Cleanup
295 delete pTemp;
296
567b3738 297 //cout<<"Merged"<<endl;
8de6876d 298 return (double)iCount;
299
300}
0683b7d5 301
9d062fe3 302//-----------------------------------------------------------------------
303void AliFlowCommonHistResults::Print(Option_t *option) const
304{
305 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
306 // ===============================================
307 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
308 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
309
310 if (fHistList) {
311 fHistList->Print(option);
312 }
313 else
314 {
315 printf( "Empty histogram list \n");
316 }
317}
318
319//-----------------------------------------------------------------------
320 void AliFlowCommonHistResults::Browse(TBrowser *b)
321{
322
323 if (!b) return;
324 if (fHistList) b->Add(fHistList,"AliFlowCommonHistResultsList");
325}
326
327
328
0683b7d5 329