]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowCommonHist.cxx
cleanup of couts and such
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowCommonHist.cxx
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 #include "Riostream.h"              //needed as include
17 #include "AliFlowCommonConstants.h" //needed as include
18 #include "AliFlowCommonHist.h"
19 #include "AliFlowEventSimple.h"
20 #include "AliFlowTrackSimple.h"
21
22 #include "TString.h" 
23 #include "TProfile.h"
24 #include "TMath.h"   //needed as include
25 #include "TList.h"
26 #include "TH2F.h"
27 #include "AliFlowVector.h"
28 #include "TBrowser.h"
29
30 class TH1F;
31 class TH1D;
32
33 // AliFlowCommonHist:
34 //
35 // Description: Class to organise common histograms for Flow Analysis
36 //
37 // authors: N. van der Kolk (kolk@nikhef.nl), A. Bilandzic (anteb@nikhef.nl), RS
38
39
40 ClassImp(AliFlowCommonHist)
41
42 //-----------------------------------------------------------------------
43
44 AliFlowCommonHist::AliFlowCommonHist():
45   TNamed(),
46   fBookOnlyBasic(kFALSE),
47   fHistMultRP(NULL),
48   fHistMultPOI(NULL),
49   fHistMultPOIvsRP(NULL),
50   fHistPtRP(NULL),
51   fHistPtPOI(NULL),
52   fHistPtSub0(NULL),
53   fHistPtSub1(NULL),
54   fHistPhiRP(NULL),
55   fHistPhiPOI(NULL),
56   fHistPhiSub0(NULL),
57   fHistPhiSub1(NULL),
58   fHistEtaRP(NULL),
59   fHistEtaPOI(NULL),
60   fHistEtaSub0(NULL),
61   fHistEtaSub1(NULL),
62   fHistPhiEtaRP(NULL),
63   fHistPhiEtaPOI(NULL),
64   fHistProMeanPtperBin(NULL),
65   fHistWeightvsPhi(NULL),
66   fHistQ(NULL),
67   fHistAngleQ(NULL),
68   fHistAngleQSub0(NULL),
69   fHistAngleQSub1(NULL), 
70   fHarmonic(NULL),
71   fRefMultVsNoOfRPs(NULL),
72   fHistRefMult(NULL),
73   fHistMassPOI(NULL),
74   fHistList(NULL)
75 {
76   
77   //default constructor
78   
79 }
80
81 AliFlowCommonHist::AliFlowCommonHist(const AliFlowCommonHist& a):
82   TNamed(),
83   fBookOnlyBasic(a.fBookOnlyBasic),
84   fHistMultRP(new TH1F(*a.fHistMultRP)),
85   fHistMultPOI(new TH1F(*a.fHistMultPOI)),
86   fHistMultPOIvsRP(new TH2F(*a.fHistMultPOIvsRP)),
87   fHistPtRP(new TH1F(*a.fHistPtRP)),
88   fHistPtPOI(new TH1F(*a.fHistPtPOI)),
89   fHistPtSub0(new TH1F(*a.fHistPtSub0)),
90   fHistPtSub1(new TH1F(*a.fHistPtSub1)),
91   fHistPhiRP(new TH1F(*a.fHistPhiRP)),
92   fHistPhiPOI(new TH1F(*a.fHistPhiPOI)),
93   fHistPhiSub0(new TH1F(*a.fHistPhiSub0)),
94   fHistPhiSub1(new TH1F(*a.fHistPhiSub1)),
95   fHistEtaRP(new TH1F(*a.fHistEtaRP)),
96   fHistEtaPOI(new TH1F(*a.fHistEtaPOI)),
97   fHistEtaSub0(new TH1F(*a.fHistEtaSub0)),
98   fHistEtaSub1(new TH1F(*a.fHistEtaSub1)),
99   fHistPhiEtaRP(new TH2F(*a.fHistPhiEtaRP)),
100   fHistPhiEtaPOI(new TH2F(*a.fHistPhiEtaPOI)),
101   fHistProMeanPtperBin(new TProfile(*a.fHistProMeanPtperBin)),
102   fHistWeightvsPhi(new TH2F(*a.fHistWeightvsPhi)),
103   fHistQ(new TH1F(*a.fHistQ)),
104   fHistAngleQ(new TH1F(*a.fHistAngleQ)),
105   fHistAngleQSub0(new TH1F(*a.fHistAngleQSub0)),
106   fHistAngleQSub1(new TH1F(*a.fHistAngleQSub1)), 
107   fHarmonic(new TProfile(*a.fHarmonic)),
108   fRefMultVsNoOfRPs(new TProfile(*a.fRefMultVsNoOfRPs)),
109   fHistRefMult(new TH1F(*a.fHistRefMult)),  
110   fHistMassPOI(new TH2F(*a.fHistMassPOI)),  
111   fHistList(NULL)
112 {
113   // copy constructor
114
115   fHistList = new TList();
116   fHistList-> Add(fHistMultRP);        
117   fHistList-> Add(fHistMultPOI);
118   if(!fBookOnlyBasic){fHistList-> Add(fHistMultPOIvsRP);}
119   fHistList-> Add(fHistPtRP);          
120   fHistList-> Add(fHistPtPOI);
121   if(!fBookOnlyBasic){fHistList-> Add(fHistPtSub0);}
122   if(!fBookOnlyBasic){fHistList-> Add(fHistPtSub1);}
123   fHistList-> Add(fHistPhiRP);          
124   fHistList-> Add(fHistPhiPOI);
125   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiSub0);}
126   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiSub1);}    
127   fHistList-> Add(fHistEtaRP);          
128   fHistList-> Add(fHistEtaPOI); 
129   if(!fBookOnlyBasic){fHistList-> Add(fHistEtaSub0);}
130   if(!fBookOnlyBasic){fHistList-> Add(fHistEtaSub1);}
131   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiEtaRP);}
132   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiEtaPOI);}
133   fHistList-> Add(fHistProMeanPtperBin);
134   if(!fBookOnlyBasic){fHistList-> Add(fHistWeightvsPhi);}
135   fHistList-> Add(fHarmonic);  
136   fHistList-> Add(fRefMultVsNoOfRPs);
137   fHistList-> Add(fHistRefMult); 
138   fHistList-> Add(fHistMassPOI); 
139   if(!fBookOnlyBasic){fHistList-> Add(fHistQ);} 
140   if(!fBookOnlyBasic){fHistList-> Add(fHistAngleQ);}
141   if(!fBookOnlyBasic){fHistList-> Add(fHistAngleQSub0);}
142   if(!fBookOnlyBasic){fHistList-> Add(fHistAngleQSub1);}
143   //  TListIter next = TListIter(a.fHistList);
144
145 }
146
147
148 //-----------------------------------------------------------------------
149
150   AliFlowCommonHist::AliFlowCommonHist(const char *anInput, const char *title, Bool_t bookOnlyBasic):
151     TNamed(anInput,title),
152     fBookOnlyBasic(bookOnlyBasic),
153     fHistMultRP(NULL),
154     fHistMultPOI(NULL),
155     fHistMultPOIvsRP(NULL),
156     fHistPtRP(NULL),
157     fHistPtPOI(NULL),
158     fHistPtSub0(NULL),
159     fHistPtSub1(NULL),
160     fHistPhiRP(NULL),
161     fHistPhiPOI(NULL),
162     fHistPhiSub0(NULL),
163     fHistPhiSub1(NULL),
164     fHistEtaRP(NULL),
165     fHistEtaPOI(NULL),
166     fHistEtaSub0(NULL),
167     fHistEtaSub1(NULL),
168     fHistPhiEtaRP(NULL),
169     fHistPhiEtaPOI(NULL),
170     fHistProMeanPtperBin(NULL),
171     fHistWeightvsPhi(NULL),
172     fHistQ(NULL),
173     fHistAngleQ(NULL),
174     fHistAngleQSub0(NULL),
175     fHistAngleQSub1(NULL), 
176     fHarmonic(NULL),
177     fRefMultVsNoOfRPs(NULL),
178     fHistRefMult(NULL),
179     fHistMassPOI(NULL),
180     fHistList(NULL)
181 {
182
183   //constructor creating histograms 
184   Int_t iNbinsMult = AliFlowCommonConstants::GetMaster()->GetNbinsMult();
185   Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
186   Int_t iNbinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
187   Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
188   Int_t iNbinsQ = AliFlowCommonConstants::GetMaster()->GetNbinsQ();
189   Int_t iNbinsMass = AliFlowCommonConstants::GetMaster()->GetNbinsMass();
190   TString sName;
191
192   Double_t  dMultMin = AliFlowCommonConstants::GetMaster()->GetMultMin();            
193   Double_t  dMultMax = AliFlowCommonConstants::GetMaster()->GetMultMax();
194   Double_t  dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();        
195   Double_t  dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
196   Double_t  dPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();      
197   Double_t  dPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
198   Double_t  dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();      
199   Double_t  dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();      
200   Double_t  dQMin = AliFlowCommonConstants::GetMaster()->GetQMin();          
201   Double_t  dQMax = AliFlowCommonConstants::GetMaster()->GetQMax();     
202   Double_t  dHistWeightvsPhiMin = AliFlowCommonConstants::GetMaster()->GetHistWeightvsPhiMin();
203   Double_t  dHistWeightvsPhiMax = AliFlowCommonConstants::GetMaster()->GetHistWeightvsPhiMax();
204   Double_t  dMassMin = AliFlowCommonConstants::GetMaster()->GetMassMin();
205   Double_t  dMassMax = AliFlowCommonConstants::GetMaster()->GetMassMax();
206
207   
208   //  cout<<"The settings for the common histograms are as follows:"<<endl;
209   //  cout<<"Multiplicity: "<<iNbinsMult<<" bins between "<<dMultMin<<" and "<<dMultMax<<endl;
210   //  cout<<"Pt: "<<iNbinsPt<<" bins between "<<dPtMin<<" and "<<dPtMax<<endl;
211   //  cout<<"Phi: "<<iNbinsPhi<<" bins between "<<dPhiMin<<" and "<<dPhiMax<<endl;
212   //  cout<<"Eta: "<<iNbinsEta<<" bins between "<<dEtaMin<<" and "<<dEtaMax<<endl;
213   //  cout<<"Q: "<<iNbinsQ<<" bins between "<<dQMin<<" and "<<dQMax<<endl;
214   //  cout<<"Mass: "<<iNbinsMass<<" bins between "<<dMassMin<<" and "<<dMassMax<<endl;
215
216   //Multiplicity
217   sName = "Control_Flow_MultRP_";
218   sName +=anInput;
219   fHistMultRP = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
220   fHistMultRP ->SetXTitle("Multiplicity for RP selection");
221   fHistMultRP ->SetYTitle("Counts");
222
223   sName = "Control_Flow_MultPOI_";
224   sName +=anInput;
225   fHistMultPOI = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
226   fHistMultPOI ->SetXTitle("Multiplicity for POI selection");
227   fHistMultPOI ->SetYTitle("Counts");
228
229   if(!fBookOnlyBasic){
230   sName = "Control_Flow_MultPOIvsRP_";
231   sName +=anInput;
232   fHistMultPOIvsRP = new TH2F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax,100, dMultMin, dMultMax);
233   fHistMultPOIvsRP->SetXTitle("Multiplicity for RP selection");
234   fHistMultPOIvsRP->SetYTitle("Multiplicity for POI selection");
235   }
236   
237   //Pt
238   sName = "Control_Flow_PtRP_";
239   sName +=anInput;
240   fHistPtRP = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax); 
241   fHistPtRP ->SetXTitle("P_{t} (GeV/c) for RP selection");
242   fHistPtRP ->SetYTitle("Counts");
243
244   sName = "Control_Flow_PtPOI_";
245   sName +=anInput;
246   fHistPtPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax); 
247   //binning has to be the same as for fHistProVPt! use to get Nprime!
248   fHistPtPOI ->SetXTitle("P_{t} (GeV/c) for POI selection");
249   fHistPtPOI ->SetYTitle("Counts");
250
251   if(!fBookOnlyBasic){
252   sName = "Control_Flow_PtSub0_";
253   sName +=anInput;
254   fHistPtSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax); 
255   fHistPtSub0 ->SetXTitle("P_{t} (GeV/c) for Subevent 0 selection");
256   fHistPtSub0 ->SetYTitle("Counts");
257   }
258   
259   if(!fBookOnlyBasic){
260   sName = "Control_Flow_PtSub1_";
261   sName +=anInput;
262   fHistPtSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax); 
263   fHistPtSub1 ->SetXTitle("P_{t} (GeV/c) for Subevent 1 selection");
264   fHistPtSub1 ->SetYTitle("Counts");
265   }
266   
267   //Phi
268   sName = "Control_Flow_PhiRP_";
269   sName +=anInput;
270   fHistPhiRP = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
271   fHistPhiRP ->SetXTitle("#phi for RP selection");
272   fHistPhiRP ->SetYTitle("Counts");
273
274   sName = "Control_Flow_PhiPOI_";
275   sName +=anInput;
276   fHistPhiPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
277   fHistPhiPOI ->SetXTitle("#phi for POI selection");
278   fHistPhiPOI ->SetYTitle("Counts");
279
280   if(!fBookOnlyBasic){
281   sName = "Control_Flow_PhiSub0_";
282   sName +=anInput;
283   fHistPhiSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
284   fHistPhiSub0 ->SetXTitle("#phi for Subevent 0 selection");
285   fHistPhiSub0 ->SetYTitle("Counts");
286   }
287    
288   if(!fBookOnlyBasic){
289   sName = "Control_Flow_PhiSub1_";
290   sName +=anInput;
291   fHistPhiSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
292   fHistPhiSub1 ->SetXTitle("#phi for Subevent 1 selection");
293   fHistPhiSub1 ->SetYTitle("Counts");
294   }
295   
296   //Eta
297   sName = "Control_Flow_EtaRP_";
298   sName +=anInput;
299   fHistEtaRP = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
300   fHistEtaRP ->SetXTitle("#eta for RP selection");
301   fHistEtaRP ->SetYTitle("Counts");
302
303   sName = "Control_Flow_EtaPOI_";
304   sName +=anInput;
305   fHistEtaPOI = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
306   fHistEtaPOI ->SetXTitle("#eta for POI selection");
307   fHistEtaPOI ->SetYTitle("Counts");
308
309   if(!fBookOnlyBasic){
310   sName = "Control_Flow_EtaSub0_";
311   sName +=anInput;
312   fHistEtaSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
313   fHistEtaSub0 ->SetXTitle("#eta for Subevent 0 selection");
314   fHistEtaSub0 ->SetYTitle("Counts");
315   }
316   
317   if(!fBookOnlyBasic){
318   sName = "Control_Flow_EtaSub1_";
319   sName +=anInput;
320   fHistEtaSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
321   fHistEtaSub1 ->SetXTitle("#eta for Subevent 1 selection");
322   fHistEtaSub1 ->SetYTitle("Counts");
323   }
324
325   if(!fBookOnlyBasic){
326   //Phi vs Eta
327   sName = "Control_Flow_PhiEtaRP_";
328   sName +=anInput;
329   fHistPhiEtaRP = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
330   fHistPhiEtaRP ->SetXTitle("#eta");
331   fHistPhiEtaRP ->SetYTitle("#phi");
332   }
333   
334   if(!fBookOnlyBasic){
335   sName = "Control_Flow_PhiEtaPOI_";
336   sName +=anInput;
337   fHistPhiEtaPOI = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
338   fHistPhiEtaPOI ->SetXTitle("#eta");
339   fHistPhiEtaPOI ->SetYTitle("#phi");
340   }
341   
342   //Mean Pt per pt bin 
343   sName = "Control_FlowPro_MeanPtperBin_";
344   sName +=anInput;
345   fHistProMeanPtperBin = new TProfile(sName.Data(), sName.Data(),iNbinsPt,dPtMin,dPtMax);
346   fHistProMeanPtperBin ->SetXTitle("P_{t} (GeV/c) ");
347   fHistProMeanPtperBin ->SetYTitle("<P_{t}> (GeV/c) ");
348
349   
350   if(!fBookOnlyBasic){
351   //Particle weight
352   sName = "Control_Flow_WeightvsPhi_";
353   sName +=anInput;
354   fHistWeightvsPhi = new TH2F(sName.Data(), sName.Data(), iNbinsPhi, dPhiMin, dPhiMax, 300, dHistWeightvsPhiMin, dHistWeightvsPhiMax); 
355   fHistWeightvsPhi ->SetXTitle("#phi");
356   fHistWeightvsPhi ->SetYTitle("weight");
357   }
358   
359   if(!fBookOnlyBasic){
360   //Q vector
361   sName = "Control_Flow_Q_";
362   sName +=anInput;
363   fHistQ = new TH1F(sName.Data(), sName.Data(),iNbinsQ, dQMin, dQMax);
364   fHistQ ->SetXTitle("Q_{vector}/Mult");
365   fHistQ ->SetYTitle("Counts");  
366   }
367     
368   if(!fBookOnlyBasic){
369   //Angle of Q vector
370   sName = "Control_Flow_AngleQ_";
371   sName +=anInput;
372   fHistAngleQ = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
373   fHistAngleQ ->SetXTitle("Angle of Q_{vector}");
374   fHistAngleQ ->SetYTitle("Counts"); 
375   }
376    
377   if(!fBookOnlyBasic){
378   sName = "Control_Flow_AngleQSub0_";
379   sName +=anInput;
380   fHistAngleQSub0 = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
381   fHistAngleQSub0 ->SetXTitle("Angle of Q_{vector} for Subevent 0");
382   fHistAngleQSub0 ->SetYTitle("Counts"); 
383   }
384   
385   if(!fBookOnlyBasic){
386   sName = "Control_Flow_AngleQSub1_";
387   sName +=anInput;
388   fHistAngleQSub1 = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
389   fHistAngleQSub1 ->SetXTitle("Angle of Q_{vector} for Subevent 1");
390   fHistAngleQSub1 ->SetYTitle("Counts"); 
391   }
392   
393   //harmonic
394   sName = "Control_Flow_Harmonic_";
395   sName +=anInput;
396   fHarmonic = new TProfile(sName.Data(),sName.Data(),1,0,1);
397   fHarmonic ->SetYTitle("harmonic");
398   
399   //<reference multiplicity> versus # of RPs
400   sName = "Reference_Multiplicity_Vs_Number_Of_RPs_";
401   sName +=anInput;
402   fRefMultVsNoOfRPs = new TProfile(sName.Data(),sName.Data(),iNbinsMult, dMultMin, dMultMax);
403   fRefMultVsNoOfRPs->SetYTitle("<reference multiplicity>");
404   fRefMultVsNoOfRPs->SetXTitle("# of RPs");
405
406   //reference multiplicity
407   sName = "Control_Flow_Ref_Mult_";
408   sName +=anInput;
409   fHistRefMult = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
410   fHistRefMult->SetXTitle("Reference multiplicity");
411   fHistRefMult->SetYTitle("Counts");
412
413   //mass for POI selection
414   sName = "Control_Flow_Mass_POI";
415   sName +=anInput;
416   fHistMassPOI = new TH2F(sName.Data(), sName.Data(), iNbinsMass, dMassMin, dMassMax,
417                           iNbinsPt, dPtMin, dPtMax);
418   double mbWidth = (dMassMax-dMassMin)/iNbinsMass*1000.;
419   fHistMassPOI->SetXTitle("Mass (GeV/c^{2})");
420   fHistMassPOI->SetYTitle("P_{t} (GeV/c)");
421   fHistMassPOI->SetZTitle( Form("Counts/(%.2f MeV/c^{2})",mbWidth) );
422
423   //list of histograms if added here also add in copy constructor
424   fHistList = new TList();
425   fHistList-> Add(fHistMultRP);        
426   fHistList-> Add(fHistMultPOI); 
427   if(!fBookOnlyBasic){fHistList-> Add(fHistMultPOIvsRP);}
428   fHistList-> Add(fHistPtRP);          
429   fHistList-> Add(fHistPtPOI); 
430   if(!fBookOnlyBasic){fHistList-> Add(fHistPtSub0);}
431   if(!fBookOnlyBasic){fHistList-> Add(fHistPtSub1);}
432   fHistList-> Add(fHistPhiRP);          
433   fHistList-> Add(fHistPhiPOI);
434   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiSub0);}
435   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiSub1);}
436   fHistList-> Add(fHistEtaRP);          
437   fHistList-> Add(fHistEtaPOI); 
438   if(!fBookOnlyBasic){fHistList-> Add(fHistEtaSub0);} 
439   if(!fBookOnlyBasic){fHistList-> Add(fHistEtaSub1);}
440   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiEtaRP);}  
441   if(!fBookOnlyBasic){fHistList-> Add(fHistPhiEtaPOI);}
442   fHistList-> Add(fHistProMeanPtperBin);
443   if(!fBookOnlyBasic){fHistList-> Add(fHistWeightvsPhi);}
444   fHistList-> Add(fHarmonic); 
445   fHistList-> Add(fRefMultVsNoOfRPs); 
446   fHistList-> Add(fHistRefMult);   
447   fHistList-> Add(fHistMassPOI);   
448   if(!fBookOnlyBasic){fHistList-> Add(fHistQ);}           
449   if(!fBookOnlyBasic){fHistList-> Add(fHistAngleQ);}
450   if(!fBookOnlyBasic){fHistList-> Add(fHistAngleQSub0);}
451   if(!fBookOnlyBasic){fHistList-> Add(fHistAngleQSub1);} 
452
453 }
454
455
456 //----------------------------------------------------------------------- 
457
458 AliFlowCommonHist::~AliFlowCommonHist()
459 {
460   //deletes histograms
461   delete fHistMultRP;       
462   delete fHistMultPOI; 
463   if(!fBookOnlyBasic){delete fHistMultPOIvsRP;}
464   delete fHistPtRP;         
465   delete fHistPtPOI;
466   if(!fBookOnlyBasic){delete fHistPtSub0;}
467   if(!fBookOnlyBasic){delete fHistPtSub1;}
468   delete fHistPhiRP;        
469   delete fHistPhiPOI;
470   if(!fBookOnlyBasic){delete fHistPhiSub0;}
471   if(!fBookOnlyBasic){delete fHistPhiSub1;}
472   delete fHistEtaRP;        
473   delete fHistEtaPOI;
474   if(!fBookOnlyBasic){delete fHistEtaSub0;}
475   if(!fBookOnlyBasic){delete fHistEtaSub1;}
476   delete fHistPhiEtaRP;
477   delete fHistPhiEtaPOI;
478   delete fHistProMeanPtperBin;
479   if(!fBookOnlyBasic){delete fHistWeightvsPhi;}
480   if(!fBookOnlyBasic){delete fHistQ;}
481   if(!fBookOnlyBasic){delete fHistAngleQ;}
482   if(!fBookOnlyBasic){delete fHistAngleQSub0;}
483   if(!fBookOnlyBasic){delete fHistAngleQSub1;}
484   delete fHarmonic;
485   delete fRefMultVsNoOfRPs;
486   delete fHistRefMult;  
487   delete fHistMassPOI;  
488   delete fHistList;
489 }
490
491
492 //----------------------------------------------------------------------- 
493
494 Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* anEvent,TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
495 {
496   //Fills the control histograms
497   if (!anEvent){
498     cout<<"##### FillControlHistograms: FlowEvent pointer null"<<endl;
499     return kFALSE;
500   }
501
502   //track datamembers
503   Double_t dPt     = 0.;
504   Double_t dPhi    = 0.;
505   Double_t dEta    = 0.;
506   Double_t dWeight = 1.;
507
508   //weights used for corrections
509   Double_t dWPhi = 1.;
510   Double_t dWPt  = 1.;
511   Double_t dWEta = 1.;
512
513   TH1F *phiWeights     = NULL;
514   TH1F *phiWeightsSub0 = NULL;
515   TH1F *phiWeightsSub1 = NULL;
516   TH1D *ptWeights      = NULL;
517   TH1D *etaWeights     = NULL;
518
519   Int_t nBinsPhi     = 0;
520   Int_t nBinsPhiSub0 = 0;
521   Int_t nBinsPhiSub1 = 0;
522   Double_t dBinWidthPt  = 0.;
523   Double_t dPtMin       = 0.;
524   Double_t dBinWidthEta = 0.;
525   Double_t dEtaMin      = 0.;
526
527   if(weightsList)
528     {
529       if(usePhiWeights)
530         {
531           phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights"));
532           if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
533           phiWeightsSub0 = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights_sub0"));
534           if(phiWeightsSub0) nBinsPhiSub0 = phiWeightsSub0->GetNbinsX();
535           phiWeightsSub1 = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights_sub1"));
536           if(phiWeightsSub1) nBinsPhiSub1 = phiWeightsSub1->GetNbinsX();
537         }
538       if(usePtWeights)
539         {
540           ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
541           if(ptWeights)
542             {
543               dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
544               dPtMin = (ptWeights->GetXaxis())->GetXmin();
545             }
546         }
547       if(useEtaWeights)
548         {
549           etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
550           if(etaWeights)
551             {
552               dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
553               dEtaMin = (etaWeights->GetXaxis())->GetXmin();
554             }
555         }
556     } // end of if(weightsList)
557
558
559   
560   //fill the histograms
561   AliFlowVector vQ = anEvent->GetQ(2, weightsList, usePhiWeights, usePtWeights, useEtaWeights); 
562   //weight by the Multiplicity
563   Double_t dQX = 0.;
564   Double_t dQY = 0.;
565   if (vQ.GetMult()!=0) {
566     dQX = vQ.X()/vQ.GetMult();
567     dQY = vQ.Y()/vQ.GetMult();
568   }
569   vQ.Set(dQX,dQY);
570   if(!fBookOnlyBasic){fHistQ->Fill(vQ.Mod());}
571   if(!fBookOnlyBasic){fHistAngleQ->Fill(vQ.Phi()/2);}
572
573   AliFlowVector* vQSub = new AliFlowVector[2];
574   anEvent->Get2Qsub(vQSub, 2, weightsList, usePhiWeights, usePtWeights, useEtaWeights);
575   AliFlowVector vQa = vQSub[0];
576   AliFlowVector vQb = vQSub[1];
577   if(!fBookOnlyBasic){fHistAngleQSub0->Fill(vQa.Phi()/2);}
578   if(!fBookOnlyBasic){fHistAngleQSub1->Fill(vQb.Phi()/2);}
579
580   Double_t dMultRP = 0.;
581   Double_t dMultPOI = 0.;
582   
583   Int_t iNumberOfTracks = anEvent->NumberOfTracks();
584   AliFlowTrackSimple* pTrack = NULL;     
585
586   for (Int_t i=0;i<iNumberOfTracks;i++) {
587     pTrack = anEvent->GetTrack(i);
588     if (pTrack ) {
589       dWeight = pTrack->Weight();
590       dPt = pTrack->Pt();
591       dPhi = pTrack->Phi();
592       if (dPhi<0.) dPhi+=2*TMath::Pi();
593       dEta = pTrack->Eta();
594
595       //weights are only used for the RP selection
596       if (pTrack->InRPSelection()){
597         // determine Phi weight:
598         if(phiWeights && nBinsPhi) {
599           dWPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
600         }
601         // determine v'(pt) weight:
602         if(ptWeights && dBinWidthPt) {
603           dWPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
604         }
605         // determine v'(eta) weight:
606         if(etaWeights && dBinWidthEta)  {
607           dWEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
608         }
609         
610         //the total weight is the product
611         Double_t dW = dWeight*dWPhi*dWPt*dWEta; 
612
613         //pt
614         fHistPtRP->Fill(dPt,dW);
615         //phi
616         fHistPhiRP->Fill(dPhi,dW);
617         //eta
618         fHistEtaRP->Fill(dEta,dW);
619         //eta vs phi
620         if(!fBookOnlyBasic){fHistPhiEtaRP->Fill(dEta,dPhi,dW);}
621         //weight vs phi
622         if(!fBookOnlyBasic){fHistWeightvsPhi->Fill(dPhi,dW);}
623         //count
624         dMultRP += dW;
625       }
626       if (pTrack->InRPSelection() && pTrack->InSubevent(0)) {
627         // determine Phi weight:
628         if(phiWeightsSub0 && nBinsPhiSub0){
629           dWPhi = phiWeightsSub0->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhiSub0/TMath::TwoPi())));
630         }
631         // determine v'(pt) weight:
632         if(ptWeights && dBinWidthPt) {
633           dWPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
634         }
635         // determine v'(eta) weight:
636         if(etaWeights && dBinWidthEta)  {
637           dWEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
638         }
639         
640         //the total weight is the product
641         Double_t dW = dWeight*dWPhi*dWPt*dWEta;  
642
643         //pt
644         if(!fBookOnlyBasic){fHistPtSub0 ->Fill(dPt,dW);}
645         //phi
646         if(!fBookOnlyBasic){fHistPhiSub0 ->Fill(dPhi,dW);}
647         //eta
648         if(!fBookOnlyBasic){fHistEtaSub0 ->Fill(dEta,dW);}
649       }
650       if (pTrack->InRPSelection() && pTrack->InSubevent(1)) {
651         // determine Phi weight:
652         if(phiWeightsSub1 && nBinsPhiSub1){
653           dWPhi = phiWeightsSub1->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhiSub1/TMath::TwoPi())));
654         }
655         // determine v'(pt) weight:
656         if(ptWeights && dBinWidthPt) {
657           dWPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
658         }
659         // determine v'(eta) weight:
660         if(etaWeights && dBinWidthEta)  {
661           dWEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
662         }
663         
664         //the total weight is the product
665         Double_t dW = dWeight*dWPhi*dWPt*dWEta;  
666
667         //pt
668         if(!fBookOnlyBasic){fHistPtSub1 -> Fill(dPt,dW);}
669         //phi
670         if(!fBookOnlyBasic){fHistPhiSub1 -> Fill(dPhi,dW);}
671         //eta
672         if(!fBookOnlyBasic){fHistEtaSub1 -> Fill(dEta,dW);}
673       }
674       if (pTrack->InPOISelection()){
675
676         Double_t dW = dWeight; //no pt, phi or eta weights
677
678         //pt
679         fHistPtPOI ->Fill(dPt,dW);
680         //phi
681         fHistPhiPOI ->Fill(dPhi,dW);
682         //eta
683         fHistEtaPOI ->Fill(dEta,dW);
684         //eta vs phi
685         if(!fBookOnlyBasic){fHistPhiEtaPOI ->Fill(dEta,dPhi,dW);}
686         //mean pt
687         fHistProMeanPtperBin ->Fill(dPt,dPt,dW);
688         //mass
689         fHistMassPOI->Fill(pTrack->Mass(),dPt,dW);
690         //count
691         dMultPOI += dW;
692       }
693     } //track
694   } //loop over tracks
695   
696   fHistMultRP->Fill(dMultRP);
697   fHistMultPOI->Fill(dMultPOI);
698   if(!fBookOnlyBasic){fHistMultPOIvsRP->Fill(dMultRP,dMultPOI);}
699   
700   //<reference multiplicity> versus # of RPs:
701   fRefMultVsNoOfRPs->Fill(dMultRP+0.5,anEvent->GetReferenceMultiplicity(),1.);
702   
703   //reference multiplicity:
704   fHistRefMult->Fill(anEvent->GetReferenceMultiplicity());
705
706   return kTRUE; 
707 }
708
709 //----------------------------------------------------------------------- 
710
711 Double_t AliFlowCommonHist::GetEntriesInPtBinRP(Int_t aBin)
712 {
713   //get entries in bin aBin from fHistPtRP
714   Double_t dEntries = fHistPtRP->GetBinContent(aBin);
715
716   return dEntries;
717
718 }
719
720 //----------------------------------------------------------------------- 
721
722 Double_t AliFlowCommonHist::GetEntriesInPtBinPOI(Int_t aBin)
723 {
724   //get entries in bin aBin from fHistPtPOI
725   Double_t dEntries = fHistPtPOI->GetBinContent(aBin);
726
727   return dEntries;
728
729 }
730
731 //----------------------------------------------------------------------- 
732
733 Double_t AliFlowCommonHist::GetEntriesInEtaBinRP(Int_t aBin)
734 {
735   //get entries in bin aBin from fHistPtRP
736   Double_t dEntries = fHistEtaRP->GetBinContent(aBin);
737
738   return dEntries;
739
740 }
741
742 //----------------------------------------------------------------------- 
743
744 Double_t AliFlowCommonHist::GetEntriesInEtaBinPOI(Int_t aBin)
745 {
746   //get entries in bin aBin from fHistPtPOI
747   Double_t dEntries = fHistEtaPOI->GetBinContent(aBin);
748
749   return dEntries;
750
751 }
752
753 //----------------------------------------------------------------------- 
754
755 Double_t AliFlowCommonHist::GetMeanPt(Int_t aBin)
756 {  
757   //Get entry from bin aBin from fHistProMeanPtperBin
758   Double_t dMeanPt = fHistProMeanPtperBin->GetBinContent(aBin);
759
760   return dMeanPt;
761   
762 }
763
764
765 //----------------------------------------------------------------------- 
766  Double_t AliFlowCommonHist::Merge(TCollection *aList)
767 {
768   //merge fuction
769   //cout<<"entering merge function"<<endl;
770   if (!aList) return 0;
771   if (aList->IsEmpty()) return 0; //no merging is needed
772
773   Int_t iCount = 0;
774   TIter next(aList); // list is supposed to contain only objects of the same type as this
775   AliFlowCommonHist *toMerge;
776   // make a temporary list
777   TList *pTemp = new TList();
778   while ((toMerge=(AliFlowCommonHist*)next())) {
779     pTemp->Add(toMerge->GetHistList()); 
780     iCount++;
781   }
782   // Now call merge for fHistList providing temp list
783   fHistList->Merge(pTemp);
784   // Cleanup
785   delete pTemp;
786     
787   //cout<<"Merged"<<endl;
788   return (double)iCount;
789     
790 }
791
792 void AliFlowCommonHist::Print(Option_t *option) const
793 {
794   //   -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
795   //             ===============================================
796   //   printf( "TH1.Print Name  = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
797   printf( "Class.Print Name = %s, Histogram list:\n",GetName());
798
799   if (fHistList) {  
800     fHistList->Print(option);
801   }
802   else
803     {
804       printf( "Empty histogram list \n");
805     }
806 }
807
808 //----------------------------------------------------------------------- 
809  void AliFlowCommonHist::Browse(TBrowser *b)
810 {
811
812   if (!b) return;
813   if (fHistList) b->Add(fHistList,"AliFlowCommonHistList");
814 }
815
816
817
818