]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowLYZHist1.cxx
First V0 QAing version
[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"
21 #include "AliFlowLYZHist1.h"
22 #include "AliFlowLYZConstants.h"  //??
23 #include "TProfile.h"
24 #include "TString.h" 
25 #include "TComplex.h" 
26
27 class TH1D; 
28
29
30 // Class to organize the histograms in the first run
31 // in the Lee Yang Zeros Flow analysis.
32 // Also contains methods to find the first minimum R0
33 // of the generating function.
34 // author: N. van der Kolk (kolk@nikhef.nl)
35
36
37 ClassImp(AliFlowLYZHist1)
38
39   
40
41 //-----------------------------------------------------------------------
42
43   AliFlowLYZHist1::AliFlowLYZHist1(Int_t theta, Int_t har)
44 {
45   //constructor creating histograms 
46   Int_t fNbins = AliFlowLYZConstants::kNbins;
47   Float_t fMin = AliFlowLYZConstants::fgMin;
48   Float_t fMax = AliFlowLYZConstants::fgMax;
49   TString title, name;
50  
51   
52   //fHistGtheta
53   name = "FirstHist_FlowLYZ_Gtheta";
54   name +=theta;
55   name +="_Har";
56   name +=har;
57   title = "FirstHist_FlowLYZ_Gtheta";
58   title +=theta;
59   title +="_Har";
60   title +=har;
61   fHistGtheta = new TH1D(name.Data(),title.Data(),fNbins,fMin,fMax);  
62   fHistGtheta->SetXTitle("r");
63   fHistGtheta->SetYTitle("|G^{#theta}(ir)|^{2}");
64   
65   //fHistProReGtheta
66   name = "FirstHist_FlowProLYZ_ReGtheta";
67   name +=theta;
68   name +="_Har";
69   name +=har;
70   title = "FirstHist_FlowProLYZ_ReGtheta";
71   title +=theta;
72   title +="_Har";
73   title +=har;
74   fHistProReGtheta = new TProfile(name.Data(),title.Data(),fNbins,fMin,fMax);
75   fHistProReGtheta->SetXTitle("r");
76   fHistProReGtheta->SetYTitle("Re G^{#theta}(ir)");
77   
78   //fHistProImGtheta
79   name = "FirstHist_FlowProLYZ_ImGtheta";
80   name +=theta;
81   name +="_Har";
82   name +=har;
83   title = "FirstHist_FlowProLYZ_ImGtheta";
84   title +=theta;
85   title +="_Har";
86   title +=har;
87   fHistProImGtheta = new TProfile(name.Data(),title.Data(),fNbins,fMin,fMax);
88   fHistProImGtheta->SetXTitle("r");
89   fHistProImGtheta->SetYTitle("Im G^{#theta}(ir)");
90     
91    
92 }
93   
94
95
96 //----------------------------------------------------------------------- 
97
98 AliFlowLYZHist1::~AliFlowLYZHist1()
99 {
100   //deletes histograms
101   delete fHistGtheta;
102   delete fHistProReGtheta;
103   delete fHistProImGtheta;
104   
105 }
106
107
108 //----------------------------------------------------------------------- 
109
110 void AliFlowLYZHist1::Fill(Float_t f, TComplex C)
111 {
112   //fill the histograms
113
114   fHistProReGtheta->Fill(f, C.Re());
115   fHistProImGtheta->Fill(f, C.Im());
116   
117 }
118
119
120 //----------------------------------------------------------------------- 
121
122 TH1D* AliFlowLYZHist1::FillGtheta()
123 {
124   //fill the fHistGtheta histograms
125   Int_t fNbins = fHistGtheta->GetNbinsX();
126   for (Int_t bin=1;bin<=fNbins;bin++)
127         {
128           //get bincentre of bins in histogram
129           Float_t fBin = fHistGtheta->GetBinCenter(bin); 
130           Float_t fRe = fHistProReGtheta->GetBinContent(bin);
131           Float_t fIm = fHistProImGtheta->GetBinContent(bin);
132           TComplex fGtheta(fRe,fIm);
133           //fill fHistGtheta with the modulus squared of fGtheta
134           fHistGtheta->Fill(fBin,fGtheta.Rho2());
135         }
136
137   return fHistGtheta;
138 }
139
140 //----------------------------------------------------------------------- 
141
142 Float_t AliFlowLYZHist1::GetR0()
143 {
144   //find the first minimum of the square of the modulus of Gtheta 
145
146   Int_t fNbins = fHistGtheta->GetNbinsX();
147   Float_t fR0 = 0; 
148
149   for (Int_t b=2;b<fNbins;b++)
150     {
151       Float_t fG0 = fHistGtheta->GetBinContent(b);
152       Float_t fGnext = fHistGtheta->GetBinContent(b+1);
153       Float_t fGnextnext = fHistGtheta->GetBinContent(b+2);
154       //fprintf(fTemp,"%f\t %f\t %f\n",fG0,fGnext,fGnextnext);
155
156       if (fGnext > fG0 && fGnextnext > fG0)
157         {
158           Float_t fGlast = fHistGtheta->GetBinContent(b-1);
159           Float_t fXlast = fHistGtheta->GetBinCenter(b-1);
160           Float_t fX0 = fHistGtheta->GetBinCenter(b);
161           Float_t fXnext = fHistGtheta->GetBinCenter(b+1);
162
163           fR0 = fX0 - ((fX0-fXlast)*(fX0-fXlast)*(fG0-fGnext) - (fX0-fXnext)*(fX0-fXnext)*(fG0-fGlast))/
164             (2.*((fX0-fXlast)*(fG0-fGnext) - (fX0-fXnext)*(fG0-fGlast))); //interpolated minimum
165           
166           break; //stop loop if minimum is found
167         } //if
168
169     }//b
170
171       
172   return fR0;
173 }
174    
175 //----------------------------------------------------------------------- 
176 Float_t AliFlowLYZHist1::GetBinCenter(Int_t i)
177 {
178   //gets bincenter of histogram
179   Float_t fR = fHistGtheta->GetBinCenter(i);
180   return fR;
181
182 }
183
184 //----------------------------------------------------------------------- 
185
186 Int_t AliFlowLYZHist1::GetNBins()
187 {
188   //gets fNbins
189   Int_t fNbins = fHistGtheta->GetNbinsX();
190   return fNbins;
191
192 }
193