]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowLYZHist1.cxx
62d981306ea71d0194cc744157610ad10a193c35
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowLYZHist1.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 /*
17 $Log$
18 */ 
19
20 //#include "Riostream.h"  //in case one wants to make print statements
21 #include "TProfile.h"
22 #include "TString.h" 
23 #include "TComplex.h"  
24 #include "AliFlowLYZConstants.h" 
25 #include "AliFlowLYZHist1.h"
26
27
28 class TH1D; 
29
30
31 // Class to organize the histograms in the first run
32 // in the Lee Yang Zeros Flow analysis.
33 // Also contains methods to find the first minimum R0
34 // of the generating function.
35 // author: N. van der Kolk (kolk@nikhef.nl)
36
37
38 ClassImp(AliFlowLYZHist1)
39
40   
41
42 //-----------------------------------------------------------------------
43
44   AliFlowLYZHist1::AliFlowLYZHist1(Int_t theta):
45     fHistGtheta(0),
46     fHistProReGtheta(0),
47     fHistProImGtheta(0)
48 {
49
50   //constructor creating histograms 
51   Int_t iNbins = AliFlowLYZConstants::kNbins;
52   Double_t dMin = AliFlowLYZConstants::fgMin;
53   Double_t dMax = AliFlowLYZConstants::fgMax;
54   TString title, name;
55  
56   
57   //fHistGtheta
58   name = "First_Flow_Gtheta";
59   name +=theta;
60   name +="_LYZ";
61   title = "First_Flow_Gtheta";
62   title +=theta;
63   title +="_LYZ";
64   fHistGtheta = new TH1D(name.Data(),title.Data(),iNbins,dMin,dMax);  
65   fHistGtheta->SetXTitle("r");
66   fHistGtheta->SetYTitle("|G^{#theta}(ir)|^{2}");
67   
68   //fHistProReGtheta
69   name = "First_FlowPro_ReGtheta";
70   name +=theta;
71   name +="_LYZ";
72   title = "First_FlowPro_ReGtheta";
73   title +=theta;
74   title +="_LYZ";
75   fHistProReGtheta = new TProfile(name.Data(),title.Data(),iNbins,dMin,dMax);
76   fHistProReGtheta->SetXTitle("r");
77   fHistProReGtheta->SetYTitle("Re G^{#theta}(ir)");
78   
79   //fHistProImGtheta
80   name = "First_FlowPro_ImGtheta";
81   name +=theta;
82   name +="_LYZ";
83   title = "First_FlowPro_ImGtheta";
84   title +=theta;
85   title +="_LYZ";
86   fHistProImGtheta = new TProfile(name.Data(),title.Data(),iNbins,dMin,dMax);
87   fHistProImGtheta->SetXTitle("r");
88   fHistProImGtheta->SetYTitle("Im G^{#theta}(ir)");
89       
90 }
91   
92 //----------------------------------------------------------------------- 
93
94 AliFlowLYZHist1::~AliFlowLYZHist1()
95 {
96   //deletes histograms
97   delete fHistGtheta;
98   delete fHistProReGtheta;
99   delete fHistProImGtheta;
100 }
101
102 //----------------------------------------------------------------------- 
103
104 void AliFlowLYZHist1::Fill(Double_t f, TComplex c)
105 {
106   //fill the histograms
107
108   fHistProReGtheta->Fill(f, c.Re());
109   fHistProImGtheta->Fill(f, c.Im());
110 }
111
112 //----------------------------------------------------------------------- 
113
114 TH1D* AliFlowLYZHist1::FillGtheta()
115 {
116   //fill the fHistGtheta histograms
117   Int_t iNbins = fHistGtheta->GetNbinsX();
118   for (Int_t bin=1;bin<=iNbins;bin++)
119         {
120           //get bincentre of bins in histogram
121           Double_t dBin = fHistGtheta->GetBinCenter(bin); 
122           Double_t dRe = fHistProReGtheta->GetBinContent(bin);
123           Double_t dIm = fHistProImGtheta->GetBinContent(bin);
124           TComplex cGtheta(dRe,dIm);
125           //fill fHistGtheta with the modulus squared of cGtheta
126           fHistGtheta->Fill(dBin,cGtheta.Rho2());
127         }
128
129   return fHistGtheta;
130 }
131
132 //----------------------------------------------------------------------- 
133
134 Double_t AliFlowLYZHist1::GetR0()
135 {
136   //find the first minimum of the square of the modulus of Gtheta 
137
138   Int_t iNbins = fHistGtheta->GetNbinsX();
139   Double_t dR0 = 0.; 
140
141   for (Int_t b=2;b<iNbins;b++)
142     {
143       Double_t dG0 = fHistGtheta->GetBinContent(b);
144       Double_t dGnext = fHistGtheta->GetBinContent(b+1);
145       Double_t dGnextnext = fHistGtheta->GetBinContent(b+2);
146       
147       if (dGnext > dG0 && dGnextnext > dG0)
148         {
149           Double_t dGlast = fHistGtheta->GetBinContent(b-1);
150           Double_t dXlast = fHistGtheta->GetBinCenter(b-1);
151           Double_t dX0 = fHistGtheta->GetBinCenter(b);
152           Double_t dXnext = fHistGtheta->GetBinCenter(b+1);
153
154           dR0 = dX0 - ((dX0-dXlast)*(dX0-dXlast)*(dG0-dGnext) - (dX0-dXnext)*(dX0-dXnext)*(dG0-dGlast))/
155             (2.*((dX0-dXlast)*(dG0-dGnext) - (dX0-dXnext)*(dG0-dGlast))); //interpolated minimum
156           
157           break; //stop loop if minimum is found
158         } //if
159
160     }//b
161
162       
163   return dR0;
164 }
165    
166 //----------------------------------------------------------------------- 
167 Double_t AliFlowLYZHist1::GetBinCenter(Int_t i)
168 {
169   //gets bincenter of histogram
170   Double_t dR = fHistGtheta->GetBinCenter(i);
171   return dR;
172 }
173
174 //----------------------------------------------------------------------- 
175
176 Int_t AliFlowLYZHist1::GetNBins()
177 {
178   //gets iNbins
179   Int_t iNbins = fHistGtheta->GetNbinsX();
180   return iNbins;
181 }
182