AliPhysics  135f0b0 (135f0b0)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliFlowCommonHistResults.cxx
Go to the documentation of this file.
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  **************************************************************************/
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  * **********************************/
28 
29 #include "Riostream.h" //needed as include
30 #include "AliFlowCommonConstants.h" //needed as include
32 
33 #include "TString.h"
34 #include "TH1D.h" //needed as include
35 #include "TMath.h" //needed as include
36 #include "TList.h"
37 #include "TBrowser.h"
38 
39 class TH1F;
40 class AliFlowVector;
41 class AliFlowCommonHist;
42 
44 
45 //-----------------------------------------------------------------------
46 
48  TNamed(),
49  fHistIntFlow(NULL),
50  fHistChi(NULL),
51  fHistIntFlowRP(NULL),
52  fHistDiffFlowPtRP(NULL),
53  fHistDiffFlowEtaRP(NULL),
54  fHistIntFlowPOI(NULL),
55  fHistDiffFlowPtPOI(NULL),
56  fHistDiffFlowEtaPOI(NULL),
57  fHistList(NULL)
58 {
59  //default constructor
60 }
61 
62 //-----------------------------------------------------------------------
63 
64  AliFlowCommonHistResults::AliFlowCommonHistResults(const char *anInput, const char *title, Int_t harmonic):
65  TNamed(anInput,title),
66  fHistIntFlow(NULL),
67  fHistChi(NULL),
68  fHistIntFlowRP(NULL),
69  fHistDiffFlowPtRP(NULL),
70  fHistDiffFlowEtaRP(NULL),
71  fHistIntFlowPOI(NULL),
72  fHistDiffFlowPtPOI(NULL),
73  fHistDiffFlowEtaPOI(NULL),
74  fHistList(NULL)
75 {
76  //constructor creating histograms
77  //Pt:
81  //eta:
85 
86  TString name;
87 
88  // Reference flow: (TBI: rename eventually integrated flow => reference flow)
89  name = "Flow_Integrated_";
90  name += anInput;
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):
99  name = "Flow_Chi_";
100  name += anInput;
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");
107 
108  // Integrated flow of RPs:
109  name = "Flow_Integrated_RP_";
110  name += anInput;
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:
119  name = "Flow_Differential_Pt_RP_";
120  name += anInput;
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));
125 
126  // Differential flow (eta) of RPs:
127  name = "Flow_Differential_Eta_RP_";
128  name += anInput;
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));
133 
134  // Integrated flow of POIs:
135  name = "Flow_Integrated_POI_";
136  name += anInput;
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:
145  name = "Flow_Differential_Pt_POI_";
146  name += anInput;
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));
150 
151  // Differential flow (eta) of POIs:
152  name = "Flow_Differential_Eta_POI_";
153  name += anInput;
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));
158 
159  // List of histograms:
160  fHistList = new TList();
161  fHistList-> Add(fHistIntFlow);
162  fHistList-> Add(fHistChi);
169  }
170 
171 //-----------------------------------------------------------------------
172 
174 {
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;
185 }
186 
187 //-----------------------------------------------------------------------
188 
190 {
191  // Fill fHistIntFlow:
192  fHistIntFlow -> SetBinContent(1,aV);
193  fHistIntFlow -> SetBinError(1,anError);
194 
195  return kTRUE;
196 }
197 
198 //-----------------------------------------------------------------------
199 
201 {
202  //Fill fHistChi
203  fHistChi -> SetBinContent(1,aChi);
204 
205  return kTRUE;
206 }
207 
208 //-----------------------------------------------------------------------
209 
211 {
212  //Fill fHistIntFlowRP
213  fHistIntFlowRP->SetBinContent(1,aV);
214  fHistIntFlowRP->SetBinError(1,anError);
215 
216  return kTRUE;
217 }
218 
219 //-----------------------------------------------------------------------
220 
222 {
223  //Fill fHistDiffFlowPtRP
224  fHistDiffFlowPtRP->SetBinContent(aBin,av);
225  fHistDiffFlowPtRP->SetBinError(aBin,anError);
226 
227  return kTRUE;
228 }
229 
230 //-----------------------------------------------------------------------
231 
233 {
234  //Fill fHistDiffFlowEtaRP
235  fHistDiffFlowEtaRP->SetBinContent(aBin,av);
236  fHistDiffFlowEtaRP->SetBinError(aBin,anError);
237 
238  return kTRUE;
239 }
240 
241 //-----------------------------------------------------------------------
242 
244 {
245  //Fill fHistIntFlowPOI
246  fHistIntFlowPOI->SetBinContent(1,aV);
247  fHistIntFlowPOI->SetBinError(1,anError);
248 
249  return kTRUE;
250 }
251 
252 //-----------------------------------------------------------------------
253 
255 {
256  //Fill fHistDiffFlowPtPOI
257  fHistDiffFlowPtPOI->SetBinContent(aBin,av);
258  fHistDiffFlowPtPOI->SetBinError(aBin,anError);
259 
260  return kTRUE;
261 }
262 
263 //-----------------------------------------------------------------------
264 
266 {
267  //Fill fHistDiffFlowEtaPOI
268  fHistDiffFlowEtaPOI->SetBinContent(aBin,av);
269  fHistDiffFlowEtaPOI->SetBinError(aBin,anError);
270 
271  return kTRUE;
272 }
273 
274 //-----------------------------------------------------------------------
275 
277 {
278  //merge fuction
279  //cout<<"entering merge function"<<endl;
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 
297  //cout<<"Merged"<<endl;
298  return (double)iCount;
299 
300 }
301 
302 //-----------------------------------------------------------------------
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 //-----------------------------------------------------------------------
321 {
322 
323  if (!b) return;
324  if (fHistList) b->Add(fHistList,"AliFlowCommonHistResultsList");
325 }
326 
327 
328 
329 
double Double_t
Definition: External.C:58
const char * title
Definition: MakeQAPdf.C:26
ClassImp(AliFlowCommonHistResults) AliFlowCommonHistResults
void Print(Option_t *option="") const
Bool_t FillDifferentialFlowPtRP(Int_t aBin, Double_t av, Double_t anError)
Bool_t FillIntegratedFlowRP(Double_t aV, Double_t anError)
int Int_t
Definition: External.C:63
Definition: External.C:212
static AliFlowCommonConstants * GetMaster()
Bool_t FillIntegratedFlow(Double_t aV, Double_t anError)
Bool_t FillDifferentialFlowEtaPOI(Int_t aBin, Double_t av, Double_t anError)
Bool_t FillIntegratedFlowPOI(Double_t aV, Double_t anError)
Bool_t FillDifferentialFlowPtPOI(Int_t aBin, Double_t av, Double_t anError)
virtual Double_t Merge(TCollection *aList)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
Bool_t FillDifferentialFlowEtaRP(Int_t aBin, Double_t av, Double_t anError)