]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Base/AliFlowLYZHist2.cxx
- HF can take now all kind of histograms
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowLYZHist2.cxx
CommitLineData
f456b167 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$Log$
18*/
19
20#include "Riostream.h"
21#include "AliFlowLYZHist2.h"
448e8856 22#include "AliFlowCommonConstants.h"
f456b167 23#include "TProfile.h"
24#include "TProfile2D.h"
25#include "TString.h"
26#include "TComplex.h"
8de6876d 27#include "TList.h"
9d062fe3 28#include "TBrowser.h"
f456b167 29
30class TH1D;
31
f456b167 32// Class to organize the histograms in the second run
33// in the Lee Yang Zeros Flow analysis.
34// Also contains methods to get values from the histograms
35// which are called in AliFlowLeeYandZerosMaker::Finish().
36// author: N. van der Kolk (kolk@nikhef.nl)
37
f456b167 38ClassImp(AliFlowLYZHist2)
f456b167 39
8de6876d 40//-----------------------------------------------------------------------
f456b167 41
8de6876d 42 AliFlowLYZHist2::AliFlowLYZHist2():
9d062fe3 43 TNamed(),
8de6876d 44 fHistProReNumer(0),
45 fHistProImNumer(0),
46 fHistProReNumerPt(0),
47 fHistProImNumerPt(0),
48 fHistProReNumer2D(0),
49 fHistProImNumer2D(0),
50 fHistList(NULL)
51{
52 //default constructor
53}
54
f456b167 55//-----------------------------------------------------------------------
56
0c380f17 57 AliFlowLYZHist2::AliFlowLYZHist2(Int_t theta, const char* aSelection, const char *anInput, Bool_t useSum):
58 TNamed(anInput,anInput),
448e8856 59 fHistProReNumer(0),
60 fHistProImNumer(0),
61 fHistProReNumerPt(0),
62 fHistProImNumerPt(0),
63 fHistProReNumer2D(0),
8de6876d 64 fHistProImNumer2D(0),
65 fHistList(NULL)
f456b167 66{
448e8856 67
f456b167 68 //constructor creating histograms
0c380f17 69 TString title, name, addlast;
70
71 if (useSum) { addlast = "LYZSUM"; }
72 else { addlast = "LYZPROD"; }
73
bee2efdc 74 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
75 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
448e8856 76
bee2efdc 77 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
78 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
79 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
80 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
448e8856 81
f456b167 82 //fHistProReNumer
448e8856 83 name = "Second_FlowPro_ReNumer";
f456b167 84 name +=theta;
81bbfdbc 85 name +=aSelection;
0c380f17 86 name +=addlast;
81bbfdbc 87 title = name;
882ffd6a 88 fHistProReNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);
f456b167 89 fHistProReNumer->SetXTitle("eta");
90 fHistProReNumer->SetYTitle("v (%)");
91
92 //fHistProImNumer
448e8856 93 name = "Second_FlowPro_ImNumer";
f456b167 94 name +=theta;
81bbfdbc 95 name +=aSelection;
0c380f17 96 name +=addlast;
81bbfdbc 97 title = name;
882ffd6a 98 fHistProImNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);
f456b167 99 fHistProImNumer->SetXTitle("eta");
100 fHistProImNumer->SetYTitle("v (%)");
101
102 //fHistProReNumerPt
448e8856 103 name = "Second_FlowPro_ReNumerPt";
f456b167 104 name +=theta;
81bbfdbc 105 name +=aSelection;
0c380f17 106 name +=addlast;
81bbfdbc 107 title = name;
882ffd6a 108 fHistProReNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax);
f456b167 109 fHistProReNumerPt->SetXTitle("Pt");
110 fHistProReNumerPt->SetYTitle("v (%)");
111
112 //fHistProImNumerPt
448e8856 113 name = "Second_FlowPro_ImNumerPt";
f456b167 114 name +=theta;
81bbfdbc 115 name +=aSelection;
0c380f17 116 name +=addlast;
81bbfdbc 117 title = name;
882ffd6a 118 fHistProImNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax);
f456b167 119 fHistProImNumerPt->SetXTitle("Pt");
120 fHistProImNumerPt->SetYTitle("v (%)");
121
122 //fHistProReNumer2D
448e8856 123 name = "Second_FlowPro_ReNumer2D";
f456b167 124 name +=theta;
81bbfdbc 125 name +=aSelection;
0c380f17 126 name +=addlast;
81bbfdbc 127 title = name;
882ffd6a 128 fHistProReNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);
f456b167 129 fHistProReNumer2D->SetXTitle("eta");
130 fHistProReNumer2D->SetYTitle("Pt (GeV/c)");
131
132 //fHistProImNumer2D
448e8856 133 name = "Second_FlowPro_ImNumer2D";
f456b167 134 name +=theta;
81bbfdbc 135 name +=aSelection;
0c380f17 136 name +=addlast;
81bbfdbc 137 title = name;
882ffd6a 138 fHistProImNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);
f456b167 139 fHistProImNumer2D->SetXTitle("eta");
140 fHistProImNumer2D->SetYTitle("Pt (GeV/c)");
8de6876d 141
142 //list of histograms
143 fHistList = new TList();
144 fHistList-> Add(fHistProReNumer);
145 fHistList-> Add(fHistProImNumer);
146 fHistList-> Add(fHistProReNumerPt);
147 fHistList-> Add(fHistProImNumerPt);
148 fHistList-> Add(fHistProReNumer2D);
149 fHistList-> Add(fHistProImNumer2D);
150
f456b167 151}
152
f456b167 153//-----------------------------------------------------------------------
154
155AliFlowLYZHist2::~AliFlowLYZHist2()
156{
157 //deletes histograms
158 delete fHistProReNumer;
159 delete fHistProImNumer;
160 delete fHistProReNumerPt;
161 delete fHistProImNumerPt;
162 delete fHistProReNumer2D;
163 delete fHistProImNumer2D;
8de6876d 164 delete fHistList;
f456b167 165}
166
f456b167 167//-----------------------------------------------------------------------
8de6876d 168void AliFlowLYZHist2::Fill(Double_t d1, Double_t d2, TComplex c)
f456b167 169{
170 //fill the real and imaginary part of fNumer
171
8de6876d 172 fHistProReNumer->Fill(d1, c.Re());
173 fHistProImNumer->Fill(d1, c.Im());
f456b167 174
8de6876d 175 fHistProReNumerPt->Fill(d2, c.Re());
176 fHistProImNumerPt->Fill(d2, c.Im());
f456b167 177
8de6876d 178 fHistProReNumer2D->Fill(d1, d2, c.Re());
179 fHistProImNumer2D->Fill(d1, d2, c.Im());
f456b167 180}
181
182//-----------------------------------------------------------------------
882ffd6a 183TComplex AliFlowLYZHist2::GetNumerEta(Int_t i)
f456b167 184{
185 //get the real and imaginary part of fNumer
882ffd6a 186 Double_t dReNumer = fHistProReNumer->GetBinContent(i);
187 Double_t dImNumer = fHistProImNumer->GetBinContent(i);
188 TComplex cNumer(dReNumer,dImNumer);
189 //if (dNumer.Rho()==0) {cerr<<"modulus of dNumer is zero in AliFlowLYZHist2::GetNumer(Int_t i)"<<endl;}
190 return cNumer;
f456b167 191}
192
193//-----------------------------------------------------------------------
882ffd6a 194TComplex AliFlowLYZHist2::GetNumerPt(Int_t i)
f456b167 195{
196 //get the real and imaginary part of fNumer
882ffd6a 197 Double_t dReNumer = fHistProReNumerPt->GetBinContent(i);
198 Double_t dImNumer = fHistProImNumerPt->GetBinContent(i);
199 TComplex cNumer(dReNumer,dImNumer);
200 return cNumer;
f456b167 201}
202
8de6876d 203//-----------------------------------------------------------------------
204 Double_t AliFlowLYZHist2::Merge(TCollection *aList)
205{
206 //merge fuction
207 if (!aList) return 0;
208 if (aList->IsEmpty()) return 0; //no merging is needed
209
210 Int_t iCount = 0;
211 TIter next(aList); // list is supposed to contain only objects of the same type as this
212 AliFlowLYZHist2 *toMerge;
213 // make a temporary list
214 TList *pTemp = new TList();
215 while ((toMerge=(AliFlowLYZHist2*)next())) {
216 pTemp->Add(toMerge->GetHistList());
217 iCount++;
218 }
219 // Now call merge for fHistList providing temp list
220 fHistList->Merge(pTemp);
221 // Cleanup
222 delete pTemp;
223
224 return (double)iCount;
225
226}
9d062fe3 227
228//-----------------------------------------------------------------------
229void AliFlowLYZHist2::Print(Option_t *option) const
230{
231 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
232 // ===============================================
233 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
234 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
235
236 if (fHistList) {
237 fHistList->Print(option);
238 }
239 else
240 {
241 printf( "Empty histogram list \n");
242 }
243}
244
245//-----------------------------------------------------------------------
246 void AliFlowLYZHist2::Browse(TBrowser *b)
247{
248
249 if (!b) return;
250 if (fHistList) b->Add(fHistList,"AliFlowLYZHist2List");
251}