]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowLYZHist2.cxx
macro and flowevent maker to run part of the code in root
[u/mrichter/AliRoot.git] / PWG2 / FLOW / 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
9d062fe3 57 AliFlowLYZHist2::AliFlowLYZHist2(Int_t theta, const char *anInput,const char *aTitle):
58 TNamed(anInput,aTitle),
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
69 TString title, name;
882ffd6a 70 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
71 Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
448e8856 72
882ffd6a 73 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
74 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
75 Double_t dEtaMin = AliFlowCommonConstants::GetEtaMin();
76 Double_t dEtaMax = AliFlowCommonConstants::GetEtaMax();
448e8856 77
f456b167 78 //fHistProReNumer
448e8856 79 name = "Second_FlowPro_ReNumer";
f456b167 80 name +=theta;
448e8856 81 name +="_LYZ";
82 title = "Second_FlowPro_ReNumer";
f456b167 83 title +=theta;
448e8856 84 title +="_LYZ";
882ffd6a 85 fHistProReNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);
f456b167 86 fHistProReNumer->SetXTitle("eta");
87 fHistProReNumer->SetYTitle("v (%)");
88
89 //fHistProImNumer
448e8856 90 name = "Second_FlowPro_ImNumer";
f456b167 91 name +=theta;
448e8856 92 name +="_LYZ";
93 title = "Second_FlowPro_ImNumer";
f456b167 94 title +=theta;
448e8856 95 title +="_LYZ";
882ffd6a 96 fHistProImNumer = new TProfile(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax);
f456b167 97 fHistProImNumer->SetXTitle("eta");
98 fHistProImNumer->SetYTitle("v (%)");
99
100 //fHistProReNumerPt
448e8856 101 name = "Second_FlowPro_ReNumerPt";
f456b167 102 name +=theta;
448e8856 103 name +="_LYZ";
104 title = "Second_FlowPro_ReNumerPt";
f456b167 105 title +=theta;
448e8856 106 title +="_LYZ";
882ffd6a 107 fHistProReNumerPt = new TProfile(name.Data(),title.Data(),iNbinsPt,dPtMin,dPtMax);
f456b167 108 fHistProReNumerPt->SetXTitle("Pt");
109 fHistProReNumerPt->SetYTitle("v (%)");
110
111 //fHistProImNumerPt
448e8856 112 name = "Second_FlowPro_ImNumerPt";
f456b167 113 name +=theta;
448e8856 114 name +="_LYZ";
115 title = "Second_FlowPro_ImNumerPt";
f456b167 116 title +=theta;
448e8856 117 title +="_LYZ";
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;
448e8856 125 name +="_LYZ";
126 title = "Second_FlowPro_ReNumer2D";
f456b167 127 title +=theta;
448e8856 128 title +="_LYZ";
882ffd6a 129 fHistProReNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);
f456b167 130 fHistProReNumer2D->SetXTitle("eta");
131 fHistProReNumer2D->SetYTitle("Pt (GeV/c)");
132
133 //fHistProImNumer2D
448e8856 134 name = "Second_FlowPro_ImNumer2D";
f456b167 135 name +=theta;
448e8856 136 name +="_LYZ";
137 title = "Second_FlowPro_ImNumer2D";
f456b167 138 title +=theta;
448e8856 139 title +="_LYZ";
882ffd6a 140 fHistProImNumer2D = new TProfile2D(name.Data(),title.Data(),iNbinsEta,dEtaMin,dEtaMax,iNbinsPt,dPtMin,dPtMax);
f456b167 141 fHistProImNumer2D->SetXTitle("eta");
142 fHistProImNumer2D->SetYTitle("Pt (GeV/c)");
8de6876d 143
144 //list of histograms
145 fHistList = new TList();
146 fHistList-> Add(fHistProReNumer);
147 fHistList-> Add(fHistProImNumer);
148 fHistList-> Add(fHistProReNumerPt);
149 fHistList-> Add(fHistProImNumerPt);
150 fHistList-> Add(fHistProReNumer2D);
151 fHistList-> Add(fHistProImNumer2D);
152
f456b167 153}
154
f456b167 155//-----------------------------------------------------------------------
156
157AliFlowLYZHist2::~AliFlowLYZHist2()
158{
159 //deletes histograms
160 delete fHistProReNumer;
161 delete fHistProImNumer;
162 delete fHistProReNumerPt;
163 delete fHistProImNumerPt;
164 delete fHistProReNumer2D;
165 delete fHistProImNumer2D;
8de6876d 166 delete fHistList;
f456b167 167}
168
f456b167 169//-----------------------------------------------------------------------
8de6876d 170void AliFlowLYZHist2::Fill(Double_t d1, Double_t d2, TComplex c)
f456b167 171{
172 //fill the real and imaginary part of fNumer
173
8de6876d 174 fHistProReNumer->Fill(d1, c.Re());
175 fHistProImNumer->Fill(d1, c.Im());
f456b167 176
8de6876d 177 fHistProReNumerPt->Fill(d2, c.Re());
178 fHistProImNumerPt->Fill(d2, c.Im());
f456b167 179
8de6876d 180 fHistProReNumer2D->Fill(d1, d2, c.Re());
181 fHistProImNumer2D->Fill(d1, d2, c.Im());
f456b167 182}
183
184//-----------------------------------------------------------------------
882ffd6a 185TComplex AliFlowLYZHist2::GetNumerEta(Int_t i)
f456b167 186{
187 //get the real and imaginary part of fNumer
882ffd6a 188 Double_t dReNumer = fHistProReNumer->GetBinContent(i);
189 Double_t dImNumer = fHistProImNumer->GetBinContent(i);
190 TComplex cNumer(dReNumer,dImNumer);
191 //if (dNumer.Rho()==0) {cerr<<"modulus of dNumer is zero in AliFlowLYZHist2::GetNumer(Int_t i)"<<endl;}
192 return cNumer;
f456b167 193}
194
195//-----------------------------------------------------------------------
882ffd6a 196TComplex AliFlowLYZHist2::GetNumerPt(Int_t i)
f456b167 197{
198 //get the real and imaginary part of fNumer
882ffd6a 199 Double_t dReNumer = fHistProReNumerPt->GetBinContent(i);
200 Double_t dImNumer = fHistProImNumerPt->GetBinContent(i);
201 TComplex cNumer(dReNumer,dImNumer);
202 return cNumer;
f456b167 203}
204
8de6876d 205//-----------------------------------------------------------------------
206 Double_t AliFlowLYZHist2::Merge(TCollection *aList)
207{
208 //merge fuction
209 if (!aList) return 0;
210 if (aList->IsEmpty()) return 0; //no merging is needed
211
212 Int_t iCount = 0;
213 TIter next(aList); // list is supposed to contain only objects of the same type as this
214 AliFlowLYZHist2 *toMerge;
215 // make a temporary list
216 TList *pTemp = new TList();
217 while ((toMerge=(AliFlowLYZHist2*)next())) {
218 pTemp->Add(toMerge->GetHistList());
219 iCount++;
220 }
221 // Now call merge for fHistList providing temp list
222 fHistList->Merge(pTemp);
223 // Cleanup
224 delete pTemp;
225
226 return (double)iCount;
227
228}
9d062fe3 229
230//-----------------------------------------------------------------------
231void AliFlowLYZHist2::Print(Option_t *option) const
232{
233 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
234 // ===============================================
235 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
236 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
237
238 if (fHistList) {
239 fHistList->Print(option);
240 }
241 else
242 {
243 printf( "Empty histogram list \n");
244 }
245}
246
247//-----------------------------------------------------------------------
248 void AliFlowLYZHist2::Browse(TBrowser *b)
249{
250
251 if (!b) return;
252 if (fHistList) b->Add(fHistList,"AliFlowLYZHist2List");
253}