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():
52 fHistDiffFlowPtRP(NULL),
53 fHistDiffFlowEtaRP(NULL),
54 fHistIntFlowPOI(NULL),
55 fHistDiffFlowPtPOI(NULL),
56 fHistDiffFlowEtaPOI(NULL),
62 //-----------------------------------------------------------------------
64 AliFlowCommonHistResults::AliFlowCommonHistResults(const char *anInput, const char *title, Int_t harmonic):
65 TNamed(anInput,title),
69 fHistDiffFlowPtRP(NULL),
70 fHistDiffFlowEtaRP(NULL),
71 fHistIntFlowPOI(NULL),
72 fHistDiffFlowPtPOI(NULL),
73 fHistDiffFlowEtaPOI(NULL),
76 //constructor creating histograms
78 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
79 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
80 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
82 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
83 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
84 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
88 // Reference flow: (TBI: rename eventually integrated flow => reference flow)
89 name = "Flow_Integrated_";
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));
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");
108 // Integrated flow of RPs:
109 name = "Flow_Integrated_RP_";
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));
118 // Differential flow (Pt) of RPs:
119 name = "Flow_Differential_Pt_RP_";
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));
126 // Differential flow (eta) of RPs:
127 name = "Flow_Differential_Eta_RP_";
129 fHistDiffFlowEtaRP = new TH1D(name.Data(),"Differential Flow vs #eta (RP)",iNbinsEta,dEtaMin,dEtaMax);
130 fHistDiffFlowEtaRP->SetStats(kFALSE);
131 fHistDiffFlowEtaRP->SetXTitle("#eta");
132 fHistDiffFlowEtaRP->SetYTitle(Form("v_{%d}",harmonic));
134 // Integrated flow of POIs:
135 name = "Flow_Integrated_POI_";
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));
144 // Differential flow (Pt) of POIs:
145 name = "Flow_Differential_Pt_POI_";
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));
151 // Differential flow (eta) of POIs:
152 name = "Flow_Differential_Eta_POI_";
154 fHistDiffFlowEtaPOI = new TH1D(name.Data(),"Differential Flow vs #eta (POI)",iNbinsEta,dEtaMin,dEtaMax);
155 fHistDiffFlowEtaPOI->SetStats(kFALSE);
156 fHistDiffFlowEtaPOI->SetXTitle("#eta");
157 fHistDiffFlowEtaPOI->SetYTitle(Form("v_{%d}",harmonic));
159 // List of histograms:
160 fHistList = new TList();
161 fHistList-> Add(fHistIntFlow);
162 fHistList-> Add(fHistChi);
163 fHistList->Add(fHistIntFlowRP);
164 fHistList->Add(fHistDiffFlowPtRP);
165 fHistList->Add(fHistDiffFlowEtaRP);
166 fHistList->Add(fHistIntFlowPOI);
167 fHistList->Add(fHistDiffFlowPtPOI);
168 fHistList->Add(fHistDiffFlowEtaPOI);
171 //-----------------------------------------------------------------------
173 AliFlowCommonHistResults::~AliFlowCommonHistResults()
175 // Deletes histograms:
178 delete fHistIntFlowRP;
179 delete fHistDiffFlowPtRP;
180 delete fHistDiffFlowEtaRP;
181 delete fHistIntFlowPOI;
182 delete fHistDiffFlowPtPOI;
183 delete fHistDiffFlowEtaPOI;
187 //-----------------------------------------------------------------------
189 Bool_t AliFlowCommonHistResults::FillIntegratedFlow(Double_t aV, Double_t anError)
191 // Fill fHistIntFlow:
192 fHistIntFlow -> SetBinContent(1,aV);
193 fHistIntFlow -> SetBinError(1,anError);
198 //-----------------------------------------------------------------------
200 Bool_t AliFlowCommonHistResults::FillChi(Double_t aChi)
203 fHistChi -> SetBinContent(1,aChi);
208 //-----------------------------------------------------------------------
210 Bool_t AliFlowCommonHistResults::FillIntegratedFlowRP(Double_t aV, Double_t anError)
212 //Fill fHistIntFlowRP
213 fHistIntFlowRP->SetBinContent(1,aV);
214 fHistIntFlowRP->SetBinError(1,anError);
219 //-----------------------------------------------------------------------
221 Bool_t AliFlowCommonHistResults::FillDifferentialFlowPtRP(Int_t aBin, Double_t av, Double_t anError)
223 //Fill fHistDiffFlowPtRP
224 fHistDiffFlowPtRP->SetBinContent(aBin,av);
225 fHistDiffFlowPtRP->SetBinError(aBin,anError);
230 //-----------------------------------------------------------------------
232 Bool_t AliFlowCommonHistResults::FillDifferentialFlowEtaRP(Int_t aBin, Double_t av, Double_t anError)
234 //Fill fHistDiffFlowEtaRP
235 fHistDiffFlowEtaRP->SetBinContent(aBin,av);
236 fHistDiffFlowEtaRP->SetBinError(aBin,anError);
241 //-----------------------------------------------------------------------
243 Bool_t AliFlowCommonHistResults::FillIntegratedFlowPOI(Double_t aV, Double_t anError)
245 //Fill fHistIntFlowPOI
246 fHistIntFlowPOI->SetBinContent(1,aV);
247 fHistIntFlowPOI->SetBinError(1,anError);
252 //-----------------------------------------------------------------------
254 Bool_t AliFlowCommonHistResults::FillDifferentialFlowPtPOI(Int_t aBin, Double_t av, Double_t anError)
256 //Fill fHistDiffFlowPtPOI
257 fHistDiffFlowPtPOI->SetBinContent(aBin,av);
258 fHistDiffFlowPtPOI->SetBinError(aBin,anError);
263 //-----------------------------------------------------------------------
265 Bool_t AliFlowCommonHistResults::FillDifferentialFlowEtaPOI(Int_t aBin, Double_t av, Double_t anError)
267 //Fill fHistDiffFlowEtaPOI
268 fHistDiffFlowEtaPOI->SetBinContent(aBin,av);
269 fHistDiffFlowEtaPOI->SetBinError(aBin,anError);
274 //-----------------------------------------------------------------------
276 Double_t AliFlowCommonHistResults::Merge(TCollection *aList)
279 //cout<<"entering merge function"<<endl;
280 if (!aList) return 0;
281 if (aList->IsEmpty()) return 0; //no merging is needed
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());
292 // Now call merge for fHistList providing temp list
293 fHistList->Merge(pTemp);
297 //cout<<"Merged"<<endl;
298 return (double)iCount;
302 //-----------------------------------------------------------------------
303 void AliFlowCommonHistResults::Print(Option_t *option) const
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());
311 fHistList->Print(option);
315 printf( "Empty histogram list \n");
319 //-----------------------------------------------------------------------
320 void AliFlowCommonHistResults::Browse(TBrowser *b)
324 if (fHistList) b->Add(fHistList,"AliFlowCommonHistResultsList");