]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhiCorrections.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemtoUser / AliFemtoCorrFctnDEtaDPhiCorrections.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoCorrFctnDEtaDPhiCorrections - A correlation function that analyzes //
4 // two particle correlations with respect to the azimuthal angle (phi)        //
5 // and pseudorapidity (eta) difference                                        //
6 //                                                                            //
7 // Authors: Adam Kisiel Adam.Kisiel@cern.ch                                   //
8 //                                                                            //
9 ////////////////////////////////////////////////////////////////////////////////
10
11 #include "AliFemtoCorrFctnDEtaDPhiCorrections.h"
12 #include "AliFemtoModelHiddenInfo.h"
13 //#include "AliFemtoHisto.hh"
14 #include <cstdio>
15 #include <TMath.h>
16 #include "THn.h"
17
18 #ifdef __ROOT__ 
19 ClassImp(AliFemtoCorrFctnDEtaDPhiCorrections)
20 #endif
21   
22 #define PIH 1.57079632679489656
23 #define PIT 6.28318530717958623
24
25
26
27
28 //____________________________
29 AliFemtoCorrFctnDEtaDPhiCorrections::AliFemtoCorrFctnDEtaDPhiCorrections(char* title, const int& aPhiBins=20, const int& aEtaBins=20):
30   AliFemtoCorrFctn(),
31   fDPhiDEtaNumerator(0),
32   fDPhiDEtaDenominator(0),
33   fDPhiNumerator(0),
34   fDPhiDenominator(0),
35   fDCosNumerator(0),
36   fDCosDenominator(0),
37   fDoFullAnalysis(kFALSE),
38   fPhi(0),
39   fEta(0),
40   fPtSumDist(0),
41   fYtYtNumerator(0),
42   fYtYtDenominator(0),
43   fIfCorrection(0),
44   fPtCorrectionsNum(0),
45   fPtCorrectionsDen(0),
46   fEtaCorrectionsNum(0),
47   fEtaCorrectionsDen(0),
48   fCorrFactorTab(0),
49   fpTab(0),
50   fPartType(kNoCorrection),
51   fphiL(0),
52   fphiT(0),
53   ifileCorrTab(0),
54   fdoPtCorr(0),
55   fdoEtaCorr(0),
56   fdoPhiCorr(0),
57   fdoZVertCorr(0),
58   fpartType1(0),
59   fpartType2(0),
60   fhntReco1(0),
61   fhntReco2(0),
62   fh1Reco1(0),
63   fh1Reco2(0),
64   fh2Reco1(0),
65   fh2Reco2(0),
66   fh3Reco1(0),
67   fh3Reco2(0),
68   fhCont1(0),
69   fhCont2(0),
70   fCorr1D(kFALSE)
71 {
72
73   fphiL = (-(int)(aPhiBins/4)+0.5)*2.*TMath::Pi()/aPhiBins;
74   fphiT = 2*TMath::Pi()+(-(int)(aPhiBins/4)+0.5)*2.*TMath::Pi()/aPhiBins;
75
76   // set up numerator
77   char tTitNumD[101] = "NumDPhiDEta";
78   strncat(tTitNumD,title, 100);
79   fDPhiDEtaNumerator = new TH2D(tTitNumD,title,aPhiBins,fphiL,fphiT,aEtaBins,-2.0,2.0);
80   // set up denominator
81   char tTitDenD[101] = "DenDPhiDEta";
82   strncat(tTitDenD,title, 100);
83   fDPhiDEtaDenominator = new TH2D(tTitDenD,title,aPhiBins,fphiL,fphiT,aEtaBins,-2.0,2.0);
84
85     // set up numerator
86   char tTitNum[101] = "PtSumDist";
87   strncat(tTitNum,title, 100);
88   fPtSumDist = new TH1D(tTitNum,title,200,0,10);
89
90   fDPhiDEtaNumerator->Sumw2();
91   fDPhiDEtaDenominator->Sumw2();
92   fPtSumDist->Sumw2();
93
94
95
96   // to enable error bar calculation...
97
98
99   
100
101 }
102
103 //____________________________
104 AliFemtoCorrFctnDEtaDPhiCorrections::AliFemtoCorrFctnDEtaDPhiCorrections(const AliFemtoCorrFctnDEtaDPhiCorrections& aCorrFctn) :
105   AliFemtoCorrFctn(),
106   fDPhiDEtaNumerator(0),
107   fDPhiDEtaDenominator(0),
108   fDPhiNumerator(0),
109   fDPhiDenominator(0),
110   fDCosNumerator(0),
111   fDCosDenominator(0),
112   fDoFullAnalysis(kFALSE),
113   fPhi(0),
114   fEta(0),
115   fPtSumDist(0),
116   fYtYtNumerator(0),
117   fYtYtDenominator(0),
118   fIfCorrection(0),
119   fPtCorrectionsNum(0),
120   fPtCorrectionsDen(0),
121   fEtaCorrectionsNum(0),
122   fEtaCorrectionsDen(0),
123   fCorrFactorTab(0),
124   fpTab(0),
125   fPartType(kNoCorrection),
126   fphiL(0),
127   fphiT(0),
128   ifileCorrTab(0),
129   fdoPtCorr(0),
130   fdoEtaCorr(0),
131   fdoPhiCorr(0),
132   fdoZVertCorr(0),
133   fpartType1(0),
134   fpartType2(0),
135   fhntReco1(0),
136   fhntReco2(0),
137   fh1Reco1(0),
138   fh1Reco2(0),
139   fh2Reco1(0),
140   fh2Reco2(0),
141   fh3Reco1(0),
142   fh3Reco2(0),
143   fhCont1(0),
144   fhCont2(0),
145   fCorr1D(kFALSE)
146 {
147   // copy constructor
148   if (aCorrFctn.fDPhiDEtaNumerator)
149     fDPhiDEtaNumerator = new TH2D(*aCorrFctn.fDPhiDEtaNumerator);
150   else
151     fDPhiDEtaNumerator = 0;
152   if (aCorrFctn.fDPhiDEtaDenominator)
153     fDPhiDEtaDenominator = new TH2D(*aCorrFctn.fDPhiDEtaDenominator);
154   else
155     fDPhiDEtaDenominator = 0;
156
157   if (aCorrFctn.fDPhiNumerator)
158     fDPhiNumerator = new TH1D(*aCorrFctn.fDPhiNumerator);
159   else
160     fDPhiNumerator = 0;
161   if (aCorrFctn.fDPhiDenominator)
162     fDPhiDenominator = new TH1D(*aCorrFctn.fDPhiDenominator);
163   else
164     fDPhiDenominator = 0;
165
166   if (aCorrFctn.fDCosNumerator)
167     fDCosNumerator = new TH1D(*aCorrFctn.fDCosNumerator);
168   else
169     fDCosNumerator = 0;
170   if (aCorrFctn.fDCosDenominator)
171     fDCosDenominator = new TH1D(*aCorrFctn.fDCosDenominator);
172   else
173     fDCosDenominator = 0;
174
175  if (aCorrFctn.fPhi)
176     fPhi = new TH1D(*aCorrFctn.fPhi);
177   else
178     fPhi = 0;
179  if (aCorrFctn.fEta)
180     fEta = new TH1D(*aCorrFctn.fEta);
181   else
182     fEta = 0;
183
184  if (aCorrFctn.fPtSumDist)
185    fPtSumDist = new TH1D(*aCorrFctn.fPtSumDist);
186  else
187    fPtSumDist = 0;
188
189  if (aCorrFctn.fYtYtNumerator)
190    fYtYtNumerator = new TH2D(*aCorrFctn.fDPhiDEtaDenominator);
191  else 
192    fYtYtNumerator = 0;
193
194  if (aCorrFctn.fYtYtDenominator)
195    fYtYtDenominator = new TH2D(*aCorrFctn.fDPhiDEtaDenominator);
196  else 
197     fYtYtDenominator = 0;
198
199   fphiL = aCorrFctn.fphiL;
200   fphiT = aCorrFctn.fphiT;
201
202   fPartType = aCorrFctn.fPartType;
203
204 //  if (aCorrFctn.fPtCorrectionsNum)
205 //    fPtCorrectionsNum = new THnSparseF(*aCorrFctn.fPtCorrectionsNum);
206 //    else 
207 //    fPtCorrectionsNum = 0;
208
209 // if (aCorrFctn.fPtCorrectionsDen)
210 //    fPtCorrectionsDen = new THnSparseF(*aCorrFctn.fPtCorrectionsDen);
211 //  else 
212 //    fPtCorrectionsDen = 0;
213
214
215
216 }
217 //____________________________
218 AliFemtoCorrFctnDEtaDPhiCorrections::~AliFemtoCorrFctnDEtaDPhiCorrections(){
219   // destructor
220   delete fDPhiDEtaNumerator;
221   delete fDPhiDEtaDenominator;
222   delete fPtSumDist;
223
224   if (fDoFullAnalysis) {
225     delete fDPhiNumerator;
226     delete fDPhiDenominator;
227     delete fDCosNumerator;
228     delete fDCosDenominator;
229
230     delete fYtYtNumerator;
231     delete fYtYtDenominator;
232     delete fPhi;
233     delete fEta;
234     delete fPtCorrectionsNum;
235     delete fPtCorrectionsDen;
236     delete fEtaCorrectionsNum;
237     delete fEtaCorrectionsDen;
238   }
239
240   //corrctions
241   if(fhntReco1){
242     delete fhntReco1;
243     delete fhntReco2;
244     delete fhCont1;
245     delete fhCont2;
246   }
247   if(fh1Reco1) delete fh1Reco1;
248   if(fh1Reco2) delete fh1Reco2;
249   if(fh2Reco1) delete fh2Reco1;
250   if(fh2Reco2) delete fh2Reco2;
251   if(fh3Reco1) delete fh3Reco1;
252   if(fh3Reco2) delete fh3Reco2;
253
254 }
255 //_________________________
256 AliFemtoCorrFctnDEtaDPhiCorrections& AliFemtoCorrFctnDEtaDPhiCorrections::operator=(const AliFemtoCorrFctnDEtaDPhiCorrections& aCorrFctn)
257 {
258   // assignment operator
259   if (this == &aCorrFctn)
260     return *this;
261
262   if (aCorrFctn.fDPhiDEtaNumerator)
263     fDPhiDEtaNumerator = new TH2D(*aCorrFctn.fDPhiDEtaNumerator);
264   else
265     fDPhiDEtaNumerator = 0;
266   if (aCorrFctn.fDPhiDEtaDenominator)
267     fDPhiDEtaDenominator = new TH2D(*aCorrFctn.fDPhiDEtaDenominator);
268   else
269     fDPhiDEtaDenominator = 0;
270
271   if (aCorrFctn.fDPhiNumerator)
272     fDPhiNumerator = new TH1D(*aCorrFctn.fDPhiNumerator);
273   else
274     fDPhiNumerator = 0;
275   if (aCorrFctn.fDPhiDenominator)
276     fDPhiDenominator = new TH1D(*aCorrFctn.fDPhiDenominator);
277   else
278     fDPhiDenominator = 0;
279
280   if (aCorrFctn.fDCosNumerator)
281     fDCosNumerator = new TH1D(*aCorrFctn.fDCosNumerator);
282   else
283     fDCosNumerator = 0;
284   if (aCorrFctn.fDCosDenominator)
285     fDCosDenominator = new TH1D(*aCorrFctn.fDCosDenominator);
286   else
287     fDCosDenominator = 0;
288
289   if (aCorrFctn.fPhi)
290     fPhi = new TH1D(*aCorrFctn.fPhi);
291   else
292     fPhi = 0;
293   if (aCorrFctn.fEta)
294     fEta = new TH1D(*aCorrFctn.fEta);
295   else
296     fEta = 0;
297
298  if (aCorrFctn.fPtSumDist)
299    fPtSumDist = new TH1D(*aCorrFctn.fPtSumDist);
300  else
301    fPtSumDist = 0;
302
303  if (aCorrFctn.fYtYtNumerator)
304    fYtYtNumerator = new TH2D(*aCorrFctn.fDPhiDEtaDenominator);
305  else 
306    fYtYtNumerator = 0;
307
308  if (aCorrFctn.fYtYtDenominator)
309    fYtYtDenominator = new TH2D(*aCorrFctn.fDPhiDEtaDenominator);
310  else 
311    fYtYtDenominator = 0;
312  
313   fphiL = aCorrFctn.fphiL;
314   fphiT = aCorrFctn.fphiT;
315
316   fPartType = aCorrFctn.fPartType;
317
318 // if (aCorrFctn.fPtCorrectionsNum)
319 //    fPtCorrectionsNum = new THnSparseF(*aCorrFctn.fPtCorrectionsNum);
320 //  else 
321 //    fPtCorrectionsNum = 0;
322
323 // if (aCorrFctn.fPtCorrectionsDen)
324 //    fPtCorrectionsDen = new THnSparseF(*aCorrFctn.fPtCorrectionsDen);
325 //  else 
326 //    fPtCorrectionsDen = 0;
327
328
329
330   return *this;
331 }
332 //_________________________
333 void AliFemtoCorrFctnDEtaDPhiCorrections::Finish(){
334   // here is where we should normalize, fit, etc...
335   // we should NOT Draw() the histos (as I had done it below),
336   // since we want to insulate ourselves from root at this level
337   // of the code.  Do it instead at root command line with browser.
338   //  mShareNumerator->Draw();
339   //mShareDenominator->Draw();
340   //mRatio->Draw();
341
342 }
343
344 //____________________________
345 AliFemtoString AliFemtoCorrFctnDEtaDPhiCorrections::Report(){
346   // create report
347   string stemp = "TPC Ncls Correlation Function Report:\n";
348   char ctemp[100];
349   snprintf(ctemp , 100, "Number of entries in numerator:\t%E\n",fDPhiDEtaNumerator->GetEntries());
350   stemp += ctemp;
351   snprintf(ctemp , 100, "Number of entries in denominator:\t%E\n",fDPhiDEtaDenominator->GetEntries());
352   stemp += ctemp;
353   //  stemp += mCoulombWeight->Report();
354   AliFemtoString returnThis = stemp;
355   return returnThis;
356 }
357 //____________________________
358 void AliFemtoCorrFctnDEtaDPhiCorrections::AddRealPair( AliFemtoPair* pair){
359   // add real (effect) pair
360   if (fPairCut)
361     if (!fPairCut->Pass(pair)) return;
362
363   /*double phi1 = pair->Track1()->Track()->P().Phi();
364     double phi2 = pair->Track2()->Track()->P().Phi();
365     double eta1 = pair->Track1()->Track()->P().PseudoRapidity();
366     double eta2 = pair->Track2()->Track()->P().PseudoRapidity();*/
367
368   double phi1 = pair->Track1()->FourMomentum().Phi();
369   double phi2 = pair->Track2()->FourMomentum().Phi();
370   double eta1 = pair->Track1()->FourMomentum().PseudoRapidity();
371   double eta2 = pair->Track2()->FourMomentum().PseudoRapidity();
372
373   double dphi = phi1 - phi2;
374   while (dphi<fphiL) dphi+=PIT;
375   while (dphi>fphiT) dphi-=PIT;
376
377   double deta = eta1 - eta2;
378
379   double px1 = pair->Track1()->Track()->P().x();
380   double py1 = pair->Track1()->Track()->P().y();
381   //double pz1 = pair->Track1()->Track()->P().z();
382
383   double px2 = pair->Track2()->Track()->P().x();
384   double py2 = pair->Track2()->Track()->P().y();
385   //double pz2 = pair->Track2()->Track()->P().z();
386
387   double pt1 = TMath::Hypot(px1, py1);
388   double pt2 = TMath::Hypot(px2, py2);
389
390   double vert1[3];
391   pair->Track1()->Track()->GetPrimaryVertex(vert1);
392   double vert2[3];
393   pair->Track2()->Track()->GetPrimaryVertex(vert2);
394
395   double corrweight=0; //double corrweightpT1=1;  double corrweightpT2=1; 
396   //if (fIfCorrection) corrweight = CalculateCorrectionWeight(pt1, pt2);
397   if (fIfCorrection) 
398     {
399       corrweight = CalculateCorrectionWeight(pt1, pt2, eta1, eta2, phi1, phi2, vert1[2], vert2[2]);
400     }
401   else if(fCorr1D)
402     {
403       corrweight = CalculateCorrectionWeight(pt1, pt2);
404       //corrweightpT1 = CalculateCorrectionWeight(pt1);
405       //corrweightpT2 = CalculateCorrectionWeight(pt2);
406     }
407
408   fPtSumDist->Fill(pt1+pt2,corrweight);
409   /*   double ptmin = pt1>pt2 ? pt2 : pt1;
410
411        double cosphi = (px1*px2 + py1*py2 + pz1*pz2)/
412        sqrt((px1*px1 + py1*py1 + pz1*pz1)*(px2*px2 + py2*py2 + pz2*pz2));
413   */
414   if (fIfCorrection || fCorr1D)
415     {
416       fDPhiDEtaNumerator->Fill(dphi, deta, corrweight);
417     }
418   else{
419     fDPhiDEtaNumerator->Fill(dphi, deta);
420   }
421
422
423   if (fDoFullAnalysis) {
424     //fDPhiPtNumerator->Fill(dphi, ptmin);
425     //fDCosPtNumerator->Fill(cosphi, ptmin);
426
427     fDPhiNumerator->Fill(dphi);
428     //fDCosNumerator->Fill(cosphi);
429     double PionMass = 0.13956995;
430     double yt1 = TMath::Log(sqrt(1+(pt1/PionMass)*(pt1/PionMass))+(pt1/PionMass));
431     double yt2 = TMath::Log(sqrt(1+(pt2/PionMass)*(pt2/PionMass))+(pt2/PionMass));
432     fYtYtNumerator->Fill(yt1,yt2);
433
434
435     fPhi->Fill(phi1);
436     fEta->Fill(eta1);
437   }
438
439 }
440 //____________________________
441 void AliFemtoCorrFctnDEtaDPhiCorrections::AddMixedPair( AliFemtoPair* pair){
442   // add mixed (background) pair
443   if (fPairCut)
444     if (!fPairCut->Pass(pair)) return;
445
446   /*double phi1 = pair->Track1()->Track()->P().Phi();
447     double phi2 = pair->Track2()->Track()->P().Phi();
448     double eta1 = pair->Track1()->Track()->P().PseudoRapidity();
449     double eta2 = pair->Track2()->Track()->P().PseudoRapidity();*/
450
451   double phi1 = pair->Track1()->FourMomentum().Phi();
452   double phi2 = pair->Track2()->FourMomentum().Phi();
453   double eta1 = pair->Track1()->FourMomentum().PseudoRapidity();
454   double eta2 = pair->Track2()->FourMomentum().PseudoRapidity();
455
456   double dphi = phi1 - phi2;
457   while (dphi<fphiL) dphi+=PIT;
458   while (dphi>fphiT) dphi-=PIT;
459
460   double deta = eta1 - eta2;
461
462   double px1 = pair->Track1()->Track()->P().x();
463   double py1 = pair->Track1()->Track()->P().y();
464   //double pz1 = pair->Track1()->Track()->P().z();
465
466   double px2 = pair->Track2()->Track()->P().x();
467   double py2 = pair->Track2()->Track()->P().y();
468   //double pz2 = pair->Track2()->Track()->P().z();
469
470   double pt1 = TMath::Hypot(px1, py1);
471   double pt2 = TMath::Hypot(px2, py2);
472   //   double ptmin = pt1>pt2 ? pt2 : pt1;
473   //   double cosphi = (px1*px2 + py1*py2 + pz1*pz2)/
474   //     sqrt((px1*px1 + py1*py1 + pz1*pz1)*(px2*px2 + py2*py2 + pz2*pz2));
475
476
477   double vert1[3];
478   pair->Track1()->Track()->GetPrimaryVertex(vert1);
479   double vert2[3];
480   pair->Track2()->Track()->GetPrimaryVertex(vert2);
481
482   double corrweight=-999;
483   //if (fIfCorrection) corrweight = CalculateCorrectionWeight(pt1, pt2);
484   if (fIfCorrection) 
485     {
486       corrweight = CalculateCorrectionWeight(pt1, pt2, eta1, eta2, phi1, phi2, vert1[2], vert2[2]);
487     }
488   else if(fCorr1D)
489     {
490       corrweight = CalculateCorrectionWeight(pt1, pt2);
491     }
492   
493   
494   if(fIfCorrection || fCorr1D)
495     fDPhiDEtaDenominator->Fill(dphi, deta, corrweight);
496   else
497     fDPhiDEtaDenominator->Fill(dphi, deta);
498
499   if (fDoFullAnalysis) {
500     //fDPhiPtDenominator->Fill(dphi, ptmin);
501     //fDCosPtDenominator->Fill(cosphi, ptmin);
502     fDPhiDenominator->Fill(dphi);
503
504     double PionMass = 0.13956995;
505     double yt1 = TMath::Log(sqrt(1+(pt1/PionMass)*(pt1/PionMass))+(pt1/PionMass));
506     double yt2 = TMath::Log(sqrt(1+(pt2/PionMass)*(pt2/PionMass))+(pt2/PionMass));
507     fYtYtDenominator->Fill(yt1,yt2);
508
509   }
510 }
511
512
513 void AliFemtoCorrFctnDEtaDPhiCorrections::WriteHistos()
514 {
515   // Write out result histograms
516   fDPhiDEtaNumerator->Write();
517   fDPhiDEtaDenominator->Write();
518   fPtSumDist->Write();
519   /*fDPhiNumerator->Write();
520   fDPhiDenominator->Write();
521   fDCosNumerator->Write();
522   fDCosDenominator->Write();
523   if (fDoFullAnalysis) {
524     fDPhiPtNumerator->Write();
525     fDPhiPtDenominator->Write();
526     fDCosPtNumerator->Write();
527     fDCosPtDenominator->Write();
528     }*/
529   // fPhi->Write();
530   // fEta->Write();
531   
532 }
533
534 TList* AliFemtoCorrFctnDEtaDPhiCorrections::GetOutputList()
535 {
536   // Prepare the list of objects to be written to the output
537   TList *tOutputList = new TList();
538
539   tOutputList->Add(fDPhiDEtaNumerator);
540   tOutputList->Add(fDPhiDEtaDenominator);
541   tOutputList->Add(fPtSumDist);
542  
543   if (fDoFullAnalysis) {
544     // tOutputList->Add(fDPhiPtNumerator);
545     // tOutputList->Add(fDPhiPtDenominator);
546     //tOutputList->Add(fDCosPtNumerator);
547     //tOutputList->Add(fDCosPtDenominator);
548     tOutputList->Add(fDPhiNumerator);
549     tOutputList->Add(fDPhiDenominator);
550     tOutputList->Add(fDCosNumerator);
551     tOutputList->Add(fDCosDenominator);
552
553     tOutputList->Add(fYtYtNumerator);
554     tOutputList->Add(fYtYtDenominator);
555     tOutputList->Add(fPhi);
556     tOutputList->Add(fEta);
557   }
558
559
560
561
562   return tOutputList;
563
564 }
565
566 void AliFemtoCorrFctnDEtaDPhiCorrections::SetDoFullAnalysis(Bool_t do2d)
567 {
568   fDoFullAnalysis = do2d;
569
570   if(fDoFullAnalysis)
571     {
572
573       int aPhiBins = fDPhiDEtaNumerator->GetNbinsX();
574       int aEtaBins = fDPhiDEtaNumerator->GetNbinsY();
575       const char *title = fDPhiDEtaNumerator->GetTitle();
576
577       // set up numerator
578       char tTitNumDPhi[101] = "NumDPhi";
579       strncat(tTitNumDPhi,title, 100);
580       fDPhiNumerator = new TH1D(tTitNumDPhi,title,aPhiBins*2,fphiL, fphiT);
581       // set up denominator
582       char tTitDenDPhi[101] = "DenDPhi";
583       strncat(tTitDenDPhi,title, 100);
584       fDPhiDenominator = new TH1D(tTitDenDPhi,title,aPhiBins*2,fphiL, fphiT);
585
586       // set up numerator
587       char tTitNumDCos[101] = "NumDCos";
588       strncat(tTitNumDCos,title, 100);
589       fDCosNumerator = new TH1D(tTitNumDCos,title,aPhiBins*2,-1.0,1.0);
590       // set up denominator
591       char tTitDenDCos[101] = "DenDCos";
592       strncat(tTitDenDCos,title, 100);
593       fDCosDenominator = new TH1D(tTitDenDCos,title,aPhiBins*2,-1.0,1.0);
594
595       // set up numerator
596       char tTitYtNum[101] = "NumYtYt";
597       strncat(tTitYtNum,title, 100);
598       fYtYtNumerator = new TH2D(tTitYtNum,title,aPhiBins,1,5,aEtaBins,1,5);
599       // set up denominator
600       char tTitYtYtDen[101] = "DenYtYt";
601       strncat(tTitYtYtDen,title, 100);
602       fYtYtDenominator = new TH2D(tTitYtYtDen,title,aPhiBins,1,5,aEtaBins,1,5);
603
604
605       char tTitPhi[101] = "Phi";
606       strncat(tTitPhi,title, 100);
607       fPhi = new TH1D(tTitPhi,title,90,-TMath::Pi(),TMath::Pi());
608
609       char tTitEta[101] = "Eta";
610       strncat(tTitEta,title, 100);
611       fEta = new TH1D(tTitEta,title,90,-1.2,1.2);
612
613       char tTitPtCorrectionsNum[101] = "NumpT1pT2EtaPhi";
614       strncat(tTitPtCorrectionsNum,title, 100);
615       char tTitPtCorrectionsDen[101] = "DenpT1pT2EtaPhi";
616       strncat(tTitPtCorrectionsDen,title, 100);
617
618       Int_t nbins[4] = {20,20,aPhiBins,aEtaBins};
619       Double_t xmin[4] = {0,0,-0.5*TMath::Pi(),-2.0};
620       Double_t xmax[4] = {4,4,1.5*TMath::Pi(),2.0};
621
622       fPtCorrectionsNum = new THnSparseF(tTitPtCorrectionsNum,title,4,nbins,xmin,xmax);
623       fPtCorrectionsDen = new THnSparseF(tTitPtCorrectionsDen,title,4,nbins,xmin,xmax);
624
625       char tTitEtaCorrectionsNum[101] = "NumEta1Eta2EtaPhi";
626       strncat(tTitEtaCorrectionsNum,title, 100);
627       char tTitEtaCorrectionsDen[101] = "DenEta1Eta2EtaPhi";
628       strncat(tTitEtaCorrectionsDen,title, 100);
629
630       Double_t xmineta[4] = {-1,1,-0.5*TMath::Pi(),-2.0};
631       Double_t xmaxeta[4] = {-1,1,1.5*TMath::Pi(),2.0};
632
633       fEtaCorrectionsNum = new THnSparseF(tTitEtaCorrectionsNum,title,4,nbins,xmineta,xmaxeta);
634       fEtaCorrectionsDen = new THnSparseF(tTitEtaCorrectionsDen,title,4,nbins,xmineta,xmaxeta);
635       // THnSparse(const char* name, const char* title, Int_t dim,
636       //           const Int_t* nbins, const Double_t* xmin, const Double_t* xmax,
637       //           Int_t chunksize);
638
639       // to enable error bar calculation...
640       fDPhiNumerator->Sumw2();
641       fDPhiDenominator->Sumw2();
642       fDCosNumerator->Sumw2();
643       fDCosDenominator->Sumw2();
644       fYtYtNumerator->Sumw2();
645       fPhi->Sumw2();
646       fEta->Sumw2();
647       fYtYtDenominator->Sumw2();
648       fPtCorrectionsNum->Sumw2();
649       fPtCorrectionsDen->Sumw2();
650     }
651
652
653 }
654
655
656
657 void AliFemtoCorrFctnDEtaDPhiCorrections::LoadCorrectionTabFromROOTFile(const char *file, ParticleType partType1, ParticleType partType2, bool doPtCorr, bool doEtaCorr, bool doPhiCorr, bool doZVertCorr)
658 {
659   fIfCorrection = kTRUE;
660  
661   ifileCorrTab = TFile::Open(file);
662   fdoPtCorr = doPtCorr;
663   fdoEtaCorr = doEtaCorr;
664   fdoPhiCorr = doPhiCorr;
665   fdoZVertCorr = doZVertCorr;
666   fpartType1 = partType1;
667   fpartType2 = partType2;
668
669   char* type1 = new char[12];
670   char* type2 = new char[12];
671
672
673   if(fpartType1==kPion) strcpy(type1,"Pion");
674   else if(fpartType1==kKaon) strcpy(type1,"Kaon");
675   else if (fpartType1==kProton)strcpy(type1,"Proton");
676   else if (fpartType1==kAll) strcpy(type1,"All");
677   else if(fpartType1==kPionMinus) strcpy(type1,"PionMinus");
678   else if(fpartType1==kKaonMinus) strcpy(type1,"KaonMinus");
679   else if (fpartType1==kProtonMinus)strcpy(type1,"ProtonMinus");
680   else strcpy(type1,"");
681
682   if(fpartType2==kPion) strcpy(type2,"Pion");
683   else if(fpartType2==kKaon) strcpy(type2,"Kaon");
684   else if (fpartType2==kProton) strcpy(type2,"Proton");
685   else if (fpartType2==kAll) strcpy(type2,"All");
686   else if(fpartType2==kPionMinus) strcpy(type1,"PionMinus");
687   else if(fpartType2==kKaonMinus) strcpy(type1,"KaonMinus");
688   else if (fpartType2==kProtonMinus)strcpy(type1,"ProtonMinus");
689   else strcpy(type1,"");
690
691
692
693   fhntReco1 = (THnT<float>*)(ifileCorrTab->Get(Form("fCorrectionMapData%s",type1)))->Clone();
694   fhntReco2 = (THnT<float>*)(ifileCorrTab->Get(Form("fCorrectionMapData%s",type2)))->Clone();
695   fhCont1 = (TH1D*)(ifileCorrTab->Get(Form("SecondariesContamination%s",type1)))->Clone();
696   fhCont2 = (TH1D*)(ifileCorrTab->Get(Form("SecondariesContamination%s",type2)))->Clone();
697
698   delete type1;
699   delete type2;
700
701   double fhntReco1_nbins = fhntReco1->GetNbins();
702   double fhntReco2_nbins = fhntReco2->GetNbins();
703
704   int boolSum = fdoPtCorr+fdoEtaCorr+fdoPhiCorr+fdoZVertCorr;
705   /*if(boolSum == 0)
706     {
707       return 1;
708       }*/
709   if(boolSum == 1)
710     {
711
712       if(fdoPtCorr == 1)
713         {
714           fh1Reco1 = (TH1F*)(fhntReco1->Projection(0))->Clone();
715           fh1Reco2 = (TH1F*)(fhntReco2->Projection(0))->Clone();
716           fh1Reco1->Scale(1./fhntReco1_nbins*fh1Reco1->GetNbinsX());
717           fh1Reco2->Scale(1./fhntReco2_nbins*fh1Reco2->GetNbinsX());
718             
719         }
720
721       else if(fdoEtaCorr == 1)
722         {
723           fh1Reco1 = (TH1F*)(fhntReco1->Projection(1))->Clone();
724           fh1Reco2 = (TH1F*)(fhntReco2->Projection(1))->Clone();
725           fh1Reco1->Scale(1./fhntReco1_nbins*fh1Reco1->GetNbinsX());
726           fh1Reco2->Scale(1./fhntReco2_nbins*fh1Reco2->GetNbinsX());
727         }
728
729       else if(fdoPhiCorr == 1)
730         {
731           fh1Reco1 = (TH1F*)(fhntReco1->Projection(2))->Clone();
732           fh1Reco2 = (TH1F*)(fhntReco2->Projection(2))->Clone();
733           fh1Reco1->Scale(1./fhntReco1_nbins*fh1Reco1->GetNbinsX());
734           fh1Reco2->Scale(1./fhntReco2_nbins*fh1Reco2->GetNbinsX());
735         }
736
737       else if(fdoZVertCorr == 1)
738         {
739           fh1Reco1 = (TH1F*)(fhntReco1->Projection(3))->Clone();
740           fh1Reco2 = (TH1F*)(fhntReco2->Projection(3))->Clone();
741           fh1Reco1->Scale(1./fhntReco1_nbins*fh1Reco1->GetNbinsX());
742           fh1Reco2->Scale(1./fhntReco2_nbins*fh1Reco2->GetNbinsX());
743         }
744
745     }
746
747   else if(boolSum == 2)
748     {
749       if(fdoPtCorr == 1 && fdoEtaCorr == 1)
750         {
751           fh2Reco1 = (TH2F*)(fhntReco1->Projection(1,0))->Clone();
752           fh2Reco2 = (TH2F*)(fhntReco2->Projection(1,0))->Clone();        
753           fh2Reco1->Scale(1./fhntReco1_nbins*fh2Reco1->GetNbinsX()*fh2Reco1->GetNbinsY());
754           fh2Reco2->Scale(1./fhntReco2_nbins*fh2Reco2->GetNbinsX()*fh2Reco2->GetNbinsY());
755         }
756
757       else if(fdoPtCorr == 1 && fdoPhiCorr == 1)
758         {
759           fh2Reco1 = (TH2F*)(fhntReco1->Projection(2,0))->Clone();
760           fh2Reco2 = (TH2F*)(fhntReco2->Projection(2,0))->Clone();
761           fh2Reco1->Scale(1./fhntReco1_nbins*fh2Reco1->GetNbinsX()*fh2Reco1->GetNbinsY());
762           fh2Reco2->Scale(1./fhntReco2_nbins*fh2Reco2->GetNbinsX()*fh2Reco2->GetNbinsY());       
763         }
764
765       else if(fdoPtCorr == 1 && fdoZVertCorr == 1)
766         {
767           fh2Reco1 = (TH2F*)(fhntReco1->Projection(3,0))->Clone();
768           fh2Reco2 = (TH2F*)(fhntReco2->Projection(3,0))->Clone();
769           fh2Reco1->Scale(1./fhntReco1_nbins*fh2Reco1->GetNbinsX()*fh2Reco1->GetNbinsY());
770           fh2Reco2->Scale(1./fhntReco2_nbins*fh2Reco2->GetNbinsX()*fh2Reco2->GetNbinsY());
771         }
772       else if(fdoEtaCorr == 1 && fdoPhiCorr == 1)
773         {
774           fh2Reco1 = (TH2F*)(fhntReco1->Projection(2,1))->Clone();
775           fh2Reco2 = (TH2F*)(fhntReco2->Projection(2,1))->Clone();
776           fh2Reco1->Scale(1./fhntReco1_nbins*fh2Reco1->GetNbinsX()*fh2Reco1->GetNbinsY());
777           fh2Reco2->Scale(1./fhntReco2_nbins*fh2Reco2->GetNbinsX()*fh2Reco2->GetNbinsY());
778         }
779       else if(fdoEtaCorr == 1 && fdoZVertCorr == 1)
780         {
781           fh2Reco1 = (TH2F*)(fhntReco1->Projection(3,1))->Clone();
782           fh2Reco2 = (TH2F*)(fhntReco2->Projection(3,1))->Clone();
783           fh2Reco1->Scale(1./fhntReco1_nbins*fh2Reco1->GetNbinsX()*fh2Reco1->GetNbinsY());
784           fh2Reco2->Scale(1./fhntReco2_nbins*fh2Reco2->GetNbinsX()*fh2Reco2->GetNbinsY());
785         }
786       else if(fdoPhiCorr == 1 && fdoZVertCorr == 1)
787         {
788           fh2Reco1 = (TH2F*)(fhntReco1->Projection(3,2))->Clone();
789           fh2Reco2 = (TH2F*)(fhntReco2->Projection(3,2))->Clone();
790           fh2Reco1->Scale(1./fhntReco1_nbins*fh2Reco1->GetNbinsX()*fh2Reco1->GetNbinsY());
791           fh2Reco2->Scale(1./fhntReco2_nbins*fh2Reco2->GetNbinsX()*fh2Reco2->GetNbinsY());
792         }
793     }
794
795
796   else if(boolSum == 3)
797     {
798       if(fdoPtCorr == 1 && fdoEtaCorr == 1 && fdoPhiCorr == 1)
799         {
800           fh3Reco1 = (TH3F*)(fhntReco1->Projection(0,1,2))->Clone();
801           fh3Reco2 = (TH3F*)(fhntReco2->Projection(0,1,2))->Clone(); 
802           fh3Reco1->Scale(1./fhntReco1_nbins*fh3Reco1->GetNbinsX()*fh3Reco1->GetNbinsY()*fh3Reco1->GetNbinsZ());
803           fh3Reco2->Scale(1./fhntReco2_nbins*fh3Reco2->GetNbinsX()*fh3Reco2->GetNbinsY()*fh3Reco2->GetNbinsZ());
804
805         }
806
807       else if(fdoPtCorr == 1 && fdoEtaCorr == 1 && fdoZVertCorr == 1)
808         {
809           fh3Reco1 = (TH3F*)(fhntReco1->Projection(0,1,3))->Clone();
810           fh3Reco2 = (TH3F*)(fhntReco2->Projection(0,1,3))->Clone(); 
811           fh3Reco1->Scale(1./fhntReco1_nbins*fh3Reco1->GetNbinsX()*fh3Reco1->GetNbinsY()*fh3Reco1->GetNbinsZ());
812           fh3Reco2->Scale(1./fhntReco2_nbins*fh3Reco2->GetNbinsX()*fh3Reco2->GetNbinsY()*fh3Reco2->GetNbinsZ());
813         }
814
815       else if(fdoPtCorr == 1 && fdoPhiCorr == 1 && fdoZVertCorr == 1)
816         {
817           fh3Reco1 = (TH3F*)(fhntReco1->Projection(0,2,3))->Clone();
818           fh3Reco2 = (TH3F*)(fhntReco2->Projection(0,2,3))->Clone(); 
819           fh3Reco1->Scale(1./fhntReco1_nbins*fh3Reco1->GetNbinsX()*fh3Reco1->GetNbinsY()*fh3Reco1->GetNbinsZ());
820           fh3Reco2->Scale(1./fhntReco2_nbins*fh3Reco2->GetNbinsX()*fh3Reco2->GetNbinsY()*fh3Reco2->GetNbinsZ());
821         }
822
823       else if(fdoEtaCorr == 1 && fdoPhiCorr == 1 && fdoZVertCorr == 1)
824         {
825           fh3Reco1 = (TH3F*)(fhntReco1->Projection(1,2,3))->Clone();
826           fh3Reco2 = (TH3F*)(fhntReco2->Projection(1,2,3))->Clone(); 
827           fh3Reco1->Scale(1./fhntReco1_nbins*fh3Reco1->GetNbinsX()*fh3Reco1->GetNbinsY()*fh3Reco1->GetNbinsZ());
828           fh3Reco2->Scale(1./fhntReco2_nbins*fh3Reco2->GetNbinsX()*fh3Reco2->GetNbinsY()*fh3Reco2->GetNbinsZ());
829         }
830     }
831
832   /*else if(boolSum == 4)
833     {
834     }*/
835
836   ifileCorrTab->Close();
837
838 }
839
840 void AliFemtoCorrFctnDEtaDPhiCorrections::LoadCorrectionTabFromROOTFile1D(const char *file, ParticleType partType1, ParticleType partType2)
841 {
842   fCorr1D = kTRUE;
843
844   ifileCorrTab = TFile::Open(file);
845
846   fpartType1 = partType1;
847   fpartType2 = partType2;
848
849
850   char type1[12]; 
851   char type2[12];
852
853
854   if(fpartType1==kPion) strcpy(type1,"Pion");
855   else if(fpartType1==kKaon) strcpy(type1,"Kaon");
856   else if (fpartType1==kProton)strcpy(type1,"Proton");
857   else if (fpartType1==kAll) strcpy(type1,"All");
858   else if(fpartType1==kPionMinus) strcpy(type1,"PionMinus");
859   else if (fpartType1==kKaonMinus) strcpy(type1,"KaonMinus");
860   else if (fpartType1==kProtonMinus)strcpy(type1,"ProtonMinus");
861   else strcpy(type1,"");
862
863   if(fpartType2==kPion) strcpy(type2,"Pion");
864   else if(fpartType2==kKaon) strcpy(type2,"Kaon");
865   else if (fpartType2==kProton) strcpy(type2,"Proton");
866   else if (fpartType2==kAll) strcpy(type2,"All");
867   else if(fpartType2==kPionMinus) strcpy(type1,"PionMinus");
868   else if(fpartType2==kKaonMinus) strcpy(type1,"KaonMinus");
869   else if (fpartType2==kProtonMinus)strcpy(type1,"ProtonMinus");
870   else strcpy(type1,"");
871
872   fhCont1 = (TH1D*)(ifileCorrTab->Get(Form("CorrectionFactorPtEffandCont%s",type1)));//->Clone();
873   fhCont2 = (TH1D*)(ifileCorrTab->Get(Form("CorrectionFactorPtEffandCont%s",type2)));//->Clone();
874   
875   ifileCorrTab->Close();
876
877 }
878
879 void AliFemtoCorrFctnDEtaDPhiCorrections::SetCorrectionTab(ParticleType partType)
880 {
881
882   double pttab[] = {0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.675, 0.7, 0.725, 0.75, 0.775, 0.8, 0.825, 0.85, 0.875, 0.9, 0.925, 0.95, 0.975, 1, 1.025, 1.05, 1.075, 1.1, 1.125, 1.15, 1.175, 1.2, 1.225, 1.25, 1.275, 1.3, 1.325, 1.35, 1.375, 1.4, 1.425, 1.45, 1.475, 1.5, 1.525, 1.55, 1.575, 1.6, 1.625, 1.65, 1.675, 1.7, 1.725, 1.75, 1.775, 1.8, 1.825, 1.85, 1.875, 1.9, 1.925, 1.95, 1.975, 2, 2.025, 2.05, 2.075, 2.1, 2.125, 2.15, 2.175, 2.2, 2.225, 2.25, 2.275, 2.3, 2.325, 2.35, 2.375, 2.4, 2.425, 2.45, 2.475, 2.5, 2.525, 2.55, 2.575, 2.6, 2.625, 2.65, 2.675, 2.7, 2.725, 2.75, 2.775, 2.8, 2.825, 2.85, 2.875, 2.9, 2.925, 2.95, 2.975, 3, 3.025, 3.05, 3.075, 3.1, 3.125, 3.15, 3.175, 3.2, 3.225, 3.25, 3.275, 3.3, 3.325, 3.35, 3.375, 3.4, 3.425, 3.45, 3.475, 3.5, 3.525, 3.55, 3.575, 3.6, 3.625, 3.65, 3.675, 3.7, 3.725, 3.75, 3.775, 3.8, 3.825, 3.85, 3.875, 3.9, 3.925, 3.95, 3.975, 4, 4.025, 4.05, 4.075, 4.1, 4.125, 4.15, 4.175, 4.2, 4.225, 4.25, 4.275, 4.3, 4.325, 4.35, 4.375, 4.4, 4.425, 4.45, 4.475, 4.5, 4.525, 4.55, 4.575, 4.6, 4.625, 4.65, 4.675, 4.7, 4.725, 4.75};
883
884   double pioncorrtab[] = {0, 0, 0, 0, 0, 0, 0, 1.40089, 1.40089, 1.29482, 1.29482, 1.25595, 1.22529, 1.22529, 1.23099, 1.32027, 1.32027, 1.44774, 1.44774, 1.74645, 1.8619, 1.8619, 1.82089, 1.78506, 1.78506, 1.75918, 1.75918, 1.74951, 1.74614, 1.74614, 1.74006, 1.73229, 1.73229, 1.72844, 1.72844, 1.72306, 1.71906, 1.71906, 1.71375, 1.71301, 1.71301, 1.70381, 1.70381, 1.69975, 1.69242, 1.69242, 1.69013, 1.67698, 1.67698, 1.6772, 1.6772, 1.67118, 1.66607, 1.66607, 1.66131, 1.67228, 1.67228, 1.66834, 1.66834, 1.66031, 1.6588, 1.6588, 1.6555, 1.64923, 1.64923, 1.6467, 1.6467, 1.63894, 1.63682, 1.63682, 1.6297, 1.62904, 1.62904, 1.63007, 1.63007, 1.62832, 1.62557, 1.62557, 1.62687, 1.62928, 1.62928, 1.62767, 1.62767, 1.62767, 1.62767, 1.62767, 1.62767, 1.63415, 1.63415, 1.63415, 1.63415, 1.63415, 1.63415, 1.63415, 1.64141, 1.64141, 1.64141, 1.64141, 1.64141, 1.64141, 1.65191, 1.65191, 1.65191, 1.65191, 1.65191, 1.65191, 1.65191, 1.66838, 1.66838, 1.66838, 1.66838, 1.66838, 1.66838, 1.6839, 1.6839, 1.6839, 1.6839, 1.6839, 1.6839, 1.69601, 1.69601, 1.69601, 1.69601, 1.69601, 1.69601, 1.69601, 1.70062, 1.70062, 1.70062, 1.70062, 1.70062, 1.70062, 1.68668, 1.68668, 1.68668, 1.68668, 1.68668, 1.68668, 1.68668, 1.68182, 1.68182, 1.68182, 1.68182, 1.68182, 1.68182, 1.681, 1.681, 1.681, 1.681, 1.681, 1.681, 1.67749, 1.67749, 1.67749, 1.67749, 1.67749, 1.67749, 1.67749, 1.66558, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.67223, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.66872, 1.64419};
885
886   double protoncorrtab[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 357.585, 357.585, 8.66944, 2.10995, 2.10995, 1.50443, 1.73168, 1.73168, 2.3605, 2.3605, 4.7726, 4.40359, 4.40359, 3.0307, 2.49649, 2.49649, 2.2231, 2.2231, 2.11247, 2.05862, 2.05862, 2.00703, 1.9623, 1.9623, 1.93393, 1.93393, 1.9101, 1.89334, 1.89334, 1.87734, 1.86342, 1.86342, 1.85075, 1.85075, 1.83985, 1.83684, 1.83684, 1.82915, 1.81832, 1.81832, 1.81215, 1.81215, 1.7998, 1.79524, 1.79524, 1.78568, 1.79989, 1.79989, 1.7973, 1.7973, 1.79591, 1.78468, 1.78468, 1.78037, 1.77394, 1.77394, 1.77198, 1.77198, 1.76736, 1.76875, 1.76875, 1.76221, 1.75729, 1.75729, 1.75397, 1.75397, 1.75229, 1.74918, 1.74918, 1.75064, 1.75643, 1.75643, 1.75765, 1.75765, 1.75765, 1.75765, 1.75765, 1.75765, 1.76345, 1.76345, 1.76345, 1.76345, 1.76345, 1.76345, 1.76345, 1.76901, 1.76901, 1.76901, 1.76901, 1.76901, 1.76901, 1.78291, 1.78291, 1.78291, 1.78291, 1.78291, 1.78291, 1.78291, 1.80009, 1.80009, 1.80009, 1.80009, 1.80009, 1.80009, 1.81064, 1.81064, 1.81064, 1.81064, 1.81064, 1.81064, 1.81765, 1.81765, 1.81765, 1.81765, 1.81765, 1.81765, 1.81765, 1.79549, 1.79549, 1.79549, 1.79549, 1.79549, 1.79549, 1.80455, 1.80455, 1.80455, 1.80455, 1.80455, 1.80455, 1.80455, 1.78912, 1.78912, 1.78912, 1.78912, 1.78912, 1.78912, 1.78501, 1.78501, 1.78501, 1.78501, 1.78501, 1.78501, 1.79512, 1.79512, 1.79512, 1.79512, 1.79512, 1.79512, 1.79512, 1.77138, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.784, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152, 1.75152};
887
888   double kaoncorrtab[] = {0, 0, 0, 0, 0, 0, 0, 8.43268, 8.43268, 3.30657, 3.30657, 2.5102, 2.16256, 2.16256, 2.03757, 2.27166, 2.27166, 2.70432, 2.70432, 4.06234, 4.69199, 4.69199, 4.13074, 3.75139, 3.75139, 3.48381, 3.48381, 3.29762, 3.15261, 3.15261, 3.03022, 2.91874, 2.91874, 2.82421, 2.82421, 2.7388, 2.65961, 2.65961, 2.58426, 2.5174, 2.5174, 2.45378, 2.45378, 2.39687, 2.34699, 2.34699, 2.30247, 2.25299, 2.25299, 2.22443, 2.22443, 2.18303, 2.16012, 2.16012, 2.13083, 2.12806, 2.12806, 2.11376, 2.11376, 2.09566, 2.07526, 2.07526, 2.05378, 2.03252, 2.03252, 2.02466, 2.02466, 2.00531, 1.98945, 1.98945, 1.97877, 1.97226, 1.97226, 1.95475, 1.95475, 1.94838, 1.9314, 1.9314, 1.92571, 1.96346, 1.96346, 1.92849, 1.92849, 1.92849, 1.92849, 1.92849, 1.92849, 1.90949, 1.90949, 1.90949, 1.90949, 1.90949, 1.90949, 1.90949, 1.88743, 1.88743, 1.88743, 1.88743, 1.88743, 1.88743, 1.87486, 1.87486, 1.87486, 1.87486, 1.87486, 1.87486, 1.87486, 1.87785, 1.87785, 1.87785, 1.87785, 1.87785, 1.87785, 1.8757, 1.8757, 1.8757, 1.8757, 1.8757, 1.8757, 1.87948, 1.87948, 1.87948, 1.87948, 1.87948, 1.87948, 1.87948, 1.86148, 1.86148, 1.86148, 1.86148, 1.86148, 1.86148, 1.84329, 1.84329, 1.84329, 1.84329, 1.84329, 1.84329, 1.84329, 1.83105, 1.83105, 1.83105, 1.83105, 1.83105, 1.83105, 1.81955, 1.81955, 1.81955, 1.81955, 1.81955, 1.81955, 1.79944, 1.79944, 1.79944, 1.79944, 1.79944, 1.79944, 1.79944, 1.79345, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.80077, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.78333, 1.74958};
889
890   double allcorrtab[] = {0, 0, 0, 0, 0, 0, 0, 1.46883, 1.46883, 1.3528, 1.3528, 1.30939, 1.26936, 1.26936, 1.23645, 1.21359, 1.21359, 1.19759, 1.19759, 1.18565, 1.17772, 1.17772, 1.17203, 1.16739, 1.16739, 1.16398, 1.16398, 1.16201, 1.16065, 1.16065, 1.16012, 1.16009, 1.16009, 1.16044, 1.16044, 1.16104, 1.16139, 1.16139, 1.16134, 1.16278, 1.16278, 1.1631, 1.1631, 1.16227, 1.16152, 1.16152, 1.16066, 1.15984, 1.15984, 1.15932, 1.15932, 1.15912, 1.15818, 1.15818, 1.15877, 1.16754, 1.16754, 1.17075, 1.17075, 1.17047, 1.16995, 1.16995, 1.16885, 1.16845, 1.16845, 1.16824, 1.16824, 1.16771, 1.16704, 1.16704, 1.16681, 1.16723, 1.16723, 1.16819, 1.16819, 1.16811, 1.16974, 1.16974, 1.17217, 1.16759, 1.16759, 1.17376, 1.17376, 1.17376, 1.17376, 1.17376, 1.17376, 1.18247, 1.18247, 1.18247, 1.18247, 1.18247, 1.18247, 1.18247, 1.18916, 1.18916, 1.18916, 1.18916, 1.18916, 1.18916, 1.19649, 1.19649, 1.19649, 1.19649, 1.19649, 1.19649, 1.19649, 1.20315, 1.20315, 1.20315, 1.20315, 1.20315, 1.20315, 1.20984, 1.20984, 1.20984, 1.20984, 1.20984, 1.20984, 1.21236, 1.21236, 1.21236, 1.21236, 1.21236, 1.21236, 1.21236, 1.21272, 1.21272, 1.21272, 1.21272, 1.21272, 1.21272, 1.21416, 1.21416, 1.21416, 1.21416, 1.21416, 1.21416, 1.21416, 1.21308, 1.21308, 1.21308, 1.21308, 1.21308, 1.21308, 1.21332, 1.21332, 1.21332, 1.21332, 1.21332, 1.21332, 1.21204, 1.21204, 1.21204, 1.21204, 1.21204, 1.21204, 1.21204, 1.21006, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.21141, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2092, 1.2066};
891
892   fpTab = new double[190];
893   for(int i=0;i<190;i++)
894     fpTab[i]=pttab[i];
895
896   if(partType==kPion || partType==kPionMinus)
897     {
898       fCorrFactorTab = new double[190];
899       for(int i=0;i<190;i++)
900         fCorrFactorTab[i] = pioncorrtab[i];
901     }
902   else if(partType==kKaon || partType==kKaonMinus)
903     {
904       fCorrFactorTab = new double[190];
905       for(int i=0;i<190;i++)
906         fCorrFactorTab[i] = kaoncorrtab[i];
907     }
908   else if(partType==kProton||partType==kProtonMinus)
909     {
910       fCorrFactorTab = new double[190];
911       for(int i=0;i<190;i++)
912         fCorrFactorTab[i] = protoncorrtab[i];
913     }
914   else if(partType==kAll)
915     {
916       fCorrFactorTab = new double[190];
917       for(int i=0;i<190;i++)
918         fCorrFactorTab[i] = allcorrtab[i];
919     }
920 }
921
922 double AliFemtoCorrFctnDEtaDPhiCorrections::CalculateCorrectionWeight(double pT1, double pT2)
923 {
924    double w1=0., w2=0.;
925    if(pT1 > fhCont1->GetXaxis()->GetXmin() && pT1 < fhCont1->GetXaxis()->GetXmax() && pT2 > fhCont2->GetXaxis()->GetXmin() && pT2 < fhCont2->GetXaxis()->GetXmax())
926      {
927        w1 = fhCont1->GetBinContent(fhCont1->FindFixBin(pT1));
928        w2 = fhCont2->GetBinContent(fhCont2->FindFixBin(pT2));
929        
930        return w1*w2;
931      } 
932    else
933      return 0;
934 }
935
936
937 double AliFemtoCorrFctnDEtaDPhiCorrections::CalculateCorrectionWeight(double pT1)
938 {
939    double w1=0.;
940    if(pT1 > fhCont1->GetXaxis()->GetXmin() && pT1 < fhCont1->GetXaxis()->GetXmax())
941      {
942        w1 = fhCont1->GetBinContent(fhCont1->FindFixBin(pT1));
943        return w1;
944      } 
945    else
946      return 0;
947 }
948
949 double AliFemtoCorrFctnDEtaDPhiCorrections::CalculateCorrectionWeight(double pT1, double pT2, double eta1, double eta2, double phi1, double phi2, double zvert1, double zvert2)
950 {
951   
952     double w1=0., w2=0.;
953     double eps1=0., eps2=0;
954     double cont1=0., cont2=0; //w=(1-cont)/eps
955     phi1 += TMath::Pi();
956     phi2 += TMath::Pi();
957
958     if(pT1 > fhCont1->GetXaxis()->GetXmin() && pT1 < fhCont1->GetXaxis()->GetXmax() && pT2 > fhCont2->GetXaxis()->GetXmin() && pT2 < fhCont2->GetXaxis()->GetXmax())
959       {
960         cont1 = fhCont1->GetBinContent(fhCont1->FindFixBin(pT1));
961         cont2 = fhCont1->GetBinContent(fhCont2->FindFixBin(pT2));
962       }
963     else
964       return 0;
965
966     int boolSum = fdoPtCorr+fdoEtaCorr+fdoPhiCorr+fdoZVertCorr;
967     if(boolSum == 0)
968       {
969         return 1;
970       }
971     else if(boolSum == 1)
972       {
973
974         if(fdoPtCorr == 1)
975           {
976             if(pT1 > fh1Reco1->GetXaxis()->GetXmin() && pT1 < fh1Reco1->GetXaxis()->GetXmax() && pT2 > fh1Reco2->GetXaxis()->GetXmin() && pT2 < fh1Reco2->GetXaxis()->GetXmax())
977               {
978                 eps1 = fh1Reco1->GetBinContent(fh1Reco1->FindFixBin(pT1));
979                 eps2 = fh1Reco2->GetBinContent(fh1Reco2->FindFixBin(pT2));
980                 
981                 w1 = (1-cont1)/eps1;
982                 w2 = (1-cont2)/eps2;
983                 return w1*w2;
984               }
985             else
986               return 0;     
987           }
988
989         else if(fdoEtaCorr == 1)
990           {
991             if(eta1 > fh1Reco1->GetXaxis()->GetXmin() && eta1 < fh1Reco1->GetXaxis()->GetXmax() && eta2 > fh1Reco2->GetXaxis()->GetXmin() && eta2 < fh1Reco2->GetXaxis()->GetXmax())
992               {
993                 eps1 = fh1Reco1->GetBinContent(fh1Reco1->FindFixBin(eta1));
994                 eps2 = fh1Reco2->GetBinContent(fh1Reco2->FindFixBin(eta2));
995           
996                 w1 = (1-cont1)/eps1;
997                 w2 = (1-cont2)/eps2;
998
999                 return w1*w2;
1000               }
1001             else
1002               return 0;
1003           }
1004
1005         else if(fdoPhiCorr == 1)
1006           {
1007             if(phi1 > fh1Reco1->GetXaxis()->GetXmin() && phi1 < fh1Reco1->GetXaxis()->GetXmax() && phi2 > fh1Reco2->GetXaxis()->GetXmin() && phi2 < fh1Reco2->GetXaxis()->GetXmax())
1008               {
1009                 eps1 = fh1Reco1->GetBinContent(fh1Reco1->FindFixBin(phi1));
1010                 eps2 = fh1Reco2->GetBinContent(fh1Reco2->FindFixBin(phi2));
1011
1012                 w1 = (1-cont1)/eps1;
1013                 w2 = (1-cont2)/eps2;
1014           
1015                 return w1*w2;
1016               }
1017             else
1018               return 0;
1019
1020           }
1021
1022         else if(fdoZVertCorr == 1)
1023           {
1024             if(zvert1 > fh1Reco1->GetXaxis()->GetXmin() && zvert1 < fh1Reco1->GetXaxis()->GetXmax() && zvert2 > fh1Reco2->GetXaxis()->GetXmin() && zvert2 < fh1Reco2->GetXaxis()->GetXmax())
1025               {
1026                 eps1 = fh1Reco1->GetBinContent(fh1Reco1->FindFixBin(zvert1));
1027                 eps2 = fh1Reco2->GetBinContent(fh1Reco2->FindFixBin(zvert2));
1028           
1029                 w1 = (1-cont1)/eps1;
1030                 w2 = (1-cont2)/eps2;
1031
1032                 return w1*w2;
1033               }
1034             else
1035               return 0;
1036           }
1037
1038       }
1039
1040     else if(boolSum == 2)
1041       {
1042         if(fdoPtCorr == 1 && fdoEtaCorr == 1)
1043           {
1044             if(pT1 > fh2Reco1->GetXaxis()->GetXmin() && pT1 < fh2Reco1->GetXaxis()->GetXmax() && pT2 > fh2Reco2->GetXaxis()->GetXmin() && pT2 < fh2Reco2->GetXaxis()->GetXmax() && eta1 > fh2Reco1->GetYaxis()->GetXmin() && eta1 < fh2Reco1->GetYaxis()->GetXmax() && eta2 > fh2Reco2->GetYaxis()->GetXmin() && eta2 < fh2Reco2->GetYaxis()->GetXmax())
1045               {
1046                 eps1 = fh2Reco1->GetBinContent(fh2Reco1->GetXaxis()->FindFixBin(pT1),fh2Reco1->GetYaxis()->FindFixBin(eta1));
1047                 eps2 = fh2Reco2->GetBinContent(fh2Reco2->GetXaxis()->FindFixBin(pT2),fh2Reco2->GetYaxis()->FindFixBin(eta2));
1048
1049                 w1 = (1-cont1)/eps1; 
1050                 w2 = (1-cont2)/eps2;
1051
1052                 return w1*w2;
1053               }
1054             else
1055               return 0;
1056
1057           }
1058
1059         if(fdoPtCorr == 1 && fdoPhiCorr == 1)
1060           {
1061          
1062             if(pT1 > fh2Reco1->GetXaxis()->GetXmin() && pT1 < fh2Reco1->GetXaxis()->GetXmax() && pT2 > fh2Reco2->GetXaxis()->GetXmin() && pT2 < fh2Reco2->GetXaxis()->GetXmax() && phi1 > fh2Reco1->GetYaxis()->GetXmin() && phi1 < fh2Reco1->GetYaxis()->GetXmax() && phi2 > fh2Reco2->GetYaxis()->GetXmin() && phi2 < fh2Reco2->GetYaxis()->GetXmax())
1063               {
1064                 eps1 = fh2Reco1->GetBinContent(fh2Reco1->GetXaxis()->FindFixBin(pT1),fh2Reco1->GetYaxis()->FindFixBin(phi1));
1065                 eps2 = fh2Reco2->GetBinContent(fh2Reco2->GetXaxis()->FindFixBin(pT2),fh2Reco2->GetYaxis()->FindFixBin(phi2));
1066           
1067                 w1 = (1-cont1)/eps1;
1068                 w2 = (1-cont2)/eps2;
1069
1070                 return w1*w2;
1071               }
1072             else
1073               return 0;
1074
1075           }
1076
1077         else if(fdoPtCorr == 1 && fdoZVertCorr == 1)
1078           {
1079
1080             if(pT1 > fh2Reco1->GetXaxis()->GetXmin() && pT1 < fh2Reco1->GetXaxis()->GetXmax() && pT2 > fh2Reco2->GetXaxis()->GetXmin() && pT2 < fh2Reco2->GetXaxis()->GetXmax() && zvert1 > fh2Reco1->GetYaxis()->GetXmin() && zvert1 < fh2Reco1->GetYaxis()->GetXmax() && zvert2 > fh2Reco2->GetYaxis()->GetXmin() && zvert2 < fh2Reco2->GetYaxis()->GetXmax())
1081               {
1082                 eps1 = fh2Reco1->GetBinContent(fh2Reco1->GetXaxis()->FindFixBin(pT1),fh2Reco1->GetYaxis()->FindFixBin(zvert1));
1083                 eps2 = fh2Reco2->GetBinContent(fh2Reco2->GetXaxis()->FindFixBin(pT2),fh2Reco2->GetYaxis()->FindFixBin(zvert2));
1084
1085                 w1 = (1-cont1)/eps1;
1086                 w2 = (1-cont2)/eps2;
1087           
1088                 return w1*w2;
1089               }
1090             else
1091               return 0;
1092           }
1093         else if(fdoEtaCorr == 1 && fdoPhiCorr == 1)
1094           {
1095
1096             if(eta1 > fh2Reco1->GetXaxis()->GetXmin() && eta1 < fh2Reco1->GetXaxis()->GetXmax() && eta2 > fh2Reco2->GetXaxis()->GetXmin() && eta2 < fh2Reco2->GetXaxis()->GetXmax() && phi1 > fh2Reco1->GetYaxis()->GetXmin() && phi1 < fh2Reco1->GetYaxis()->GetXmax() && phi2 > fh2Reco2->GetYaxis()->GetXmin() && phi2 < fh2Reco2->GetYaxis()->GetXmax())
1097               {
1098                 eps1 = fh2Reco1->GetBinContent(fh2Reco1->GetXaxis()->FindFixBin(eta1),fh2Reco1->GetYaxis()->FindFixBin(phi1));
1099                 eps2 = fh2Reco2->GetBinContent(fh2Reco2->GetXaxis()->FindFixBin(eta2),fh2Reco2->GetYaxis()->FindFixBin(phi2));
1100           
1101                 w1 = (1-cont1)/eps1;
1102                 w2 = (1-cont2)/eps2;
1103
1104                 return w1*w2;
1105               }
1106             else
1107               return 0;
1108
1109
1110           }
1111         else if(fdoEtaCorr == 1 && fdoZVertCorr == 1)
1112           {
1113
1114             if(eta1 > fh2Reco1->GetXaxis()->GetXmin() && eta1 < fh2Reco1->GetXaxis()->GetXmax() && eta2 > fh2Reco2->GetXaxis()->GetXmin() && eta2 < fh2Reco2->GetXaxis()->GetXmax() && zvert1 > fh2Reco1->GetYaxis()->GetXmin() && zvert1 < fh2Reco1->GetYaxis()->GetXmax() && zvert2 > fh2Reco2->GetXaxis()->GetXmin() && zvert2 < fh2Reco2->GetXaxis()->GetXmax())
1115               {
1116                 eps1 = fh2Reco1->GetBinContent(fh2Reco1->GetXaxis()->FindFixBin(eta1),fh2Reco1->GetYaxis()->FindFixBin(zvert1));
1117                 eps1 = fh2Reco2->GetBinContent(fh2Reco2->GetXaxis()->FindFixBin(eta2),fh2Reco2->GetYaxis()->FindFixBin(zvert2));
1118
1119
1120                 w1 = (1-cont1)/eps1;
1121                 w2 = (1-cont2)/eps2;
1122           
1123                 return w1*w2;
1124               }
1125             else
1126               return 0;
1127
1128           }
1129         else if(fdoPhiCorr == 1 && fdoZVertCorr == 1)
1130           {
1131
1132             if(phi1 > fh2Reco1->GetXaxis()->GetXmin() && phi1 < fh2Reco1->GetXaxis()->GetXmax() && phi2 > fh2Reco2->GetXaxis()->GetXmin() && phi2 < fh2Reco2->GetXaxis()->GetXmax() && zvert1 > fh2Reco1->GetYaxis()->GetXmin() && zvert1 < fh2Reco1->GetYaxis()->GetXmax() && zvert2 > fh2Reco2->GetYaxis()->GetXmin() && zvert2 < fh2Reco2->GetYaxis()->GetXmax())
1133               {
1134                 eps1 = fh2Reco1->GetBinContent(fh2Reco1->GetXaxis()->FindFixBin(phi1),fh2Reco1->GetYaxis()->FindFixBin(zvert1));
1135                 eps2 = fh2Reco2->GetBinContent(fh2Reco2->GetXaxis()->FindFixBin(phi2),fh2Reco2->GetYaxis()->FindFixBin(zvert2));
1136
1137                 w1 = (1-cont1)/eps1;
1138                 w2 = (1-cont2)/eps2;
1139           
1140                 return w1*w2;
1141               }
1142             else
1143               return 0;
1144
1145           }
1146       }
1147
1148
1149     else if(boolSum == 3)
1150       {
1151         if(fdoPtCorr == 1 && fdoEtaCorr == 1 && fdoPhiCorr == 1)
1152           {
1153             if(pT1 >fh3Reco1->GetXaxis()->GetXmin() && pT1 <fh3Reco1->GetXaxis()->GetXmax() && 
1154                pT2 > fh3Reco2->GetXaxis()->GetXmin() && pT2 <fh3Reco2->GetXaxis()->GetXmax() && 
1155                eta1 > fh3Reco1->GetYaxis()->GetXmin() && eta1 <fh3Reco1->GetYaxis()->GetXmax() &&  
1156                eta2 > fh3Reco2->GetYaxis()->GetXmin() && eta2 <fh3Reco2->GetYaxis()->GetXmax() &&  
1157                phi1 > fh3Reco1->GetZaxis()->GetXmin() && phi1 < fh3Reco1->GetZaxis()->GetXmax() && 
1158                phi2 > fh3Reco2->GetZaxis()->GetXmin() && phi2 < fh3Reco2->GetZaxis()->GetXmax())
1159               {
1160                 eps1 = fh3Reco1->GetBinContent(fh3Reco1->GetXaxis()->FindFixBin(pT1),fh3Reco1->GetYaxis()->FindFixBin(eta1),fh3Reco1->GetZaxis()->FindFixBin(phi1));
1161                 eps2 = fh3Reco2->GetBinContent(fh3Reco2->GetXaxis()->FindFixBin(pT2),fh3Reco2->GetYaxis()->FindFixBin(eta2),fh3Reco2->GetZaxis()->FindFixBin(phi2));
1162           
1163                 w1 = (1-cont1)/eps1;
1164                 w2 = (1-cont2)/eps2;
1165
1166                 return w1*w2;
1167               }
1168             else
1169               return 0;
1170
1171
1172         }
1173
1174         else if(fdoPtCorr == 1 && fdoEtaCorr == 1 && fdoZVertCorr == 1)
1175           {
1176
1177             if(pT1 >fh3Reco1->GetXaxis()->GetXmin() && pT1 <fh3Reco1->GetXaxis()->GetXmax() && pT2 > fh3Reco2->GetXaxis()->GetXmin() && pT2 <fh3Reco2->GetXaxis()->GetXmax() && eta1 > fh3Reco1->GetYaxis()->GetXmin() && eta1 <fh3Reco1->GetYaxis()->GetXmax() &&  eta2 > fh3Reco2->GetYaxis()->GetXmin() && eta2 <fh3Reco2->GetYaxis()->GetXmax() &&  zvert1 > fh3Reco1->GetZaxis()->GetXmin() && zvert1 < fh3Reco1->GetZaxis()->GetXmax() &&  zvert2 > fh3Reco2->GetZaxis()->GetXmin() && zvert2 < fh3Reco2->GetZaxis()->GetXmax())
1178               {
1179                 eps1 = fh3Reco1->GetBinContent(fh3Reco1->GetXaxis()->FindFixBin(pT1),fh3Reco1->GetYaxis()->FindFixBin(eta1),fh3Reco1->GetZaxis()->FindFixBin(zvert1));
1180                 eps2 = fh3Reco2->GetBinContent(fh3Reco2->GetXaxis()->FindFixBin(pT2),fh3Reco2->GetYaxis()->FindFixBin(eta2),fh3Reco2->GetZaxis()->FindFixBin(zvert2));
1181           
1182                 w1 = (1-cont1)/eps1;
1183                 w2 = (1-cont2)/eps2;
1184
1185                 return w1*w2;
1186               }
1187             else
1188               return 0;
1189           }
1190
1191         else if(fdoPtCorr == 1 && fdoPhiCorr == 1 && fdoZVertCorr == 1)
1192           {
1193
1194             if(pT1 >fh3Reco1->GetXaxis()->GetXmin() && pT1 <fh3Reco1->GetXaxis()->GetXmax() && pT2 > fh3Reco2->GetXaxis()->GetXmin() && pT2 <fh3Reco2->GetXaxis()->GetXmax() && phi1 > fh3Reco1->GetYaxis()->GetXmin() && phi1 <fh3Reco1->GetYaxis()->GetXmax() &&  phi2 > fh3Reco2->GetYaxis()->GetXmin() && phi2 <fh3Reco2->GetYaxis()->GetXmax() &&  zvert1 > fh3Reco1->GetZaxis()->GetXmin() && zvert1 < fh3Reco1->GetZaxis()->GetXmax() &&  zvert2 > fh3Reco2->GetZaxis()->GetXmin() && zvert2 < fh3Reco2->GetZaxis()->GetXmax())
1195               {
1196                 eps1 = fh3Reco1->GetBinContent(fh3Reco1->GetXaxis()->FindFixBin(pT1),fh3Reco1->GetYaxis()->FindFixBin(phi1),fh3Reco1->GetZaxis()->FindFixBin(zvert1));
1197                 eps2 = fh3Reco2->GetBinContent(fh3Reco2->GetXaxis()->FindFixBin(pT2),fh3Reco2->GetYaxis()->FindFixBin(phi2),fh3Reco2->GetZaxis()->FindFixBin(zvert2));
1198           
1199                 w1 = (1-cont1)/eps1;
1200                 w2 = (1-cont2)/eps2;
1201
1202                 return w1*w2;
1203               }
1204             else
1205               return 0;
1206
1207           }
1208
1209         else if(fdoEtaCorr == 1 && fdoPhiCorr == 1 && fdoZVertCorr == 1)
1210           {
1211
1212             if(eta1 >fh3Reco1->GetXaxis()->GetXmin() && eta1 <fh3Reco1->GetXaxis()->GetXmax() && eta2 > fh3Reco2->GetXaxis()->GetXmin() && eta2 <fh3Reco2->GetXaxis()->GetXmax() && phi1 > fh3Reco1->GetYaxis()->GetXmin() && phi1 <fh3Reco1->GetYaxis()->GetXmax() &&  phi2 > fh3Reco2->GetYaxis()->GetXmin() && phi2 <fh3Reco2->GetYaxis()->GetXmax() &&  zvert1 > fh3Reco1->GetZaxis()->GetXmin() && zvert1 < fh3Reco1->GetZaxis()->GetXmax() &&  zvert2 > fh3Reco2->GetZaxis()->GetXmin() && zvert2 < fh3Reco2->GetZaxis()->GetXmax())
1213               {
1214                 eps1 = fh3Reco1->GetBinContent(fh3Reco1->GetXaxis()->FindFixBin(eta1),fh3Reco1->GetYaxis()->FindFixBin(phi1),fh3Reco1->GetZaxis()->FindFixBin(zvert1));
1215                 eps2 = fh3Reco2->GetBinContent(fh3Reco2->GetXaxis()->FindFixBin(eta2),fh3Reco2->GetYaxis()->FindFixBin(phi2),fh3Reco2->GetZaxis()->FindFixBin(zvert2));
1216           
1217                 w1 = (1-cont1)/eps1;
1218                 w2 = (1-cont2)/eps2;
1219
1220                 return w1*w2;
1221               }
1222             else
1223               return 0;
1224
1225           }
1226       }
1227
1228     else if(boolSum == 4)
1229       {
1230                                                           
1231         if(pT1 > fhntReco1->GetAxis(0)->GetXmin() && pT1 < fhntReco1->GetAxis(0)->GetXmax() && pT2 > fhntReco2->GetAxis(0)->GetXmin() && pT2 < fhntReco2->GetAxis(0)->GetXmax() && eta1 > fhntReco1->GetAxis(1)->GetXmin() && eta1 <fhntReco1->GetAxis(1)->GetXmax() && eta2 > fhntReco2->GetAxis(1)->GetXmin() && eta2 < fhntReco2->GetAxis(1)->GetXmax() && phi1 > fhntReco1->GetAxis(2)->GetXmin() && phi2 < fhntReco2->GetAxis(2)->GetXmax() && phi2 > fhntReco2->GetAxis(2)->GetXmin() && phi2 < fhntReco2->GetAxis(2)->GetXmax() && zvert1 > fhntReco1->GetAxis(3)->GetXmin() && zvert1 < fhntReco1->GetAxis(3)->GetXmax() && zvert2 > fhntReco2->GetAxis(3)->GetXmin() && zvert2 < fhntReco2->GetAxis(3)->GetXmax())
1232               {
1233
1234                 int tab1[] = {fhntReco1->GetAxis(0)->FindFixBin(pT1),fhntReco1->GetAxis(1)->FindFixBin(eta1),fhntReco1->GetAxis(2)->FindFixBin(phi1),fhntReco1->GetAxis(3)->FindFixBin(zvert1)};
1235                 int tab2[] = {fhntReco2->GetAxis(0)->FindFixBin(pT2),fhntReco2->GetAxis(1)->FindFixBin(eta2),fhntReco2->GetAxis(2)->FindFixBin(phi2),fhntReco2->GetAxis(3)->FindFixBin(zvert2)};
1236        
1237                 eps1 = fhntReco1->GetBinContent(tab1);
1238                 eps2 = fhntReco2->GetBinContent(tab2);
1239
1240                 w1 = (1-cont1)/eps1;
1241                 w2 = (1-cont2)/eps2;
1242                 return w1*w2;
1243                   
1244               }
1245             else
1246               return 0;
1247
1248       }
1249     
1250     return 0;
1251       
1252 }