1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /*************************************
17 * AliFlowCommonHistResults: *
18 * class to organize the common *
19 * histograms for Flow Analysis *
21 * authors: Naomi van der Kolk *
24 * (snelling@nikhef.nl) *
27 * **********************************/
29 #include "Riostream.h" //needed as include
30 #include "AliFlowCommonConstants.h" //needed as include
31 #include "AliFlowCommonHistResults.h"
34 #include "TH1D.h" //needed as include
35 #include "TMath.h" //needed as include
41 class AliFlowCommonHist;
43 ClassImp(AliFlowCommonHistResults)
45 //-----------------------------------------------------------------------
47 AliFlowCommonHistResults::AliFlowCommonHistResults():
49 fHistIntFlow(NULL),//to be removed
50 fHistDiffFlow(NULL),//to be removed
51 fHistChi(NULL),//to be removed
54 fHistDiffFlowPtRP(NULL),
55 fHistDiffFlowEtaRP(NULL),
56 fHistIntFlowPOI(NULL),
58 fHistDiffFlowPtPOI(NULL),
59 fHistDiffFlowEtaPOI(NULL),
65 //-----------------------------------------------------------------------
67 AliFlowCommonHistResults::AliFlowCommonHistResults(const char *anInput, const char *title):
68 TNamed(anInput,title),
69 fHistIntFlow(NULL),//to be removed
70 fHistDiffFlow(NULL),//to be removed
71 fHistChi(NULL),//to be removed
74 fHistDiffFlowPtRP(NULL),
75 fHistDiffFlowEtaRP(NULL),
76 fHistIntFlowPOI(NULL),
78 fHistDiffFlowPtPOI(NULL),
79 fHistDiffFlowEtaPOI(NULL),
82 //constructor creating histograms
84 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
85 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
86 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
88 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
89 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
90 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
95 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
96 // !!! to be removed !!!
98 name = "Flow_Integrated_";
100 fHistIntFlow = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
101 fHistIntFlow ->SetXTitle("");
102 fHistIntFlow ->SetYTitle("V_{2}");
105 name = "Flow_Differential_Pt_";
107 fHistDiffFlow = new TH1D(name.Data(), name.Data(),iNbinsPt,dPtMin,dPtMax);
108 fHistDiffFlow ->SetXTitle("P_{t}");
109 fHistDiffFlow ->SetYTitle("v_{2}");
111 //Chi (needed for rebinning later on)
114 fHistChi = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
115 fHistChi ->SetXTitle("");
116 fHistChi ->SetYTitle("#Chi");
117 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
120 name = "Flow_Integrated_RP_";
122 fHistIntFlowRP = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
123 fHistIntFlowRP->SetLabelSize(0.06);
124 fHistIntFlowRP->SetLabelOffset(0.01);
125 (fHistIntFlowRP->GetXaxis())->SetBinLabel(1,"V_{2}");
127 //Chi (needed for rebinning later on)
128 name = "Flow_Chi_RP_";
130 fHistChiRP = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
131 fHistChiRP->SetLabelSize(0.06);
132 fHistChiRP->SetLabelOffset(0.01);
133 (fHistChiRP->GetXaxis())->SetBinLabel(1,"#chi");
135 //differential flow (Pt)
136 name = "Flow_Differential_Pt_RP_";
138 fHistDiffFlowPtRP = new TH1D(name.Data(), name.Data(),iNbinsPt,dPtMin,dPtMax);
139 fHistDiffFlowPtRP->SetXTitle("P_{t}");
140 fHistDiffFlowPtRP->SetYTitle("v_{2}");
142 //differential flow (eta)
143 name = "Flow_Differential_Eta_RP_";
145 fHistDiffFlowEtaRP = new TH1D(name.Data(), name.Data(),iNbinsEta,dEtaMin,dEtaMax);
146 fHistDiffFlowEtaRP->SetXTitle("#eta");
147 fHistDiffFlowEtaRP->SetYTitle("v_{2}");
150 name = "Flow_Integrated_POI_";
152 fHistIntFlowPOI = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
153 fHistIntFlowPOI->SetLabelSize(0.06);
154 fHistIntFlowPOI->SetLabelOffset(0.01);
155 (fHistIntFlowPOI->GetXaxis())->SetBinLabel(1,"V_{2}");
157 //Chi (needed for rebinning later on)
158 name = "Flow_Chi_POI_";
160 fHistChiPOI = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
161 fHistChiPOI->SetLabelSize(0.06);
162 fHistChiPOI->SetLabelOffset(0.01);
163 (fHistChiPOI->GetXaxis())->SetBinLabel(1,"#chi");
165 //differential flow (Pt)
166 name = "Flow_Differential_Pt_POI_";
168 fHistDiffFlowPtPOI = new TH1D(name.Data(), name.Data(),iNbinsPt,dPtMin,dPtMax);
169 fHistDiffFlowPtPOI->SetXTitle("P_{t}");
170 fHistDiffFlowPtPOI->SetYTitle("v_{2}");
172 //differential flow (eta)
173 name = "Flow_Differential_Eta_POI_";
175 fHistDiffFlowEtaPOI = new TH1D(name.Data(), name.Data(),iNbinsEta,dEtaMin,dEtaMax);
176 fHistDiffFlowEtaPOI->SetXTitle("#eta");
177 fHistDiffFlowEtaPOI->SetYTitle("v_{2}");
180 fHistList = new TList();
183 fHistList-> Add(fHistIntFlow);//to be removed
184 fHistList-> Add(fHistDiffFlow);//to be removed
185 fHistList-> Add(fHistChi);//to be removed
188 fHistList->Add(fHistIntFlowRP);
189 fHistList->Add(fHistChiRP);
190 fHistList->Add(fHistDiffFlowPtRP);
191 fHistList->Add(fHistDiffFlowEtaRP);
192 fHistList->Add(fHistIntFlowPOI);
193 fHistList->Add(fHistChiPOI);
194 fHistList->Add(fHistDiffFlowPtPOI);
195 fHistList->Add(fHistDiffFlowEtaPOI);
199 //-----------------------------------------------------------------------
201 AliFlowCommonHistResults::~AliFlowCommonHistResults()
204 delete fHistIntFlow;//to be removed
205 delete fHistDiffFlow;//to be removed
206 delete fHistChi;//to be removed
207 delete fHistIntFlowRP;
209 delete fHistDiffFlowPtRP;
210 delete fHistDiffFlowEtaRP;
211 delete fHistIntFlowPOI;
213 delete fHistDiffFlowPtPOI;
214 delete fHistDiffFlowEtaPOI;
218 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
219 // !!! to be removed !!!
220 //-----------------------------------------------------------------------
222 Bool_t AliFlowCommonHistResults::FillIntegratedFlow(Double_t aV, Double_t anError)
225 fHistIntFlow -> SetBinContent(1,aV);
226 fHistIntFlow -> SetBinError(1,anError);
231 //-----------------------------------------------------------------------
233 Bool_t AliFlowCommonHistResults::FillDifferentialFlow(Int_t aBin, Double_t av, Double_t anError)
236 fHistDiffFlow ->SetBinContent(aBin,av);
237 fHistDiffFlow ->SetBinError(aBin,anError);
242 //-----------------------------------------------------------------------
244 Bool_t AliFlowCommonHistResults::FillChi(Double_t aChi)
247 fHistChi -> SetBinContent(1,aChi);
251 //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
253 //-----------------------------------------------------------------------
255 Bool_t AliFlowCommonHistResults::FillIntegratedFlowRP(Double_t aV, Double_t anError)
257 //Fill fHistIntFlowRP
258 fHistIntFlowRP->SetBinContent(1,aV);
259 fHistIntFlowRP->SetBinError(1,anError);
264 //-----------------------------------------------------------------------
266 Bool_t AliFlowCommonHistResults::FillChiRP(Double_t aChi)
269 fHistChiRP->SetBinContent(1,aChi);
274 //-----------------------------------------------------------------------
276 Bool_t AliFlowCommonHistResults::FillDifferentialFlowPtRP(Int_t aBin, Double_t av, Double_t anError)
278 //Fill fHistDiffFlowPtRP
279 fHistDiffFlowPtRP->SetBinContent(aBin,av);
280 fHistDiffFlowPtRP->SetBinError(aBin,anError);
285 //-----------------------------------------------------------------------
287 Bool_t AliFlowCommonHistResults::FillDifferentialFlowEtaRP(Int_t aBin, Double_t av, Double_t anError)
289 //Fill fHistDiffFlowEtaRP
290 fHistDiffFlowEtaRP->SetBinContent(aBin,av);
291 fHistDiffFlowEtaRP->SetBinError(aBin,anError);
296 //-----------------------------------------------------------------------
298 Bool_t AliFlowCommonHistResults::FillIntegratedFlowPOI(Double_t aV, Double_t anError)
300 //Fill fHistIntFlowPOI
301 fHistIntFlowPOI->SetBinContent(1,aV);
302 fHistIntFlowPOI->SetBinError(1,anError);
307 //-----------------------------------------------------------------------
309 Bool_t AliFlowCommonHistResults::FillChiPOI(Double_t aChi)
312 fHistChiPOI->SetBinContent(1,aChi);
317 //-----------------------------------------------------------------------
319 Bool_t AliFlowCommonHistResults::FillDifferentialFlowPtPOI(Int_t aBin, Double_t av, Double_t anError)
321 //Fill fHistDiffFlowPtPOI
322 fHistDiffFlowPtPOI->SetBinContent(aBin,av);
323 fHistDiffFlowPtPOI->SetBinError(aBin,anError);
328 //-----------------------------------------------------------------------
330 Bool_t AliFlowCommonHistResults::FillDifferentialFlowEtaPOI(Int_t aBin, Double_t av, Double_t anError)
332 //Fill fHistDiffFlowEtaPOI
333 fHistDiffFlowEtaPOI->SetBinContent(aBin,av);
334 fHistDiffFlowEtaPOI->SetBinError(aBin,anError);
339 //-----------------------------------------------------------------------
341 Double_t AliFlowCommonHistResults::Merge(TCollection *aList)
344 //cout<<"entering merge function"<<endl;
345 if (!aList) return 0;
346 if (aList->IsEmpty()) return 0; //no merging is needed
349 TIter next(aList); // list is supposed to contain only objects of the same type as this
350 AliFlowCommonHistResults *toMerge;
351 // make a temporary list
352 TList *pTemp = new TList();
353 while ((toMerge=(AliFlowCommonHistResults*)next())) {
354 pTemp->Add(toMerge->GetHistList());
357 // Now call merge for fHistList providing temp list
358 fHistList->Merge(pTemp);
362 //cout<<"Merged"<<endl;
363 return (double)iCount;
367 //-----------------------------------------------------------------------
368 void AliFlowCommonHistResults::Print(Option_t *option) const
370 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
371 // ===============================================
372 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
373 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
376 fHistList->Print(option);
380 printf( "Empty histogram list \n");
384 //-----------------------------------------------------------------------
385 void AliFlowCommonHistResults::Browse(TBrowser *b)
389 if (fHistList) b->Add(fHistList,"AliFlowCommonHistResultsList");