114db0b86f8f69220dd927ac80bcb26d25960483
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / AliAnalysisTaskPi0Flow.cxx
1 #include "TChain.h"
2 #include "TTree.h"
3 #include "TObjArray.h"
4 #include "TF1.h"
5 #include "TFile.h"
6 #include "TH1F.h"
7 #include "TH2F.h"
8 #include "TH2I.h"
9 #include "TH3F.h"
10 #include "TParticle.h"
11 #include "TCanvas.h"
12 #include "TStyle.h"
13 #include "TRandom.h"
14
15 #include "AliAnalysisManager.h"
16 #include "AliMCEventHandler.h"
17 #include "AliMCEvent.h"
18 #include "AliStack.h"
19 #include "AliAnalysisTaskSE.h"
20 #include "AliAnalysisTaskPi0Flow.h"
21 #include "AliCaloPhoton.h"
22 #include "AliPHOSGeometry.h"
23 #include "AliPHOSEsdCluster.h"
24 #include "AliPHOSCalibData.h"
25 #include "AliESDEvent.h"
26 #include "AliESDCaloCells.h"
27 #include "AliESDVertex.h"
28 #include "AliESDtrackCuts.h"
29 #include "AliLog.h"
30 #include "AliPID.h"
31 #include "AliCDBManager.h"
32 #include "AliCentrality.h" 
33 #include "AliESDtrackCuts.h"
34 #include "AliEventplane.h"
35 #include "TProfile.h"
36 #include "AliOADBContainer.h"
37
38 // Analysis task to fill histograms with PHOS ESD clusters and cells
39 // Authors: Dmitri Peressounko
40 // Date   : 28.05.2011
41
42 ClassImp(AliAnalysisTaskPi0Flow)
43
44 //________________________________________________________________________
45 Double_t rnlin(Double_t *x, Double_t * /*par*/)
46 {
47   //a = par[0], b = par[1].
48   //1+a*exp(-e/b)
49
50 // return 0.0241+1.0504*x[0]+0.000249*x[0]*x[0] ; 
51  return 1.015*(0.0241+1.0504*x[0]+0.000249*x[0]*x[0]) ; 
52
53 }
54
55 //________________________________________________________________________
56 AliAnalysisTaskPi0Flow::AliAnalysisTaskPi0Flow(const char *name) 
57 : AliAnalysisTaskSE(name),
58   fESDtrackCuts(0x0),
59   fStack(0x0),
60   fOutputContainer(0x0),
61   fPHOSEvent(0x0),
62   fPHOSCalibData(0x0),
63   fNonLinCorr(0),
64   fRP(0),
65   fRPV0A(0),
66   fRPV0C(0),
67   fHaveTPCRP(0),
68   fMultV0(0x0),
69   fV0Cpol(0.),fV0Apol(0.),
70   fRunNumber(0),
71   fCentrality(0.),
72   fCenBin(0),
73   fPHOSGeo(0),
74   fEventCounter(0)
75 {
76   // Constructor
77   for(Int_t i=0;i<1;i++){
78     for(Int_t j=0;j<10;j++)
79       for(Int_t k=0;k<11;k++)
80         fPHOSEvents[i][j][k]=0 ;
81   }
82   for(Int_t i=0;i<nCentrBinV0;i++){
83     for(Int_t j=0;j<2; j++)
84       for(Int_t k=0; k<2; k++)
85         fMeanQ[i][j][k]=0. ;
86   }
87   
88   // Output slots #0 write into a TH1 container
89   DefineOutput(1,TList::Class());
90
91   // Set bad channel map
92   char key[55] ;
93   for(Int_t i=0; i<6; i++){
94     snprintf(key,55,"PHOS_BadMap_mod%d",i) ;
95     fPHOSBadMap[i]=new TH2I(key,"Bad Modules map",64,0.,64.,56,0.,56.) ;
96   }
97   // Initialize the PHOS geometry
98   fPHOSGeo = AliPHOSGeometry::GetInstance("IHEP") ;
99
100   //We have to apply re-calibration for pass1 LCH10h
101   // Initialize decalibration factors in the form of the OCDB object
102
103
104   AliCDBManager * man = AliCDBManager::Instance();
105   man->SetRun(140000) ;
106   man->SetDefaultStorage("local://OCDB");
107   fPHOSCalibData = new AliPHOSCalibData();
108
109   // Initialize non-linrarity correction
110   fNonLinCorr = new TF1("nonlib",rnlin,0.,40.,0);
111
112
113 }
114
115 //________________________________________________________________________
116 void AliAnalysisTaskPi0Flow::UserCreateOutputObjects()
117 {
118   // Create histograms
119   // Called once
120   const Int_t nRuns=200 ;
121   
122   // ESD histograms
123   if(fOutputContainer != NULL){
124     delete fOutputContainer;
125   }
126   fOutputContainer = new TList();
127   fOutputContainer->SetOwner(kTRUE);
128   
129   //========QA histograms=======
130
131   //Event selection
132   fOutputContainer->Add(new TH2F("hSelEvents","Event selection", 10,0.,10.,nRuns,0.,float(nRuns))) ;
133   fOutputContainer->Add(new TH1F("hTotSelEvents","Event selection", 10,0.,10.)) ;
134   
135   //vertex distribution
136   fOutputContainer->Add(new TH2F("hZvertex","Z vertex position", 50,-25.,25.,nRuns,0.,float(nRuns))) ;
137   
138   //Centrality
139   fOutputContainer->Add(new TH2F("hCentrality","Event centrality", 100,0.,100.,nRuns,0.,float(nRuns))) ;
140   fOutputContainer->Add(new TH2F("hCenPHOS","Centrality vs PHOSclusters", 100,0.,100.,200,0.,200.)) ;
141   fOutputContainer->Add(new TH2F("hCenPHOSCells","Centrality vs PHOS cells", 100,0.,100.,100,0.,1000.)) ;
142   fOutputContainer->Add(new TH2F("hCenTrack","Centrality vs tracks", 100,0.,100.,100,0.,15000.)) ;  
143   fOutputContainer->Add(new TH2F("hCluEvsClu","ClusterMult vs E",200,0.,10.,100,0.,100.)) ;
144   
145   
146   //Reaction plane
147   fOutputContainer->Add(new TH3F("hPHOSphi","cos" ,10,0.,100.,20,0.,10.,100,-TMath::Pi(),TMath::Pi()));
148   
149    fOutputContainer->Add(new TH2F("cos2AC","RP correlation between TPC subs", 100,-1.,1.,20,0.,100.)) ;
150    fOutputContainer->Add(new TH2F("cos2V0AC","RP correlation between VO A and C sides", 100,-1.,1.,20,0.,100.)) ;
151    fOutputContainer->Add(new TH2F("cos2V0ATPC","RP correlation between TPC and V0A", 100,-1.,1.,20,0.,100.)) ;
152    fOutputContainer->Add(new TH2F("cos2V0CTPC","RP correlation between TPC and V0C", 100,-1.,1.,20,0.,100.)) ;
153  
154    fOutputContainer->Add(new TH2F("phiRP","RP distribution with TPC", 100,0.,TMath::Pi(),20,0.,100.)) ;
155    fOutputContainer->Add(new TH2F("phiRPflat","RP distribution with TPC flat", 100,0.,TMath::Pi(),20,0.,100.)) ;
156    fOutputContainer->Add(new TH2F("phiRPV0A","RP distribution with V0A", 100,0.,TMath::Pi(),20,0.,100.)) ;
157    fOutputContainer->Add(new TH2F("phiRPV0C","RP distribution with V0C", 100,0.,TMath::Pi(),20,0.,100.)) ;
158    fOutputContainer->Add(new TH2F("phiRPV0Aflat","RP distribution with V0 flat", 100,0.,TMath::Pi(),20,0.,100.)) ;
159    fOutputContainer->Add(new TH2F("phiRPV0Cflat","RP distribution with V0 flat", 100,0.,TMath::Pi(),20,0.,100.)) ;
160    fOutputContainer->Add(new TH3F("phiRPV0ATPC","RP distribution with V0A + TPC", 100,0.,TMath::Pi(),100,0.,TMath::Pi(),20,0.,100.)) ;
161    fOutputContainer->Add(new TH3F("phiRPV0CTPC","RP distribution with V0C + TPC", 100,0.,TMath::Pi(),100,0.,TMath::Pi(),20,0.,100.)) ;
162   
163   
164   //PHOS QA
165   fOutputContainer->Add(new TH1I("hCellMultEvent"  ,"PHOS cell multiplicity per event"    ,2000,0,2000));
166   fOutputContainer->Add(new TH1I("hCellMultEventM1","PHOS cell multiplicity per event, M1",2000,0,2000));
167   fOutputContainer->Add(new TH1I("hCellMultEventM2","PHOS cell multiplicity per event, M2",2000,0,2000));
168   fOutputContainer->Add(new TH1I("hCellMultEventM3","PHOS cell multiplicity per event, M3",2000,0,2000));
169
170   fOutputContainer->Add(new TH1F("hCellEnergy"  ,"Cell energy"            ,3000,0.,30.));
171   fOutputContainer->Add(new TH1F("hCellEnergyM1","Cell energy in module 1",3000,0.,30.));
172   fOutputContainer->Add(new TH1F("hCellEnergyM2","Cell energy in module 2",3000,0.,30.));
173   fOutputContainer->Add(new TH1F("hCellEnergyM3","Cell energy in module 3",3000,0.,30.));
174
175   fOutputContainer->Add(new TH2F("hCellNXZM1","Cell (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
176   fOutputContainer->Add(new TH2F("hCellNXZM2","Cell (X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
177   fOutputContainer->Add(new TH2F("hCellNXZM3","Cell (X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
178   fOutputContainer->Add(new TH2F("hCellEXZM1","Cell E(X,Z), M1",64,0.5,64.5, 56,0.5,56.5));
179   fOutputContainer->Add(new TH2F("hCellEXZM2","Cell E(X,Z), M2",64,0.5,64.5, 56,0.5,56.5));
180   fOutputContainer->Add(new TH2F("hCellEXZM3","Cell E(X,Z), M3",64,0.5,64.5, 56,0.5,56.5));
181                           
182   //Bad Map
183   fOutputContainer->Add(new TH2F("hCluLowM1","Cell (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
184   fOutputContainer->Add(new TH2F("hCluLowM2","Cell (X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
185   fOutputContainer->Add(new TH2F("hCluLowM3","Cell (X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
186
187   fOutputContainer->Add(new TH2F("hCluHighM1","Cell (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
188   fOutputContainer->Add(new TH2F("hCluHighM2","Cell (X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
189   fOutputContainer->Add(new TH2F("hCluHighM3","Cell (X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
190   
191   fOutputContainer->Add(new TH2F("hCluVetoM1","Cell (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
192   fOutputContainer->Add(new TH2F("hCluVetoM2","Cell (X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
193   fOutputContainer->Add(new TH2F("hCluVetoM3","Cell (X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
194
195   fOutputContainer->Add(new TH2F("hCluDispM1","Cell (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
196   fOutputContainer->Add(new TH2F("hCluDispM2","Cell (X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
197   fOutputContainer->Add(new TH2F("hCluDispM3","Cell (X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
198
199   
200   //Single photon and pi0 spectrum
201   Int_t nPtPhot = 300 ;
202   Double_t ptPhotMax = 30 ;
203   Int_t nM       = 500;
204   Double_t mMin  = 0.0;
205   Double_t mMax  = 1.0;
206     
207   //PHOS calibration QA
208   fOutputContainer->Add(new TH2F("hPi0M11","Pairs in modules",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
209   fOutputContainer->Add(new TH2F("hPi0M12","Pairs in modules",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
210   fOutputContainer->Add(new TH2F("hPi0M13","Pairs in modules",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
211   fOutputContainer->Add(new TH2F("hPi0M22","Pairs in modules",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
212   fOutputContainer->Add(new TH2F("hPi0M23","Pairs in modules",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
213   fOutputContainer->Add(new TH2F("hPi0M33","Pairs in modules",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
214     
215   char key[55] ;
216   for(Int_t cent=0; cent<10; cent++){
217     snprintf(key,55,"hPhotAll_cen%d",cent) ;
218     fOutputContainer->Add(new TH1F(key,"All clusters",nPtPhot,0.,ptPhotMax));
219     snprintf(key,55,"hPhotAllcore_cen%d",cent) ;
220     fOutputContainer->Add(new TH1F(key,"All clusters",nPtPhot,0.,ptPhotMax));
221     snprintf(key,55,"hPhotAllwou_cen%d",cent) ;
222     fOutputContainer->Add(new TH1F(key,"All clusters",nPtPhot,0.,ptPhotMax));
223     snprintf(key,55,"hPhotDisp_cen%d",cent) ;
224     fOutputContainer->Add(new TH1F(key,"Disp clusters",nPtPhot,0.,ptPhotMax));
225     snprintf(key,55,"hPhotDisp2_cen%d",cent) ;
226     fOutputContainer->Add(new TH1F(key,"Disp clusters",nPtPhot,0.,ptPhotMax));
227     snprintf(key,55,"hPhotDispcore_cen%d",cent) ;
228     fOutputContainer->Add(new TH1F(key,"Disp clusters",nPtPhot,0.,ptPhotMax));
229     snprintf(key,55,"hPhotDispwou_cen%d",cent) ;
230     fOutputContainer->Add(new TH1F(key,"Disp clusters",nPtPhot,0.,ptPhotMax));
231     snprintf(key,55,"hPhotCPV_cen%d",cent) ;
232     fOutputContainer->Add(new TH1F(key,"CPV clusters",nPtPhot,0.,ptPhotMax));
233     snprintf(key,55,"hPhotCPVcore_cen%d",cent) ;
234     fOutputContainer->Add(new TH1F(key,"CPV clusters",nPtPhot,0.,ptPhotMax));
235     snprintf(key,55,"hPhotCPV2_cen%d",cent) ;
236     fOutputContainer->Add(new TH1F(key,"CPV clusters",nPtPhot,0.,ptPhotMax));
237     snprintf(key,55,"hPhotBoth_cen%d",cent) ;
238     fOutputContainer->Add(new TH1F(key,"Both clusters",nPtPhot,0.,ptPhotMax));
239     snprintf(key,55,"hPhotBothcore_cen%d",cent) ;
240     fOutputContainer->Add(new TH1F(key,"Both clusters",nPtPhot,0.,ptPhotMax));
241
242     snprintf(key,55,"hPi0All_cen%d",cent) ;
243     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
244     snprintf(key,55,"hPi0Allcore_cen%d",cent) ;
245     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
246     snprintf(key,55,"hPi0Allwou_cen%d",cent) ;
247     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
248     snprintf(key,55,"hPi0Disp_cen%d",cent) ;
249     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
250     snprintf(key,55,"hPi0Disp2_cen%d",cent) ;
251     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
252     snprintf(key,55,"hPi0Dispcore_cen%d",cent) ;
253     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
254     snprintf(key,55,"hPi0Dispwou_cen%d",cent) ;
255     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
256     snprintf(key,55,"hPi0CPV_cen%d",cent) ;
257     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
258     snprintf(key,55,"hPi0CPVcore_cen%d",cent) ;
259     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
260     snprintf(key,55,"hPi0CPV2_cen%d",cent) ;
261     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
262     snprintf(key,55,"hPi0Both_cen%d",cent) ;
263     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
264     snprintf(key,55,"hPi0Bothcore_cen%d",cent) ;
265     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
266
267     snprintf(key,55,"hPi0All_a07_cen%d",cent) ;
268     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
269     snprintf(key,55,"hPi0Disp_a07_cen%d",cent) ;
270     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
271     snprintf(key,55,"hPi0CPV_a07_cen%d",cent) ;
272     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
273     snprintf(key,55,"hPi0CPV2_a07_cen%d",cent) ;
274     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
275     snprintf(key,55,"hPi0Both_a07_cen%d",cent) ;
276     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));        
277
278     snprintf(key,55,"hSingleAll_cen%d",cent) ;
279     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
280     snprintf(key,55,"hSingleAllcore_cen%d",cent) ;
281     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
282     snprintf(key,55,"hSingleAllwou_cen%d",cent) ;
283     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
284     snprintf(key,55,"hSingleDisp_cen%d",cent) ;
285     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
286     snprintf(key,55,"hSingleDisp2_cen%d",cent) ;
287     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
288     snprintf(key,55,"hSingleDispcore_cen%d",cent) ;
289     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
290     snprintf(key,55,"hSingleDispwou_cen%d",cent) ;
291     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
292     snprintf(key,55,"hSingleCPV_cen%d",cent) ;
293     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
294     snprintf(key,55,"hSingleCPVcore_cen%d",cent) ;
295     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
296     snprintf(key,55,"hSingleCPV2_cen%d",cent) ;
297     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
298     snprintf(key,55,"hSingleBoth_cen%d",cent) ;
299     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
300     snprintf(key,55,"hSingleBothcore_cen%d",cent) ;
301     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
302     
303     
304     snprintf(key,55,"hMiPi0All_cen%d",cent) ;
305     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
306     snprintf(key,55,"hMiPi0Allcore_cen%d",cent) ;
307     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
308     snprintf(key,55,"hMiPi0Allwou_cen%d",cent) ;
309     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
310     snprintf(key,55,"hMiPi0Disp_cen%d",cent) ;
311     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
312     snprintf(key,55,"hMiPi0Disp2_cen%d",cent) ;
313     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
314     snprintf(key,55,"hMiPi0Dispwou_cen%d",cent) ;
315     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
316     snprintf(key,55,"hMiPi0Dispcore_cen%d",cent) ;
317     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
318     snprintf(key,55,"hMiPi0CPV_cen%d",cent) ;
319     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
320     snprintf(key,55,"hMiPi0CPVcore_cen%d",cent) ;
321     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
322     snprintf(key,55,"hMiPi0CPV2_cen%d",cent) ;
323     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
324     snprintf(key,55,"hMiPi0Both_cen%d",cent) ;
325     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
326     snprintf(key,55,"hMiPi0Bothcore_cen%d",cent) ;
327     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
328     
329     snprintf(key,55,"hMiPi0All_a07_cen%d",cent) ;
330     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
331     snprintf(key,55,"hMiPi0Disp_a07_cen%d",cent) ;
332     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
333     snprintf(key,55,"hMiPi0CPV_a07_cen%d",cent) ;
334     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
335     snprintf(key,55,"hMiPi0CPV2_a07_cen%d",cent) ;
336     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
337     snprintf(key,55,"hMiPi0Both_a07_cen%d",cent) ;
338     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));   
339
340     snprintf(key,55,"hMiSingleAll_cen%d",cent) ;
341     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
342     snprintf(key,55,"hMiSingleAllwou_cen%d",cent) ;
343     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
344     snprintf(key,55,"hMiSingleAllcore_cen%d",cent) ;
345     fOutputContainer->Add(new TH2F(key,"All clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
346     snprintf(key,55,"hMiSingleDisp_cen%d",cent) ;
347     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
348     snprintf(key,55,"hMiSingleDisp2_cen%d",cent) ;
349     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
350     snprintf(key,55,"hMiSingleDispwou_cen%d",cent) ;
351     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
352     snprintf(key,55,"hMiSingleDispcore_cen%d",cent) ;
353     fOutputContainer->Add(new TH2F(key,"Disp clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
354     snprintf(key,55,"hMiSingleCPV_cen%d",cent) ;
355     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
356     snprintf(key,55,"hMiSingleCPVcore_cen%d",cent) ;
357     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
358     snprintf(key,55,"hMiSingleCPV2_cen%d",cent) ;
359     fOutputContainer->Add(new TH2F(key,"CPV clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
360     snprintf(key,55,"hMiSingleBoth_cen%d",cent) ;
361     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
362     snprintf(key,55,"hMiSingleBothcore_cen%d",cent) ;
363     fOutputContainer->Add(new TH2F(key,"Both clusters",nM,mMin,mMax,nPtPhot,0.,ptPhotMax));
364   }
365
366   
367
368   Int_t nPt      = 20;
369   Double_t xPt[21]={0.6,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.,5.5,6.,7.,8.,9.,10.,12.,14.,16.,18.,20.} ;
370   Int_t nPhi=10 ;
371   Double_t xPhi[11] ;
372   for(Int_t i=0;i<=10;i++)xPhi[i]=i*0.1*TMath::Pi() ;
373   Int_t nMm=200 ;
374   Double_t xM[201] ;
375   for(Int_t i=0;i<=200;i++){xM[i]=0.0025*i;}
376
377   char phiTitle[15] ;
378   for(Int_t iRP=0; iRP<3; iRP++){
379     if(iRP==0)
380       snprintf(phiTitle,15,"TPC") ;
381     if(iRP==1)
382       snprintf(phiTitle,15,"V0A") ;
383     if(iRP==2)
384       snprintf(phiTitle,15,"V0C") ;
385   for(Int_t cent=0; cent<10; cent++){
386     snprintf(key,55,"hPhotPhi%sAll_cen%d",phiTitle,cent) ;
387     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
388     snprintf(key,55,"hPhotPhi%sAllcore_cen%d",phiTitle,cent) ;
389     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
390     snprintf(key,55,"hPhotPhi%sDisp_cen%d",phiTitle,cent) ;
391     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
392     snprintf(key,55,"hPhotPhi%sDispcore_cen%d",phiTitle,cent) ;
393     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
394     snprintf(key,55,"hPhotPhi%sCPV_cen%d",phiTitle,cent) ;
395     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
396     snprintf(key,55,"hPhotPhi%sCPVcore_cen%d",phiTitle,cent) ;
397     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
398     snprintf(key,55,"hPhotPhi%sBoth_cen%d",phiTitle,cent) ;
399     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
400     snprintf(key,55,"hPhotPhi%sBothcore_cen%d",phiTitle,cent) ;
401     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nPt,xPt,nPhi,xPhi));
402
403     //Pions
404     snprintf(key,55,"hMassPt%sAll_cen%d",phiTitle,cent) ;
405     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
406     snprintf(key,55,"hMassPt%sAllcore_cen%d",phiTitle,cent) ;
407     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
408     snprintf(key,55,"hMassPt%sCPV_cen%d",phiTitle,cent) ;
409     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
410     snprintf(key,55,"hMassPt%sCPVcore_cen%d",phiTitle,cent) ;
411     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
412     snprintf(key,55,"hMassPt%sDisp_cen%d",phiTitle,cent) ;
413     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
414     snprintf(key,55,"hMassPt%sDispcore_cen%d",phiTitle,cent) ;
415     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
416     snprintf(key,55,"hMassPt%sBoth_cen%d",phiTitle,cent) ;
417     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
418     snprintf(key,55,"hMassPt%sBothcore_cen%d",phiTitle,cent) ;
419     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
420         
421     //Mixed
422     snprintf(key,55,"hMiMassPt%sAll_cen%d",phiTitle,cent) ;
423     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
424     snprintf(key,55,"hMiMassPt%sAllcore_cen%d",phiTitle,cent) ;
425     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
426     snprintf(key,55,"hMiMassPt%sCPV_cen%d",phiTitle,cent) ;
427     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
428     snprintf(key,55,"hMiMassPt%sCPVcore_cen%d",phiTitle,cent) ;
429     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
430     snprintf(key,55,"hMiMassPt%sDisp_cen%d",phiTitle,cent) ;
431     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
432     snprintf(key,55,"hMiMassPt%sDispcore_cen%d",phiTitle,cent) ;
433     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
434     snprintf(key,55,"hMiMassPt%sBoth_cen%d",phiTitle,cent) ;
435     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
436     snprintf(key,55,"hMiMassPt%sBothcore_cen%d",phiTitle,cent) ;
437     fOutputContainer->Add(new TH3F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nMm,xM,nPt,xPt,nPhi,xPhi));
438   }
439   }
440  
441
442   // Create ESD track cut
443   fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts() ;
444   fESDtrackCuts->SetRequireTPCRefit(kTRUE);
445
446 //  fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
447   
448   PostData(1, fOutputContainer);
449
450 }
451
452 //________________________________________________________________________
453 void AliAnalysisTaskPi0Flow::UserExec(Option_t *) 
454 {
455   // Main loop, called for each event
456   // Analyze ESD/AOD
457     
458   fStack=0 ;
459   if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()){
460     if(static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent())
461       fStack = static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack();
462   }
463   
464   
465   AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
466   if (!event) {
467     Printf("ERROR: Could not retrieve event");
468     PostData(1, fOutputContainer);
469     return;
470   }
471
472   fRunNumber=ConvertRunNumber(event->GetRunNumber()) ;
473   FillHistogram("hSelEvents",0.5,fRunNumber-0.5) ;
474   FillHistogram("hTotSelEvents",0.5) ;
475   
476   // Get PHOS rotation matrices from ESD and set them to the PHOS geometry
477   char skey[55] ;
478   if(fEventCounter == 0) {
479    OpenInfoCalbration(event->GetRunNumber()) ;
480    for(Int_t mod=0; mod<5; mod++) {
481       if(!event->GetPHOSMatrix(mod)) continue;
482       fPHOSGeo->SetMisalMatrix(event->GetPHOSMatrix(mod),mod) ;
483       Printf("PHOS geo matrix %p for module # %d is set\n", event->GetPHOSMatrix(mod), mod);
484     }
485     fEventCounter++ ;
486   }
487
488   
489   // Checks if we have a primary vertex
490   // Get primary vertices form ESD
491   const AliESDVertex *esdVertex5 = event->GetPrimaryVertex();
492
493   Double_t vtx0[3] = {0,0,0}; // don't rely on ESD vertex, assume (0,0,0)
494   Double_t vtx5[3] ={0.,0.,0.};
495   
496   vtx5[0] = esdVertex5->GetX();
497   vtx5[1] = esdVertex5->GetY();
498   vtx5[2] = esdVertex5->GetZ();
499   
500   
501   FillHistogram("hZvertex",esdVertex5->GetZ(),fRunNumber-0.5);
502   if (TMath::Abs(esdVertex5->GetZ()) > 10. ){
503     PostData(1, fOutputContainer);
504     return;
505   }
506   FillHistogram("hSelEvents",1.5,fRunNumber-0.5) ;
507   FillHistogram("hTotSelEvents",1.5) ;
508
509 /*  
510   if(event->IsPileupFromSPD()){
511     PostData(1, fOutputContainer);
512     return;
513   } 
514 */
515   FillHistogram("hSelEvents",2.5,fRunNumber-0.5) ;
516   FillHistogram("hTotSelEvents",2.5) ;  
517   
518   
519   /*
520   //Vtx class z-bin
521   Int_t zvtx = (Int_t)((vtx5[2]+10.)/2.) ;
522   if(zvtx<0)zvtx=0 ;
523   if(zvtx>9)zvtx=9 ;
524   */
525   //No dependence on zVtx observed, save memory
526   Int_t zvtx=0 ;
527
528   AliCentrality *centrality = event->GetCentrality(); 
529   fCentrality=centrality->GetCentralityPercentile("V0M");
530
531   if( fCentrality <= 0. || fCentrality>80. ){
532     PostData(1, fOutputContainer);
533     return;
534   }
535
536   FillHistogram("hSelEvents",3.5,fRunNumber-0.5) ;
537   FillHistogram("hTotSelEvents",3.5) ;
538
539   fCenBin=1+Int_t(fCentrality/10.) ;
540   if(fCentrality<5.)
541     fCenBin=0 ;
542   if(fCenBin>9)
543     fCenBin=9 ;
544
545
546   //reaction plane
547   AliEventplane *eventplane = event->GetEventplane();
548   Double_t rpFull = eventplane->GetEventplane("Q");
549   FillHistogram("phiRP",rpFull,fCentrality) ;
550   
551   if(rpFull==999 || rpFull < 0.){ //reaction plain was not defined
552     fHaveTPCRP = kFALSE ;
553     fRP=0. ;
554   }
555   else{
556     fHaveTPCRP = kTRUE ;    
557   }
558   if(fHaveTPCRP){
559     fRP = ApplyFlattening(rpFull,fCentrality) ;
560     while(fRP<0)fRP+=TMath::Pi() ;
561     while(fRP>TMath::Pi())fRP-=TMath::Pi() ;
562     FillHistogram("phiRPflat",fRP,fCentrality) ;  
563     Double_t dPsi=eventplane->GetQsubRes() ;
564     FillHistogram("cos2AC",TMath::Cos(2.*dPsi),fCentrality) ;
565   }
566   
567   EvalV0ReactionPlane(event) ;
568   FillHistogram("phiRPV0Aflat",fRPV0A,fCentrality) ;
569   FillHistogram("phiRPV0AC",fRPV0A,fRPV0C,fCentrality) ;
570   FillHistogram("cos2V0AC",TMath::Cos(2.*(fRPV0A-fRPV0C)),fCentrality) ;
571   if(fHaveTPCRP){
572     FillHistogram("phiRPV0ATPC",fRP,fRPV0A,fCentrality) ;
573     FillHistogram("cos2V0ATPC",TMath::Cos(2.*(fRP-fRPV0A)),fCentrality) ;
574   }
575   
576   FillHistogram("phiRPV0Cflat",fRPV0C,fCentrality) ;
577   if(fHaveTPCRP){
578     FillHistogram("phiRPV0CTPC",fRP,fRPV0C,fCentrality) ;
579     FillHistogram("cos2V0CTPC",TMath::Cos(2.*(fRP-fRPV0C)),fCentrality) ;
580   }    
581   
582   FillHistogram("hSelEvents",4.5,fRunNumber-0.5) ;
583   FillHistogram("hTotSelEvents",4.5) ;
584   //All event selections done
585   FillHistogram("hCentrality",fCentrality,fRunNumber-0.5) ;
586   //Reaction plane is defined in the range (0;pi)
587   //We have 10 bins
588   Double_t averageRP = fRPV0A+fRPV0C+fRP ;
589   if(fHaveTPCRP)
590     averageRP/=3.;
591   else
592     averageRP/=2.;
593   Int_t irp=Int_t(10.*(averageRP)/TMath::Pi());
594   if(irp>9)irp=9 ;
595
596   if(!fPHOSEvents[zvtx][fCenBin][irp]) 
597     fPHOSEvents[zvtx][fCenBin][irp]=new TList() ;
598   TList * prevPHOS = fPHOSEvents[zvtx][fCenBin][irp] ;
599
600   //  ProcessMC() ;
601
602   if(fPHOSEvent)
603     fPHOSEvent->Clear() ;
604   else
605     fPHOSEvent = new TClonesArray("AliCaloPhoton",200) ;
606
607   //For re-calibration
608   const Double_t logWeight=4.5 ;  
609
610   TVector3 vertex(vtx5);
611   
612   Int_t multClust = event->GetNumberOfCaloClusters();
613   Int_t inPHOS=0,inMod1=0, inMod2=0, inMod3=0 ;
614   Double_t avrgEm1=0,avrgEm2=0,avrgEm3=0; //average cluster energy
615
616   AliESDCaloCells * cells = event->GetPHOSCells() ;
617   FillHistogram("hCenPHOSCells",fCentrality,cells->GetNumberOfCells()) ;
618   FillHistogram("hCenTrack",fCentrality,event->GetNumberOfTracks()) ;
619   
620   //QA PHOS cells
621   Int_t nCellModule[3] = {0,0,0};
622   for (Int_t iCell=0; iCell<cells->GetNumberOfCells(); iCell++) {
623     Int_t cellAbsId = cells->GetCellNumber(iCell);
624     Int_t relId[4] ;
625     fPHOSGeo->AbsToRelNumbering(cellAbsId,relId);
626     Int_t mod1  = relId[0];
627     Int_t cellX = relId[2];
628     Int_t cellZ = relId[3] ;
629     Float_t energy = cells->GetAmplitude(iCell);
630     FillHistogram("hCellEnergy",energy);
631     if(mod1==1) {
632       nCellModule[0]++;
633       FillHistogram("hCellEnergyM1",cells->GetAmplitude(iCell));
634       FillHistogram("hCellNXZM1",cellX,cellZ,1.);
635       FillHistogram("hCellEXZM1",cellX,cellZ,energy);
636     }
637     else if (mod1==2) {
638       nCellModule[1]++;
639       FillHistogram("hCellEnergyM2",cells->GetAmplitude(iCell));
640       FillHistogram("hCellNXZM2",cellX,cellZ,1.);
641       FillHistogram("hCellEXZM2",cellX,cellZ,energy);
642     }
643     else if (mod1==3) {
644       nCellModule[2]++;
645       FillHistogram("hCellEnergyM3",cells->GetAmplitude(iCell));
646       FillHistogram("hCellNXZM3",cellX,cellZ,1.);
647       FillHistogram("hCellEXZM3",cellX,cellZ,energy);
648     }
649   }
650   FillHistogram("hCellMultEventM1",nCellModule[0]);
651   FillHistogram("hCellMultEventM2",nCellModule[1]);
652   FillHistogram("hCellMultEventM3",nCellModule[2]);
653
654   TVector3 localPos ;
655   for (Int_t i=0; i<multClust; i++) {
656     AliESDCaloCluster *clu = event->GetCaloCluster(i);
657     if ( !clu->IsPHOS() || clu->E()<0.3) continue;
658     
659     Float_t  position[3];
660     clu->GetPosition(position);
661     TVector3 global(position) ;
662     Int_t relId[4] ;
663     fPHOSGeo->GlobalPos2RelId(global,relId) ;
664     Int_t mod  = relId[0] ;
665     Int_t cellX = relId[2];
666     Int_t cellZ = relId[3] ;
667     if ( !IsGoodChannel("PHOS",mod,cellX,cellZ) ) 
668       continue ;
669     
670     //Remove 6 noisy channels in run 139036
671     if(event->GetRunNumber()==139036 && mod==1 && 
672        (cellX==9||cellX==10||cellX==11) && (cellZ==45 || cellZ==46))
673       continue ;
674     
675     FillHistogram("hCluEvsClu",clu->E(),clu->GetNCells()) ;
676
677     //Apply re-Calibreation
678     AliPHOSEsdCluster cluPHOS1(*clu);
679     cluPHOS1.Recalibrate(fPHOSCalibData,cells); // modify the cell energies
680     Reclusterize(&cluPHOS1) ;
681     cluPHOS1.EvalAll(logWeight,vertex);         // recalculate the cluster parameters
682     cluPHOS1.SetE(fNonLinCorr->Eval(cluPHOS1.E()));// Users's nonlinearity
683     if(cluPHOS1.E()<0.3) continue;
684     if(clu->GetNCells()<3) continue ;
685     if(clu->GetM02()<0.2)   continue ;
686         
687     //correct misalignment
688     const Float_t shiftX[6]={0.,-2.3,-2.11,-1.53,0.,0.} ;
689     const Float_t shiftZ[6]={0.,-0.4, 0.52, 0.8,0.,0.} ;
690     fPHOSGeo->Global2Local(localPos,global,mod) ;
691     fPHOSGeo->Local2Global(mod,localPos.X()+shiftX[mod],localPos.Z()+shiftZ[mod],global);  
692     position[0]=global.X() ;
693     position[1]=global.Y() ;
694     position[2]=global.Z() ;
695     cluPHOS1.SetPosition(position) ; 
696    
697  
698     if(mod==1){
699       avrgEm1+=cluPHOS1.E() ;
700       inMod1++ ;
701     }
702     if(mod==2){
703       avrgEm2+=cluPHOS1.E() ;
704       inMod2++ ;
705     }
706     if(mod==3){
707       avrgEm3+=cluPHOS1.E() ;
708       inMod3++ ;
709     }
710        
711     TLorentzVector pv1 ;
712     cluPHOS1.GetMomentum(pv1 ,vtx0);
713
714     if(mod==2) pv1*=135.5/134.0 ;
715     if(mod==3) pv1*=135.5/137.2 ;
716     
717     Double_t ecore=CoreEnergy(&cluPHOS1) ; 
718     if(mod==2) ecore*=135.5/134.0 ;
719     if(mod==3) ecore*=135.5/137.2 ;
720     
721     snprintf(skey,55,"hCluLowM%d",mod) ;
722     FillHistogram(skey,cellX,cellZ,1.);
723     if(cluPHOS1.E()>1.5){
724       sprintf(skey,"hCluHighM%d",mod) ;
725       FillHistogram(skey,cellX,cellZ,1.);
726     }
727     
728     if(inPHOS>=fPHOSEvent->GetSize()){
729       fPHOSEvent->Expand(inPHOS+50) ;
730     }
731     new((*fPHOSEvent)[inPHOS]) AliCaloPhoton(pv1.X(),pv1.Py(),pv1.Z(),pv1.E()) ;
732     AliCaloPhoton * ph = (AliCaloPhoton*)fPHOSEvent->At(inPHOS) ;
733     ph->SetModule(mod) ;
734     pv1*= ecore/pv1.E() ;
735     ph->SetMomV2(&pv1) ;
736     ph->SetNCells(clu->GetNCells());
737     ph->SetDispBit(TestLambda(clu->E(),clu->GetM20(),clu->GetM02())) ;
738     ph->SetDisp2Bit(TestLambda2(clu->E(),clu->GetM20(),clu->GetM02())) ;
739     if(ph->IsDispOK()){
740       sprintf(skey,"hCluDispM%d",mod) ;
741       FillHistogram(skey,cellX,cellZ,1.);
742     }
743     //Track matching
744     Double_t dx=clu->GetTrackDx() ;
745     Double_t dz=clu->GetTrackDz() ;
746     Bool_t cpvBit=kTRUE ; //No track matched by default
747     Bool_t cpvBit2=kTRUE ; //More Strict criterion
748     TArrayI * itracks = clu->GetTracksMatched() ;  
749     if(itracks->GetSize()>0){
750       Int_t iTr = itracks->At(0);
751       if(iTr>=0 && iTr<event->GetNumberOfTracks()){
752         AliESDtrack *track = event->GetTrack(iTr) ;
753         Double_t pt = track->Pt() ;
754         Short_t charge = track->Charge() ;
755         Double_t r=TestCPV(dx, dz, pt,charge) ;
756         cpvBit=(r>2.) ;
757         cpvBit2=(r>4.) ;
758       }
759     }
760     ph->SetCPVBit(cpvBit) ;
761     ph->SetCPV2Bit(cpvBit2) ;
762     if(cpvBit){
763       sprintf(skey,"hCluVetoM%d",mod) ;
764       FillHistogram(skey,cellX,cellZ,1.);
765     }
766     ph->SetEMCx(float(cellX)) ;
767     ph->SetEMCz(float(cellZ)) ;
768 //    ph->SetLambdas(clu->GetM20(),clu->GetM02()) ;
769     ph->SetUnfolded(clu->GetNExMax()<2); // Remember, if it is unfolded          
770     inPHOS++ ;
771   }
772   
773   FillHistogram("hCenPHOS",fCentrality,inPHOS) ;
774
775   
776   char key[55] ;
777   for (Int_t i1=0; i1<inPHOS; i1++) {
778     AliCaloPhoton * ph1=(AliCaloPhoton*)fPHOSEvent->At(i1) ;
779     
780     Double_t dphiA=ph1->Phi()-fRPV0A ;
781     while(dphiA<0)dphiA+=TMath::Pi() ;
782     while(dphiA>TMath::Pi())dphiA-=TMath::Pi() ;
783
784     Double_t dphiC=ph1->Phi()-fRPV0C ;
785     while(dphiC<0)dphiC+=TMath::Pi() ;
786     while(dphiC>TMath::Pi())dphiC-=TMath::Pi() ;
787
788     Double_t dphiT=ph1->Phi()-fRP ;
789     while(dphiT<0)dphiT+=TMath::Pi() ;
790     while(dphiT>TMath::Pi())dphiT-=TMath::Pi() ;
791     
792     FillHistogram(Form("hPhotPhiV0AAll_cen%d",fCenBin),ph1->Pt(),dphiA) ;
793     FillHistogram(Form("hPhotPhiV0CAll_cen%d",fCenBin),ph1->Pt(),dphiC) ;
794     if(fHaveTPCRP)
795       FillHistogram(Form("hPhotPhiTPCAll_cen%d",fCenBin),ph1->Pt(),dphiT) ;
796     
797     FillHistogram(Form("hPhotAll_cen%d",fCenBin),ph1->Pt()) ;
798     FillHistogram(Form("hPhotAllcore_cen%d",fCenBin),ph1->GetMomV2()->Pt()) ;
799     if(ph1->IsntUnfolded()){
800       FillHistogram(Form("hPhotAllwou_cen%d",fCenBin),ph1->Pt()) ;
801     }
802     if(ph1->IsCPVOK()){
803       FillHistogram(Form("hPhotPhiV0ACPV_cen%d",fCenBin),ph1->Pt(),dphiA) ;
804       FillHistogram(Form("hPhotPhiV0CCPV_cen%d",fCenBin),ph1->Pt(),dphiC) ;
805       if(fHaveTPCRP)
806         FillHistogram(Form("hPhotPhiTPCCPV_cen%d",fCenBin),ph1->Pt(),dphiT) ;
807
808       FillHistogram(Form("hPhotPhiV0ACPVcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiA) ;
809       FillHistogram(Form("hPhotPhiV0CCPVcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiC) ;
810       if(fHaveTPCRP)
811         FillHistogram(Form("hPhotPhiTPCCPVcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiT) ;
812
813       FillHistogram(Form("hPhotCPV_cen%d",fCenBin),ph1->Pt()) ;
814       FillHistogram(Form("hPhotCPVcore_cen%d",fCenBin),ph1->GetMomV2()->Pt()) ;
815     }
816     if(ph1->IsCPV2OK()){
817       FillHistogram(Form("hPhotCPV2_cen%d",fCenBin),ph1->Pt()) ;
818     }
819     if(ph1->IsDispOK()){
820       FillHistogram(Form("hPhotPhiV0ADisp_cen%d",fCenBin),ph1->Pt(),dphiA) ;
821       FillHistogram(Form("hPhotPhiV0CDisp_cen%d",fCenBin),ph1->Pt(),dphiC) ;
822       if(fHaveTPCRP)
823         FillHistogram(Form("hPhotPhiTPCDisp_cen%d",fCenBin),ph1->Pt(),dphiT) ;
824
825       FillHistogram(Form("hPhotPhiV0ADispcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiA) ;
826       FillHistogram(Form("hPhotPhiV0CDispcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiC) ;
827       if(fHaveTPCRP)
828         FillHistogram(Form("hPhotPhiTPCDispcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiT) ;
829       
830       FillHistogram(Form("hPhotDisp_cen%d",fCenBin),ph1->Pt()) ;
831       if(ph1->IsDisp2OK()){
832         FillHistogram(Form("hPhotDisp2_cen%d",fCenBin),ph1->Pt()) ;
833       }
834       FillHistogram(Form("hPhotDispcore_cen%d",fCenBin),ph1->GetMomV2()->Pt()) ;
835       if(ph1->IsntUnfolded()){
836         FillHistogram(Form("hPhotDispwou_cen%d",fCenBin),ph1->Pt()) ;
837       }
838       if(ph1->IsCPVOK()){
839         FillHistogram(Form("hPhotPhiV0ABoth_cen%d",fCenBin),ph1->Pt(),dphiA) ;
840         FillHistogram(Form("hPhotPhiV0CBoth_cen%d",fCenBin),ph1->Pt(),dphiC) ;
841         if(fHaveTPCRP)
842           FillHistogram(Form("hPhotPhiTPCBoth_cen%d",fCenBin),ph1->Pt(),dphiT) ;
843
844         FillHistogram(Form("hPhotPhiV0ABothcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiA) ;
845         FillHistogram(Form("hPhotPhiV0CBothcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiC) ;
846         if(fHaveTPCRP)
847           FillHistogram(Form("hPhotPhiTPCBothcore_cen%d",fCenBin),ph1->GetMomV2()->Pt(),dphiT) ;
848
849         FillHistogram(Form("hPhotBoth_cen%d",fCenBin),ph1->Pt()) ;
850         FillHistogram(Form("hPhotBothcore_cen%d",fCenBin),ph1->GetMomV2()->Pt()) ;
851       }
852     }  
853   }
854   
855   const Double_t alphaCut=0.7 ;
856   //pi0
857   for (Int_t i1=0; i1<inPHOS-1; i1++) {
858     AliCaloPhoton * ph1=(AliCaloPhoton*)fPHOSEvent->At(i1) ;
859     for (Int_t i2=i1+1; i2<inPHOS; i2++) {
860       AliCaloPhoton * ph2=(AliCaloPhoton*)fPHOSEvent->At(i2) ;
861       TLorentzVector p12  = *ph1  + *ph2;
862       TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());      
863       FillHistogram("hPHOSphi",fCentrality,p12.Pt(),p12.Phi());
864       Double_t dphiA=p12.Phi()-fRPV0A ;
865       while(dphiA<0)dphiA+=TMath::Pi() ;
866       while(dphiA>TMath::Pi())dphiA-=TMath::Pi() ;
867       
868       Double_t dphiC=p12.Phi()-fRPV0C ;
869       while(dphiC<0)dphiC+=TMath::Pi() ;
870       while(dphiC>TMath::Pi())dphiC-=TMath::Pi() ;
871
872       Double_t dphiT=p12.Phi()-fRP ;
873       while(dphiT<0)dphiT+=TMath::Pi() ;
874       while(dphiT>TMath::Pi())dphiT-=TMath::Pi() ;
875       
876       Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
877       
878       FillHistogram(Form("hMassPtV0AAll_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiA) ;
879       FillHistogram(Form("hMassPtV0CAll_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiC) ;
880       if(fHaveTPCRP)
881         FillHistogram(Form("hMassPtTPCAll_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiT) ;
882
883       FillHistogram(Form("hMassPtV0AAllcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiA) ;
884       FillHistogram(Form("hMassPtV0CAllcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiC) ;
885       if(fHaveTPCRP)
886         FillHistogram(Form("hMassPtTPCAllcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiT) ;
887       
888       
889       FillHistogram(Form("hPi0All_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
890       FillHistogram(Form("hPi0Allcore_cen%d",fCenBin),pv12.M() ,pv12.Pt()) ;
891       if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
892         FillHistogram(Form("hPi0Allwou_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
893       }
894       
895       FillHistogram(Form("hSingleAll_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
896       FillHistogram(Form("hSingleAll_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
897       FillHistogram(Form("hSingleAllcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
898       FillHistogram(Form("hSingleAllcore_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
899       if(ph1->IsntUnfolded())
900         FillHistogram(Form("hSingleAllwou_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
901       if(ph2->IsntUnfolded())
902         FillHistogram(Form("hSingleAllwou_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
903       if(ph1->IsCPVOK()){
904         FillHistogram(Form("hSingleCPV_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
905         FillHistogram(Form("hSingleCPVcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
906       }
907       if(ph2->IsCPVOK()){
908         FillHistogram(Form("hSingleCPV_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
909         FillHistogram(Form("hSingleCPV_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
910       }
911       if(ph1->IsCPV2OK()){
912         FillHistogram(Form("hSingleCPV2_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
913       }
914       if(ph2->IsCPV2OK()){
915         FillHistogram(Form("hSingleCPV2_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
916       }      
917       if(ph1->IsDispOK()){
918         FillHistogram(Form("hSingleDisp_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
919         if(ph1->IsntUnfolded()){
920           FillHistogram(Form("hSingleDispwou_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
921         }
922         FillHistogram(Form("hSingleDispcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
923       }
924       if(ph2->IsDispOK()){
925         FillHistogram(Form("hSingleDisp_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
926         if(ph1->IsntUnfolded()){
927           FillHistogram(Form("hSingleDispwou_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
928         }
929         FillHistogram(Form("hSingleDispcore_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
930       }
931       if(ph1->IsDisp2OK()){
932         FillHistogram(Form("hSingleDisp2_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
933       }
934       if(ph2->IsDisp2OK()){
935         FillHistogram(Form("hSingleDisp2_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
936       }
937       if(ph1->IsDispOK() && ph1->IsCPVOK()){
938         FillHistogram(Form("hSingleBoth_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
939         FillHistogram(Form("hSingleBothcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
940       }
941       if(ph2->IsDispOK() && ph2->IsCPVOK()){
942         FillHistogram(Form("hSingleBoth_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
943         FillHistogram(Form("hSingleBothcore_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
944       }            
945       
946       
947       if(a<alphaCut){
948         FillHistogram(Form("hPi0All_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
949       }
950
951       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
952         snprintf(key,55,"hMassPtCPV_cen%d",fCenBin) ;
953         FillHistogram(Form("hMassPtV0ACPV_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiA) ;
954         FillHistogram(Form("hMassPtV0CCPV_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiC) ;
955         if(fHaveTPCRP)
956           FillHistogram(Form("hMassPtTPCCPV_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiT) ;
957
958         FillHistogram(Form("hMassPtV0ACPVcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiA) ;
959         FillHistogram(Form("hMassPtV0CCPVcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiC) ;
960         if(fHaveTPCRP)
961           FillHistogram(Form("hMassPtTPCCPVcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiT) ;
962
963         FillHistogram(Form("hPi0CPV_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
964         FillHistogram(Form("hPi0CPVcore_cen%d",fCenBin),pv12.M(), pv12.Pt()) ;
965                 
966         if(a<alphaCut){
967           FillHistogram(Form("hPi0CPV_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
968         }
969       } 
970       if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
971         FillHistogram(Form("hPi0CPV2_cen%d",fCenBin),p12.M(),p12.Pt()) ;
972         if(a<alphaCut){
973           FillHistogram(Form("hPi0CPV2_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
974         }
975       } 
976       if(ph1->IsDispOK() && ph2->IsDispOK()){
977         snprintf(key,55,"hMassPtDisp_cen%d",fCenBin) ;
978         FillHistogram(Form("hMassPtV0ADisp_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiA) ;
979         FillHistogram(Form("hMassPtV0CDisp_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiC) ;
980         if(fHaveTPCRP)
981           FillHistogram(Form("hMassPtTPCDisp_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiT) ;
982
983         FillHistogram(Form("hMassPtV0ADispcore_cen%d",fCenBin),pv12.M(), pv12.Pt(),dphiA) ;
984         FillHistogram(Form("hMassPtV0CDispcore_cen%d",fCenBin),pv12.M(), pv12.Pt(),dphiC) ;
985         if(fHaveTPCRP)
986           FillHistogram(Form("hMassPtTPCDispcore_cen%d",fCenBin),pv12.M(), pv12.Pt(),dphiT) ;
987                 
988         FillHistogram(Form("hPi0Disp_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
989         FillHistogram(Form("hPi0Dispcore_cen%d",fCenBin),pv12.M(), pv12.Pt()) ;
990         if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
991           FillHistogram(Form("hPi0Disp2_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
992         }
993         if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
994           FillHistogram(Form("hPi0Dispwou_cen%d",fCenBin),p12.M(), p12.Pt()) ;
995         }
996                 
997         if(a<alphaCut){
998           FillHistogram(Form("hPi0Disp_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
999         }
1000         
1001         if(ph1->IsCPVOK() && ph2->IsCPVOK()){
1002           FillHistogram(Form("hMassPtV0ABoth_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiA) ;
1003           FillHistogram(Form("hMassPtV0CBoth_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiC) ;
1004           if(fHaveTPCRP)
1005             FillHistogram(Form("hMassPtTPCBoth_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiT) ;
1006
1007           FillHistogram(Form("hMassPtV0ABothcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiA) ;
1008           FillHistogram(Form("hMassPtV0CBothcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiC) ;
1009           if(fHaveTPCRP)
1010             FillHistogram(Form("hMassPtTPCBothcore_cen%d",fCenBin),pv12.M() ,pv12.Pt(),dphiT) ;
1011                   
1012           FillHistogram(Form("hPi0Both_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1013           FillHistogram(Form("hPi0Bothcore_cen%d",fCenBin),pv12.M() ,pv12.Pt()) ;
1014           
1015           if(a<alphaCut){
1016             snprintf(key,55,"hPi0Both_a07_cen%d",fCenBin) ;
1017             FillHistogram(Form("hPi0Both_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1018           }
1019           if(fCentrality>20.){
1020           if(ph1->Module()==1 && ph2->Module()==1)
1021             FillHistogram("hPi0M11",p12.M(),p12.Pt() );
1022           else if(ph1->Module()==2 && ph2->Module()==2)
1023             FillHistogram("hPi0M22",p12.M(),p12.Pt() );
1024           else if(ph1->Module()==3 && ph2->Module()==3)
1025             FillHistogram("hPi0M33",p12.M(),p12.Pt() );
1026           else if(ph1->Module()==1 && ph2->Module()==2)
1027             FillHistogram("hPi0M12",p12.M(),p12.Pt() );
1028           else if(ph1->Module()==1 && ph2->Module()==3)
1029             FillHistogram("hPi0M13",p12.M(),p12.Pt() );
1030           else if(ph1->Module()==2 && ph2->Module()==3)
1031             FillHistogram("hPi0M23",p12.M(),p12.Pt() );
1032           }
1033
1034         }
1035       }
1036     } // end of loop i2
1037   } // end of loop i1
1038   
1039   //now mixed
1040   for (Int_t i1=0; i1<inPHOS; i1++) {
1041     AliCaloPhoton * ph1=(AliCaloPhoton*)fPHOSEvent->At(i1) ;
1042     for(Int_t ev=0; ev<prevPHOS->GetSize();ev++){
1043       TClonesArray * mixPHOS = static_cast<TClonesArray*>(prevPHOS->At(ev)) ;
1044       for(Int_t i2=0; i2<mixPHOS->GetEntriesFast();i2++){
1045         AliCaloPhoton * ph2=(AliCaloPhoton*)mixPHOS->At(i2) ;
1046         TLorentzVector p12  = *ph1  + *ph2;
1047         TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());
1048
1049         Double_t dphiA=p12.Phi()-fRPV0A ;
1050         while(dphiA<0)dphiA+=TMath::Pi() ;
1051         while(dphiA>TMath::Pi())dphiA-=TMath::Pi() ;
1052
1053         Double_t dphiC=p12.Phi()-fRPV0C ;
1054         while(dphiC<0)dphiC+=TMath::Pi() ;
1055         while(dphiC>TMath::Pi())dphiC-=TMath::Pi() ;
1056
1057         Double_t dphiT=p12.Phi()-fRP ;
1058         while(dphiT<0)dphiT+=TMath::Pi() ;
1059         while(dphiT>TMath::Pi())dphiT-=TMath::Pi() ;
1060         
1061         
1062         Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
1063         
1064         snprintf(key,55,"hMiMassPtAll_cen%d",fCenBin) ;
1065         FillHistogram(Form("hMiMassPtV0AAll_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiA) ;
1066         FillHistogram(Form("hMiMassPtV0CAll_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiC) ;
1067         if(fHaveTPCRP)
1068           FillHistogram(Form("hMiMassPtTPCAll_cen%d",fCenBin),p12.M() ,p12.Pt(),dphiT) ;
1069
1070         FillHistogram(Form("hMiMassPtV0AAllcore_cen%d",fCenBin),pv12.M(), pv12.Pt(), dphiA) ;
1071         FillHistogram(Form("hMiMassPtV0CAllcore_cen%d",fCenBin),pv12.M(), pv12.Pt(), dphiC) ;
1072         if(fHaveTPCRP)
1073           FillHistogram(Form("hMiMassPtTPCAllcore_cen%d",fCenBin),pv12.M(), pv12.Pt(), dphiT) ;
1074
1075         FillHistogram(Form("hMiPi0All_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1076         FillHistogram(Form("hMiPi0Allcore_cen%d",fCenBin),pv12.M() ,pv12.Pt()) ;
1077         if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
1078           FillHistogram(Form("hMiPi0Allwou_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1079         }
1080
1081         FillHistogram(Form("hMiSingleAll_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1082         FillHistogram(Form("hMiSingleAll_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1083         FillHistogram(Form("hMiSingleAllcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
1084         FillHistogram(Form("hMiSingleAllcore_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
1085         if(ph1->IsntUnfolded())
1086           FillHistogram(Form("hMiSingleAllwou_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1087         if(ph2->IsntUnfolded())
1088           FillHistogram(Form("hMiSingleAllwou_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1089         if(ph1->IsCPVOK()){
1090           FillHistogram(Form("hMiSingleCPV_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1091           FillHistogram(Form("hMiSingleCPVcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
1092         }
1093         if(ph2->IsCPVOK()){
1094           FillHistogram(Form("hMiSingleCPV_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1095           FillHistogram(Form("hMiSingleCPVcore_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
1096         }
1097         if(ph1->IsCPV2OK()){
1098           FillHistogram(Form("hMiSingleCPV2_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1099         }
1100         if(ph2->IsCPV2OK()){
1101           FillHistogram(Form("hMiSingleCPV2_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1102         }      
1103         if(ph1->IsDispOK()){
1104           FillHistogram(Form("hMiSingleDisp_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1105           if(ph1->IsntUnfolded()){
1106             FillHistogram(Form("hMiSingleDispwou_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1107           }
1108           FillHistogram(Form("hMiSingleDispcore_cen%d",fCenBin),pv12.M(),ph1->GetMomV2()->Pt()) ;
1109         }
1110         if(ph2->IsDispOK()){
1111           FillHistogram(Form("hMiSingleDisp_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1112           if(ph1->IsntUnfolded()){
1113             FillHistogram(Form("hMiSingleDispwou_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1114           }
1115           FillHistogram(Form("hMiSingleDispcore_cen%d",fCenBin),pv12.M(),ph2->GetMomV2()->Pt()) ;
1116         }
1117         if(ph1->IsDisp2OK()){
1118           FillHistogram(Form("hMiSingleDisp2_cen%d",fCenBin),p12.M(),ph1->Pt()) ;
1119         } 
1120         if(ph2->IsDisp2OK()){
1121           FillHistogram(Form("hMiSingleDisp2_cen%d",fCenBin),p12.M(),ph2->Pt()) ;
1122         }
1123         if(ph1->IsDispOK() && ph1->IsCPVOK()){
1124           snprintf(key,55,"hMiSingleBoth_cen%d",fCenBin) ;
1125           FillHistogram(key,p12.M(),ph1->Pt()) ;
1126           snprintf(key,55,"hMiSingleBothcore_cen%d",fCenBin) ;
1127           FillHistogram(key,pv12.M(),ph1->GetMomV2()->Pt()) ;
1128         }
1129         if(ph2->IsDispOK() && ph2->IsCPVOK()){
1130           snprintf(key,55,"hMiSingleBoth_cen%d",fCenBin) ;
1131           FillHistogram(key,p12.M(),ph2->Pt()) ;
1132           snprintf(key,55,"hMiSingleBothcore_cen%d",fCenBin) ;
1133           FillHistogram(key,pv12.M(),ph2->GetMomV2()->Pt()) ;
1134         }            
1135         
1136         
1137         
1138         if(a<alphaCut){
1139           snprintf(key,55,"hMiPi0All_a07_cen%d",fCenBin) ;
1140           FillHistogram(key,p12.M() ,p12.Pt()) ;
1141         }
1142         if(ph1->IsCPVOK() && ph2->IsCPVOK()){
1143           FillHistogram(Form("hMiMassPtV0ACPV_cen%d",fCenBin),p12.M(), p12.Pt(),dphiA) ;
1144           FillHistogram(Form("hMiMassPtV0CCPV_cen%d",fCenBin),p12.M(), p12.Pt(),dphiC) ;
1145           if(fHaveTPCRP)
1146             FillHistogram(Form("hMiMassPtTPCCPV_cen%d",fCenBin),p12.M(), p12.Pt(),dphiT) ;
1147
1148           FillHistogram(Form("hMiMassPtV0ACPVcore_cen%d",fCenBin),pv12.M(), pv12.Pt(),dphiA) ;
1149           FillHistogram(Form("hMiMassPtV0CCPVcore_cen%d",fCenBin),pv12.M(), pv12.Pt(),dphiC) ;
1150           if(fHaveTPCRP)
1151             FillHistogram(Form("hMiMassPtTPCCPVcore_cen%d",fCenBin),pv12.M(), pv12.Pt(),dphiT) ;
1152           
1153           FillHistogram(Form("hMiPi0CPV_cen%d",fCenBin),p12.M(), p12.Pt()) ;
1154           FillHistogram(Form("hMiPi0CPVcore_cen%d",fCenBin),pv12.M(), pv12.Pt()) ;
1155
1156           if(a<alphaCut){
1157             FillHistogram(Form("hMiPi0CPV_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1158           }
1159         }
1160         if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
1161           FillHistogram(Form("hMiPi0CPV2_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1162
1163           if(a<alphaCut){
1164             FillHistogram(Form("hMiPi0CPV2_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1165           }
1166         }
1167         if(ph1->IsDispOK() && ph2->IsDispOK()){
1168           FillHistogram(Form("hMiMassPtV0ADisp_cen%d",fCenBin),p12.M(),p12.Pt(),dphiA) ;
1169           FillHistogram(Form("hMiMassPtV0CDisp_cen%d",fCenBin),p12.M(),p12.Pt(),dphiC) ;
1170           if(fHaveTPCRP)
1171             FillHistogram(Form("hMiMassPtTPCDisp_cen%d",fCenBin),p12.M(),p12.Pt(),dphiT) ;
1172           
1173           FillHistogram(Form("hMiMassPtV0ADispcore_cen%d",fCenBin),pv12.M(),pv12.Pt(),dphiA) ;
1174           FillHistogram(Form("hMiMassPtV0CDispcore_cen%d",fCenBin),pv12.M(),pv12.Pt(),dphiC) ;
1175           if(fHaveTPCRP)
1176             FillHistogram(Form("hMiMassPtTPCDispcore_cen%d",fCenBin),pv12.M(),pv12.Pt(),dphiT) ;
1177
1178           
1179           FillHistogram(Form("hMiPi0Disp_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1180           FillHistogram(Form("hMiPi0Dispcore_cen%d",fCenBin),pv12.M(),pv12.Pt()) ;
1181           if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
1182             FillHistogram(Form("hMiPi0Dispwou_cen%d",fCenBin),p12.M(),p12.Pt()) ;
1183           }
1184           
1185           if(a<alphaCut){
1186             FillHistogram(Form("hMiPi0Disp_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1187           }       
1188           if(ph1->IsCPVOK() && ph2->IsCPVOK()){
1189             FillHistogram(Form("hMiMassPtV0ABoth_cen%d",fCenBin),p12.M(),p12.Pt(),dphiA) ;
1190             FillHistogram(Form("hMiMassPtV0CBoth_cen%d",fCenBin),p12.M(),p12.Pt(),dphiC) ;
1191             if(fHaveTPCRP)
1192               FillHistogram(Form("hMiMassPtTPCBoth_cen%d",fCenBin),p12.M(),p12.Pt(),dphiT) ;
1193
1194             FillHistogram(Form("hMiMassPtV0ABothcore_cen%d",fCenBin),pv12.M(),pv12.Pt(),dphiA) ;
1195             FillHistogram(Form("hMiMassPtV0CBothcore_cen%d",fCenBin),pv12.M(),pv12.Pt(),dphiC) ;
1196             if(fHaveTPCRP)
1197               FillHistogram(Form("hMiMassPtTPCBothcore_cen%d",fCenBin),pv12.M(),pv12.Pt(),dphiT) ;
1198                             
1199             FillHistogram(Form("hMiPi0Both_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1200             FillHistogram(Form("hMiPi0Bothcore_cen%d",fCenBin),pv12.M(),pv12.Pt()) ;
1201
1202             if(a<alphaCut){
1203               FillHistogram(Form("hMiPi0Both_a07_cen%d",fCenBin),p12.M() ,p12.Pt()) ;
1204             }
1205           }
1206         }
1207       } // end of loop i2
1208     }
1209   } // end of loop i1
1210   
1211   
1212   //Now we either add current events to stack or remove
1213   //If no photons in current event - no need to add it to mixed
1214   if(fPHOSEvent->GetEntriesFast()>0){
1215     prevPHOS->AddFirst(fPHOSEvent) ;
1216     fPHOSEvent=0;
1217     if(prevPHOS->GetSize()>100){//Remove redundant events
1218       TClonesArray * tmp = static_cast<TClonesArray*>(prevPHOS->Last()) ;
1219       prevPHOS->RemoveLast() ;
1220       delete tmp ;
1221     }
1222   }
1223   // Post output data.
1224   PostData(1, fOutputContainer);
1225   fEventCounter++;
1226 }
1227
1228 //________________________________________________________________________
1229 void AliAnalysisTaskPi0Flow::Terminate(Option_t *)
1230 {
1231   // Draw result to the screen
1232   // Called once at the end of the query
1233   
1234 }
1235
1236 //________________________________________________________________________
1237 Bool_t AliAnalysisTaskPi0Flow::IsGoodChannel(const char * det, Int_t mod, Int_t ix, Int_t iz)
1238 {
1239   //Check if this channel belogs to the good ones
1240
1241   if(strcmp(det,"PHOS")==0){
1242     if(mod>5 || mod<1){
1243       AliError(Form("No bad map for PHOS module %d ",mod)) ;
1244       return kTRUE ;
1245     }
1246     if(!fPHOSBadMap[mod]){
1247       AliError(Form("No Bad map for PHOS module %d",mod)) ;
1248       return kTRUE ;
1249     }
1250     if(fPHOSBadMap[mod]->GetBinContent(ix,iz)>0)
1251       return kFALSE ;
1252     else
1253       return kTRUE ;
1254   }
1255   else{
1256     AliError(Form("Can not find bad channels for detector %s ",det)) ;
1257   }
1258   return kTRUE ;
1259 }
1260 //_____________________________________________________________________________
1261 void AliAnalysisTaskPi0Flow::FillHistogram(const char * key,Double_t x)const{
1262   //FillHistogram
1263   TH1I * tmpI = dynamic_cast<TH1I*>(fOutputContainer->FindObject(key)) ;
1264   if(tmpI){
1265     tmpI->Fill(x) ;
1266     return ;
1267   }
1268   TH1F * tmpF = dynamic_cast<TH1F*>(fOutputContainer->FindObject(key)) ;
1269   if(tmpF){
1270     tmpF->Fill(x) ;
1271     return ;
1272   }
1273   TH1D * tmpD = dynamic_cast<TH1D*>(fOutputContainer->FindObject(key)) ;
1274   if(tmpD){
1275     tmpD->Fill(x) ;
1276     return ;
1277   }
1278   AliInfo(Form("can not find histogram <%s> ",key)) ;
1279 }
1280 //_____________________________________________________________________________
1281 void AliAnalysisTaskPi0Flow::FillHistogram(const char * key,Double_t x,Double_t y)const{
1282   //FillHistogram
1283   TObject * tmp = fOutputContainer->FindObject(key) ;
1284   if(!tmp){
1285     AliInfo(Form("can not find histogram <%s> ",key)) ;
1286     return ;
1287   }
1288   if(tmp->IsA() == TClass::GetClass("TH1F")){
1289     ((TH1F*)tmp)->Fill(x,y) ;
1290     return ;
1291   }
1292   if(tmp->IsA() == TClass::GetClass("TH2F")){
1293     ((TH2F*)tmp)->Fill(x,y) ;
1294     return ;
1295   }
1296   AliError(Form("Calling FillHistogram with 2 parameters for histo <%s> of type %s",key,tmp->IsA()->GetName())) ;
1297 }
1298
1299 //_____________________________________________________________________________
1300 void AliAnalysisTaskPi0Flow::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z) const{
1301   //Fills 1D histograms with key
1302   TObject * tmp = fOutputContainer->FindObject(key) ;
1303   if(!tmp){
1304     AliInfo(Form("can not find histogram <%s> ",key)) ;
1305     return ;
1306   }
1307   if(tmp->IsA() == TClass::GetClass("TH2F")){
1308     ((TH2F*)tmp)->Fill(x,y,z) ;
1309     return ;
1310   }
1311   if(tmp->IsA() == TClass::GetClass("TH3F")){
1312     ((TH3F*)tmp)->Fill(x,y,z) ;
1313     return ;
1314   }
1315 }
1316
1317 //___________________________________________________________________________
1318 Int_t AliAnalysisTaskPi0Flow::ConvertRunNumber(Int_t run){
1319
1320   switch(run){  
1321   case  139517 : return 137; 
1322   case  139514 : return 136; 
1323   case  139513 : return 135; 
1324   case  139511 : return 134; 
1325   case  139510 : return 133; 
1326   case  139507 : return 132; 
1327   case  139505 : return 131; 
1328   case  139504 : return 130; 
1329   case  139503 : return 129; 
1330   case  139470 : return 128; 
1331   case  139467 : return 127; 
1332   case  139466 : return 126; 
1333   case  139465 : return 125; 
1334   case  139440 : return 124; 
1335   case  139439 : return 123; 
1336   case  139438 : return 122; 
1337   case  139437 : return 121; 
1338   case  139360 : return 120; 
1339   case  139329 : return 119; 
1340   case  139328 : return 118; 
1341   case  139314 : return 117; 
1342   case  139311 : return 116; 
1343   case  139310 : return 115; 
1344   case  139309 : return 114; 
1345   case  139308 : return 113; 
1346   case  139173 : return 112; 
1347   case  139172 : return 111; 
1348   case  139110 : return 110; 
1349   case  139107 : return 109; 
1350   case  139105 : return 108; 
1351   case  139104 : return 107; 
1352   case  139042 : return 106; 
1353   case  139038 : return 105; 
1354   case  139037 : return 104; 
1355   case  139036 : return 103; 
1356   case  139029 : return 102; 
1357   case  139028 : return 101; 
1358   case  138983 : return 100; 
1359   case  138982 : return 99; 
1360   case  138980 : return 98; 
1361   case  138979 : return 97; 
1362   case  138978 : return 96; 
1363   case  138977 : return 95; 
1364   case  138976 : return 94; 
1365   case  138973 : return 93; 
1366   case  138972 : return 92; 
1367   case  138965 : return 91; 
1368   case  138924 : return 90; 
1369   case  138872 : return 89; 
1370   case  138871 : return 88; 
1371   case  138870 : return 87; 
1372   case  138837 : return 86; 
1373   case  138830 : return 85; 
1374   case  138828 : return 84; 
1375   case  138826 : return 83; 
1376   case  138796 : return 82; 
1377   case  138795 : return 81; 
1378   case  138742 : return 80; 
1379   case  138732 : return 79; 
1380   case  138730 : return 78; 
1381   case  138666 : return 77; 
1382   case  138662 : return 76; 
1383   case  138653 : return 75; 
1384   case  138652 : return 74; 
1385   case  138638 : return 73; 
1386   case  138624 : return 72; 
1387   case  138621 : return 71; 
1388   case  138583 : return 70; 
1389   case  138582 : return 69; 
1390   case  138579 : return 68; 
1391   case  138578 : return 67; 
1392   case  138534 : return 66; 
1393   case  138469 : return 65; 
1394   case  138442 : return 64; 
1395   case  138439 : return 63; 
1396   case  138438 : return 62; 
1397   case  138396 : return 61; 
1398   case  138364 : return 60; 
1399   case  138359 : return 59; 
1400   case  138275 : return 58; 
1401   case  138225 : return 57; 
1402   case  138201 : return 56; 
1403   case  138200 : return 55; 
1404   case  138197 : return 54; 
1405   case  138192 : return 53; 
1406   case  138190 : return 52; 
1407   case  138154 : return 51; 
1408   case  138153 : return 50; 
1409   case  138151 : return 49; 
1410   case  138150 : return 48; 
1411   case  138126 : return 47; 
1412   case  138125 : return 46; 
1413   case  137848 : return 45; 
1414   case  137847 : return 44; 
1415   case  137844 : return 43; 
1416   case  137843 : return 42; 
1417   case  137752 : return 41; 
1418   case  137751 : return 40; 
1419   case  137748 : return 39; 
1420   case  137724 : return 38; 
1421   case  137722 : return 37; 
1422   case  137718 : return 36; 
1423   case  137704 : return 35; 
1424   case  137693 : return 34; 
1425   case  137692 : return 33; 
1426   case  137691 : return 32; 
1427   case  137689 : return 31; 
1428   case  137686 : return 30; 
1429   case  137685 : return 29; 
1430   case  137639 : return 28; 
1431   case  137638 : return 27; 
1432   case  137608 : return 26; 
1433   case  137595 : return 25; 
1434   case  137549 : return 24; 
1435   case  137546 : return 23; 
1436   case  137544 : return 22; 
1437   case  137541 : return 21; 
1438   case  137539 : return 20; 
1439   case  137531 : return 19; 
1440   case  137530 : return 18; 
1441   case  137443 : return 17; 
1442   case  137441 : return 16; 
1443   case  137440 : return 15; 
1444   case  137439 : return 14; 
1445   case  137434 : return 13; 
1446   case  137432 : return 12; 
1447   case  137431 : return 11; 
1448   case  137430 : return 10; 
1449   case  137366 : return 9; 
1450   case  137243 : return 8; 
1451   case  137236 : return 7; 
1452   case  137235 : return 6; 
1453   case  137232 : return 5; 
1454   case  137231 : return 4; 
1455   case  137165 : return 3; 
1456   case  137162 : return 2; 
1457   case  137161 : return 1;
1458   default : return 199;
1459   } 
1460
1461 }
1462 //_____________________________________________________________________________
1463 Bool_t AliAnalysisTaskPi0Flow::TestLambda(Double_t pt,Double_t l1,Double_t l2){
1464   
1465   Double_t l2Mean  = 1.53126+9.50835e+06/(1.+1.08728e+07*pt+1.73420e+06*pt*pt) ;
1466   Double_t l1Mean  = 1.12365+0.123770*TMath::Exp(-pt*0.246551)+5.30000e-03*pt ;
1467   Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*pt+5.01265e+05*pt*pt)+9.00000e-03*pt;
1468   Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*pt+6.78604e-07*pt*pt)+9.00000e-03*pt;
1469   Double_t c=-0.35-0.550*TMath::Exp(-0.390730*pt) ;
1470   Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma + 
1471               0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
1472               0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
1473   return (R2<2.5*2.5) ;
1474   
1475 }
1476 //_____________________________________________________________________________
1477 Bool_t AliAnalysisTaskPi0Flow::TestLambda2(Double_t pt,Double_t l1,Double_t l2){
1478   
1479   Double_t l2Mean  = 1.53126+9.50835e+06/(1.+1.08728e+07*pt+1.73420e+06*pt*pt) ;
1480   Double_t l1Mean  = 1.12365+0.123770*TMath::Exp(-pt*0.246551)+5.30000e-03*pt ;
1481   Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*pt+5.01265e+05*pt*pt)+9.00000e-03*pt;
1482   Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*pt+6.78604e-07*pt*pt)+9.00000e-03*pt;
1483   Double_t c=-0.35-0.550*TMath::Exp(-0.390730*pt) ;
1484   Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma + 
1485               0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
1486               0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
1487   return (R2<1.5*1.5) ;
1488   
1489 }
1490 //____________________________________________________________________________
1491 Double_t AliAnalysisTaskPi0Flow::TestCPV(Double_t dx, Double_t dz, Double_t pt, Int_t charge){
1492   //Parameterization of LHC10h period
1493   //_true if neutral_
1494   
1495   Double_t meanX=0;
1496   Double_t meanZ=0.;
1497   Double_t sx=TMath::Min(5.4,2.59719e+02*TMath::Exp(-pt/1.02053e-01)+
1498               6.58365e-01*5.91917e-01*5.91917e-01/((pt-9.61306e-01)*(pt-9.61306e-01)+5.91917e-01*5.91917e-01)+1.59219);
1499   Double_t sz=TMath::Min(2.75,4.90341e+02*1.91456e-02*1.91456e-02/(pt*pt+1.91456e-02*1.91456e-02)+1.60) ;
1500   AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
1501   Double_t mf = 0.; //
1502   if(event) mf = event->GetMagneticField(); //Positive for ++ and negative for --
1503
1504   if(mf<0.){ //field --
1505     meanZ = -0.468318 ;
1506     if(charge>0)
1507       meanX=TMath::Min(7.3, 3.89994*1.20679*1.20679/(pt*pt+1.20679*1.20679)+0.249029+2.49088e+07*TMath::Exp(-pt*3.33650e+01)) ;
1508     else
1509       meanX=-TMath::Min(7.7,3.86040*0.912499*0.912499/(pt*pt+0.912499*0.912499)+1.23114+4.48277e+05*TMath::Exp(-pt*2.57070e+01)) ;
1510   }
1511   else{ //Field ++
1512     meanZ= -0.468318;
1513     if(charge>0)
1514       meanX=-TMath::Min(8.0,3.86040*1.31357*1.31357/(pt*pt+1.31357*1.31357)+0.880579+7.56199e+06*TMath::Exp(-pt*3.08451e+01)) ;
1515     else
1516       meanX= TMath::Min(6.85, 3.89994*1.16240*1.16240/(pt*pt+1.16240*1.16240)-0.120787+2.20275e+05*TMath::Exp(-pt*2.40913e+01)) ;     
1517   }
1518
1519   Double_t rz=(dz-meanZ)/sz ;
1520   Double_t rx=(dx-meanX)/sx ;
1521   return TMath::Sqrt(rx*rx+rz*rz) ;
1522 }
1523 //____________________________________________________________________________
1524 Double_t  AliAnalysisTaskPi0Flow::ApplyFlatteningV0A(Double_t phi, Double_t c){
1525   //LHC10h
1526
1527   Double_t v2c =0.;
1528   Double_t v2s =0; 
1529
1530 if(fRunNumber==1){
1531   v2c=0.00271301 + (0.00340046)*c + (-0.000376369)*c*c + (8.56362e-06)*c*c*c + (-5.70955e-08)*c*c*c*c ;
1532   v2s=0.024278 + (0.000586593)*c + (-1.07748e-06)*c*c + (-5.01567e-07)*c*c*c + (3.65956e-09)*c*c*c*c ;
1533 }
1534 if(fRunNumber==2){
1535   v2c=0.111374 + (-0.0111331)*c + (0.000212342)*c*c + (-9.6774e-07)*c*c*c + (-2.54199e-09)*c*c*c*c ;
1536   v2s=-0.0252636 + (0.0152193)*c + (-0.000830793)*c*c + (1.5099e-05)*c*c*c + (-9.04687e-08)*c*c*c*c ;
1537 }
1538 if(fRunNumber==4){
1539   v2c=-0.0323376 + (0.0058672)*c + (-0.000257135)*c*c + (3.54353e-06)*c*c*c + (-1.50431e-08)*c*c*c*c ;
1540   v2s=0.0596758 + (-0.00520203)*c + (0.000178495)*c*c + (-2.94143e-06)*c*c*c + (1.55424e-08)*c*c*c*c ;
1541 }
1542 if(fRunNumber==5){
1543   v2c=-0.0415369 + (0.0098273)*c + (-0.000486907)*c*c + (8.00188e-06)*c*c*c + (-4.29107e-08)*c*c*c*c ;
1544   v2s=-0.0146049 + (0.00693627)*c + (-0.000348663)*c*c + (5.79331e-06)*c*c*c + (-3.33179e-08)*c*c*c*c ;
1545 }
1546 if(fRunNumber==6){
1547   v2c=0.251902 + (-0.0415419)*c + (0.0018553)*c*c + (-3.15181e-05)*c*c*c + (1.80073e-07)*c*c*c*c ;
1548   v2s=0.0771839 + (-0.00962468)*c + (0.000394453)*c*c + (-7.22485e-06)*c*c*c + (4.53562e-08)*c*c*c*c ;
1549 }
1550 if(fRunNumber==7){
1551   v2c=0.157038 + (-0.0204377)*c + (0.000847477)*c*c + (-1.4232e-05)*c*c*c + (8.04965e-08)*c*c*c*c ;
1552   v2s=0.0256337 + (-0.00242333)*c + (0.000140455)*c*c + (-3.5149e-06)*c*c*c + (2.44854e-08)*c*c*c*c ;
1553 }
1554 if(fRunNumber==8){
1555   v2c=-0.0916108 + (0.0146996)*c + (-0.000624971)*c*c + (9.63331e-06)*c*c*c + (-4.8574e-08)*c*c*c*c ;
1556   v2s=0.0332113 + (-0.00332475)*c + (0.000151857)*c*c + (-2.86187e-06)*c*c*c + (1.54796e-08)*c*c*c*c ;
1557 }
1558 if(fRunNumber==9){
1559   v2c=0.00925348 + (1.58854e-05)*c + (-3.85178e-05)*c*c + (6.75167e-07)*c*c*c + (-3.1502e-09)*c*c*c*c ;
1560   v2s=0.0249253 + (-0.00300902)*c + (0.000152653)*c*c + (-3.20923e-06)*c*c*c + (2.08818e-08)*c*c*c*c ;
1561 }
1562 if(fRunNumber==10){
1563   v2c=0.040903 + (0.00142711)*c + (-0.000264675)*c*c + (6.50624e-06)*c*c*c + (-4.46628e-08)*c*c*c*c ;
1564   v2s=0.0914196 + (-0.00957901)*c + (0.000408998)*c*c + (-7.49412e-06)*c*c*c + (4.63915e-08)*c*c*c*c ;
1565 }
1566 if(fRunNumber==11){
1567   v2c=-0.0130133 + (0.00296474)*c + (-0.000183518)*c*c + (3.65755e-06)*c*c*c + (-2.24484e-08)*c*c*c*c ;
1568   v2s=-0.00449031 + (0.00365474)*c + (-0.000226455)*c*c + (4.49792e-06)*c*c*c + (-2.96018e-08)*c*c*c*c ;
1569 }
1570 if(fRunNumber==12){
1571   v2c=-0.021987 + (0.00506675)*c + (-0.000301768)*c*c + (5.66088e-06)*c*c*c + (-3.21447e-08)*c*c*c*c ;
1572   v2s=0.0830858 + (-0.00871637)*c + (0.000299212)*c*c + (-4.10705e-06)*c*c*c + (1.76888e-08)*c*c*c*c ;
1573 }
1574 if(fRunNumber==13){
1575   v2c=0.0502952 + (-0.00152478)*c + (-0.000106289)*c*c + (3.39398e-06)*c*c*c + (-2.45015e-08)*c*c*c*c ;
1576   v2s=0.0639936 + (-0.00775191)*c + (0.000347449)*c*c + (-6.46454e-06)*c*c*c + (4.00439e-08)*c*c*c*c ;
1577 }
1578 if(fRunNumber==14){
1579   v2c=-0.116922 + (0.0122105)*c + (-0.000373923)*c*c + (4.08464e-06)*c*c*c + (-1.05659e-08)*c*c*c*c ;
1580   v2s=0.128821 + (-0.0204399)*c + (0.000831009)*c*c + (-1.33147e-05)*c*c*c + (7.24876e-08)*c*c*c*c ;
1581 }
1582 if(fRunNumber==15){
1583   v2c=0.0853741 + (-0.00924528)*c + (0.00034257)*c*c + (-5.69551e-06)*c*c*c + (3.44998e-08)*c*c*c*c ;
1584   v2s=0.0205492 + (-0.00052015)*c + (-5.42051e-05)*c*c + (1.82754e-06)*c*c*c + (-1.58393e-08)*c*c*c*c ;
1585 }
1586 if(fRunNumber==16){
1587   v2c=-0.0233639 + (0.00703612)*c + (-0.000403314)*c*c + (7.45693e-06)*c*c*c + (-4.4522e-08)*c*c*c*c ;
1588   v2s=-0.0712605 + (0.0124469)*c + (-0.000543644)*c*c + (8.22618e-06)*c*c*c + (-4.1073e-08)*c*c*c*c ;
1589 }
1590 if(fRunNumber==17){
1591   v2c=0.0113215 + (-0.0019788)*c + (9.81834e-05)*c*c + (-1.30009e-06)*c*c*c + (5.03998e-09)*c*c*c*c ;
1592   v2s=0.0459851 + (-0.00170929)*c + (-5.96459e-05)*c*c + (2.90146e-06)*c*c*c + (-2.85325e-08)*c*c*c*c ;
1593 }
1594 if(fRunNumber==18){
1595   v2c=-0.0924521 + (0.0162203)*c + (-0.000702717)*c*c + (1.0269e-05)*c*c*c + (-4.632e-08)*c*c*c*c ;
1596   v2s=-0.0456605 + (0.00706138)*c + (-0.000243957)*c*c + (2.7335e-06)*c*c*c + (-8.83296e-09)*c*c*c*c ;
1597 }
1598 if(fRunNumber==19){
1599   v2c=0.00150974 + (0.0113356)*c + (-0.000923111)*c*c + (2.0452e-05)*c*c*c + (-1.36949e-07)*c*c*c*c ;
1600   v2s=0.0673845 + (-0.0187379)*c + (0.00112044)*c*c + (-2.19997e-05)*c*c*c + (1.33115e-07)*c*c*c*c ;
1601 }
1602 if(fRunNumber==20){
1603   v2c=0.0223891 + (-0.000921021)*c + (-3.56276e-05)*c*c + (9.95622e-07)*c*c*c + (-5.54486e-09)*c*c*c*c ;
1604   v2s=0.0657305 + (-0.00354234)*c + (2.90428e-05)*c*c + (5.82994e-07)*c*c*c + (-7.53656e-09)*c*c*c*c ;
1605 }
1606 if(fRunNumber==21){
1607   v2c=0.00969434 + (-0.00195313)*c + (3.56409e-05)*c*c + (2.15514e-07)*c*c*c + (-5.5161e-09)*c*c*c*c ;
1608   v2s=0.000236584 + (0.00458234)*c + (-0.000306408)*c*c + (6.04476e-06)*c*c*c + (-3.79354e-08)*c*c*c*c ;
1609 }
1610 if(fRunNumber==22){
1611   v2c=0.0973536 + (-0.00907174)*c + (0.000239041)*c*c + (-2.64399e-06)*c*c*c + (1.12038e-08)*c*c*c*c ;
1612   v2s=0.0506578 + (-0.00256521)*c + (1.53982e-05)*c*c + (4.18193e-07)*c*c*c + (-4.99622e-09)*c*c*c*c ;
1613 }
1614 if(fRunNumber==23){
1615   v2c=0.120714 + (-0.0190965)*c + (0.000887955)*c*c + (-1.57144e-05)*c*c*c + (9.22823e-08)*c*c*c*c ;
1616   v2s=-0.00178837 + (0.00377706)*c + (-0.000358619)*c*c + (9.54949e-06)*c*c*c + (-7.39141e-08)*c*c*c*c ;
1617 }
1618 if(fRunNumber==24){
1619   v2c=0.0593053 + (-0.00687397)*c + (0.000200607)*c*c + (-2.34483e-06)*c*c*c + (9.60642e-09)*c*c*c*c ;
1620   v2s=0.0235174 + (0.00219788)*c + (-0.000225065)*c*c + (4.9594e-06)*c*c*c + (-3.2695e-08)*c*c*c*c ;
1621 }
1622 if(fRunNumber==25){
1623   v2c=0.0551353 + (-0.00340874)*c + (2.26718e-05)*c*c + (4.1675e-07)*c*c*c + (-3.37457e-09)*c*c*c*c ;
1624   v2s=0.0110038 + (-0.000180543)*c + (3.28645e-05)*c*c + (-1.08119e-06)*c*c*c + (6.7157e-09)*c*c*c*c ;
1625 }
1626 if(fRunNumber==26){
1627   v2c=-0.0138673 + (0.00475006)*c + (-0.00030584)*c*c + (6.0294e-06)*c*c*c + (-3.69906e-08)*c*c*c*c ;
1628   v2s=0.0395065 + (-0.00331262)*c + (9.40592e-05)*c*c + (-1.1541e-06)*c*c*c + (4.38329e-09)*c*c*c*c ;
1629 }
1630 if(fRunNumber==27){
1631   v2c=0.0547504 + (-0.00669067)*c + (0.000269785)*c*c + (-4.75217e-06)*c*c*c + (2.96254e-08)*c*c*c*c ;
1632   v2s=0.101508 + (-0.0107211)*c + (0.000385539)*c*c + (-6.28713e-06)*c*c*c + (3.75932e-08)*c*c*c*c ;
1633 }
1634 if(fRunNumber==28){
1635   v2c=-0.102173 + (0.0158262)*c + (-0.000706394)*c*c + (1.14263e-05)*c*c*c + (-6.14646e-08)*c*c*c*c ;
1636   v2s=0.02013 + (9.82197e-05)*c + (-1.71572e-05)*c*c + (-7.69646e-08)*c*c*c + (1.45113e-09)*c*c*c*c ;
1637 }
1638 if(fRunNumber==29){
1639   v2c=0.100539 + (-0.0115012)*c + (0.000295367)*c*c + (-2.57489e-06)*c*c*c + (5.41526e-09)*c*c*c*c ;
1640   v2s=0.138027 + (-0.00342397)*c + (-0.000392569)*c*c + (1.34626e-05)*c*c*c + (-1.06683e-07)*c*c*c*c ;
1641 }
1642 if(fRunNumber==30){
1643   v2c=0.0695326 + (-0.00752755)*c + (0.000237872)*c*c + (-3.31513e-06)*c*c*c + (1.69653e-08)*c*c*c*c ;
1644   v2s=0.0290133 + (-0.00073999)*c + (-3.35653e-05)*c*c + (7.61029e-07)*c*c*c + (-2.95792e-09)*c*c*c*c ;
1645 }
1646 if(fRunNumber==31){
1647   v2c=-0.103171 + (0.0134058)*c + (-0.000631602)*c*c + (1.10298e-05)*c*c*c + (-6.41177e-08)*c*c*c*c ;
1648   v2s=-0.137648 + (0.0111259)*c + (-0.000400035)*c*c + (5.90535e-06)*c*c*c + (-3.24676e-08)*c*c*c*c ;
1649 }
1650 if(fRunNumber==32){
1651   v2c=0.0522957 + (-0.00718492)*c + (0.000288586)*c*c + (-5.14534e-06)*c*c*c + (3.31303e-08)*c*c*c*c ;
1652   v2s=0.0731685 + (-0.00469449)*c + (9.57641e-05)*c*c + (-1.11891e-06)*c*c*c + (6.13984e-09)*c*c*c*c ;
1653 }
1654 if(fRunNumber==33){
1655   v2c=0.0882828 + (-0.00916109)*c + (0.00027821)*c*c + (-3.61312e-06)*c*c*c + (1.76418e-08)*c*c*c*c ;
1656   v2s=0.123302 + (-0.0156303)*c + (0.000623468)*c*c + (-9.83474e-06)*c*c*c + (5.24687e-08)*c*c*c*c ;
1657 }
1658 if(fRunNumber==34){
1659   v2c=0.0848636 + (-0.0142808)*c + (0.000723319)*c*c + (-1.32627e-05)*c*c*c + (7.77064e-08)*c*c*c*c ;
1660   v2s=-0.138483 + (0.0268553)*c + (-0.0013585)*c*c + (2.56034e-05)*c*c*c + (-1.63065e-07)*c*c*c*c ;
1661 }
1662 if(fRunNumber==35){
1663   v2c=-0.0134575 + (0.00267433)*c + (-0.000168784)*c*c + (3.24012e-06)*c*c*c + (-1.92766e-08)*c*c*c*c ;
1664   v2s=0.0596795 + (-0.00350808)*c + (2.97282e-05)*c*c + (3.52115e-07)*c*c*c + (-4.17462e-09)*c*c*c*c ;
1665 }
1666 if(fRunNumber==36){
1667   v2c=0.0784813 + (-0.00718389)*c + (0.000145303)*c*c + (-1.40121e-06)*c*c*c + (7.52775e-09)*c*c*c*c ;
1668   v2s=-0.0439181 + (0.0101363)*c + (-0.000494075)*c*c + (8.43356e-06)*c*c*c + (-4.68549e-08)*c*c*c*c ;
1669 }
1670 if(fRunNumber==37){
1671   v2c=-0.0118549 + (0.00328751)*c + (-0.000207156)*c*c + (3.92678e-06)*c*c*c + (-2.30059e-08)*c*c*c*c ;
1672   v2s=0.0344878 + (-0.000363669)*c + (-7.62481e-05)*c*c + (1.67135e-06)*c*c*c + (-9.64004e-09)*c*c*c*c ;
1673 }
1674 if(fRunNumber==38){
1675   v2c=-0.0254171 + (0.00297494)*c + (-0.000122361)*c*c + (1.78861e-06)*c*c*c + (-7.87609e-09)*c*c*c*c ;
1676   v2s=-0.0321399 + (0.00705636)*c + (-0.000325906)*c*c + (5.17669e-06)*c*c*c + (-2.86143e-08)*c*c*c*c ;
1677 }
1678 if(fRunNumber==39){
1679   v2c=-0.0368721 + (0.00253133)*c + (-0.000136793)*c*c + (2.51874e-06)*c*c*c + (-1.46055e-08)*c*c*c*c ;
1680   v2s=-0.0757763 + (0.005728)*c + (-0.000217489)*c*c + (3.11936e-06)*c*c*c + (-1.56919e-08)*c*c*c*c ;
1681 }
1682 if(fRunNumber==40){
1683   v2c=0.0166884 + (0.000509256)*c + (-0.000117911)*c*c + (2.65839e-06)*c*c*c + (-1.60875e-08)*c*c*c*c ;
1684   v2s=0.0336629 + (-0.00123023)*c + (-4.90123e-05)*c*c + (2.17862e-06)*c*c*c + (-1.98445e-08)*c*c*c*c ;
1685 }
1686 if(fRunNumber==41){
1687   v2c=-0.00887514 + (0.00491344)*c + (-0.000325782)*c*c + (6.54782e-06)*c*c*c + (-4.14143e-08)*c*c*c*c ;
1688   v2s=0.0720999 + (-0.00650524)*c + (0.000214752)*c*c + (-3.19681e-06)*c*c*c + (1.64573e-08)*c*c*c*c ;
1689 }
1690 if(fRunNumber==42){
1691   v2c=-0.0495903 + (0.00428229)*c + (-0.000181618)*c*c + (2.3913e-06)*c*c*c + (-8.55469e-09)*c*c*c*c ;
1692   v2s=0.0127982 + (-0.00690065)*c + (0.000342707)*c*c + (-6.40515e-06)*c*c*c + (3.83973e-08)*c*c*c*c ;
1693 }
1694 if(fRunNumber==43){
1695   v2c=0.0196783 + (-0.000221524)*c + (-7.09556e-05)*c*c + (1.76517e-06)*c*c*c + (-1.19612e-08)*c*c*c*c ;
1696   v2s=0.0350359 + (-0.0020458)*c + (5.18727e-05)*c*c + (-6.58401e-07)*c*c*c + (1.10936e-09)*c*c*c*c ;
1697 }
1698 if(fRunNumber==44){
1699   v2c=-0.0196041 + (0.00257682)*c + (-0.000174854)*c*c + (3.2168e-06)*c*c*c + (-1.85569e-08)*c*c*c*c ;
1700   v2s=-0.0870278 + (0.00634528)*c + (-0.000273588)*c*c + (4.77944e-06)*c*c*c + (-2.98422e-08)*c*c*c*c ;
1701 }
1702 if(fRunNumber==45){
1703   v2c=-0.0105827 + (0.00271714)*c + (-0.000152357)*c*c + (2.71899e-06)*c*c*c + (-1.5435e-08)*c*c*c*c ;
1704   v2s=0.135579 + (-0.0135952)*c + (0.000424184)*c*c + (-5.12316e-06)*c*c*c + (1.84497e-08)*c*c*c*c ;
1705 }
1706 if(fRunNumber==46){
1707   v2c=-0.017755 + (0.00411137)*c + (-0.000231724)*c*c + (4.17641e-06)*c*c*c + (-2.39164e-08)*c*c*c*c ;
1708   v2s=-0.0198628 + (0.0010032)*c + (-4.9708e-05)*c*c + (7.12455e-07)*c*c*c + (-4.22231e-09)*c*c*c*c ;
1709 }
1710 if(fRunNumber==47){
1711   v2c=-0.0111387 + (0.00258591)*c + (-0.000194287)*c*c + (3.84062e-06)*c*c*c + (-2.37192e-08)*c*c*c*c ;
1712   v2s=-0.0478616 + (0.00365349)*c + (-0.000152037)*c*c + (2.24323e-06)*c*c*c + (-1.23308e-08)*c*c*c*c ;
1713 }
1714 if(fRunNumber==48){
1715   v2c=0.070344 + (-0.0137332)*c + (0.000638536)*c*c + (-1.188e-05)*c*c*c + (7.4801e-08)*c*c*c*c ;
1716   v2s=-0.00208823 + (-0.00314157)*c + (9.9553e-05)*c*c + (-8.73891e-07)*c*c*c + (-1.72944e-09)*c*c*c*c ;
1717 }
1718 if(fRunNumber==51){
1719   v2c=0.017789 + (-0.00598224)*c + (0.000328477)*c*c + (-6.80787e-06)*c*c*c + (4.46905e-08)*c*c*c*c ;
1720   v2s=-0.0894734 + (0.007351)*c + (-0.000291085)*c*c + (4.38654e-06)*c*c*c + (-2.32261e-08)*c*c*c*c ;
1721 }
1722 if(fRunNumber==52){
1723   v2c=0.0555614 + (-0.00430576)*c + (0.00011519)*c*c + (-1.81584e-06)*c*c*c + (1.19214e-08)*c*c*c*c ;
1724   v2s=0.0901479 + (-0.0091505)*c + (0.000343757)*c*c + (-5.71204e-06)*c*c*c + (3.31217e-08)*c*c*c*c ;
1725 }
1726 if(fRunNumber==53){
1727   v2c=0.0181761 + (-0.00186378)*c + (4.60531e-05)*c*c + (-7.59581e-07)*c*c*c + (5.52465e-09)*c*c*c*c ;
1728   v2s=0.0456713 + (-0.00526813)*c + (0.000232978)*c*c + (-3.98724e-06)*c*c*c + (2.10384e-08)*c*c*c*c ;
1729 }
1730 if(fRunNumber==54){
1731   v2c=0.0456225 + (-0.00611173)*c + (0.000228414)*c*c + (-3.70527e-06)*c*c*c + (2.10774e-08)*c*c*c*c ;
1732   v2s=-0.00553874 + (0.00501799)*c + (-0.000331323)*c*c + (6.96978e-06)*c*c*c + (-4.72472e-08)*c*c*c*c ;
1733 }
1734 if(fRunNumber==55){
1735   v2c=-0.0578879 + (0.00664986)*c + (-0.000335443)*c*c + (6.0086e-06)*c*c*c + (-3.54293e-08)*c*c*c*c ;
1736   v2s=-0.0675269 + (0.00407581)*c + (-0.000148063)*c*c + (1.922e-06)*c*c*c + (-8.8635e-09)*c*c*c*c ;
1737 }
1738 if(fRunNumber==56){
1739   v2c=-0.000898903 + (0.00199222)*c + (-0.000207257)*c*c + (4.46148e-06)*c*c*c + (-2.71361e-08)*c*c*c*c ;
1740   v2s=-0.103794 + (0.0198667)*c + (-0.000879042)*c*c + (1.43177e-05)*c*c*c + (-8.09672e-08)*c*c*c*c ;
1741 }
1742 if(fRunNumber==57){
1743   v2c=0.00953087 + (0.000947327)*c + (-3.45822e-05)*c*c + (-4.22294e-07)*c*c*c + (9.08727e-09)*c*c*c*c ;
1744   v2s=0.0662314 + (-0.0076136)*c + (0.000288482)*c*c + (-4.82931e-06)*c*c*c + (2.67751e-08)*c*c*c*c ;
1745 }
1746 if(fRunNumber==58){
1747   v2c=0.00682728 + (-0.000293407)*c + (-2.88037e-05)*c*c + (6.63629e-07)*c*c*c + (-3.93121e-09)*c*c*c*c ;
1748   v2s=0.0085365 + (0.00138919)*c + (-8.15068e-05)*c*c + (1.26437e-06)*c*c*c + (-7.50322e-09)*c*c*c*c ;
1749 }
1750 if(fRunNumber==59){
1751   v2c=-0.0185226 + (0.00377881)*c + (-0.000226383)*c*c + (4.22897e-06)*c*c*c + (-2.51383e-08)*c*c*c*c ;
1752   v2s=-0.222605 + (0.0100699)*c + (-0.00029256)*c*c + (3.3855e-06)*c*c*c + (-1.33648e-08)*c*c*c*c ;
1753 }
1754 if(fRunNumber==60){
1755   v2c=-0.00111322 + (0.00291259)*c + (-0.000215769)*c*c + (4.13355e-06)*c*c*c + (-2.36883e-08)*c*c*c*c ;
1756   v2s=0.033686 + (-0.00124534)*c + (1.52616e-05)*c*c + (-2.99302e-07)*c*c*c + (1.05198e-09)*c*c*c*c ;
1757 }
1758 if(fRunNumber==61){
1759   v2c=0.00041873 + (-0.000231092)*c + (1.19226e-05)*c*c + (-6.29604e-07)*c*c*c + (7.26582e-09)*c*c*c*c ;
1760   v2s=0.00435438 + (0.0025265)*c + (-0.000153028)*c*c + (2.71169e-06)*c*c*c + (-1.67127e-08)*c*c*c*c ;
1761 }
1762 if(fRunNumber==62){
1763   v2c=-0.0573899 + (0.00972389)*c + (-0.000495772)*c*c + (9.0103e-06)*c*c*c + (-5.45756e-08)*c*c*c*c ;
1764   v2s=0.00702691 + (0.00698504)*c + (-0.000541929)*c*c + (1.19971e-05)*c*c*c + (-8.26942e-08)*c*c*c*c ;
1765 }
1766 if(fRunNumber==63){
1767   v2c=0.047222 + (-0.00604037)*c + (0.0002092)*c*c + (-3.07144e-06)*c*c*c + (1.68579e-08)*c*c*c*c ;
1768   v2s=0.0568815 + (-0.00607571)*c + (0.000244243)*c*c + (-4.22237e-06)*c*c*c + (2.38928e-08)*c*c*c*c ;
1769 }
1770 if(fRunNumber==64){
1771   v2c=0.0464686 + (-0.00463482)*c + (0.000146379)*c*c + (-2.23008e-06)*c*c*c + (1.29549e-08)*c*c*c*c ;
1772   v2s=-0.00571995 + (0.00273485)*c + (-0.000131945)*c*c + (2.08986e-06)*c*c*c + (-1.26717e-08)*c*c*c*c ;
1773 }
1774 if(fRunNumber==65){
1775   v2c=0.0544794 + (-0.00616918)*c + (0.000173808)*c*c + (-2.01338e-06)*c*c*c + (8.78123e-09)*c*c*c*c ;
1776   v2s=0.0557002 + (-0.00701287)*c + (0.000340418)*c*c + (-6.12754e-06)*c*c*c + (3.3384e-08)*c*c*c*c ;
1777 }
1778 if(fRunNumber==66){
1779   v2c=0.0111176 + (0.000262254)*c + (-7.20349e-05)*c*c + (1.38755e-06)*c*c*c + (-6.65016e-09)*c*c*c*c ;
1780   v2s=0.0644184 + (-0.00518515)*c + (0.000174227)*c*c + (-2.7347e-06)*c*c*c + (1.29547e-08)*c*c*c*c ;
1781 }
1782 if(fRunNumber==67){
1783   v2c=-0.0481037 + (0.00823686)*c + (-0.000418053)*c*c + (7.40186e-06)*c*c*c + (-4.19609e-08)*c*c*c*c ;
1784   v2s=0.0560171 + (-0.002556)*c + (2.54529e-05)*c*c + (-5.22269e-09)*c*c*c + (-2.19983e-09)*c*c*c*c ;
1785 }
1786 if(fRunNumber==68){
1787   v2c=-0.0139809 + (0.00274305)*c + (-0.00017744)*c*c + (3.20286e-06)*c*c*c + (-1.74137e-08)*c*c*c*c ;
1788   v2s=-0.218673 + (0.00764806)*c + (-0.000222739)*c*c + (3.14656e-06)*c*c*c + (-1.73548e-08)*c*c*c*c ;
1789 }
1790 if(fRunNumber==69){
1791   v2c=0.0736938 + (-0.0122004)*c + (0.000498227)*c*c + (-8.08779e-06)*c*c*c + (4.52749e-08)*c*c*c*c ;
1792   v2s=-0.236254 + (0.00979816)*c + (-0.000280698)*c*c + (3.4103e-06)*c*c*c + (-1.47299e-08)*c*c*c*c ;
1793 }
1794 if(fRunNumber==70){
1795   v2c=-0.0366545 + (0.00399604)*c + (-0.000196876)*c*c + (3.49686e-06)*c*c*c + (-2.01142e-08)*c*c*c*c ;
1796   v2s=0.0220911 + (-0.000529459)*c + (9.10408e-06)*c*c + (-3.57334e-07)*c*c*c + (1.87909e-09)*c*c*c*c ;
1797 }
1798 if(fRunNumber==71){
1799   v2c=-0.039698 + (0.00654615)*c + (-0.000323865)*c*c + (5.50998e-06)*c*c*c + (-3.00866e-08)*c*c*c*c ;
1800   v2s=0.0650078 + (-0.00502636)*c + (0.000128459)*c*c + (-1.3877e-06)*c*c*c + (3.21917e-09)*c*c*c*c ;
1801 }
1802 if(fRunNumber==72){
1803   v2c=0.0594227 + (-0.00872513)*c + (0.000368684)*c*c + (-6.34986e-06)*c*c*c + (3.79523e-08)*c*c*c*c ;
1804   v2s=0.050348 + (-0.00512087)*c + (0.000228643)*c*c + (-4.40797e-06)*c*c*c + (2.62482e-08)*c*c*c*c ;
1805 }
1806 if(fRunNumber==73){
1807   v2c=0.131281 + (-0.0162697)*c + (0.000584063)*c*c + (-8.64349e-06)*c*c*c + (4.61009e-08)*c*c*c*c ;
1808   v2s=0.0271721 + (-0.000487039)*c + (1.60624e-05)*c*c + (-5.38029e-07)*c*c*c + (2.08589e-09)*c*c*c*c ;
1809 }
1810 if(fRunNumber==74){
1811   v2c=-0.0128651 + (0.00946426)*c + (-0.00055547)*c*c + (9.37245e-06)*c*c*c + (-4.78224e-08)*c*c*c*c ;
1812   v2s=0.0903476 + (-0.0164972)*c + (0.000927481)*c*c + (-1.88459e-05)*c*c*c + (1.20249e-07)*c*c*c*c ;
1813 }
1814 if(fRunNumber==75){
1815   v2c=0.0204147 + (-0.00139139)*c + (-2.47732e-05)*c*c + (1.1214e-06)*c*c*c + (-7.22533e-09)*c*c*c*c ;
1816   v2s=0.0214247 + (-0.000147929)*c + (-7.58241e-06)*c*c + (-7.05565e-08)*c*c*c + (-4.86528e-10)*c*c*c*c ;
1817 }
1818 if(fRunNumber==76){
1819   v2c=0.0469095 + (-0.00541793)*c + (0.000133238)*c*c + (-1.14334e-06)*c*c*c + (3.4826e-09)*c*c*c*c ;
1820   v2s=0.0304763 + (-0.00213957)*c + (8.27588e-05)*c*c + (-1.34495e-06)*c*c*c + (4.81134e-09)*c*c*c*c ;
1821 }
1822 if(fRunNumber==77){
1823   v2c=0.113822 + (-0.0154286)*c + (0.000574533)*c*c + (-8.67874e-06)*c*c*c + (4.76727e-08)*c*c*c*c ;
1824   v2s=0.010623 + (0.00513467)*c + (-0.000372733)*c*c + (7.40692e-06)*c*c*c + (-4.64093e-08)*c*c*c*c ;
1825 }
1826 if(fRunNumber==78){
1827   v2c=0.020658 + (-0.00274725)*c + (5.8872e-05)*c*c + (-3.43999e-07)*c*c*c + (-1.04273e-10)*c*c*c*c ;
1828   v2s=0.00219379 + (0.000972033)*c + (-1.41816e-05)*c*c + (-4.41149e-07)*c*c*c + (3.81037e-09)*c*c*c*c ;
1829 }
1830 if(fRunNumber==79){
1831   v2c=0.227324 + (-0.0264915)*c + (0.000915298)*c*c + (-1.3343e-05)*c*c*c + (7.1044e-08)*c*c*c*c ;
1832   v2s=0.0474072 + (-0.00939515)*c + (0.000730108)*c*c + (-1.80811e-05)*c*c*c + (1.3003e-07)*c*c*c*c ;
1833 }
1834 if(fRunNumber==81){
1835   v2c=-0.0368028 + (0.00368927)*c + (-0.000228321)*c*c + (4.48174e-06)*c*c*c + (-2.75298e-08)*c*c*c*c ;
1836   v2s=-0.238807 + (0.0108667)*c + (-0.000350649)*c*c + (4.95568e-06)*c*c*c + (-2.53022e-08)*c*c*c*c ;
1837 }
1838 if(fRunNumber==82){
1839   v2c=-0.0214072 + (0.00119258)*c + (-7.80215e-05)*c*c + (1.37682e-06)*c*c*c + (-7.31103e-09)*c*c*c*c ;
1840   v2s=-0.233825 + (0.00735109)*c + (-0.000142737)*c*c + (9.15013e-07)*c*c*c + (-1.98463e-10)*c*c*c*c ;
1841 }
1842 if(fRunNumber==83){
1843   v2c=-0.0716708 + (0.00855289)*c + (-0.00037249)*c*c + (6.41638e-06)*c*c*c + (-3.66318e-08)*c*c*c*c ;
1844   v2s=-0.329702 + (0.033231)*c + (-0.00131012)*c*c + (2.1101e-05)*c*c*c + (-1.18905e-07)*c*c*c*c ;
1845 }
1846 if(fRunNumber==84){
1847   v2c=-0.0259022 + (0.00711773)*c + (-0.000434778)*c*c + (8.94774e-06)*c*c*c + (-5.84408e-08)*c*c*c*c ;
1848   v2s=-0.0936287 + (-0.00455282)*c + (0.000390982)*c*c + (-7.95224e-06)*c*c*c + (4.95612e-08)*c*c*c*c ;
1849 }
1850 if(fRunNumber==85){
1851   v2c=0.0263223 + (-0.00475593)*c + (9.63236e-05)*c*c + (-4.95311e-07)*c*c*c + (-5.47428e-10)*c*c*c*c ;
1852   v2s=-0.220593 + (0.00823892)*c + (-0.000248477)*c*c + (3.28082e-06)*c*c*c + (-1.45098e-08)*c*c*c*c ;
1853 }
1854 if(fRunNumber==86){
1855   v2c=-0.0157962 + (0.00408922)*c + (-0.000282087)*c*c + (5.81961e-06)*c*c*c + (-3.6481e-08)*c*c*c*c ;
1856   v2s=0.0340979 + (-0.00139471)*c + (6.48561e-06)*c*c + (3.02184e-08)*c*c*c + (-1.05879e-09)*c*c*c*c ;
1857 }
1858 if(fRunNumber==87){
1859   v2c=0.0577366 + (-0.00471394)*c + (0.000107329)*c*c + (-7.28927e-07)*c*c*c + (-1.51199e-09)*c*c*c*c ;
1860   v2s=0.0350171 + (-0.00402687)*c + (0.00016046)*c*c + (-2.39625e-06)*c*c*c + (9.98146e-09)*c*c*c*c ;
1861 }
1862 if(fRunNumber==88){
1863   v2c=-0.00547971 + (0.00161905)*c + (-0.00013831)*c*c + (2.94662e-06)*c*c*c + (-1.92504e-08)*c*c*c*c ;
1864   v2s=-0.0722251 + (0.0127634)*c + (-0.000612284)*c*c + (1.07553e-05)*c*c*c + (-6.34054e-08)*c*c*c*c ;
1865 }
1866 if(fRunNumber==89){
1867   v2c=0.165574 + (-0.0241913)*c + (0.00101221)*c*c + (-1.62279e-05)*c*c*c + (8.77252e-08)*c*c*c*c ;
1868   v2s=0.0692954 + (-0.0147219)*c + (0.00068782)*c*c + (-1.11091e-05)*c*c*c + (5.37295e-08)*c*c*c*c ;
1869 }
1870 if(fRunNumber==91){
1871   v2c=-0.0334666 + (0.00583866)*c + (-0.000329883)*c*c + (6.08932e-06)*c*c*c + (-3.59853e-08)*c*c*c*c ;
1872   v2s=-0.229775 + (0.010061)*c + (-0.00028144)*c*c + (3.3231e-06)*c*c*c + (-1.40799e-08)*c*c*c*c ;
1873 }
1874 if(fRunNumber==95){
1875   v2c=-0.0993203 + (0.0150547)*c + (-0.000713531)*c*c + (1.22733e-05)*c*c*c + (-6.98669e-08)*c*c*c*c ;
1876   v2s=-0.217746 + (0.0068375)*c + (-0.000171962)*c*c + (2.05506e-06)*c*c*c + (-8.78703e-09)*c*c*c*c ;
1877 }
1878 if(fRunNumber==96){
1879   v2c=-0.0398801 + (0.00406028)*c + (-0.000214066)*c*c + (3.69056e-06)*c*c*c + (-1.99339e-08)*c*c*c*c ;
1880   v2s=-0.240195 + (0.00782806)*c + (-0.000131365)*c*c + (3.18193e-07)*c*c*c + (4.88009e-09)*c*c*c*c ;
1881 }
1882 if(fRunNumber==97){
1883   v2c=-0.0325538 + (0.00250986)*c + (-0.000136762)*c*c + (2.35572e-06)*c*c*c + (-1.23413e-08)*c*c*c*c ;
1884   v2s=-0.240415 + (0.010435)*c + (-0.000291848)*c*c + (3.35357e-06)*c*c*c + (-1.35833e-08)*c*c*c*c ;
1885 }
1886 if(fRunNumber==98){
1887   v2c=-0.00692338 + (0.00379335)*c + (-0.000332833)*c*c + (7.35052e-06)*c*c*c + (-4.89956e-08)*c*c*c*c ;
1888   v2s=-0.263042 + (0.0134291)*c + (-0.000465334)*c*c + (7.09595e-06)*c*c*c + (-3.90332e-08)*c*c*c*c ;
1889 }
1890 if(fRunNumber==101){
1891   v2c=-0.049409 + (0.0073433)*c + (-0.000376933)*c*c + (7.39945e-06)*c*c*c + (-4.967e-08)*c*c*c*c ;
1892   v2s=0.00564511 + (-0.00101958)*c + (0.000121077)*c*c + (-3.44889e-06)*c*c*c + (2.42733e-08)*c*c*c*c ;
1893 }
1894 if(fRunNumber==102){
1895   v2c=-0.0393185 + (0.00610331)*c + (-0.000286099)*c*c + (4.61693e-06)*c*c*c + (-2.44104e-08)*c*c*c*c ;
1896   v2s=-0.00898987 + (0.00463766)*c + (-0.000269122)*c*c + (5.46456e-06)*c*c*c + (-3.85677e-08)*c*c*c*c ;
1897 }
1898 if(fRunNumber==103){
1899   v2c=-0.0171815 + (0.00271616)*c + (-9.49063e-05)*c*c + (5.68888e-07)*c*c*c + (2.77777e-09)*c*c*c*c ;
1900   v2s=-0.0348362 + (0.00661647)*c + (-0.000196625)*c*c + (1.60914e-06)*c*c*c + (-4.34769e-09)*c*c*c*c ;
1901 }
1902 if(fRunNumber==104){
1903   v2c=0.0453893 + (-0.00220981)*c + (-6.34642e-05)*c*c + (2.5268e-06)*c*c*c + (-1.81319e-08)*c*c*c*c ;
1904   v2s=0.0131555 + (0.00115036)*c + (-5.70975e-05)*c*c + (5.20224e-07)*c*c*c + (-3.11332e-09)*c*c*c*c ;
1905 }
1906 if(fRunNumber==105){
1907   v2c=0.0052505 + (0.000251094)*c + (-3.95143e-05)*c*c + (5.6354e-07)*c*c*c + (-1.86603e-09)*c*c*c*c ;
1908   v2s=0.079882 + (-0.00841369)*c + (0.000342924)*c*c + (-5.64554e-06)*c*c*c + (2.89511e-08)*c*c*c*c ;
1909 }
1910 if(fRunNumber==106){
1911   v2c=0.0561693 + (-0.00693389)*c + (0.000243013)*c*c + (-3.7816e-06)*c*c*c + (2.21666e-08)*c*c*c*c ;
1912   v2s=0.115847 + (-0.0145063)*c + (0.000597908)*c*c + (-9.37418e-06)*c*c*c + (4.57406e-08)*c*c*c*c ;
1913 }
1914 if(fRunNumber==107){
1915   v2c=-0.160892 + (0.0259075)*c + (-0.00120084)*c*c + (1.99814e-05)*c*c*c + (-1.09708e-07)*c*c*c*c ;
1916   v2s=0.0922001 + (-0.00861465)*c + (0.000196846)*c*c + (-5.34939e-07)*c*c*c + (-1.20442e-08)*c*c*c*c ;
1917 }
1918 if(fRunNumber==108){
1919   v2c=0.0325605 + (-0.00795036)*c + (0.000436987)*c*c + (-9.37794e-06)*c*c*c + (6.59912e-08)*c*c*c*c ;
1920   v2s=0.0894763 + (-0.00694006)*c + (0.000214928)*c*c + (-3.05745e-06)*c*c*c + (1.33679e-08)*c*c*c*c ;
1921 }
1922 if(fRunNumber==109){
1923   v2c=-8.30505e-05 + (0.00304264)*c + (-0.000228365)*c*c + (4.43511e-06)*c*c*c + (-2.5788e-08)*c*c*c*c ;
1924   v2s=0.0276356 + (-0.000486726)*c + (-1.12152e-05)*c*c + (1.56258e-07)*c*c*c + (-2.17826e-09)*c*c*c*c ;
1925 }
1926 if(fRunNumber==112){
1927   v2c=0.0273919 + (-0.00243837)*c + (2.41667e-05)*c*c + (3.06367e-07)*c*c*c + (-3.9028e-09)*c*c*c*c ;
1928   v2s=0.0119428 + (0.00161447)*c + (-0.00010526)*c*c + (1.76239e-06)*c*c*c + (-1.12844e-08)*c*c*c*c ;
1929 }
1930 if(fRunNumber==114){
1931   v2c=0.114287 + (-0.016125)*c + (0.000673002)*c*c + (-1.11635e-05)*c*c*c + (6.39533e-08)*c*c*c*c ;
1932   v2s=0.0353709 + (-0.00169691)*c + (-3.93183e-05)*c*c + (2.08815e-06)*c*c*c + (-2.03159e-08)*c*c*c*c ;
1933 }
1934 if(fRunNumber==115){
1935   v2c=-0.0109276 + (0.00378322)*c + (-0.000252651)*c*c + (4.599e-06)*c*c*c + (-2.36568e-08)*c*c*c*c ;
1936   v2s=0.0185448 + (0.00102852)*c + (-6.04966e-05)*c*c + (5.89933e-07)*c*c*c + (-2.5921e-09)*c*c*c*c ;
1937 }
1938 if(fRunNumber==116){
1939   v2c=-0.117563 + (0.00405449)*c + (-0.000112806)*c*c + (4.01903e-06)*c*c*c + (-4.25358e-08)*c*c*c*c ;
1940   v2s=0.0280797 + (-0.00528592)*c + (0.000375784)*c*c + (-9.96825e-06)*c*c*c + (7.72147e-08)*c*c*c*c ;
1941 }
1942 if(fRunNumber==117){
1943   v2c=0.0301869 + (-0.000751512)*c + (-9.43748e-05)*c*c + (2.60697e-06)*c*c*c + (-1.73948e-08)*c*c*c*c ;
1944   v2s=0.0594442 + (-0.00499442)*c + (0.000170617)*c*c + (-2.80903e-06)*c*c*c + (1.51075e-08)*c*c*c*c ;
1945 }
1946 if(fRunNumber==118){
1947   v2c=0.0118942 + (-0.000669595)*c + (-3.6634e-05)*c*c + (1.40794e-06)*c*c*c + (-1.15253e-08)*c*c*c*c ;
1948   v2s=-0.0174395 + (0.00460355)*c + (-0.00023192)*c*c + (3.83941e-06)*c*c*c + (-2.30761e-08)*c*c*c*c ;
1949 }
1950 if(fRunNumber==119){
1951   v2c=0.018229 + (-0.00144698)*c + (-1.07295e-06)*c*c + (6.22528e-07)*c*c*c + (-4.90504e-09)*c*c*c*c ;
1952   v2s=0.0122761 + (0.000985351)*c + (-6.02936e-05)*c*c + (9.41867e-07)*c*c*c + (-6.59756e-09)*c*c*c*c ;
1953 }
1954 if(fRunNumber==120){
1955   v2c=-0.0968065 + (0.0131861)*c + (-0.000585224)*c*c + (9.82175e-06)*c*c*c + (-5.51313e-08)*c*c*c*c ;
1956   v2s=0.0719334 + (-0.00752912)*c + (0.000362464)*c*c + (-6.65114e-06)*c*c*c + (3.70295e-08)*c*c*c*c ;
1957 }
1958 if(fRunNumber==121){
1959   v2c=0.0296329 + (-0.00448004)*c + (0.00010239)*c*c + (-2.40647e-07)*c*c*c + (-5.4555e-09)*c*c*c*c ;
1960   v2s=0.0774925 + (-0.00635491)*c + (0.0001939)*c*c + (-3.04755e-06)*c*c*c + (1.66055e-08)*c*c*c*c ;
1961 }
1962 if(fRunNumber==122){
1963   v2c=0.00956939 + (0.000460793)*c + (-0.000105912)*c*c + (2.38286e-06)*c*c*c + (-1.446e-08)*c*c*c*c ;
1964   v2s=0.0152677 + (0.00345263)*c + (-0.000262399)*c*c + (5.5895e-06)*c*c*c + (-3.84974e-08)*c*c*c*c ;
1965 }
1966 if(fRunNumber==123){
1967   v2c=0.0495618 + (-0.00059293)*c + (-0.00025227)*c*c + (6.61088e-06)*c*c*c + (-4.24063e-08)*c*c*c*c ;
1968   v2s=0.0862227 + (-0.0190161)*c + (0.0010647)*c*c + (-1.94957e-05)*c*c*c + (1.08665e-07)*c*c*c*c ;
1969 }
1970 if(fRunNumber==124){
1971   v2c=-0.0408078 + (0.00565108)*c + (-0.00027528)*c*c + (5.2165e-06)*c*c*c + (-3.3244e-08)*c*c*c*c ;
1972   v2s=0.00169862 + (0.00371982)*c + (-0.000169757)*c*c + (2.07347e-06)*c*c*c + (-8.30142e-09)*c*c*c*c ;
1973 }
1974 if(fRunNumber==125){
1975   v2c=0.0285065 + (-0.00348583)*c + (0.000106189)*c*c + (-1.56726e-06)*c*c*c + (9.40552e-09)*c*c*c*c ;
1976   v2s=0.0363645 + (-0.00252206)*c + (0.000122553)*c*c + (-2.74066e-06)*c*c*c + (1.66856e-08)*c*c*c*c ;
1977 }
1978 if(fRunNumber==126){
1979   v2c=-0.00864424 + (0.00157555)*c + (-0.000127367)*c*c + (2.47447e-06)*c*c*c + (-1.42302e-08)*c*c*c*c ;
1980   v2s=-0.213003 + (0.00643156)*c + (-0.000121219)*c*c + (6.06838e-07)*c*c*c + (1.48381e-09)*c*c*c*c ;
1981 }
1982 if(fRunNumber==127){
1983   v2c=-0.0336884 + (0.00299236)*c + (-0.000147557)*c*c + (2.47908e-06)*c*c*c + (-1.33495e-08)*c*c*c*c ;
1984   v2s=-0.271925 + (0.0158755)*c + (-0.000583802)*c*c + (9.14376e-06)*c*c*c + (-5.05302e-08)*c*c*c*c ;
1985 }
1986 if(fRunNumber==128){
1987   v2c=-0.0639711 + (0.00822881)*c + (-0.000428416)*c*c + (7.98075e-06)*c*c*c + (-4.81995e-08)*c*c*c*c ;
1988   v2s=-0.22634 + (0.00908632)*c + (-0.00029)*c*c + (4.14095e-06)*c*c*c + (-2.15823e-08)*c*c*c*c ;
1989 }
1990 if(fRunNumber==129){
1991   v2c=0.0652753 + (-0.00529737)*c + (0.000133883)*c*c + (-1.63339e-06)*c*c*c + (7.88294e-09)*c*c*c*c ;
1992   v2s=0.00357003 + (0.00503303)*c + (-0.000316531)*c*c + (6.45793e-06)*c*c*c + (-4.44467e-08)*c*c*c*c ;
1993 }
1994 if(fRunNumber==131){
1995   v2c=0.117255 + (-0.0149009)*c + (0.000560178)*c*c + (-8.75754e-06)*c*c*c + (4.85024e-08)*c*c*c*c ;
1996   v2s=-0.00180786 + (0.00224258)*c + (-9.84056e-05)*c*c + (1.39525e-06)*c*c*c + (-7.63512e-09)*c*c*c*c ;
1997 }
1998 if(fRunNumber==132){
1999   v2c=0.0100287 + (-0.00051338)*c + (-2.7702e-05)*c*c + (5.0205e-07)*c*c*c + (-1.12682e-09)*c*c*c*c ;
2000   v2s=0.00556895 + (0.00211082)*c + (-0.000125448)*c*c + (2.30409e-06)*c*c*c + (-1.63703e-08)*c*c*c*c ;
2001 }
2002 if(fRunNumber==133){
2003   v2c=-0.00755913 + (0.00327793)*c + (-0.00024545)*c*c + (5.03417e-06)*c*c*c + (-3.11617e-08)*c*c*c*c ;
2004   v2s=0.0398477 + (-0.000728372)*c + (-2.63935e-05)*c*c + (7.85276e-07)*c*c*c + (-7.72703e-09)*c*c*c*c ;
2005 }
2006 if(fRunNumber==134){
2007   v2c=0.00344056 + (0.000171769)*c + (-8.00887e-05)*c*c + (1.76696e-06)*c*c*c + (-1.08652e-08)*c*c*c*c ;
2008   v2s=-0.200474 + (0.00736532)*c + (-0.000221809)*c*c + (2.91763e-06)*c*c*c + (-1.40827e-08)*c*c*c*c ;
2009 }
2010 if(fRunNumber==135){
2011   v2c=-0.0251554 + (0.00227996)*c + (-0.000133757)*c*c + (2.50604e-06)*c*c*c + (-1.48528e-08)*c*c*c*c ;
2012   v2s=-0.229223 + (0.0091122)*c + (-0.000245035)*c*c + (2.64826e-06)*c*c*c + (-9.57268e-09)*c*c*c*c ;
2013 }
2014 if(fRunNumber==136){
2015   v2c=-0.0308547 + (0.00209237)*c + (-0.000183034)*c*c + (4.54164e-06)*c*c*c + (-3.26557e-08)*c*c*c*c ;
2016   v2s=-0.241702 + (0.00988355)*c + (-0.000263014)*c*c + (2.73376e-06)*c*c*c + (-9.79971e-09)*c*c*c*c ;
2017 }
2018
2019   
2020   
2021   
2022   
2023 /*  
2024   
2025   if(fRunNumber>=1 && fRunNumber<=45){ // 137161 -137848 //period 1
2026 //    v2c = 1.133676e-02-1.759454e-04*x-6.217033e-05*x*x+1.532507e-06*x*x*x-9.665265e-09*x*x*x*x;
2027 //    v2s = 2.173690e-02-8.410340e-04*x-1.391841e-05*x*x+5.003301e-07*x*x*x-4.175974e-09*x*x*x*x;
2028     v2c=2.295070e-02-1.050171e-03*x-3.432843e-05*x*x+1.156549e-06*x*x*x-7.781377e-09*x*x*x*x ;
2029     v2s=3.994886e-02-1.961957e-03*x+1.641958e-05*x*x+1.234025e-07*x*x*x-2.175698e-09*x*x*x*x ;
2030   }
2031   if(fRunNumber>=46 && fRunNumber<=58){ //138125-138275//period 2
2032     v2c =-1.394612e-03+1.333726e-03*x-1.115323e-04*x*x+2.103762e-06*x*x*x-1.186760e-08*x*x*x*x ;
2033     v2s =-7.788201e-03+7.178984e-04*x-4.553597e-05*x*x+6.941817e-07*x*x*x-4.465249e-09*x*x*x*x ;
2034   }
2035   if(fRunNumber>=59 && fRunNumber<=78){ //138359-138730//period 3
2036     v2c = 1.448809e-02+-7.894029e-04*x-2.693871e-05*x*x+7.944017e-07*x*x*x-4.272135e-09*x*x*x*x ;
2037     v2s = 3.442216e-03+-5.574560e-05*x-1.758343e-05*x*x+2.386547e-07*x*x*x-2.404210e-09*x*x*x*x ;
2038   }
2039   if(fRunNumber>=79){//period 4
2040     v2c =-1.553536e-03+7.761106e-04*x-9.529723e-05*x*x+2.026750e-06*x*x*x-1.217009e-08*x*x*x*x ;
2041     v2s =-7.787317e-02+3.843455e-03*x-1.221144e-04*x*x+1.478448e-06*x*x*x-7.442702e-09*x*x*x*x ;
2042   }
2043 */  
2044   
2045   return phi+v2c*TMath::Sin(2.*phi)-v2s*TMath::Cos(2.*phi) ;
2046
2047 }
2048 //____________________________________________________________________________
2049 Double_t  AliAnalysisTaskPi0Flow::ApplyFlatteningV0C(Double_t phi, Double_t c){
2050   //LHC10h
2051   
2052   Double_t v2c =0.;
2053   Double_t v2s =0;  
2054
2055 if(fRunNumber==1){
2056   v2c=-0.038901 + (0.00539521)*c + (-0.000213271)*c*c + (3.01147e-06)*c*c*c + (-1.35977e-08)*c*c*c*c ;
2057   v2s=0.0693294 + (-0.00851319)*c + (0.000337408)*c*c + (-5.33097e-06)*c*c*c + (2.90883e-08)*c*c*c*c ;
2058 }
2059 if(fRunNumber==2){
2060   v2c=-0.0943695 + (0.0137829)*c + (-0.000569334)*c*c + (8.95522e-06)*c*c*c + (-4.78396e-08)*c*c*c*c ;
2061   v2s=0.00971525 + (-0.00181026)*c + (6.15798e-05)*c*c + (-8.51046e-07)*c*c*c + (4.57403e-09)*c*c*c*c ;
2062 }
2063 if(fRunNumber==4){
2064   v2c=-0.00585475 + (0.000307793)*c + (1.89109e-06)*c*c + (-3.14804e-07)*c*c*c + (3.54341e-09)*c*c*c*c ;
2065   v2s=0.00374568 + (-0.00123435)*c + (8.01941e-05)*c*c + (-1.70807e-06)*c*c*c + (1.14576e-08)*c*c*c*c ;
2066 }
2067 if(fRunNumber==5){
2068   v2c=-0.0301267 + (0.00206698)*c + (-4.82282e-05)*c*c + (4.39355e-07)*c*c*c + (-1.3747e-09)*c*c*c*c ;
2069   v2s=-0.0441947 + (0.00501774)*c + (-0.000181736)*c*c + (2.69235e-06)*c*c*c + (-1.37411e-08)*c*c*c*c ;
2070 }
2071 if(fRunNumber==6){
2072   v2c=0.190652 + (-0.0254912)*c + (0.00105707)*c*c + (-1.63872e-05)*c*c*c + (8.51113e-08)*c*c*c*c ;
2073   v2s=0.0803124 + (-0.0119724)*c + (0.000575997)*c*c + (-1.07892e-05)*c*c*c + (6.67214e-08)*c*c*c*c ;
2074 }
2075 if(fRunNumber==7){
2076   v2c=0.00875044 + (-0.00343147)*c + (0.0002198)*c*c + (-4.76292e-06)*c*c*c + (3.24844e-08)*c*c*c*c ;
2077   v2s=-0.081288 + (0.0146429)*c + (-0.000728327)*c*c + (1.32462e-05)*c*c*c + (-7.95362e-08)*c*c*c*c ;
2078 }
2079 if(fRunNumber==8){
2080   v2c=0.0381367 + (-0.0082048)*c + (0.000410914)*c*c + (-7.28851e-06)*c*c*c + (4.22008e-08)*c*c*c*c ;
2081   v2s=-0.023338 + (0.003381)*c + (-0.000167791)*c*c + (3.13998e-06)*c*c*c + (-1.97233e-08)*c*c*c*c ;
2082 }
2083 if(fRunNumber==9){
2084   v2c=-0.00734261 + (0.00121272)*c + (-5.31181e-05)*c*c + (7.88974e-07)*c*c*c + (-3.86356e-09)*c*c*c*c ;
2085   v2s=-0.0228333 + (0.00266052)*c + (-0.000112824)*c*c + (1.89515e-06)*c*c*c + (-1.07446e-08)*c*c*c*c ;
2086 }
2087 if(fRunNumber==10){
2088   v2c=-0.0456385 + (0.0102956)*c + (-0.000529689)*c*c + (9.62809e-06)*c*c*c + (-5.7301e-08)*c*c*c*c ;
2089   v2s=0.0142197 + (-0.0031677)*c + (0.000190389)*c*c + (-4.10911e-06)*c*c*c + (2.81791e-08)*c*c*c*c ;
2090 }
2091 if(fRunNumber==11){
2092   v2c=-0.00999249 + (0.00123939)*c + (-4.23895e-05)*c*c + (6.55415e-07)*c*c*c + (-3.98256e-09)*c*c*c*c ;
2093   v2s=-0.00809817 + (0.00199727)*c + (-0.000116718)*c*c + (2.33449e-06)*c*c*c + (-1.46407e-08)*c*c*c*c ;
2094 }
2095 if(fRunNumber==12){
2096   v2c=0.0183566 + (-0.0020805)*c + (6.79726e-05)*c*c + (-7.96708e-07)*c*c*c + (3.1214e-09)*c*c*c*c ;
2097   v2s=-0.00714715 + (0.000721418)*c + (-3.50355e-05)*c*c + (9.09996e-07)*c*c*c + (-7.92198e-09)*c*c*c*c ;
2098 }
2099 if(fRunNumber==13){
2100   v2c=0.0056915 + (0.000167211)*c + (-4.68018e-05)*c*c + (1.21891e-06)*c*c*c + (-8.70124e-09)*c*c*c*c ;
2101   v2s=0.00986223 + (-0.00247957)*c + (0.000133539)*c*c + (-2.51362e-06)*c*c*c + (1.5397e-08)*c*c*c*c ;
2102 }
2103 if(fRunNumber==14){
2104   v2c=0.0479623 + (-0.00948196)*c + (0.000551795)*c*c + (-1.05692e-05)*c*c*c + (6.38754e-08)*c*c*c*c ;
2105   v2s=-0.00438456 + (-0.00152976)*c + (2.00645e-05)*c*c + (9.91017e-07)*c*c*c + (-1.35776e-08)*c*c*c*c ;
2106 }
2107 if(fRunNumber==15){
2108   v2c=-0.00384088 + (0.00121719)*c + (-6.88665e-05)*c*c + (1.26138e-06)*c*c*c + (-7.13987e-09)*c*c*c*c ;
2109   v2s=0.0273017 + (-0.00314818)*c + (7.85031e-05)*c*c + (-9.07336e-08)*c*c*c + (-6.42421e-09)*c*c*c*c ;
2110 }
2111 if(fRunNumber==16){
2112   v2c=-0.0313175 + (0.00368025)*c + (-0.000126895)*c*c + (1.7443e-06)*c*c*c + (-9.12442e-09)*c*c*c*c ;
2113   v2s=-0.0812178 + (0.0117402)*c + (-0.000506287)*c*c + (8.36766e-06)*c*c*c + (-4.69866e-08)*c*c*c*c ;
2114 }
2115 if(fRunNumber==17){
2116   v2c=0.062893 + (-0.0128204)*c + (0.000591931)*c*c + (-1.00835e-05)*c*c*c + (5.72782e-08)*c*c*c*c ;
2117   v2s=-0.143105 + (0.0183921)*c + (-0.000787289)*c*c + (1.33237e-05)*c*c*c + (-7.71707e-08)*c*c*c*c ;
2118 }
2119 if(fRunNumber==18){
2120   v2c=-0.0029353 + (-0.0016097)*c + (0.000199618)*c*c + (-5.42008e-06)*c*c*c + (4.08897e-08)*c*c*c*c ;
2121   v2s=0.0482015 + (-0.00115233)*c + (3.96019e-05)*c*c + (-7.7193e-07)*c*c*c + (3.90004e-09)*c*c*c*c ;
2122 }
2123 if(fRunNumber==19){
2124   v2c=-0.0397728 + (0.0129154)*c + (-0.000703903)*c*c + (1.30972e-05)*c*c*c + (-7.93547e-08)*c*c*c*c ;
2125   v2s=0.181945 + (-0.0289807)*c + (0.00133685)*c*c + (-2.30866e-05)*c*c*c + (1.32746e-07)*c*c*c*c ;
2126 }
2127 if(fRunNumber==20){
2128   v2c=-0.00927858 + (0.0021033)*c + (-0.000113971)*c*c + (2.17508e-06)*c*c*c + (-1.36812e-08)*c*c*c*c ;
2129   v2s=0.0201645 + (-0.00331311)*c + (0.000164916)*c*c + (-3.08376e-06)*c*c*c + (1.92565e-08)*c*c*c*c ;
2130 }
2131 if(fRunNumber==21){
2132   v2c=-0.0254895 + (0.00388685)*c + (-0.000171429)*c*c + (2.87209e-06)*c*c*c + (-1.60625e-08)*c*c*c*c ;
2133   v2s=0.00237609 + (0.000664255)*c + (-4.93436e-05)*c*c + (8.86415e-07)*c*c*c + (-4.51913e-09)*c*c*c*c ;
2134 }
2135 if(fRunNumber==22){
2136   v2c=0.0308671 + (-0.00365824)*c + (0.000148483)*c*c + (-2.52946e-06)*c*c*c + (1.49859e-08)*c*c*c*c ;
2137   v2s=-0.00805023 + (0.00154452)*c + (-6.89678e-05)*c*c + (1.14317e-06)*c*c*c + (-5.98991e-09)*c*c*c*c ;
2138 }
2139 if(fRunNumber==23){
2140   v2c=0.122018 + (-0.0233973)*c + (0.00116385)*c*c + (-2.11232e-05)*c*c*c + (1.25836e-07)*c*c*c*c ;
2141   v2s=-0.0511879 + (0.00708815)*c + (-0.000227282)*c*c + (2.27542e-06)*c*c*c + (-4.83128e-09)*c*c*c*c ;
2142 }
2143 if(fRunNumber==24){
2144   v2c=0.00888562 + (-0.000839847)*c + (2.52839e-05)*c*c + (-2.28921e-07)*c*c*c + (1.01057e-11)*c*c*c*c ;
2145   v2s=0.00814357 + (-0.000788997)*c + (2.43948e-05)*c*c + (-2.99558e-07)*c*c*c + (1.21675e-09)*c*c*c*c ;
2146 }
2147 if(fRunNumber==25){
2148   v2c=0.00360833 + (0.000379977)*c + (-3.68193e-05)*c*c + (5.86861e-07)*c*c*c + (-2.01826e-09)*c*c*c*c ;
2149   v2s=-0.00642047 + (0.00060076)*c + (-2.42907e-05)*c*c + (4.12933e-07)*c*c*c + (-2.3557e-09)*c*c*c*c ;
2150 }
2151 if(fRunNumber==26){
2152   v2c=-0.0131971 + (0.00189761)*c + (-7.7551e-05)*c*c + (1.25884e-06)*c*c*c + (-7.38989e-09)*c*c*c*c ;
2153   v2s=0.00679891 + (-0.000614692)*c + (1.04559e-06)*c*c + (4.34463e-07)*c*c*c + (-4.75821e-09)*c*c*c*c ;
2154 }
2155 if(fRunNumber==27){
2156   v2c=-0.00887089 + (0.00126865)*c + (-7.15766e-05)*c*c + (1.43811e-06)*c*c*c + (-9.408e-09)*c*c*c*c ;
2157   v2s=-0.0302105 + (0.00349565)*c + (-0.000126108)*c*c + (1.835e-06)*c*c*c + (-9.27845e-09)*c*c*c*c ;
2158 }
2159 if(fRunNumber==28){
2160   v2c=-0.0187616 + (0.0021974)*c + (-5.11412e-05)*c*c + (2.94628e-07)*c*c*c + (7.4194e-10)*c*c*c*c ;
2161   v2s=-0.0119204 + (-0.00156879)*c + (0.000132746)*c*c + (-2.67371e-06)*c*c*c + (1.61097e-08)*c*c*c*c ;
2162 }
2163 if(fRunNumber==29){
2164   v2c=-0.121018 + (0.0228924)*c + (-0.00127093)*c*c + (2.48724e-05)*c*c*c + (-1.56121e-07)*c*c*c*c ;
2165   v2s=-0.0687197 + (0.015702)*c + (-0.000764074)*c*c + (1.38991e-05)*c*c*c + (-8.48812e-08)*c*c*c*c ;
2166 }
2167 if(fRunNumber==30){
2168   v2c=0.01582 + (-0.0012293)*c + (1.62768e-05)*c*c + (2.36172e-07)*c*c*c + (-3.67153e-09)*c*c*c*c ;
2169   v2s=-0.00875651 + (0.00135376)*c + (-5.16763e-05)*c*c + (6.17614e-07)*c*c*c + (-1.64099e-09)*c*c*c*c ;
2170 }
2171 if(fRunNumber==31){
2172   v2c=-0.044721 + (0.00756113)*c + (-0.000365759)*c*c + (6.15804e-06)*c*c*c + (-3.40075e-08)*c*c*c*c ;
2173   v2s=-0.0500828 + (-0.000695112)*c + (0.000130909)*c*c + (-3.38476e-06)*c*c*c + (2.41179e-08)*c*c*c*c ;
2174 }
2175 if(fRunNumber==32){
2176   v2c=0.0306236 + (-0.00443307)*c + (0.000196517)*c*c + (-3.48059e-06)*c*c*c + (2.10266e-08)*c*c*c*c ;
2177   v2s=0.00819214 + (-0.000560558)*c + (-5.03783e-06)*c*c + (4.37862e-07)*c*c*c + (-3.93834e-09)*c*c*c*c ;
2178 }
2179 if(fRunNumber==33){
2180   v2c=0.0120077 + (-0.00139976)*c + (5.85677e-05)*c*c + (-9.06209e-07)*c*c*c + (4.61403e-09)*c*c*c*c ;
2181   v2s=-0.0197677 + (0.00253589)*c + (-0.000101374)*c*c + (1.59347e-06)*c*c*c + (-8.65961e-09)*c*c*c*c ;
2182 }
2183 if(fRunNumber==34){
2184   v2c=0.0759546 + (-0.0131538)*c + (0.000577001)*c*c + (-9.39636e-06)*c*c*c + (5.16814e-08)*c*c*c*c ;
2185   v2s=-0.0727864 + (0.00956655)*c + (-0.000406191)*c*c + (7.50453e-06)*c*c*c + (-4.93819e-08)*c*c*c*c ;
2186 }
2187 if(fRunNumber==35){
2188   v2c=-0.00622564 + (0.00107647)*c + (-6.25644e-05)*c*c + (1.28553e-06)*c*c*c + (-8.46286e-09)*c*c*c*c ;
2189   v2s=0.0051704 + (-0.00165348)*c + (8.69531e-05)*c*c + (-1.69895e-06)*c*c*c + (1.09762e-08)*c*c*c*c ;
2190 }
2191 if(fRunNumber==36){
2192   v2c=0.0117872 + (-0.000807391)*c + (-1.70999e-05)*c*c + (1.19089e-06)*c*c*c + (-1.13278e-08)*c*c*c*c ;
2193   v2s=-0.000162495 + (1.04465e-05)*c + (-1.07156e-05)*c*c + (2.54308e-07)*c*c*c + (-7.04948e-10)*c*c*c*c ;
2194 }
2195 if(fRunNumber==37){
2196   v2c=-0.0119236 + (0.00290105)*c + (-0.000162086)*c*c + (3.22645e-06)*c*c*c + (-2.07075e-08)*c*c*c*c ;
2197   v2s=-0.0178535 + (0.00283024)*c + (-0.00012812)*c*c + (2.02404e-06)*c*c*c + (-1.0248e-08)*c*c*c*c ;
2198 }
2199 if(fRunNumber==38){
2200   v2c=0.023002 + (-0.00433112)*c + (0.000229879)*c*c + (-4.52792e-06)*c*c*c + (2.92715e-08)*c*c*c*c ;
2201   v2s=-0.0217933 + (0.00235291)*c + (-0.000108054)*c*c + (2.08937e-06)*c*c*c + (-1.3524e-08)*c*c*c*c ;
2202 }
2203 if(fRunNumber==39){
2204   v2c=0.00795585 + (-0.000372683)*c + (1.85243e-05)*c*c + (-4.28133e-07)*c*c*c + (3.02452e-09)*c*c*c*c ;
2205   v2s=-0.0849826 + (0.00529466)*c + (-0.000163148)*c*c + (2.1186e-06)*c*c*c + (-9.48208e-09)*c*c*c*c ;
2206 }
2207 if(fRunNumber==40){
2208   v2c=0.00653019 + (-0.00127651)*c + (7.59264e-05)*c*c + (-1.6363e-06)*c*c*c + (1.11375e-08)*c*c*c*c ;
2209   v2s=-0.0107686 + (0.000982587)*c + (-2.97061e-05)*c*c + (4.04795e-07)*c*c*c + (-1.91289e-09)*c*c*c*c ;
2210 }
2211 if(fRunNumber==41){
2212   v2c=0.012007 + (-0.00102703)*c + (3.48714e-05)*c*c + (-5.13011e-07)*c*c*c + (2.57827e-09)*c*c*c*c ;
2213   v2s=-0.00713083 + (0.00101952)*c + (-4.7675e-05)*c*c + (9.12723e-07)*c*c*c + (-5.99694e-09)*c*c*c*c ;
2214 }
2215 if(fRunNumber==42){
2216   v2c=-0.0486696 + (0.00723345)*c + (-0.000324232)*c*c + (5.25317e-06)*c*c*c + (-2.78981e-08)*c*c*c*c ;
2217   v2s=-0.0485877 + (-0.00064506)*c + (9.15858e-05)*c*c + (-1.97486e-06)*c*c*c + (1.28831e-08)*c*c*c*c ;
2218 }
2219 if(fRunNumber==43){
2220   v2c=0.0003541 + (-0.000236832)*c + (1.82448e-05)*c*c + (-4.20764e-07)*c*c*c + (2.96882e-09)*c*c*c*c ;
2221   v2s=0.00107616 + (-0.000462058)*c + (2.46761e-05)*c*c + (-4.33199e-07)*c*c*c + (2.47324e-09)*c*c*c*c ;
2222 }
2223 if(fRunNumber==44){
2224   v2c=-0.0778259 + (0.0128797)*c + (-0.000514371)*c*c + (7.70095e-06)*c*c*c + (-3.89026e-08)*c*c*c*c ;
2225   v2s=-0.106839 + (0.00670369)*c + (-0.000184721)*c*c + (1.64581e-06)*c*c*c + (-1.47049e-09)*c*c*c*c ;
2226 }
2227 if(fRunNumber==45){
2228   v2c=0.0513049 + (-0.00715356)*c + (0.000289106)*c*c + (-4.46938e-06)*c*c*c + (2.36599e-08)*c*c*c*c ;
2229   v2s=-0.0252464 + (0.00170124)*c + (-3.04376e-05)*c*c + (9.4935e-08)*c*c*c + (9.41807e-10)*c*c*c*c ;
2230 }
2231 if(fRunNumber==46){
2232   v2c=0.0317697 + (-0.00121243)*c + (5.94543e-05)*c*c + (-1.26341e-06)*c*c*c + (8.49329e-09)*c*c*c*c ;
2233   v2s=-0.092276 + (0.00299941)*c + (-5.24713e-05)*c*c + (3.07331e-07)*c*c*c + (7.44139e-10)*c*c*c*c ;
2234 }
2235 if(fRunNumber==47){
2236   v2c=0.0429796 + (-0.000861588)*c + (6.82123e-07)*c*c + (1.96388e-07)*c*c*c + (-1.56984e-09)*c*c*c*c ;
2237   v2s=-0.133047 + (0.00853153)*c + (-0.000287983)*c*c + (4.1155e-06)*c*c*c + (-2.00239e-08)*c*c*c*c ;
2238 }
2239 if(fRunNumber==48){
2240   v2c=0.0480979 + (-0.000354969)*c + (-6.45176e-05)*c*c + (2.34807e-06)*c*c*c + (-1.9069e-08)*c*c*c*c ;
2241   v2s=-0.138315 + (0.0126874)*c + (-0.000672052)*c*c + (1.34449e-05)*c*c*c + (-8.64756e-08)*c*c*c*c ;
2242 }
2243 if(fRunNumber==51){
2244   v2c=-0.0114422 + (0.00506157)*c + (-0.000227041)*c*c + (3.97457e-06)*c*c*c + (-2.35322e-08)*c*c*c*c ;
2245   v2s=-0.208135 + (0.0160488)*c + (-0.000536132)*c*c + (7.2714e-06)*c*c*c + (-3.28328e-08)*c*c*c*c ;
2246 }
2247 if(fRunNumber==52){
2248   v2c=0.00113321 + (0.000922798)*c + (-6.5971e-05)*c*c + (1.40416e-06)*c*c*c + (-9.29905e-09)*c*c*c*c ;
2249   v2s=0.0550392 + (-0.00725661)*c + (0.000298984)*c*c + (-4.85473e-06)*c*c*c + (2.72063e-08)*c*c*c*c ;
2250 }
2251 if(fRunNumber==53){
2252   v2c=-0.003508 + (6.54451e-06)*c + (1.28603e-05)*c*c + (-3.83674e-07)*c*c*c + (3.1053e-09)*c*c*c*c ;
2253   v2s=0.00714978 + (-0.00198147)*c + (0.000113909)*c*c + (-2.1949e-06)*c*c*c + (1.34933e-08)*c*c*c*c ;
2254 }
2255 if(fRunNumber==54){
2256   v2c=-0.0024598 + (5.87979e-05)*c + (9.36516e-06)*c*c + (-2.66045e-07)*c*c*c + (1.80016e-09)*c*c*c*c ;
2257   v2s=-0.00651135 + (0.00109883)*c + (-4.41501e-05)*c*c + (6.19398e-07)*c*c*c + (-2.61977e-09)*c*c*c*c ;
2258 }
2259 if(fRunNumber==55){
2260   v2c=0.0472936 + (-0.00156718)*c + (3.03713e-05)*c*c + (-1.97139e-07)*c*c*c + (-3.55205e-10)*c*c*c*c ;
2261   v2s=-0.155014 + (0.00717506)*c + (-0.000168137)*c*c + (1.55419e-06)*c*c*c + (-3.64579e-09)*c*c*c*c ;
2262 }
2263 if(fRunNumber==56){
2264   v2c=0.011328 + (0.000924574)*c + (-6.803e-05)*c*c + (9.76956e-07)*c*c*c + (-2.90494e-09)*c*c*c*c ;
2265   v2s=-0.0412661 + (0.0107218)*c + (-0.000533108)*c*c + (9.75563e-06)*c*c*c + (-5.95608e-08)*c*c*c*c ;
2266 }
2267 if(fRunNumber==57){
2268   v2c=0.00900452 + (0.000588343)*c + (-3.02208e-05)*c*c + (2.13239e-07)*c*c*c + (9.25727e-10)*c*c*c*c ;
2269   v2s=0.13086 + (-0.0204768)*c + (0.000928956)*c*c + (-1.63917e-05)*c*c*c + (9.8273e-08)*c*c*c*c ;
2270 }
2271 if(fRunNumber==58){
2272   v2c=-0.0143951 + (0.00247373)*c + (-0.000107909)*c*c + (1.69603e-06)*c*c*c + (-9.05555e-09)*c*c*c*c ;
2273   v2s=-0.0209397 + (0.00180446)*c + (-5.97034e-05)*c*c + (8.17388e-07)*c*c*c + (-3.77989e-09)*c*c*c*c ;
2274 }
2275 if(fRunNumber==59){
2276   v2c=-0.0619279 + (0.00393575)*c + (-0.00011867)*c*c + (1.45001e-06)*c*c*c + (-5.98792e-09)*c*c*c*c ;
2277   v2s=-0.248103 + (0.0158553)*c + (-0.000529631)*c*c + (7.46158e-06)*c*c*c + (-3.60091e-08)*c*c*c*c ;
2278 }
2279 if(fRunNumber==60){
2280   v2c=-0.00886115 + (0.00152741)*c + (-6.94062e-05)*c*c + (1.11727e-06)*c*c*c + (-5.81351e-09)*c*c*c*c ;
2281   v2s=-0.000911417 + (0.000122344)*c + (-1.24605e-06)*c*c + (-6.29249e-08)*c*c*c + (8.81971e-10)*c*c*c*c ;
2282 }
2283 if(fRunNumber==61){
2284   v2c=-0.00510166 + (0.00040596)*c + (-4.37341e-06)*c*c + (-1.15302e-07)*c*c*c + (1.53428e-09)*c*c*c*c ;
2285   v2s=-0.0170123 + (0.00220818)*c + (-9.50905e-05)*c*c + (1.59566e-06)*c*c*c + (-8.92053e-09)*c*c*c*c ;
2286 }
2287 if(fRunNumber==62){
2288   v2c=-0.00332885 + (-0.000430498)*c + (5.60341e-05)*c*c + (-1.47922e-06)*c*c*c + (1.09723e-08)*c*c*c*c ;
2289   v2s=-0.0519534 + (0.00892818)*c + (-0.000434243)*c*c + (7.8407e-06)*c*c*c + (-4.69363e-08)*c*c*c*c ;
2290 }
2291 if(fRunNumber==63){
2292   v2c=-0.00176529 + (0.00123097)*c + (-6.59677e-05)*c*c + (1.24591e-06)*c*c*c + (-7.90285e-09)*c*c*c*c ;
2293   v2s=-0.0181792 + (0.00222004)*c + (-7.96902e-05)*c*c + (1.13047e-06)*c*c*c + (-5.72272e-09)*c*c*c*c ;
2294 }
2295 if(fRunNumber==64){
2296   v2c=0.00546184 + (-0.000449463)*c + (1.50833e-05)*c*c + (-1.72501e-07)*c*c*c + (3.58774e-10)*c*c*c*c ;
2297   v2s=0.013284 + (-0.00260671)*c + (0.000134403)*c*c + (-2.461e-06)*c*c*c + (1.47694e-08)*c*c*c*c ;
2298 }
2299 if(fRunNumber==65){
2300   v2c=0.0108447 + (-0.0017699)*c + (4.62716e-05)*c*c + (-3.4647e-07)*c*c*c + (5.24536e-10)*c*c*c*c ;
2301   v2s=0.0302247 + (-0.00605136)*c + (0.000290676)*c*c + (-4.87706e-06)*c*c*c + (2.65104e-08)*c*c*c*c ;
2302 }
2303 if(fRunNumber==66){
2304   v2c=-0.0100092 + (0.00144457)*c + (-6.512e-05)*c*c + (1.05356e-06)*c*c*c + (-5.52231e-09)*c*c*c*c ;
2305   v2s=-0.00380228 + (0.000610003)*c + (-3.47943e-05)*c*c + (7.21188e-07)*c*c*c + (-4.76727e-09)*c*c*c*c ;
2306 }
2307 if(fRunNumber==67){
2308   v2c=-0.0229901 + (0.00400737)*c + (-0.000206024)*c*c + (3.93038e-06)*c*c*c + (-2.46388e-08)*c*c*c*c ;
2309   v2s=-0.00286041 + (0.000648607)*c + (-2.37397e-05)*c*c + (2.0372e-07)*c*c*c + (2.97679e-10)*c*c*c*c ;
2310 }
2311 if(fRunNumber==68){
2312   v2c=-0.0603647 + (0.0045685)*c + (-0.000171555)*c*c + (2.66377e-06)*c*c*c + (-1.45892e-08)*c*c*c*c ;
2313   v2s=-0.21447 + (0.00909524)*c + (-0.000265298)*c*c + (3.73262e-06)*c*c*c + (-1.84484e-08)*c*c*c*c ;
2314 }
2315 if(fRunNumber==69){
2316   v2c=-0.0207879 + (0.000139613)*c + (1.27802e-05)*c*c + (-6.40328e-07)*c*c*c + (6.35949e-09)*c*c*c*c ;
2317   v2s=-0.266459 + (0.0156802)*c + (-0.000481647)*c*c + (6.4597e-06)*c*c*c + (-3.047e-08)*c*c*c*c ;
2318 }
2319 if(fRunNumber==70){
2320   v2c=-0.0324843 + (0.00376852)*c + (-0.000136873)*c*c + (2.01389e-06)*c*c*c + (-1.03877e-08)*c*c*c*c ;
2321   v2s=-0.0178378 + (0.00145491)*c + (-3.55421e-05)*c*c + (2.25993e-07)*c*c*c + (7.06258e-10)*c*c*c*c ;
2322 }
2323 if(fRunNumber==71){
2324   v2c=-0.0138645 + (0.00167315)*c + (-6.68544e-05)*c*c + (1.07133e-06)*c*c*c + (-5.92659e-09)*c*c*c*c ;
2325   v2s=0.0359716 + (-0.00461076)*c + (0.000192868)*c*c + (-3.21409e-06)*c*c*c + (1.84468e-08)*c*c*c*c ;
2326 }
2327 if(fRunNumber==72){
2328   v2c=0.0111712 + (-0.00175546)*c + (6.87862e-05)*c*c + (-8.99029e-07)*c*c*c + (3.44492e-09)*c*c*c*c ;
2329   v2s=-0.00352823 + (0.000480673)*c + (-2.66091e-05)*c*c + (5.54922e-07)*c*c*c + (-3.84534e-09)*c*c*c*c ;
2330 }
2331 if(fRunNumber==73){
2332   v2c=-0.000939145 + (-0.000235945)*c + (2.51908e-05)*c*c + (-6.52435e-07)*c*c*c + (4.8218e-09)*c*c*c*c ;
2333   v2s=0.00666852 + (-0.000373105)*c + (-1.22838e-05)*c*c + (7.3621e-07)*c*c*c + (-7.2867e-09)*c*c*c*c ;
2334 }
2335 if(fRunNumber==74){
2336   v2c=0.0474235 + (-0.00890967)*c + (0.000427741)*c*c + (-7.38723e-06)*c*c*c + (4.17242e-08)*c*c*c*c ;
2337   v2s=0.0142517 + (-0.00326338)*c + (0.000142729)*c*c + (-2.27831e-06)*c*c*c + (1.14084e-08)*c*c*c*c ;
2338 }
2339 if(fRunNumber==75){
2340   v2c=0.0237808 + (-0.00310491)*c + (0.000134288)*c*c + (-2.27429e-06)*c*c*c + (1.32749e-08)*c*c*c*c ;
2341   v2s=-0.0258905 + (0.00417719)*c + (-0.000193901)*c*c + (3.41383e-06)*c*c*c + (-2.01695e-08)*c*c*c*c ;
2342 }
2343 if(fRunNumber==76){
2344   v2c=0.0149865 + (-0.00140739)*c + (4.24537e-05)*c*c + (-4.06273e-07)*c*c*c + (5.44496e-10)*c*c*c*c ;
2345   v2s=0.00820134 + (-0.000519432)*c + (6.82211e-06)*c*c + (1.06291e-07)*c*c*c + (-1.65344e-09)*c*c*c*c ;
2346 }
2347 if(fRunNumber==77){
2348   v2c=0.048123 + (-0.00608197)*c + (0.000246409)*c*c + (-4.05028e-06)*c*c*c + (2.33536e-08)*c*c*c*c ;
2349   v2s=-0.0214729 + (0.0029389)*c + (-0.000133826)*c*c + (2.29845e-06)*c*c*c + (-1.29253e-08)*c*c*c*c ;
2350 }
2351 if(fRunNumber==78){
2352   v2c=-0.0172924 + (0.00202216)*c + (-6.478e-05)*c*c + (8.08739e-07)*c*c*c + (-3.73211e-09)*c*c*c*c ;
2353   v2s=-0.0355638 + (0.00121518)*c + (3.97839e-05)*c*c + (-1.62346e-06)*c*c*c + (1.27105e-08)*c*c*c*c ;
2354 }
2355 if(fRunNumber==79){
2356   v2c=0.040762 + (-0.00311921)*c + (6.66868e-05)*c*c + (-1.18554e-06)*c*c*c + (1.07519e-08)*c*c*c*c ;
2357   v2s=-0.00558438 + (-0.00154821)*c + (0.000165732)*c*c + (-4.56377e-06)*c*c*c + (3.56988e-08)*c*c*c*c ;
2358 }
2359 if(fRunNumber==81){
2360   v2c=-0.0247995 + (0.00179444)*c + (-0.000102085)*c*c + (2.31093e-06)*c*c*c + (-1.61924e-08)*c*c*c*c ;
2361   v2s=-0.249009 + (0.0133297)*c + (-0.000415717)*c*c + (5.84494e-06)*c*c*c + (-2.88179e-08)*c*c*c*c ;
2362 }
2363 if(fRunNumber==82){
2364   v2c=-0.0249921 + (0.00199208)*c + (-7.86121e-05)*c*c + (1.40547e-06)*c*c*c + (-9.39651e-09)*c*c*c*c ;
2365   v2s=-0.254469 + (0.0150694)*c + (-0.000499848)*c*c + (7.08318e-06)*c*c*c + (-3.40806e-08)*c*c*c*c ;
2366 }
2367 if(fRunNumber==83){
2368   v2c=-0.0721 + (0.00951559)*c + (-0.000431762)*c*c + (8.4632e-06)*c*c*c + (-5.79485e-08)*c*c*c*c ;
2369   v2s=-0.00864625 + (-0.00706196)*c + (0.000313773)*c*c + (-5.10066e-06)*c*c*c + (2.9662e-08)*c*c*c*c ;
2370 }
2371 if(fRunNumber==84){
2372   v2c=-0.0198112 + (-0.0062788)*c + (0.000353589)*c*c + (-5.70525e-06)*c*c*c + (2.82617e-08)*c*c*c*c ;
2373   v2s=-0.0704647 + (0.0031015)*c + (-0.000244985)*c*c + (6.17258e-06)*c*c*c + (-4.43331e-08)*c*c*c*c ;
2374 }
2375 if(fRunNumber==85){
2376   v2c=-0.0161955 + (-0.0017361)*c + (0.000130612)*c*c + (-2.9548e-06)*c*c*c + (2.05684e-08)*c*c*c*c ;
2377   v2s=-0.204119 + (0.00714989)*c + (-0.000162549)*c*c + (1.87459e-06)*c*c*c + (-7.79143e-09)*c*c*c*c ;
2378 }
2379 if(fRunNumber==86){
2380   v2c=0.00995155 + (-0.00196822)*c + (0.00010617)*c*c + (-2.01071e-06)*c*c*c + (1.22728e-08)*c*c*c*c ;
2381   v2s=0.0148901 + (-0.002581)*c + (0.000132002)*c*c + (-2.44601e-06)*c*c*c + (1.48144e-08)*c*c*c*c ;
2382 }
2383 if(fRunNumber==87){
2384   v2c=-0.00411031 + (0.000510639)*c + (-2.27814e-05)*c*c + (6.41192e-07)*c*c*c + (-5.85467e-09)*c*c*c*c ;
2385   v2s=0.0121118 + (-0.00281)*c + (0.000143754)*c*c + (-2.62557e-06)*c*c*c + (1.61207e-08)*c*c*c*c ;
2386 }
2387 if(fRunNumber==88){
2388   v2c=-0.00570308 + (-0.000945116)*c + (7.42606e-05)*c*c + (-1.51212e-06)*c*c*c + (9.57993e-09)*c*c*c*c ;
2389   v2s=-0.0282666 + (0.00398475)*c + (-0.000165678)*c*c + (2.68542e-06)*c*c*c + (-1.4688e-08)*c*c*c*c ;
2390 }
2391 if(fRunNumber==89){
2392   v2c=0.0845785 + (-0.012611)*c + (0.000561197)*c*c + (-9.39333e-06)*c*c*c + (5.16139e-08)*c*c*c*c ;
2393   v2s=0.149689 + (-0.0193648)*c + (0.000771629)*c*c + (-1.21901e-05)*c*c*c + (6.6443e-08)*c*c*c*c ;
2394 }
2395 if(fRunNumber==91){
2396   v2c=-0.0289605 + (0.00127922)*c + (-4.47445e-06)*c*c + (-4.00293e-07)*c*c*c + (3.82966e-09)*c*c*c*c ;
2397   v2s=-0.241098 + (0.00906132)*c + (-0.000159552)*c*c + (6.47243e-07)*c*c*c + (4.61048e-09)*c*c*c*c ;
2398 }
2399 if(fRunNumber==95){
2400   v2c=0.0144072 + (-0.000966056)*c + (6.47254e-05)*c*c + (-1.84164e-06)*c*c*c + (1.51588e-08)*c*c*c*c ;
2401   v2s=-0.306678 + (0.0184746)*c + (-0.000540218)*c*c + (6.36681e-06)*c*c*c + (-2.37512e-08)*c*c*c*c ;
2402 }
2403 if(fRunNumber==96){
2404   v2c=0.00506182 + (-0.000632672)*c + (1.89752e-05)*c*c + (-2.14999e-07)*c*c*c + (3.12179e-10)*c*c*c*c ;
2405   v2s=-0.218693 + (0.00676786)*c + (-0.000115485)*c*c + (5.56737e-07)*c*c*c + (2.68891e-09)*c*c*c*c ;
2406 }
2407 if(fRunNumber==97){
2408   v2c=-0.0225062 + (0.00204445)*c + (-6.76028e-05)*c*c + (8.92976e-07)*c*c*c + (-4.00576e-09)*c*c*c*c ;
2409   v2s=-0.260286 + (0.0139325)*c + (-0.000425631)*c*c + (5.64038e-06)*c*c*c + (-2.51554e-08)*c*c*c*c ;
2410 }
2411 if(fRunNumber==98){
2412   v2c=-0.0261849 + (0.0063862)*c + (-0.000293076)*c*c + (4.37234e-06)*c*c*c + (-2.04899e-08)*c*c*c*c ;
2413   v2s=-0.17744 + (0.00236157)*c + (9.2782e-06)*c*c + (-5.63126e-07)*c*c*c + (4.9714e-09)*c*c*c*c ;
2414 }
2415 if(fRunNumber==101){
2416   v2c=0.101445 + (-0.015664)*c + (0.000747255)*c*c + (-1.36979e-05)*c*c*c + (8.36903e-08)*c*c*c*c ;
2417   v2s=0.0152975 + (-0.00329946)*c + (0.00018627)*c*c + (-3.88572e-06)*c*c*c + (2.64895e-08)*c*c*c*c ;
2418 }
2419 if(fRunNumber==102){
2420   v2c=-0.0344927 + (0.00470964)*c + (-0.000188941)*c*c + (3.0206e-06)*c*c*c + (-1.69735e-08)*c*c*c*c ;
2421   v2s=0.0142624 + (-0.00240623)*c + (9.16657e-05)*c*c + (-1.14663e-06)*c*c*c + (4.14195e-09)*c*c*c*c ;
2422 }
2423 if(fRunNumber==103){
2424   v2c=-0.0238316 + (0.00322675)*c + (-0.000123462)*c*c + (1.76428e-06)*c*c*c + (-8.66176e-09)*c*c*c*c ;
2425   v2s=0.0227184 + (-0.00299954)*c + (0.00014422)*c*c + (-2.81018e-06)*c*c*c + (1.82546e-08)*c*c*c*c ;
2426 }
2427 if(fRunNumber==104){
2428   v2c=0.0118014 + (-0.000998833)*c + (3.77271e-05)*c*c + (-6.19183e-07)*c*c*c + (3.49065e-09)*c*c*c*c ;
2429   v2s=0.000977264 + (0.00012542)*c + (1.40219e-08)*c*c + (-2.24472e-09)*c*c*c + (-3.39763e-10)*c*c*c*c ;
2430 }
2431 if(fRunNumber==105){
2432   v2c=0.0312332 + (-0.00348485)*c + (0.000108654)*c*c + (-1.28443e-06)*c*c*c + (4.80188e-09)*c*c*c*c ;
2433   v2s=-0.0344234 + (0.00443313)*c + (-0.000173309)*c*c + (2.7124e-06)*c*c*c + (-1.42518e-08)*c*c*c*c ;
2434 }
2435 if(fRunNumber==106){
2436   v2c=0.0369386 + (-0.00434063)*c + (0.00018894)*c*c + (-3.45688e-06)*c*c*c + (2.16617e-08)*c*c*c*c ;
2437   v2s=-0.00675251 + (0.000691284)*c + (-1.08033e-06)*c*c + (-5.57352e-07)*c*c*c + (6.28148e-09)*c*c*c*c ;
2438 }
2439 if(fRunNumber==107){
2440   v2c=-0.0441483 + (0.00803486)*c + (-0.00034871)*c*c + (4.76349e-06)*c*c*c + (-1.81393e-08)*c*c*c*c ;
2441   v2s=-0.141046 + (0.0165183)*c + (-0.000592546)*c*c + (8.956e-06)*c*c*c + (-4.86662e-08)*c*c*c*c ;
2442 }
2443 if(fRunNumber==108){
2444   v2c=-0.0531169 + (0.00637348)*c + (-0.000218334)*c*c + (2.66873e-06)*c*c*c + (-9.86859e-09)*c*c*c*c ;
2445   v2s=-0.00809622 + (-0.000552159)*c + (6.27984e-05)*c*c + (-1.33136e-06)*c*c*c + (7.45069e-09)*c*c*c*c ;
2446 }
2447 if(fRunNumber==109){
2448   v2c=-0.00189593 + (0.00153994)*c + (-9.92105e-05)*c*c + (1.98756e-06)*c*c*c + (-1.24677e-08)*c*c*c*c ;
2449   v2s=0.0252107 + (-0.00330651)*c + (0.000128362)*c*c + (-1.89951e-06)*c*c*c + (9.45477e-09)*c*c*c*c ;
2450 }
2451 if(fRunNumber==112){
2452   v2c=-0.00939028 + (0.00128226)*c + (-5.24125e-05)*c*c + (8.50382e-07)*c*c*c + (-4.65785e-09)*c*c*c*c ;
2453   v2s=0.00201633 + (-0.00116151)*c + (7.59727e-05)*c*c + (-1.59962e-06)*c*c*c + (1.04645e-08)*c*c*c*c ;
2454 }
2455 if(fRunNumber==114){
2456   v2c=-0.00783351 + (0.00122277)*c + (-3.37736e-05)*c*c + (3.12136e-07)*c*c*c + (-9.19359e-10)*c*c*c*c ;
2457   v2s=0.0103833 + (-0.00215968)*c + (9.96942e-05)*c*c + (-1.71974e-06)*c*c*c + (1.01511e-08)*c*c*c*c ;
2458 }
2459 if(fRunNumber==115){
2460   v2c=0.00588164 + (-0.00083683)*c + (5.13684e-05)*c*c + (-1.14177e-06)*c*c*c + (8.11899e-09)*c*c*c*c ;
2461   v2s=0.0037561 + (-0.000786163)*c + (3.88084e-05)*c*c + (-7.73678e-07)*c*c*c + (5.27396e-09)*c*c*c*c ;
2462 }
2463 if(fRunNumber==116){
2464   v2c=0.0610685 + (-0.00392239)*c + (6.23272e-05)*c*c + (9.84282e-07)*c*c*c + (-1.75418e-08)*c*c*c*c ;
2465   v2s=-0.106295 + (0.0124333)*c + (-0.000510299)*c*c + (8.51235e-06)*c*c*c + (-4.9787e-08)*c*c*c*c ;
2466 }
2467 if(fRunNumber==117){
2468   v2c=-0.0132264 + (0.0024143)*c + (-0.000106307)*c*c + (1.74632e-06)*c*c*c + (-9.79752e-09)*c*c*c*c ;
2469   v2s=-0.00788943 + (0.000443907)*c + (-1.83984e-05)*c*c + (3.81018e-07)*c*c*c + (-2.52604e-09)*c*c*c*c ;
2470 }
2471 if(fRunNumber==118){
2472   v2c=-0.045835 + (0.00849686)*c + (-0.000408675)*c*c + (7.3031e-06)*c*c*c + (-4.34655e-08)*c*c*c*c ;
2473   v2s=-0.0455199 + (0.00718851)*c + (-0.000340502)*c*c + (6.00457e-06)*c*c*c + (-3.51883e-08)*c*c*c*c ;
2474 }
2475 if(fRunNumber==119){
2476   v2c=-0.00627236 + (0.00146712)*c + (-9.05375e-05)*c*c + (1.96962e-06)*c*c*c + (-1.35867e-08)*c*c*c*c ;
2477   v2s=-0.00544096 + (0.000598445)*c + (-7.61032e-06)*c*c + (-2.09579e-07)*c*c*c + (3.00091e-09)*c*c*c*c ;
2478 }
2479 if(fRunNumber==120){
2480   v2c=-0.0376823 + (0.00376965)*c + (-8.01573e-05)*c*c + (-2.80792e-09)*c*c*c + (6.79508e-09)*c*c*c*c ;
2481   v2s=-0.0675803 + (0.00849852)*c + (-0.000298266)*c*c + (3.93178e-06)*c*c*c + (-1.68582e-08)*c*c*c*c ;
2482 }
2483 if(fRunNumber==121){
2484   v2c=0.0285153 + (-0.00340253)*c + (0.000130854)*c*c + (-2.02449e-06)*c*c*c + (1.09594e-08)*c*c*c*c ;
2485   v2s=0.0224991 + (-0.00524188)*c + (0.000269226)*c*c + (-4.93926e-06)*c*c*c + (2.97604e-08)*c*c*c*c ;
2486 }
2487 if(fRunNumber==122){
2488   v2c=0.00379321 + (0.000532446)*c + (-6.16649e-05)*c*c + (1.67786e-06)*c*c*c + (-1.29277e-08)*c*c*c*c ;
2489   v2s=-0.011158 + (0.00256124)*c + (-0.000150921)*c*c + (3.22488e-06)*c*c*c + (-2.16809e-08)*c*c*c*c ;
2490 }
2491 if(fRunNumber==123){
2492   v2c=-0.0607006 + (0.00831906)*c + (-0.000398705)*c*c + (6.66385e-06)*c*c*c + (-3.5222e-08)*c*c*c*c ;
2493   v2s=0.0389204 + (-0.00798361)*c + (0.000297135)*c*c + (-3.79751e-06)*c*c*c + (1.47914e-08)*c*c*c*c ;
2494 }
2495 if(fRunNumber==124){
2496   v2c=-0.0288952 + (0.00325728)*c + (-0.000104126)*c*c + (1.29062e-06)*c*c*c + (-6.03539e-09)*c*c*c*c ;
2497   v2s=0.0318884 + (-0.00301585)*c + (0.000131913)*c*c + (-2.5702e-06)*c*c*c + (1.71313e-08)*c*c*c*c ;
2498 }
2499 if(fRunNumber==125){
2500   v2c=-0.00413859 + (0.00024613)*c + (5.33902e-06)*c*c + (-3.86963e-07)*c*c*c + (3.89277e-09)*c*c*c*c ;
2501   v2s=-0.0492298 + (0.00624793)*c + (-0.000243844)*c*c + (3.69001e-06)*c*c*c + (-1.9156e-08)*c*c*c*c ;
2502 }
2503 if(fRunNumber==126){
2504   v2c=-0.018816 + (0.00134076)*c + (-4.50486e-05)*c*c + (5.84259e-07)*c*c*c + (-2.34235e-09)*c*c*c*c ;
2505   v2s=-0.295912 + (0.0159608)*c + (-0.000497569)*c*c + (6.92442e-06)*c*c*c + (-3.35159e-08)*c*c*c*c ;
2506 }
2507 if(fRunNumber==127){
2508   v2c=-0.039222 + (0.00400933)*c + (-0.0001341)*c*c + (1.65214e-06)*c*c*c + (-6.33829e-09)*c*c*c*c ;
2509   v2s=-0.290884 + (0.0147027)*c + (-0.000429021)*c*c + (5.64116e-06)*c*c*c + (-2.58784e-08)*c*c*c*c ;
2510 }
2511 if(fRunNumber==128){
2512   v2c=0.0168685 + (-0.00285775)*c + (0.000141099)*c*c + (-2.48846e-06)*c*c*c + (1.41845e-08)*c*c*c*c ;
2513   v2s=-0.278776 + (0.0113771)*c + (-0.000279052)*c*c + (3.16144e-06)*c*c*c + (-1.18545e-08)*c*c*c*c ;
2514 }
2515 if(fRunNumber==129){
2516   v2c=0.0490322 + (-0.00736827)*c + (0.000304529)*c*c + (-4.89472e-06)*c*c*c + (2.60746e-08)*c*c*c*c ;
2517   v2s=-0.0961198 + (0.0179264)*c + (-0.000914589)*c*c + (1.70145e-05)*c*c*c + (-1.03423e-07)*c*c*c*c ;
2518 }
2519 if(fRunNumber==131){
2520   v2c=0.075924 + (-0.0108106)*c + (0.000493471)*c*c + (-8.39074e-06)*c*c*c + (4.67109e-08)*c*c*c*c ;
2521   v2s=0.0700446 + (-0.0105027)*c + (0.00048267)*c*c + (-8.4422e-06)*c*c*c + (4.91292e-08)*c*c*c*c ;
2522 }
2523 if(fRunNumber==132){
2524   v2c=0.00752887 + (-0.00142672)*c + (7.37857e-05)*c*c + (-1.36894e-06)*c*c*c + (8.28054e-09)*c*c*c*c ;
2525   v2s=-0.0121719 + (0.00188256)*c + (-8.67104e-05)*c*c + (1.50514e-06)*c*c*c + (-8.79759e-09)*c*c*c*c ;
2526 }
2527 if(fRunNumber==133){
2528   v2c=0.00242068 + (-0.000274576)*c + (1.06631e-05)*c*c + (-1.45829e-07)*c*c*c + (7.18001e-10)*c*c*c*c ;
2529   v2s=0.0113182 + (-0.000529549)*c + (-7.75839e-06)*c*c + (4.86382e-07)*c*c*c + (-3.98634e-09)*c*c*c*c ;
2530 }
2531 if(fRunNumber==134){
2532   v2c=-0.0438721 + (0.00906564)*c + (-0.000407471)*c*c + (6.6254e-06)*c*c*c + (-3.61035e-08)*c*c*c*c ;
2533   v2s=-0.276264 + (0.0107322)*c + (-0.000281971)*c*c + (3.27634e-06)*c*c*c + (-1.17426e-08)*c*c*c*c ;
2534 }
2535 if(fRunNumber==135){
2536   v2c=0.0224469 + (-0.00324762)*c + (0.000165861)*c*c + (-3.16496e-06)*c*c*c + (2.011e-08)*c*c*c*c ;
2537   v2s=-0.308891 + (0.0136721)*c + (-0.00032343)*c*c + (2.93575e-06)*c*c*c + (-5.7637e-09)*c*c*c*c ;
2538 }
2539 if(fRunNumber==136){
2540   v2c=0.0279685 + (-0.00441)*c + (0.000294342)*c*c + (-6.56635e-06)*c*c*c + (4.53669e-08)*c*c*c*c ;
2541   v2s=-0.273287 + (0.00917778)*c + (-0.000144155)*c*c + (1.59881e-07)*c*c*c + (8.63874e-09)*c*c*c*c ;
2542 }
2543   
2544 /*
2545   if(fRunNumber>=1 && fRunNumber<=45){ // 137161 -137848 //period 1
2546 //    v2c =-3.523975e-03+8.132703e-04*x+-4.107765e-05*x*x+7.308763e-07*x*x*x+-4.285144e-09*x*x*x*x;
2547 //    v2s =-1.555676e-02+1.075371e-03*x+-3.597818e-05*x*x+4.927188e-07*x*x*x+-2.217080e-09*x*x*x*x;
2548      v2c=-2.007559e-05+3.143290e-04*x-2.065995e-05*x*x+4.071671e-07*x*x*x-2.562114e-09*x*x*x*x ;
2549      v2s=-4.920033e-03+6.807606e-04*x-3.065278e-05*x*x+5.132261e-07*x*x*x-2.767644e-09*x*x*x*x ;
2550
2551   }
2552   if(fRunNumber>=46 && fRunNumber<=58){ //138125-138275//period 2
2553     v2c = 1.591471e-02+2.772445e-04*x-2.229627e-05*x*x+3.803341e-07*x*x*x-2.056551e-09*x*x*x*x;
2554     v2s =-5.800393e-02+2.007102e-03*x-3.292094e-05*x*x+7.266378e-08*x*x*x+1.828472e-09*x*x*x*x ;
2555   }
2556   if(fRunNumber>=59 && fRunNumber<=78){ //138359-138730//period 3
2557     v2c =-8.010228e-03+8.947184e-04*x-4.192609e-05*x*x+7.388210e-07*x*x*x-4.280541e-09*x*x*x*x ;
2558     v2s =-3.203888e-02+2.122650e-03*x-7.549389e-05*x*x+1.161380e-06*x*x*x-6.156621e-09*x*x*x*x ;
2559   }
2560   if(fRunNumber>=79){//period 4
2561     v2c =-1.025964e-02+1.128454e-03*x-4.603917e-05*x*x+7.386637e-07*x*x*x-4.035342e-09*x*x*x*x ;
2562     v2s =-9.746961e-02+4.672675e-03*x-1.311440e-04*x*x+1.650922e-06*x*x*x-7.083187e-09*x*x*x*x ;
2563   }
2564 */  
2565   return phi+v2c*TMath::Sin(2.*phi)-v2s*TMath::Cos(2.*phi) ;
2566
2567 }
2568 //____________________________________________________________________________
2569 Double_t  AliAnalysisTaskPi0Flow::ApplyFlattening(Double_t phi, Double_t c){
2570   
2571  
2572   if(fRunNumber==39){ //137748
2573     Double_t v2c= 0.0222974-0.00132297*c+0.000204021*c*c-4.49827e-06*c*c*c+2.76986e-08*c*c*c*c ; 
2574     Double_t v2s=0.00615401-7.76462e-05*c ;   
2575     return phi+v2c*TMath::Sin(2.*phi)-v2s*TMath::Cos(2.*phi) ;
2576   }
2577   
2578   
2579   //Periods 1,2,3
2580   //fRunNumber - run index
2581   if(fRunNumber>=1 && fRunNumber<79){
2582     Double_t v2c=4.40516e-04+TMath::Exp(-4.71923-7.62089e-02*c) ;
2583     Double_t v2s=1.79859e-03+TMath::Exp(-4.99649-7.87523e-02*c) ;
2584    
2585     return phi+v2c*TMath::Sin(2.*phi)-v2s*TMath::Cos(2.*phi) ;
2586   }
2587   
2588   //period4
2589    //138826, 138828, 138830
2590   if(fRunNumber==83 ||fRunNumber==84 ||fRunNumber==85 ){
2591      Double_t v2c = -1.4e-03 ;
2592      Double_t v2s =  -5.60117e-02-TMath::Exp( -1.62827e+00-9.96071e-02*c);
2593     return phi + v2c*TMath::Sin(2.*phi) - v2s*TMath::Cos(2.*phi) ;
2594   }
2595   //Runs 138871,138872
2596   if(fRunNumber==87 ||fRunNumber==88 ){   
2597     Double_t v2c=-0.00518371 ;
2598     Double_t v2s= 0.00633324 ;
2599     return phi + v2c*TMath::Sin(2.*phi) - v2s*TMath::Cos(2.*phi) ;
2600   }   
2601   //run 139029
2602   if(fRunNumber==102 ){   
2603      Double_t v2c = -0.00354633 ;
2604      Double_t v2s =  0.00418512 ;
2605      return phi+v2c*TMath::Sin(2.*phi)-v2s*TMath::Cos(2.*phi) ;
2606   }  
2607   //run 139110  
2608 /*
2609   if(fRunNumber==110 ){   
2610     Double_t v2c=4.78327e-04+TMath::Exp(-3.21625    -6.74306e-02*c) ;
2611     Double_t v2s=3.50176e-02+TMath::Exp(-9.73541e-01-9.19214e-02*c) ;
2612     return phi + v2c*TMath::Sin(2.*phi) - v2s*TMath::Cos(2.*phi) ;
2613   }
2614 */
2615   if(fRunNumber>=79 && fRunNumber<=139){
2616     Double_t v2c= 4.78327e-04 + TMath::Exp(-6.70587-2.33120e-02*c) ;
2617     Double_t v2s=-2.57731e-03 + TMath::Exp(-2.75493-1.05166e-01*c) ;
2618    
2619     return phi + v2c*TMath::Sin(2.*phi) - v2s*TMath::Cos(2.*phi) ;
2620   }
2621   return phi ;  
2622   
2623 }  
2624 //____________________________________________________________________________
2625 Double_t  AliAnalysisTaskPi0Flow::CoreEnergy(AliESDCaloCluster * clu){  
2626   //calculate energy of the cluster in the circle with radius distanceCut around the maximum
2627   
2628   //Can not use already calculated coordinates?
2629   //They have incidence correction...
2630   const Double_t distanceCut =3.5 ;
2631   const Double_t logWeight=4.5 ;
2632   
2633   Double32_t * elist = clu->GetCellsAmplitudeFraction() ;  
2634 // Calculates the center of gravity in the local PHOS-module coordinates
2635   Float_t wtot = 0;
2636   Double_t xc[100]={0} ;
2637   Double_t zc[100]={0} ;
2638   Double_t x = 0 ;
2639   Double_t z = 0 ;
2640   Int_t mulDigit=TMath::Min(100,clu->GetNCells()) ;
2641   for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
2642     Int_t relid[4] ;
2643     Float_t xi ;
2644     Float_t zi ;
2645     fPHOSGeo->AbsToRelNumbering(clu->GetCellAbsId(iDigit), relid) ;
2646     fPHOSGeo->RelPosInModule(relid, xi, zi);
2647     xc[iDigit]=xi ;
2648     zc[iDigit]=zi ;
2649     if (clu->E()>0 && elist[iDigit]>0) {
2650       Float_t w = TMath::Max( 0., logWeight + TMath::Log( elist[iDigit] / clu->E() ) ) ;
2651       x    += xc[iDigit] * w ;
2652       z    += zc[iDigit] * w ;
2653       wtot += w ;
2654     }
2655   }
2656   if (wtot>0) {
2657     x /= wtot ;
2658     z /= wtot ;
2659   }
2660   Double_t coreE=0. ;
2661   for(Int_t iDigit=0; iDigit < mulDigit; iDigit++) {
2662     Double_t distance = TMath::Sqrt((xc[iDigit]-x)*(xc[iDigit]-x)+(zc[iDigit]-z)*(zc[iDigit]-z)) ;
2663     if(distance < distanceCut)
2664       coreE += elist[iDigit] ;
2665   }
2666   //Apply non-linearity correction
2667   return fNonLinCorr->Eval(coreE) ;
2668 }
2669 //____________________________________________________________________________
2670 Bool_t  AliAnalysisTaskPi0Flow::AreNeibors(Int_t id1,Int_t id2){
2671
2672   Int_t relid1[4] ; 
2673   fPHOSGeo->AbsToRelNumbering(id1, relid1) ; 
2674
2675   Int_t relid2[4] ; 
2676   fPHOSGeo->AbsToRelNumbering(id2, relid2) ; 
2677  
2678   if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module 
2679     Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;  
2680     Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;  
2681     
2682     if (( coldiff <= 1 )  && ( rowdiff <= 1 )){   //At least common vertex
2683       //    if (( relid1[2]==relid2[2] && coldiff <= 1 )  || ( relid1[3]==relid2[3] &&  rowdiff <= 1 )){ //common side
2684       return 1 ; 
2685     }
2686     else {
2687       if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) 
2688         return 0; //  Difference in row numbers is too large to look further 
2689     }
2690     return 0 ;
2691
2692   } 
2693
2694   return 0 ; 
2695 }
2696 //____________________________________________________________________________
2697 void  AliAnalysisTaskPi0Flow::Reclusterize(AliESDCaloCluster * clu){
2698   //Re-clusterize to make continues cluster
2699   
2700   const Int_t oldMulDigit=clu->GetNCells() ;
2701   Double32_t * elist = clu->GetCellsAmplitudeFraction() ;  
2702   UShort_t * dlist = clu->GetCellsAbsId();
2703
2704   Int_t index[oldMulDigit] ;
2705   Bool_t used[oldMulDigit] ;
2706   for(Int_t i=0; i<oldMulDigit; i++) used[i]=0 ;
2707   Int_t inClu=0 ;
2708   Double_t eMax=0. ;
2709   //find maximum
2710   for(Int_t iDigit=0; iDigit<oldMulDigit; iDigit++) {
2711     if(eMax<elist[iDigit]){
2712       eMax=elist[iDigit];
2713       index[0]=iDigit ;
2714       inClu=1 ;
2715     }
2716   }
2717   if(inClu==0){ //empty cluster
2718     return ;
2719   }
2720   used[index[0]]=kTRUE ; //mark as used
2721   for(Int_t i=0; i<inClu; i++){
2722     for(Int_t iDigit=0 ;iDigit<oldMulDigit; iDigit++){
2723        if(used[iDigit]) //already used
2724          continue ;
2725        if(AreNeibors(dlist[index[i]],dlist[iDigit])){
2726          index[inClu]= iDigit ;
2727          inClu++ ;
2728          used[iDigit]=kTRUE ;
2729        }
2730     }
2731   }
2732   
2733   if(inClu==oldMulDigit) //no need to modify
2734     return ; 
2735
2736   clu->SetNCells(inClu);
2737   //copy
2738   UShort_t tmpD[oldMulDigit] ;
2739   Double_t tmpE[oldMulDigit] ;
2740   for(Int_t i=0; i<oldMulDigit; i++){
2741     tmpD[i]=dlist[i] ;    
2742     tmpE[i]=elist[i] ;
2743   }
2744   //change order of digits in list so that
2745   //first inClu cells were true ones
2746   for(Int_t i=0; i<inClu; i++){
2747     dlist[i]=tmpD[index[i]] ;
2748     elist[i]=tmpE[index[i]] ;
2749   }
2750   
2751   
2752 }
2753
2754 //_____________________________________________________________________________
2755 void AliAnalysisTaskPi0Flow::OpenInfoCalbration(Int_t run){
2756     TString oadbfilename = "$ALICE_ROOT/OADB/PWGCF/VZERO/VZEROcalibEP.root";
2757     TFile *foadb = TFile::Open(oadbfilename.Data());
2758
2759     if(!foadb){
2760         printf("OADB file %s cannot be opened\n",oadbfilename.Data());
2761         return;
2762     }
2763
2764     AliOADBContainer *cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorr");
2765     if(!cont){
2766         printf("OADB object hMultV0BefCorr is not available in the file\n");
2767         return; 
2768     }
2769
2770     if(!(cont->GetObject(run))){
2771         printf("OADB object hMultV0BefCorr is not available for run %i (used run 137366)\n",run);
2772         run = 137366;
2773     }
2774     printf("Setting V0 calibration \n") ;
2775     fMultV0 = ((TH2F *) cont->GetObject(run))->ProfileX();
2776
2777     TF1 *fpol0 = new TF1("fpol0","pol0"); 
2778     fMultV0->Fit(fpol0,"","",0,31);
2779     fV0Cpol = fpol0->GetParameter(0);
2780     fMultV0->Fit(fpol0,"","",32,64);
2781     fV0Apol = fpol0->GetParameter(0);
2782
2783     for(Int_t iside=0;iside<2;iside++){
2784         for(Int_t icoord=0;icoord<2;icoord++){
2785             for(Int_t i=0;i  < nCentrBinV0;i++){
2786                 char namecont[100];
2787                 if(iside==0 && icoord==0)
2788                     snprintf(namecont,100,"hQxc2_%i",i);
2789                 else if(iside==1 && icoord==0)
2790                     snprintf(namecont,100,"hQxa2_%i",i);
2791                 else if(iside==0 && icoord==1)
2792                     snprintf(namecont,100,"hQyc2_%i",i);
2793                 else if(iside==1 && icoord==1)
2794                     snprintf(namecont,100,"hQya2_%i",i);
2795
2796                 cont = (AliOADBContainer*) foadb->Get(namecont);
2797                 if(!cont){
2798                     printf("OADB object %s is not available in the file\n",namecont);
2799                     return;     
2800                 }
2801                 
2802                 if(!(cont->GetObject(run))){
2803                     printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
2804                     run = 137366;
2805                 }
2806                 fMeanQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
2807                 fWidthQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
2808
2809                 //for v3
2810                 if(iside==0 && icoord==0)
2811                     snprintf(namecont,100,"hQxc3_%i",i);
2812                 else if(iside==1 && icoord==0)
2813                     snprintf(namecont,100,"hQxa3_%i",i);
2814                 else if(iside==0 && icoord==1)
2815                     snprintf(namecont,100,"hQyc3_%i",i);
2816                 else if(iside==1 && icoord==1)
2817                     snprintf(namecont,100,"hQya3_%i",i);
2818
2819                 cont = (AliOADBContainer*) foadb->Get(namecont);
2820                 if(!cont){
2821                     printf("OADB object %s is not available in the file\n",namecont);
2822                     return;     
2823                 }
2824                 
2825                 if(!(cont->GetObject(run))){
2826                     printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
2827                     run = 137366;
2828                 }
2829 //              fMeanQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
2830 //              fWidthQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
2831
2832             }
2833         }
2834     }
2835 }
2836   
2837 //____________________________________________________________________________
2838 void  AliAnalysisTaskPi0Flow::EvalV0ReactionPlane(AliESDEvent * event){
2839
2840   //VZERO data
2841   AliESDVZERO* esdV0 = event->GetVZEROData();
2842
2843   //reset Q vector info 
2844   Double_t Qxa2 = 0, Qya2 = 0;
2845   Double_t Qxc2 = 0, Qyc2 = 0;
2846
2847   for (Int_t iv0 = 0; iv0 < 64; iv0++) {
2848     Double_t phiV0 = TMath::PiOver4()*(0.5 + iv0 % 8);
2849     Float_t multv0 = esdV0->GetMultiplicity(iv0);
2850     if (iv0 < 32){ // V0C
2851       Qxc2 += TMath::Cos(2*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
2852       Qyc2 += TMath::Sin(2*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
2853     } else {       // V0A
2854       Qxa2 += TMath::Cos(2*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
2855       Qya2 += TMath::Sin(2*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
2856     }
2857   }
2858
2859   Int_t iC = -1;    
2860   // centrality bins
2861   if(fCentrality < 5) iC = 0;
2862   else if(fCentrality < 10) iC = 1;
2863   else if(fCentrality < 20) iC = 2;
2864   else if(fCentrality < 30) iC = 3;
2865   else if(fCentrality < 40) iC = 4;
2866   else if(fCentrality < 50) iC = 5;
2867   else if(fCentrality < 60) iC = 6;
2868   else if(fCentrality < 70) iC = 7;
2869   else iC = 8;
2870
2871     //grab for each centrality the proper histo with the Qx and Qy to do the recentering
2872   Double_t Qxamean2 = fMeanQ[iC][1][0];
2873   Double_t Qxarms2  = fWidthQ[iC][1][0];
2874   Double_t Qyamean2 = fMeanQ[iC][1][1];
2875   Double_t Qyarms2  = fWidthQ[iC][1][1];
2876     
2877   Double_t Qxcmean2 = fMeanQ[iC][0][0];
2878   Double_t Qxcrms2  = fWidthQ[iC][0][0];
2879   Double_t Qycmean2 = fMeanQ[iC][0][1];
2880   Double_t Qycrms2  = fWidthQ[iC][0][1];        
2881     
2882   Double_t QxaCor2 = (Qxa2 - Qxamean2)/Qxarms2;
2883   Double_t QyaCor2 = (Qya2 - Qyamean2)/Qyarms2;
2884   Double_t QxcCor2 = (Qxc2 - Qxcmean2)/Qxcrms2;
2885   Double_t QycCor2 = (Qyc2 - Qycmean2)/Qycrms2;
2886         
2887   fRPV0A = TMath::ATan2(QyaCor2, QxaCor2)/2.;
2888   fRPV0C = TMath::ATan2(QycCor2, QxcCor2)/2.;
2889
2890   while(fRPV0A<0)fRPV0A+=TMath::Pi() ;
2891   while(fRPV0A>TMath::Pi())fRPV0A-=TMath::Pi() ;
2892   FillHistogram("phiRPV0A",fRPV0A,fCentrality) ;
2893   fRPV0A=ApplyFlatteningV0A(fRPV0A,fCentrality) ;
2894   while(fRPV0A<0)fRPV0A+=TMath::Pi() ;
2895   while(fRPV0A>TMath::Pi())fRPV0A-=TMath::Pi() ;
2896   
2897   while(fRPV0C<0)fRPV0C+=TMath::Pi() ;
2898   while(fRPV0C>TMath::Pi())fRPV0C-=TMath::Pi() ;
2899   FillHistogram("phiRPV0C",fRPV0C,fCentrality) ;
2900   fRPV0C=ApplyFlatteningV0C(fRPV0C,fCentrality) ;
2901   while(fRPV0C<0)fRPV0C+=TMath::Pi() ;
2902   while(fRPV0C>TMath::Pi())fRPV0C-=TMath::Pi() ;
2903
2904 }