]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommon/AliFlowLYZHist1.cxx
corrections for single particle distributions in Q cumulants{2}
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFlowLYZHist1.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
f456b167 16
448e8856 17//#include "Riostream.h" //in case one wants to make print statements
f456b167 18#include "TProfile.h"
19#include "TString.h"
8de6876d 20#include "TComplex.h"
21#include "TList.h"
448e8856 22#include "AliFlowLYZConstants.h"
23#include "AliFlowLYZHist1.h"
9d062fe3 24#include "TBrowser.h"
448e8856 25
f456b167 26class TH1D;
27
f456b167 28// Class to organize the histograms in the first run
29// in the Lee Yang Zeros Flow analysis.
30// Also contains methods to find the first minimum R0
31// of the generating function.
32// author: N. van der Kolk (kolk@nikhef.nl)
33
f456b167 34ClassImp(AliFlowLYZHist1)
35
8de6876d 36//-----------------------------------------------------------------------
37
38 AliFlowLYZHist1::AliFlowLYZHist1():
9d062fe3 39 TNamed(),
8de6876d 40 fHistGtheta(0),
41 fHistProReGtheta(0),
42 fHistProImGtheta(0),
43 fHistList(NULL)
44{
45 //default constructor
46}
f456b167 47
48//-----------------------------------------------------------------------
49
0c380f17 50 AliFlowLYZHist1::AliFlowLYZHist1(Int_t theta, const char *anInput,Bool_t useSum):
51 TNamed(anInput,anInput),
448e8856 52 fHistGtheta(0),
53 fHistProReGtheta(0),
8de6876d 54 fHistProImGtheta(0),
55 fHistList(NULL)
f456b167 56{
448e8856 57
f456b167 58 //constructor creating histograms
aa5e7c3f 59 Int_t iNbins = AliFlowLYZConstants::kNbins;
60 Double_t dMaxSUM = AliFlowLYZConstants::fgMaxSUM;
61 Double_t dMaxPROD = AliFlowLYZConstants::fgMaxPROD;
62 Double_t dMin = 0.;
63
0c380f17 64 TString name, addlast;
f456b167 65
0c380f17 66 if (useSum) { addlast = "LYZSUM"; }
67 else { addlast = "LYZPROD"; }
f456b167 68
69 //fHistGtheta
448e8856 70 name = "First_Flow_Gtheta";
f456b167 71 name +=theta;
0c380f17 72 name +=addlast;
aa5e7c3f 73 if (useSum) { fHistGtheta = new TH1D(name.Data(),name.Data(),iNbins,dMin,dMaxSUM); }
74 else { fHistGtheta = new TH1D(name.Data(),name.Data(),iNbins,dMin,dMaxPROD); }
f456b167 75 fHistGtheta->SetXTitle("r");
76 fHistGtheta->SetYTitle("|G^{#theta}(ir)|^{2}");
77
78 //fHistProReGtheta
448e8856 79 name = "First_FlowPro_ReGtheta";
f456b167 80 name +=theta;
0c380f17 81 name +=addlast;
aa5e7c3f 82 if (useSum) { fHistProReGtheta = new TProfile(name.Data(),name.Data(),iNbins,dMin,dMaxSUM); }
83 else { fHistProReGtheta = new TProfile(name.Data(),name.Data(),iNbins,dMin,dMaxPROD); }
f456b167 84 fHistProReGtheta->SetXTitle("r");
85 fHistProReGtheta->SetYTitle("Re G^{#theta}(ir)");
86
87 //fHistProImGtheta
448e8856 88 name = "First_FlowPro_ImGtheta";
f456b167 89 name +=theta;
0c380f17 90 name +=addlast;
aa5e7c3f 91 if (useSum) { fHistProImGtheta = new TProfile(name.Data(),name.Data(),iNbins,dMin,dMaxSUM); }
92 else { fHistProImGtheta = new TProfile(name.Data(),name.Data(),iNbins,dMin,dMaxPROD); }
f456b167 93 fHistProImGtheta->SetXTitle("r");
94 fHistProImGtheta->SetYTitle("Im G^{#theta}(ir)");
8de6876d 95
96 //list of histograms
97 fHistList = new TList();
98 fHistList-> Add(fHistGtheta);
99 fHistList-> Add(fHistProReGtheta);
100 fHistList-> Add(fHistProImGtheta);
448e8856 101
f456b167 102}
103
f456b167 104//-----------------------------------------------------------------------
105
106AliFlowLYZHist1::~AliFlowLYZHist1()
107{
108 //deletes histograms
109 delete fHistGtheta;
110 delete fHistProReGtheta;
111 delete fHistProImGtheta;
8de6876d 112 delete fHistList;
f456b167 113}
114
f456b167 115//-----------------------------------------------------------------------
116
882ffd6a 117void AliFlowLYZHist1::Fill(Double_t f, TComplex c)
f456b167 118{
119 //fill the histograms
120
882ffd6a 121 fHistProReGtheta->Fill(f, c.Re());
122 fHistProImGtheta->Fill(f, c.Im());
f456b167 123}
124
f456b167 125//-----------------------------------------------------------------------
126
127TH1D* AliFlowLYZHist1::FillGtheta()
128{
129 //fill the fHistGtheta histograms
882ffd6a 130 Int_t iNbins = fHistGtheta->GetNbinsX();
131 for (Int_t bin=1;bin<=iNbins;bin++)
f456b167 132 {
133 //get bincentre of bins in histogram
882ffd6a 134 Double_t dBin = fHistGtheta->GetBinCenter(bin);
135 Double_t dRe = fHistProReGtheta->GetBinContent(bin);
136 Double_t dIm = fHistProImGtheta->GetBinContent(bin);
137 TComplex cGtheta(dRe,dIm);
138 //fill fHistGtheta with the modulus squared of cGtheta
139 fHistGtheta->Fill(dBin,cGtheta.Rho2());
f456b167 140 }
141
142 return fHistGtheta;
143}
144
145//-----------------------------------------------------------------------
146
448e8856 147Double_t AliFlowLYZHist1::GetR0()
f456b167 148{
149 //find the first minimum of the square of the modulus of Gtheta
150
882ffd6a 151 Int_t iNbins = fHistGtheta->GetNbinsX();
152 Double_t dR0 = 0.;
f456b167 153
882ffd6a 154 for (Int_t b=2;b<iNbins;b++)
f456b167 155 {
882ffd6a 156 Double_t dG0 = fHistGtheta->GetBinContent(b);
157 Double_t dGnext = fHistGtheta->GetBinContent(b+1);
158 Double_t dGnextnext = fHistGtheta->GetBinContent(b+2);
448e8856 159
882ffd6a 160 if (dGnext > dG0 && dGnextnext > dG0)
f456b167 161 {
882ffd6a 162 Double_t dGlast = fHistGtheta->GetBinContent(b-1);
163 Double_t dXlast = fHistGtheta->GetBinCenter(b-1);
164 Double_t dX0 = fHistGtheta->GetBinCenter(b);
165 Double_t dXnext = fHistGtheta->GetBinCenter(b+1);
f456b167 166
882ffd6a 167 dR0 = dX0 - ((dX0-dXlast)*(dX0-dXlast)*(dG0-dGnext) - (dX0-dXnext)*(dX0-dXnext)*(dG0-dGlast))/
168 (2.*((dX0-dXlast)*(dG0-dGnext) - (dX0-dXnext)*(dG0-dGlast))); //interpolated minimum
f456b167 169
170 break; //stop loop if minimum is found
171 } //if
172
173 }//b
174
175
882ffd6a 176 return dR0;
f456b167 177}
178
179//-----------------------------------------------------------------------
448e8856 180Double_t AliFlowLYZHist1::GetBinCenter(Int_t i)
f456b167 181{
182 //gets bincenter of histogram
882ffd6a 183 Double_t dR = fHistGtheta->GetBinCenter(i);
184 return dR;
f456b167 185}
186
187//-----------------------------------------------------------------------
188
189Int_t AliFlowLYZHist1::GetNBins()
190{
882ffd6a 191 //gets iNbins
192 Int_t iNbins = fHistGtheta->GetNbinsX();
193 return iNbins;
f456b167 194}
195
8de6876d 196//-----------------------------------------------------------------------
197 Double_t AliFlowLYZHist1::Merge(TCollection *aList)
198{
199 //merge fuction
200 if (!aList) return 0;
201 if (aList->IsEmpty()) return 0; //no merging is needed
202
203 Int_t iCount = 0;
204 TIter next(aList); // list is supposed to contain only objects of the same type as this
205 AliFlowLYZHist1 *toMerge;
206 // make a temporary list
207 TList *pTemp = new TList();
208 while ((toMerge=(AliFlowLYZHist1*)next())) {
209 pTemp->Add(toMerge->GetHistList());
210 iCount++;
211 }
212 // Now call merge for fHistList providing temp list
213 fHistList->Merge(pTemp);
214 // Cleanup
215 delete pTemp;
216
217 return (double)iCount;
218
219}
220
9d062fe3 221//-----------------------------------------------------------------------
222void AliFlowLYZHist1::Print(Option_t *option) const
223{
224 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
225 // ===============================================
226 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
227 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
228
229 if (fHistList) {
230 fHistList->Print(option);
231 }
232 else
233 {
234 printf( "Empty histogram list \n");
235 }
236}
237
238//-----------------------------------------------------------------------
239 void AliFlowLYZHist1::Browse(TBrowser *b)
240{
241
242 if (!b) return;
243 if (fHistList) b->Add(fHistList,"AliFlowLYZHist1List");
244}
245
246
247