Setters/getters updated, code polished
authorprsnko <Dmitri.Peressounko@cern.ch>
Wed, 24 Sep 2014 06:19:38 +0000 (10:19 +0400)
committermkrzewic <mikolaj.krzewicki@cern.ch>
Mon, 29 Sep 2014 08:47:47 +0000 (10:47 +0200)
PWGGA/PHOSTasks/PHOS_Correlation/AddTaskPi0Correlations.C
PWGGA/PHOSTasks/PHOS_Correlation/AliPHOSCorrelations.cxx
PWGGA/PHOSTasks/PHOS_Correlation/AliPHOSCorrelations.h

index 89e4d0f..9610939 100644 (file)
@@ -44,14 +44,18 @@ AliPHOSCorrelations* AddTaskPi0Correlations (       const char* name = "Pi0Corr",
                task->SetCentralityEstimator("V0M");
                if( downCentLimit == 0 && upCentLimit == 10 ) 
                {
-                       task->SetMassMeanParametrs(-4.03237e-05, 0.138352);
-                       task->SetMassSigmaParametrs(0.00722915, 1.24329e-08, 0.00553326, 0.00128347);
+                       Double_t meanParametrs[2]  = { -4.03237e-05, 0.138352 };
+                       Double_t sigmaParametrs[4] = { 0.00722915, 1.24329e-08, 0.00553326, 0.00128347 };
+                       task->SetMassMeanParametrs(meanParametrs);
+                       task->SetMassSigmaParametrs(sigmaParametrs);
                }
 
                if( downCentLimit == 20 && upCentLimit == 50 ) 
                {
-                       task->SetMassMeanParametrs(1.00796e-05, 0.136096);
-                       task->SetMassSigmaParametrs(0.00100059, 1.10485, 0.00570446, 0.00100001);
+                       Double_t meanParametrs[2]  = { 1.00796e-05, 0.136096 };
+                       Double_t sigmaParametrs[4] = { 0.00100059, 1.10485, 0.00570446, 0.00100001 };
+                       task->SetMassMeanParametrs(meanParametrs);
+                       task->SetMassSigmaParametrs(sigmaParametrs);
                }
 
        }
@@ -60,15 +64,18 @@ AliPHOSCorrelations* AddTaskPi0Correlations (       const char* name = "Pi0Corr",
                task->SetCentralityEstimator("V0A");
                if( downCentLimit == 0 && upCentLimit == 10 ) 
                {
-                       task->SetMassMeanParametrs(-1.15288e-05, 0.134496);
-                       task->SetMassSigmaParametrs(0.00541561, 1.55431e-15, 0.00661674, 0.00899229);
+                       Double_t meanParametrs[2]  = { -1.15288e-05, 0.134496 };
+                       Double_t sigmaParametrs[4] = {0.00541561, 1.55431e-15, 0.00661674, 0.00899229 };
+                       task->SetMassMeanParametrs(meanParametrs);
+                       task->SetMassSigmaParametrs(sigmaParametrs);
                }
 
                if( downCentLimit == 20 && upCentLimit == 50 ) 
                {
-                       task->SetMassMeanParametrs(-8.28487e-06, 0.134528);
-                       task->SetMassSigmaParametrs(0.0070921, 2.05058e-12, 0.00660061, 0.00750263);
-
+                       Double_t meanParametrs[2]  = { -8.28487e-06, 0.134528 };
+                       Double_t sigmaParametrs[4] = { 0.0070921, 2.05058e-12, 0.00660061, 0.00750263 };
+                       task->SetMassMeanParametrs(meanParametrs);
+                       task->SetMassSigmaParametrs(sigmaParametrs);
                }
        }
 
@@ -96,8 +103,6 @@ AliPHOSCorrelations* AddTaskPi0Correlations (        const char* name = "Pi0Corr",
                task->SetCentralityBinning(tbin, tNMixed);
        }
 
-       task->SetAnalysisAlgoritmForReal("ME");
-       task->SetAnalysisAlgoritmForMix("ME");
        task->EnableTOFCut(false, 100.e-9);
        task->SelectCollisionCandidates(AliVEvent::kAny);
        task->SetCentralityBorders(downCentLimit , upCentLimit) ;
index 2f03deb..ee4f602 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
  
-// Analysis task for identified PHOS cluster from pi0 and extracting pi0-hadron correlation.
-// Authors:    Daniil Ponomarenko <Daniil.Ponomarenko@cern.ch>
-//             Dmitry Blau <Dmitry.Blau@cern.ch>
-// 09-Jul-2014
+// Analysis task for identifion PHOS cluster from Pi0 and extracting pi0-hadron correlation.
+// Author:     Daniil Ponomarenko <Daniil.Ponomarenko@cern.ch>
+// 20-Sept-2014
 
 #include <Riostream.h>
 #include "THashList.h"
@@ -68,115 +67,82 @@ ClassImp(AliPHOSCorrelations)
 AliPHOSCorrelations::AliPHOSCorrelations()
 :AliAnalysisTaskSE(),
        fPHOSGeo(0x0),
-       fOutputContainer(0x0),
-       fMinClusterEnergy(0.3),
-       fMinBCDistance(0),
-       fMinNCells(3),
-       fMinM02(0.2),
-       fTOFCutEnabled(1),
-       fTOFCut(100.e-9),
-       fNVtxZBins(1),
-       fCentEdges(10),
-       fCentNMixed(),
-       fNEMRPBins(9),
-       fAssocBins(),   
-    fUseMEAlgoritmForReal(true),
-    fUseMEAlgoritmForMix(true),
-    fUseEfficiency(true),
-    fMakePHOSModulesCorrFunctions(false),
-    fMakeTPCHalfBarrelCorrFunctions(false),
-       fCheckHibridGlobal(kOnlyHibridTracks),
+    fOutputContainer(0x0),
+    fEvent(0x0),
+    fEventESD(0x0),
+    fEventAOD(0x0),
+    fEventHandler(0),
+    fCaloPhotonsPHOS(0x0),
+    fTracksTPC(0x0),
+    fCaloPhotonsPHOSLists(0x0),
+    fTracksTPCLists(0x0),
+    fRunNumber(-999),
+    fInternalRunNumber(0),
+    fPeriod(kUndefinedPeriod),
        fPHOSEvent(false),
-       fMBEvent(false),
-       fPeriod(kUndefinedPeriod),
-       fMaxAbsVertexZ(10.),
-       fManualV0EPCalc(false),
-       fCentCutoffDown(0.),
-       fCentCutoffUp(90),
-       fMassInvMean(0.135),
-       fMassInvSigma(0.05),
-       fSigmaWidth(0.),
-       fMassMeanP0(1.00796e-05),
-       fMassMeanP1(0.136096),
-       fMassSigmaP0(0.00100059),
-       fMassSigmaP1(1.10485),
-       fMassSigmaP2(0.00570446),
-       fMassSigmaP3(0.00100001),
-       fEvent(0x0),
-       fEventESD(0x0),
-       fEventAOD(0x0),
-       fEventHandler(0),
-       fESDtrackCuts(0x0),
-       fRunNumber(-999),
-       fInternalRunNumber(0),
-       fMultV0(0x0),
-       fV0Cpol(0.),fV0Apol(0.),
-       fEPcalibFileName("$ALICE_ROOT/OADB/PHOS/PHOSflat.root"),
+    fMBEvent(false),
+    fNVtxZBins(10),
+    fCentEdges(10),
+    fCentNMixed(),
+    fNEMRPBins(9),
+    fAssocBins(),
        fVertexVector(),
-       fVtxBin(0),
-       fCentralityEstimator("V0M"),
-       fCentrality(0.),
-       fCentBin(0),
-       fHaveTPCRP(0),
-       fRP(0.),
-       fEMRPBin(0),
-       fCaloPhotonsPHOS(0x0),
-       fTracksTPC(0x0),
-       fCaloPhotonsPHOSLists(0x0),
-       fTracksTPCLists(0x0)
-{
-  //Deafult constructor, no memory allocations here
-}
-
-//_______________________________________________________________________________
-AliPHOSCorrelations::AliPHOSCorrelations(const char *name)
-:AliAnalysisTaskSE(name),
-    fPHOSGeo(0x0),
-    fOutputContainer(0x0),
+    fVtxBin(0),
+    fCentralityEstimator("V0M"),
+    fCentrality(0.),
+    fCentBin(0),
+    fHaveTPCRP(0),
+    fRP(0.),
+    fEMRPBin(0),
+    fMaxAbsVertexZ(10.),
+    fCentralityLowLimit(0.),
+    fCentralityHightLimit(90),
+    fESDtrackCuts(0x0),
+    fCheckHibridGlobal(kOnlyHibridTracks),
     fMinClusterEnergy(0.3),
     fMinBCDistance(0),
     fMinNCells(3),
     fMinM02(0.2),
     fTOFCutEnabled(1),
     fTOFCut(100.e-9),
-    fNVtxZBins(1),
-    fCentEdges(10),
-    fCentNMixed(),
-    fNEMRPBins(9),
-    fAssocBins(),
-    fUseMEAlgoritmForReal(true),
-    fUseMEAlgoritmForMix(true),
-    fUseEfficiency(true),
-    fMakePHOSModulesCorrFunctions(false),
-    fMakeTPCHalfBarrelCorrFunctions(false),
-    fCheckHibridGlobal(kOnlyHibridTracks),
-    fPHOSEvent(false),
-    fMBEvent(false),
-    fPeriod(kUndefinedPeriod),
-    fMaxAbsVertexZ(10.),
-    fManualV0EPCalc(false),
-    fCentCutoffDown(0.),
-    fCentCutoffUp(90),
     fMassInvMean(0.135),
     fMassInvSigma(0.05),
     fSigmaWidth(0.),
-    fMassMeanP0(1.00796e-05),
-       fMassMeanP1(0.136096),
-       fMassSigmaP0(0.00100059),
-       fMassSigmaP1(1.10485),
-       fMassSigmaP2(0.00570446),
-       fMassSigmaP3(0.00100001),
+    fUseEfficiency(true)
+{
+       //Deafult constructor, no memory allocations here
+       fMassMean[0] = 1.00796e-05 ;
+       fMassMean[1] = 0.136096    ;
+       fMassSigma[0] = 0.00100059 ;
+       fMassSigma[1] = 1.10485 ;
+       fMassSigma[2] = 0.00570446 ;
+       fMassSigma[3] = 0.00100001 ;
+}
+
+//_______________________________________________________________________________
+AliPHOSCorrelations::AliPHOSCorrelations(const char *name)
+:AliAnalysisTaskSE(name),
+    fPHOSGeo(0x0),
+    fOutputContainer(0x0),
     fEvent(0x0),
     fEventESD(0x0),
     fEventAOD(0x0),
     fEventHandler(0),
-    fESDtrackCuts(0x0),
+    fCaloPhotonsPHOS(0x0),
+    fTracksTPC(0x0),
+    fCaloPhotonsPHOSLists(0x0),
+    fTracksTPCLists(0x0),
     fRunNumber(-999),
     fInternalRunNumber(0),
-    fMultV0(0x0),
-    fV0Cpol(0.),fV0Apol(0.),
-    fEPcalibFileName("$ALICE_ROOT/OADB/PHOS/PHOSflat.root"),
-    fVertexVector(),
+    fPeriod(kUndefinedPeriod),
+       fPHOSEvent(false),
+    fMBEvent(false),
+    fNVtxZBins(10),
+    fCentEdges(10),
+    fCentNMixed(),
+    fNEMRPBins(9),
+    fAssocBins(),
+       fVertexVector(),
     fVtxBin(0),
     fCentralityEstimator("V0M"),
     fCentrality(0.),
@@ -184,28 +150,47 @@ AliPHOSCorrelations::AliPHOSCorrelations(const char *name)
     fHaveTPCRP(0),
     fRP(0.),
     fEMRPBin(0),
-    fCaloPhotonsPHOS(0x0),
-    fTracksTPC(0x0),
-    fCaloPhotonsPHOSLists(0x0),
-    fTracksTPCLists(0x0)
+    fMaxAbsVertexZ(10.),
+    fCentralityLowLimit(0.),
+    fCentralityHightLimit(90),
+    fESDtrackCuts(0x0),
+    fCheckHibridGlobal(kOnlyHibridTracks),
+    fMinClusterEnergy(0.3),
+    fMinBCDistance(0),
+    fMinNCells(3),
+    fMinM02(0.2),
+    fTOFCutEnabled(1),
+    fTOFCut(100.e-9),
+    fMassInvMean(0.135),
+    fMassInvSigma(0.05),
+    fSigmaWidth(0.),
+    fUseEfficiency(true)
 {
     // Constructor
     // Output slots #0 write into a TH1 container
     DefineOutput(1,THashList::Class());
 
-    const Int_t nPtAssoc=10 ;
-    Double_t ptAssocBins[nPtAssoc]={0.,0.5,1.0,1.5,2.0,3.,5.,7.,10.,16} ;
+    fMassMean[0] = 1.00796e-05 ;
+       fMassMean[1] = 0.136096    ;
+       fMassSigma[0] = 0.00100059 ;
+       fMassSigma[1] = 1.10485 ;
+       fMassSigma[2] = 0.00570446 ;
+       fMassSigma[3] = 0.00100001 ;
+
+    const Int_t nPtAssoc = 10 ;
+    Double_t ptAssocBins[nPtAssoc] = {0.,0.5,1.0,1.5,2.0,3.,5.,7.,10.,16} ;
     fAssocBins.Set(nPtAssoc,ptAssocBins) ;
 
     const int nbins = 9;
     Double_t edges[nbins+1] = {0., 5., 10., 20., 30., 40., 50., 60., 70., 80.};
-    TArrayD centEdges(nbins+1, edges);
+    TArrayD centEdges( nbins+1, edges );
     Int_t nMixed[nbins] = {4,4,6,10,20,30,50,100,100};
-    //Int_t nMixed[nbins] = {100,100,100,100,100,100,100,100,100};
     TArrayI centNMixed(nbins, nMixed);
     SetCentralityBinning(centEdges, centNMixed);
 
-    fVertex[0]=0; fVertex[1]=0; fVertex[2]=0;
+    fVertex[0] = 0; 
+    fVertex[1] = 0; 
+    fVertex[2] = 0;
 
     SetGeometry();
 
@@ -216,67 +201,60 @@ AliPHOSCorrelations::AliPHOSCorrelations(const char *name)
 AliPHOSCorrelations::AliPHOSCorrelations(const char *name, Period period)
 :AliAnalysisTaskSE(name),
        fPHOSGeo(0x0),
-       fOutputContainer(0x0),
-       fMinClusterEnergy(0.3),
-       fMinBCDistance(0),
-       fMinNCells(3),
-       fMinM02(0.2),
-       fTOFCutEnabled(1),
-       fTOFCut(100.e-9),
-       fNVtxZBins(1),
-       fCentEdges(10),
-       fCentNMixed(),
-       fNEMRPBins(9),
-       fAssocBins(),   
-    fUseMEAlgoritmForReal(true),
-    fUseMEAlgoritmForMix(true),
-    fUseEfficiency(true),
-    fMakePHOSModulesCorrFunctions(false),
-    fMakeTPCHalfBarrelCorrFunctions(false),
-       fCheckHibridGlobal(kOnlyHibridTracks),
+    fOutputContainer(0x0),
+    fEvent(0x0),
+    fEventESD(0x0),
+    fEventAOD(0x0),
+    fEventHandler(0),
+    fCaloPhotonsPHOS(0x0),
+    fTracksTPC(0x0),
+    fCaloPhotonsPHOSLists(0x0),
+    fTracksTPCLists(0x0),
+    fRunNumber(-999),
+    fInternalRunNumber(0),
+    fPeriod(period),
        fPHOSEvent(false),
-       fMBEvent(false),
-       fPeriod(period),
-       fMaxAbsVertexZ(10.),
-       fManualV0EPCalc(false),
-       fCentCutoffDown(0.),
-       fCentCutoffUp(90),
-       fMassInvMean(0.135),
-       fMassInvSigma(0.05),
-       fSigmaWidth(0.),
-       fMassMeanP0(1.00796e-05),
-       fMassMeanP1(0.136096),
-       fMassSigmaP0(0.00100059),
-       fMassSigmaP1(1.10485),
-       fMassSigmaP2(0.00570446),
-       fMassSigmaP3(0.00100001),
-       fEvent(0x0),
-       fEventESD(0x0),
-       fEventAOD(0x0),
-       fEventHandler(0),
-       fESDtrackCuts(0x0),
-       fRunNumber(-999),
-       fInternalRunNumber(0),
-       fMultV0(0x0),
-       fV0Cpol(0.),fV0Apol(0.),
-       fEPcalibFileName("$ALICE_ROOT/OADB/PHOS/PHOSflat.root"),
+    fMBEvent(false),
+    fNVtxZBins(10),
+    fCentEdges(10),
+    fCentNMixed(),
+    fNEMRPBins(9),
+    fAssocBins(),
        fVertexVector(),
-       fVtxBin(0),
-       fCentralityEstimator("V0M"),
-       fCentrality(0.),
-       fCentBin(0),
-       fHaveTPCRP(0),
-       fRP(0.),
-       fEMRPBin(0),
-       fCaloPhotonsPHOS(0x0),
-       fTracksTPC(0x0),
-       fCaloPhotonsPHOSLists(0x0),
-       fTracksTPCLists(0x0)
+    fVtxBin(0),
+    fCentralityEstimator("V0M"),
+    fCentrality(0.),
+    fCentBin(0),
+    fHaveTPCRP(0),
+    fRP(0.),
+    fEMRPBin(0),
+    fMaxAbsVertexZ(10.),
+    fCentralityLowLimit(0.),
+    fCentralityHightLimit(90),
+    fESDtrackCuts(0x0),
+    fCheckHibridGlobal(kOnlyHibridTracks),
+    fMinClusterEnergy(0.3),
+    fMinBCDistance(0),
+    fMinNCells(3),
+    fMinM02(0.2),
+    fTOFCutEnabled(1),
+    fTOFCut(100.e-9),
+    fMassInvMean(0.135),
+    fMassInvSigma(0.05),
+    fSigmaWidth(0.),
+    fUseEfficiency(true)
 {
        // Constructor
        // Output slots #0 write into a TH1 container
        DefineOutput(1,THashList::Class());
 
+       fMassMean[0] = 1.00796e-05 ;
+       fMassMean[1] = 0.136096    ;
+       fMassSigma[0] = 0.00100059 ;
+       fMassSigma[1] = 1.10485 ;
+       fMassSigma[2] = 0.00570446 ;
+       fMassSigma[3] = 0.00100001 ;
+
        const Int_t nPtAssoc=10 ;
        Double_t ptAssocBins[nPtAssoc]={0.,0.5,1.0,1.5,2.0,3.,5.,7.,10.,16} ;
        fAssocBins.Set(nPtAssoc,ptAssocBins) ;
@@ -289,12 +267,15 @@ AliPHOSCorrelations::AliPHOSCorrelations(const char *name, Period period)
        TArrayI centNMixed(nbins, nMixed);
        SetCentralityBinning(centEdges, centNMixed);
 
-       fVertex[0]=0; fVertex[1]=0; fVertex[2]=0; 
+       fVertex[0] = 0; 
+       fVertex[1] = 0; 
+       fVertex[2] = 0; 
 
        SetGeometry();
 
        ZeroingVariables();
 }
+
 //_______________________________________________________________________________
 AliPHOSCorrelations::~AliPHOSCorrelations()
 {
@@ -330,15 +311,16 @@ AliPHOSCorrelations::~AliPHOSCorrelations()
          fOutputContainer=0x0;
        }         
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::UserCreateOutputObjects()
 {
        // Create histograms
        // Called once
-       const Int_t nRuns=200 ;
-       const Int_t  ptMult = 200;
-       const Double_t ptMin = 0.;
-       const Double_t ptMax = 20.;
+       const Int_t     nRuns   =200 ;
+       const Int_t     ptMult  = 300;
+       const Double_t  ptMin   = 0.;
+       const Double_t  ptMax   = 30.;
 
        // Create histograms
        if(fOutputContainer != NULL) { delete fOutputContainer; }
@@ -346,28 +328,27 @@ void AliPHOSCorrelations::UserCreateOutputObjects()
        fOutputContainer->SetOwner(kTRUE);
        
     // Event selection
-    fOutputContainer->Add(new TH1F("hTriggerPassedEvents","Event selection passed Cuts", 20, 0., 20.) );
+    fOutputContainer->Add(new TH1F( "hTriggerPassedEvents","Event selection passed Cuts",      20, 0., 20.) );
     // Analysis event's progress
-    fOutputContainer->Add(new TH1F("hTotSelEvents","Event selection", 15, 0., 15)) ;
-       fOutputContainer->Add(new TH2F("hSelEvents","Event selection", kTotalSelected+1, 0., double(kTotalSelected+1), nRuns,0.,float(nRuns))) ;
+    fOutputContainer->Add(new TH1F( "hTotSelEvents","Event selection",                                                 15, 0., 15)) ;
+       fOutputContainer->Add(new TH2F( "hSelEvents","Event selection", kTotalSelected+1, 0., double(kTotalSelected+1), nRuns,0., float(nRuns) )) ;
     // Centrality, Reaction plane selection
-    fOutputContainer->Add(new TH2F("hCentrality","Event centrality of all events", 100,0.,100.,nRuns,0.,float(nRuns))) ;
-    fOutputContainer->Add(new TH2F("hCentralityTriggerEvent","Event centrality trigger events", 100,0.,100.,nRuns,0.,float(nRuns))) ;
-    fOutputContainer->Add(new TH2F("hCentralityMBEvent","Event centrality MB events", 100,0.,100.,nRuns,0.,float(nRuns))) ;
-
-       fOutputContainer->Add(new TH2F("phiRPflat","RP distribution with TPC flat", 100, 0., 2.*TMath::Pi(),20,0.,100.)) ;
+    fOutputContainer->Add(new TH2F( "hCentrality","Event centrality of all events",                            100, 0., 100., nRuns,0., float(nRuns)   )) ;
+    fOutputContainer->Add(new TH2F( "hCentralityTriggerEvent","Event centrality trigger events",       100, 0., 100., nRuns,0., float(nRuns)   )) ;
+    fOutputContainer->Add(new TH2F( "hCentralityMBEvent","Event centrality MB events",                                 100, 0., 100., nRuns,0., float(nRuns)   )) ;
+       fOutputContainer->Add(new TH2F( "phiRPflat","RP distribution with TPC flat",                                    100, 0., 2.*TMath::Pi(), 20, 0., 100.   )) ;
     // Mass selection
-       fOutputContainer->Add(new TH2F("massWindow","mean & sigma", 100,0.095,0.185,500,0.,0.05));
-    fOutputContainer->Add(new TH1F("massWindowPass","Mass selection", 10, 0., 10.)) ;
+       fOutputContainer->Add(new TH2F( "massWindow","mean & sigma",                                                                    100,0.095,0.185,500,0.,0.05));
+    fOutputContainer->Add(new TH1F( "massWindowPass","Mass selection",                                                                 10, 0., 10.)) ;
     // Cluster multiplisity
-       fOutputContainer->Add(new TH2F("hCluEvsClu","ClusterMult vs E",200,0.,10.,100,0.,100.)) ;
+       fOutputContainer->Add(new TH2F( "hCluEvsClu","ClusterMult vs E",                                                                200,0.,10.,100,0.,100.)) ;
        
 
        // Set hists, with track's and cluster's angle distributions.
        SetHistPtNumTrigger(ptMult, ptMin, ptMax);
        SetHistEtaPhi();
        SetHistPHOSClusterMap();
-       SetHistMass(ptMult, ptMin, ptMax);
+       SetHistMass       (ptMult, ptMin, ptMax);
        SetHistPtAssoc(ptMult, ptMin, ptMax);
 
        // Setup photon lists
@@ -380,13 +361,16 @@ void AliPHOSCorrelations::UserCreateOutputObjects()
 
        PostData(1, fOutputContainer);
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetHistPtNumTrigger(Int_t  ptMult, Double_t ptMin, Double_t ptMax)
 {
        TString spid[4]={"all","cpv","disp","both"} ;
        for(Int_t ipid=0; ipid<4; ipid++)       
        {
-               fOutputContainer->Add(new TH1F(Form("nTrigger_%s", spid[ipid].Data()), Form("Num of trigger particle %s", spid[ipid].Data()), ptMult+300, ptMin, ptMax ) );
+               fOutputContainer->Add(new TH1F( Form("nTrigger_%s", spid[ipid].Data()), 
+                                                                               Form("Num of trigger particle %s", spid[ipid].Data()), 
+                                                                               ptMult+300, ptMin, ptMax ) );
                TH1F *h = static_cast<TH1F*>(fOutputContainer->Last()) ;
                h->Sumw2();
                h->GetXaxis()->SetTitle("Pt [GEV]");
@@ -394,13 +378,16 @@ void AliPHOSCorrelations::SetHistPtNumTrigger(Int_t  ptMult, Double_t ptMin, Dou
        }
        for(Int_t ipid=0; ipid<4; ipid++)       
        {
-               fOutputContainer->Add(new TH1F(Form("nTrigger_%s_MB", spid[ipid].Data()), Form("Num of trigger particle %s", spid[ipid].Data()), ptMult+300, ptMin, ptMax ) );
+               fOutputContainer->Add(new TH1F( Form("nTrigger_%s_MB", spid[ipid].Data()), 
+                                                                               Form("Num of trigger particle %s", spid[ipid].Data()), 
+                                                                               ptMult+300, ptMin, ptMax ) );
                TH1F *h = static_cast<TH1F*>(fOutputContainer->Last()) ;
                h->Sumw2();
                h->GetXaxis()->SetTitle("Pt [GEV]");
                //h->GetYaxis()->SetTitle("#varepsilon"); // 1/efficiensy
        }
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetHistEtaPhi() 
 {
@@ -409,31 +396,35 @@ void AliPHOSCorrelations::SetHistEtaPhi()
        Float_t pi = TMath::Pi();
 
        //===
-       fOutputContainer->Add(new TH2F("clu_phieta","Cluster's #phi & #eta distribution", 300, double(-1.8), double(-0.6), 300, double(-0.2), double(0.2) ) );
+       fOutputContainer->Add(new TH2F( "clu_phieta","Cluster's #phi & #eta distribution", 
+                                                                       300, double(-1.8), double(-0.6), 
+                                                                       300, double(-0.2), double(0.2) ) );
        TH2F * h = static_cast<TH2F*>(fOutputContainer->Last()) ;
-       h->GetXaxis()->SetTitle("#phi [rad]");
+    h->GetXaxis()->SetTitle("#phi [rad]");
        h->GetYaxis()->SetTitle("#eta");
 
        //===
-               fOutputContainer->Add(new TH2F("clusingle_phieta","Cluster's  #phi & #eta distribution", 300, double(-1.8), double(-0.6), 300, double(-0.2), double(0.2) ) );
+               fOutputContainer->Add(new TH2F( "clusingle_phieta","Cluster's  #phi & #eta distribution", 
+                                                                               300, double(-1.8), double(-0.6), 
+                                                                               300, double(-0.2), double(0.2) ) );
        h = static_cast<TH2F*>(fOutputContainer->Last()) ;
-       h->GetXaxis()->SetTitle("#phi [rad]");
+    h->GetXaxis()->SetTitle("#phi [rad]");
        h->GetYaxis()->SetTitle("#eta");
        
        //===
-       fOutputContainer->Add(new TH2F("track_phieta","TPC track's  #phi & #eta distribution", 200, double(-pi-0.3), double(pi+0.3), 200, double(-0.9), double(0.9) ) );
+       fOutputContainer->Add(new TH2F( "track_phieta","TPC track's  #phi & #eta distribution", 
+                                                                       200, double(-pi-0.3), double(pi+0.3), 
+                                                                       200, double(-0.9), double(0.9) ) );
        h = static_cast<TH2F*>(fOutputContainer->FindObject("track_phieta")) ;
-       h->GetXaxis()->SetTitle("#phi [rad]");
+    h->GetXaxis()->SetTitle("#phi [rad]");
        h->GetYaxis()->SetTitle("#eta");
 } 
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetHistMass(Int_t  ptMult, Double_t ptMin, Double_t ptMax) 
 {
-       // Set other histograms.
-       // cout<<"\nSetting output SetHist_CutDistribution...";
-       
-       // Double_t massMin = fMassInvMean-fMassInvSigma;
-       // Double_t massMax = fMassInvMean+fMassInvSigma;
+       // Set mass histograms.
+
        Double_t binMult = 400;
        Double_t massMin = 0.0;
        Double_t massMax = 0.4;
@@ -446,44 +437,9 @@ void AliPHOSCorrelations::SetHistMass(Int_t  ptMult, Double_t ptMin, Double_t pt
        {
                // Real ++++++++++++++++++++++++++++++
 
-               fOutputContainer->Add(new TH2F(Form("%s_mpt",spid[ipid].Data() )," real ", binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
-               h = static_cast<TH2F*>(fOutputContainer->Last()) ;
-               //h->Sumw2();
-               h->GetXaxis()->SetTitle("Mass [GeV]");
-               h->GetYaxis()->SetTitle("Pt [GEV]");
-
-               // MIX +++++++++++++++++++++++++
-
-               fOutputContainer->Add(new TH2F(Form("mix_%s_mpt",spid[ipid].Data() )," mix ", binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
-               h = static_cast<TH2F*>(fOutputContainer->Last()) ;
-               //h->Sumw2();
-           h->GetXaxis()->SetTitle("Mass [GeV]");
-               h->GetYaxis()->SetTitle("Pt [GEV]");
-       }
-
-       // Calibration PHOS Module Pi0peak {REAL}
-       for(Int_t mod=1; mod<4; mod++){
-         fOutputContainer->Add(new TH2F(Form("both%d_mpt",mod),Form("Both cuts (CPV + Disp) mod[%d]",mod), binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
-         h = static_cast<TH2F*>(fOutputContainer->Last()) ;
-         //h->Sumw2();
-         h->GetXaxis()->SetTitle("Mass [GeV]");
-         h->GetYaxis()->SetTitle("Pt [GEV]");
-
-         // Calibration PHOS Module Pi0peak {MIX}
-         fOutputContainer->Add(new TH2F(Form("mix_both%d_mpt",mod),Form(" Both cuts (CPV + Disp) mod[%d]",mod), binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
-         h = static_cast<TH2F*>(fOutputContainer->Last()) ;
-         //h->Sumw2();
-         h->GetXaxis()->SetTitle("Mass [GeV]");
-         h->GetYaxis()->SetTitle("Pt [GEV]");
-         
-       }
-
-       // For efficiensy.
-       for(Int_t ipid=0; ipid<4; ipid++)       
-       {
-               // Real ++++++++++++++++++++++++++++++
-
-               fOutputContainer->Add(new TH2F(Form("%s_mpt_eff",spid[ipid].Data() )," real ", binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
+               fOutputContainer->Add(new TH2F(Form("%s_mpt", spid[ipid].Data() ), "Real", 
+                                                                                       binMult, massMin, massMax, 
+                                                                                       ptMult, ptMin, ptMax ) );
                h = static_cast<TH2F*>(fOutputContainer->Last()) ;
                h->Sumw2();
                h->GetXaxis()->SetTitle("Mass [GeV]");
@@ -491,62 +447,71 @@ void AliPHOSCorrelations::SetHistMass(Int_t  ptMult, Double_t ptMin, Double_t pt
 
                // MIX +++++++++++++++++++++++++
 
-               fOutputContainer->Add(new TH2F(Form("mix_%s_mpt_eff",spid[ipid].Data() )," mix ", binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
+               fOutputContainer->Add(new TH2F(Form("mix_%s_mpt", spid[ipid].Data() ), "Mix", 
+                                                                                       binMult, massMin, massMax, 
+                                                                                       ptMult, ptMin, ptMax ) );
                h = static_cast<TH2F*>(fOutputContainer->Last()) ;
                h->Sumw2();
-       h->GetXaxis()->SetTitle("Mass [GeV]");
+           h->GetXaxis()->SetTitle("Mass [GeV]");
                h->GetYaxis()->SetTitle("Pt [GEV]");
        }
 
        // Calibration PHOS Module Pi0peak {REAL}
        for(Int_t mod=1; mod<4; mod++){
-         fOutputContainer->Add(new TH2F(Form("both%d_mpt_eff",mod),Form("Both cuts (CPV + Disp) mod[%d]",mod), binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
+         fOutputContainer->Add(new TH2F(Form(  "both%d_mpt",mod), Form("Both cuts (CPV + Disp) mod[%d]",mod), 
+                                                                                       binMult, massMin, massMax, 
+                                                                                       ptMult, ptMin, ptMax ) );
          h = static_cast<TH2F*>(fOutputContainer->Last()) ;
          h->Sumw2();
-         h->GetXaxis()->SetTitle("Mass [GeV]");
+         h->GetXaxis()->SetTitle("Mass [GeV]");
          h->GetYaxis()->SetTitle("Pt [GEV]");
 
          // Calibration PHOS Module Pi0peak {MIX}
-         fOutputContainer->Add(new TH2F(Form("mix_both%d_mpt_eff",mod),Form(" Both cuts (CPV + Disp) mod[%d]",mod), binMult, massMin, massMax, ptMult, ptMin, ptMax ) );
+         fOutputContainer->Add(new TH2F(Form(  "mix_both%d_mpt",mod), Form(" Both cuts (CPV + Disp) mod[%d]",mod), 
+                                                                                       binMult, massMin, massMax, 
+                                                                                       ptMult, ptMin, ptMax ) );
          h = static_cast<TH2F*>(fOutputContainer->Last()) ;
          h->Sumw2();
-         h->GetXaxis()->SetTitle("Mass [GeV]");
+         h->GetXaxis()->SetTitle("Mass [GeV]");
          h->GetYaxis()->SetTitle("Pt [GEV]");
+         
        }
-
-       // cout<<"  OK!"<<endl;
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetHistPtAssoc(Int_t  ptMult, Double_t ptMin, Double_t ptMax)
 {
        Double_t pi = TMath::Pi();
        
-       Int_t PhiMult  =  100;
-       Float_t PhiMin =  -0.5*pi;
-       Float_t PhiMax =  1.5*pi;
-       Int_t EtaMult  =  20; 
-       Float_t EtaMin = -1.;
-       Float_t EtaMax =  1.;
+       Int_t PhiMult  =  100           ;
+       Float_t PhiMin =  -0.5*pi       ;
+       Float_t PhiMax =  1.5*pi        ;
+       Int_t EtaMult  =  20            ; 
+       Float_t EtaMin = -1.            ;
+       Float_t EtaMax =  1.            ;
 
        TString spid[4]={"all","cpv","disp","both"} ;
-       Int_t PhotonsInMod[6] = {1, 2, 3, 12, 13, 23};
        
        for (int i = 0; i<fAssocBins.GetSize()-1; i++){
          for(Int_t ipid=0; ipid<4; ipid++){
-               // Main histo for ConsiderPi0s() or ConsiderPi0sME().
-               fOutputContainer->Add(new TH3F(Form("%s_ptphieta_ptAssoc_%3.1f",spid[ipid].Data(),fAssocBins.At(i+1)),
-                                              Form("%s_ptphieta_ptAssoc_%3.1f",spid[ipid].Data(),fAssocBins.At(i+1)), 
-                                              ptMult, ptMin, ptMax,  PhiMult, PhiMin, PhiMax, EtaMult, EtaMin, EtaMax ) );
+               // Main histo for ConsiderPi0s().
+               fOutputContainer->Add(new TH3F(Form("%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), fAssocBins.At(i+1)),
+                                              Form("%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), fAssocBins.At(i+1)), 
+                                              ptMult, ptMin, ptMax,  
+                                              PhiMult, PhiMin, PhiMax, 
+                                              EtaMult, EtaMin, EtaMax ) );
                TH3F * h = static_cast<TH3F*>(fOutputContainer->Last()) ;
                h->Sumw2();
        h->GetXaxis()->SetTitle("Pt_{triger} [GEV]");
                h->GetYaxis()->SetTitle("#phi [rad]");
                h->GetZaxis()->SetTitle("#eta");
 
-               // For ConsiderPi0sME_MBSelection().
-               fOutputContainer->Add(new TH3F(Form("%s_ptphieta_ptAssoc_%3.1f_MB",spid[ipid].Data(),fAssocBins.At(i+1)),
-                                              Form("%s_ptphieta_ptAssoc_%3.1f",spid[ipid].Data(),fAssocBins.At(i+1)), 
-                                              ptMult, ptMin, ptMax,  PhiMult, PhiMin, PhiMax, EtaMult, EtaMin, EtaMax ) );
+               // For ConsiderPi0s_MBSelection().
+               fOutputContainer->Add(new TH3F(Form("%s_ptphieta_ptAssoc_%3.1f_MB", spid[ipid].Data(), fAssocBins.At(i+1)),
+                                              Form("%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), fAssocBins.At(i+1)), 
+                                              ptMult, ptMin, ptMax,  
+                                              PhiMult, PhiMin, PhiMax, 
+                                              EtaMult, EtaMin, EtaMax ) );
                h = static_cast<TH3F*>(fOutputContainer->Last()) ;
                h->Sumw2();
        h->GetXaxis()->SetTitle("Pt_{triger} [GEV]");
@@ -554,63 +519,44 @@ void AliPHOSCorrelations::SetHistPtAssoc(Int_t  ptMult, Double_t ptMin, Double_t
                h->GetZaxis()->SetTitle("#eta");
 
                // For Mixed events in ConsiderTracksMix()
-               fOutputContainer->Add(new TH3F(Form("mix_%s_ptphieta_ptAssoc_%3.1f",spid[ipid].Data(),fAssocBins.At(i+1)),
-                                              Form("Mixed %s_ptphieta_ptAssoc_%3.1f",spid[ipid].Data(),fAssocBins.At(i+1)),
-                                              ptMult, ptMin, ptMax,  PhiMult, PhiMin, PhiMax, EtaMult, EtaMin, EtaMax ) );
+               fOutputContainer->Add(new TH3F(Form("mix_%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), fAssocBins.At(i+1)),
+                                              Form("Mixed %s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), fAssocBins.At(i+1)),
+                                              ptMult, ptMin, ptMax,  
+                                              PhiMult, PhiMin, PhiMax, 
+                                              EtaMult, EtaMin, EtaMax ) );
                h = static_cast<TH3F*>(fOutputContainer->Last()) ;
                h->Sumw2();
                h->GetXaxis()->SetTitle("Pt_{triger} [GEV]");
                h->GetYaxis()->SetTitle("#phi [rad]");
                h->GetZaxis()->SetTitle("#eta");
-
-               if(fMakePHOSModulesCorrFunctions)       // For checking PHOS module dependens correletion function.
-               for(Int_t m=0; m<6; m++)
-               {
-                       fOutputContainer->Add(new TH3F(Form("mix_%s_ptphieta_ptAssoc_%3.1f_mod%i",spid[ipid].Data(),fAssocBins.At(i+1), PhotonsInMod[m]),
-                                              Form("Mixed %s_ptphieta_ptAssoc_%3.1f_mod%i",spid[ipid].Data(),fAssocBins.At(i+1), PhotonsInMod[m]),
-                                              ptMult, ptMin, ptMax,  PhiMult, PhiMin, PhiMax, EtaMult, EtaMin, EtaMax ) );
-                       h = static_cast<TH3F*>(fOutputContainer->Last()) ;
-                       h->Sumw2();
-                       h->GetXaxis()->SetTitle("Pt_{triger} [GEV]");
-                       h->GetYaxis()->SetTitle("#phi [rad]");
-                       h->GetZaxis()->SetTitle("#eta");
-               }
-
-               if(fMakeTPCHalfBarrelCorrFunctions) // For checking TPC dependens correletion function.
-               for(Int_t itpc=1; itpc<3; itpc++)
-               {
-                       fOutputContainer->Add(new TH3F(Form("mix_%s_ptphieta_ptAssoc_%3.1f_tpc%i",spid[ipid].Data(),fAssocBins.At(i+1), itpc),
-                                              Form("Mixed %s_ptphieta_ptAssoc_%3.1f_tpc%i",spid[ipid].Data(),fAssocBins.At(i+1), itpc),
-                                              ptMult, ptMin, ptMax,  PhiMult, PhiMin, PhiMax, EtaMult, EtaMin, EtaMax ) );
-                       h = static_cast<TH3F*>(fOutputContainer->Last()) ;
-                       h->Sumw2();
-                       h->GetXaxis()->SetTitle("Pt_{triger} [GEV]");
-                       h->GetYaxis()->SetTitle("#phi [rad]");
-                       h->GetZaxis()->SetTitle("#eta");
-               }
          }
        }
 }
 
+//_______________________________________________________________________________
 void AliPHOSCorrelations::SetHistPHOSClusterMap()
 {
+       //  Cluster X/Z/E distribution.
        for(int i =  0; i<5; i++)
        {
-               //  Cluster X/Z/E distribution.
-               fOutputContainer->Add(new TH3F(Form("QA_cluXZE_mod%i", i),Form("PHOS Clusters XZE distribution of module %i", i), 70, 0, 70, 60, 0, 60, 200, 0, 20 ) );
+               fOutputContainer->Add(new TH3F( Form("QA_cluXZE_mod%i", i), Form("PHOS Clusters XZE distribution of module %i", i), 
+                                                                               70, 0, 70, 
+                                                                               60, 0, 60, 
+                                                                               200, 0, 20 ) );
                TH3F *h = static_cast<TH3F*>(fOutputContainer->Last()) ;
            h->GetXaxis()->SetTitle("X");
                h->GetYaxis()->SetTitle("Z");
                h->GetZaxis()->SetTitle("E");
        }       
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::UserExec(Option_t *) 
 {
        // Main loop, called for each event analyze ESD/AOD 
        // Step 0: Event Objects
-
     LogProgress(0);
+
        fEvent = InputEvent();
        if( ! fEvent ) 
        {
@@ -619,23 +565,23 @@ void AliPHOSCorrelations::UserExec(Option_t *)
                return ;
        }
     LogProgress(1);
-               
-    ZeroingVariables();
-
-       fEventESD = dynamic_cast<AliESDEvent*>(fEvent);
-       fEventAOD = dynamic_cast<AliAODEvent*>(fEvent);
 
        // Step 1(done once):  
        if( fRunNumber != fEvent->GetRunNumber() )
        {
                fRunNumber = fEvent->GetRunNumber();
                fInternalRunNumber = ConvertToInternalRunNumber(fRunNumber);
-               //SetGeometry();
                SetESDTrackCuts();
        }
+       LogProgress(2);
+
+       // Step 2: Preparation variables for new event
+    ZeroingVariables();
 
-       //Data
-       //get Event-Handler for the trigger information
+       fEventESD = dynamic_cast<AliESDEvent*>(fEvent);
+       fEventAOD = dynamic_cast<AliAODEvent*>(fEvent);
+
+       // Get Event-Handler for the trigger information
        fEventHandler= dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
        if (!fEventHandler) 
        {
@@ -643,16 +589,18 @@ void AliPHOSCorrelations::UserExec(Option_t *)
                PostData(1, fOutputContainer);
                return; // Reject!
        }
-    LogProgress(2);
+    LogProgress(3);
 
+    // Step 3: Event trigger selection
+    // fPHOSEvent, fMBEvent
        if( RejectTriggerMaskSelection() ) 
        {
                PostData(1, fOutputContainer);
                return; // Reject!
        }
-    LogProgress(3);
-       
-       // Step 2: Vertex
+    LogProgress(4);
+
+       // Step 4: Vertex
        // fVertex, fVertexVector, fVtxBin
        SetVertex();
        if( RejectEventVertex() ) 
@@ -660,9 +608,9 @@ void AliPHOSCorrelations::UserExec(Option_t *)
                PostData(1, fOutputContainer);
                return; // Reject!
        }
-    LogProgress(4);
+    LogProgress(5);
 
-       // Step 3: Centrality
+       // Step 5: Centrality
        // fCentrality, fCentBin
        SetCentrality(); 
        if( RejectEventCentrality() ) 
@@ -670,108 +618,80 @@ void AliPHOSCorrelations::UserExec(Option_t *)
                PostData(1, fOutputContainer);
                return; // Reject!
        }
-    LogProgress(5);
-    FillHistogram("hCentrality",fCentrality,fInternalRunNumber-0.5) ;
-    if(fPHOSEvent) FillHistogram("hCentralityTriggerEvent",fCentrality,fInternalRunNumber-0.5) ;
-    if(fMBEvent) FillHistogram("hCentralityMBEvent",fCentrality,fInternalRunNumber-0.5) ;
+    LogProgress(6);
+    if(fPHOSEvent)     FillHistogram( "hCentralityTriggerEvent",       fCentrality, fInternalRunNumber-0.5 ) ;
+    if(fMBEvent)       FillHistogram( "hCentralityMBEvent",            fCentrality, fInternalRunNumber-0.5 ) ;
+    FillHistogram( "hCentrality", fCentrality, fInternalRunNumber-0.5 ) ;
 
-       // Step 4: Reaction Plane
+       // Step 6: Reaction Plane
        // fHaveTPCRP, fRP, fRPV0A, fRPV0C, fRPBin
        EvalReactionPlane();  
        fEMRPBin = GetRPBin(); 
        
-       // Step 5: Event Photons (PHOS Clusters) selectionMakeFlat
+       // Step 7: Event Photons (PHOS Clusters) selection
        SelectPhotonClusters();
        if( ! fCaloPhotonsPHOS->GetEntriesFast() )      
                LogSelection(kHasPHOSClusters, fInternalRunNumber);
 
-       // Step 6: Event Associated particles (TPC Tracks) selection
+       // Step 8: Event Associated particles (TPC Tracks) selection
        SelectAccosiatedTracks();
        if( ! fTracksTPC->GetEntriesFast() )    
         LogSelection(kHasTPCTracks, fInternalRunNumber);
        LogSelection(kTotalSelected, fInternalRunNumber);
 
-    // Step 7: Make TPC's mask
+    // Step 9: Fill TPC's track mask
     FillTrackEtaPhi();
+    LogProgress(7);
 
-    LogProgress(6);
 
-    // Step 8: Start correlation analysis.
-    // Filling real histograms:
-    if (fUseMEAlgoritmForReal) // if true than use ME algoritm
-    {
-        LogProgress(7);
-        SelectTriggerPi0ME();   // Extract one most energetic pi0 candidate in this event.
-
-        if (fPHOSEvent)
-        {
-            ConsiderPi0sME(); // Consider the most energetic Pi0 in this event with all tracks of this event.
-            LogProgress(8);
-        }
-        
-        if(fPeriod == kLHC13 && fMBEvent) 
-        {
-               ConsiderPi0sME_MBSelection();
-               LogProgress(9);
-        }
+    // Step 10: Extract one most energetic pi0 candidate in this event.   
+    SelectTriggerPi0ME();
 
+    // Step 11: Start correlation analysis.
+    if (fPHOSEvent)
+    {
+        ConsiderPi0s(); // Consider the most energetic Pi0 in this event with all tracks of this event.
+        LogProgress(8);
     }
-    else //using common algoritm
+    
+    if(fPeriod == kLHC13 && fMBEvent) 
     {
-        LogProgress(11);
-        if (fPHOSEvent)
-        {
-            ConsiderPi0s(); // Extract all pi0 candidates and compare them with all track of this event.
-            LogProgress(12);
-        }
+       ConsiderPi0s_MBSelection();
+       LogProgress(9);
     }
 
     // Filling mixing histograms:
-    if(fUseMEAlgoritmForMix) // if true than use ME algoritm
+    if (fMBEvent)
     {
-        // Filling mixing histograms
-        if (fMBEvent)
-        {
-            if (!fUseMEAlgoritmForReal)  SelectTriggerPi0ME();   // Extract one most energetic pi0 candidate in this event if it not done yet.
+        ConsiderPi0sMix();      // Make background for extracting pi0 mass.
+        ConsiderTracksMix();  // Compare only one most energetic pi0 candidate with all tracks from previous MB events.
 
-            ConsiderPi0sMix();      // Make background for extracting pi0 mass.
-            ConsiderTracksMixME();  // Compare only one most energetic pi0 candidate with all tracks from previous MB events.
-
-            UpdatePhotonLists();    // Updating pull of photons.
-            UpdateTrackLists();     // Updating pull of tracks.
-            LogProgress(10);
-        }
-    }
-    else //using common algoritm
-    {
-        if (fMBEvent)
-        {
-            ConsiderPi0sMix();      // Make background for extracting pi0 mass.
-            ConsiderTracksMix();    // Compare all pi0 candidates in current event whit all tracks from previous MB events.
-
-            UpdatePhotonLists();
-            UpdateTrackLists();
-            LogProgress(13);
-        }
+        UpdatePhotonLists();    // Updating pull of photons.
+        UpdateTrackLists();     // Updating pull of tracks.
+        LogProgress(10);
     }
 
     LogProgress(14);
        // Post output data.
        PostData(1, fOutputContainer);
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetESDTrackCuts()
 {
-  if( fEventESD ) {
-    // Create ESD track cut
-    fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts() ;
-    //fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
-    fESDtrackCuts->SetRequireTPCRefit(kTRUE);
-  }
+       if( fEventESD ) 
+       {
+               // Create ESD track cut
+               fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts() ;
+               fESDtrackCuts->SetRequireTPCRefit(kTRUE) ;
+       }
 }
+
 //_______________________________________________________________________________
-Int_t AliPHOSCorrelations::ConvertToInternalRunNumber(Int_t run){
-  if(fPeriod== kLHC11h){
+Int_t AliPHOSCorrelations::ConvertToInternalRunNumber(Int_t run)
+{
+       // Manual setup using data from logbook.
+       if(fPeriod== kLHC11h){
                                switch(run)
                                {
                                        case  170593 : return 179 ;
@@ -1281,7 +1201,7 @@ Int_t AliPHOSCorrelations::ConvertToInternalRunNumber(Int_t run){
                                        AliWarning("Period not defined");
                                }
                                return 1;
-                       }
+}
 
 //_______________________________________________________________________________
 Bool_t AliPHOSCorrelations::RejectTriggerMaskSelection()
@@ -1295,44 +1215,42 @@ Bool_t AliPHOSCorrelations::RejectTriggerMaskSelection()
 
        Int_t physSelMask = fEventHandler->IsEventSelected();
 
-       Bool_t isAny = physSelMask & AliVEvent::kAny;
+       Bool_t isAny             = physSelMask & AliVEvent::kAny;
 
-       Bool_t isPHI1 = physSelMask & AliVEvent::kPHI1;
-       Bool_t isPHI7 = physSelMask & AliVEvent::kPHI7;
-       Bool_t isPHI8 = physSelMask & AliVEvent::kPHI8;
-       Bool_t isCentral = physSelMask & AliVEvent::kCentral;
+       Bool_t isPHI1            = physSelMask & AliVEvent::kPHI1;
+       Bool_t isPHI7            = physSelMask & AliVEvent::kPHI7;
+       Bool_t isPHI8            = physSelMask & AliVEvent::kPHI8;
+       Bool_t isCentral         = physSelMask & AliVEvent::kCentral;
        Bool_t isSemiCentral = physSelMask & AliVEvent::kSemiCentral;
-       Bool_t isPHOSPb = physSelMask & AliVEvent::kPHOSPb;
-
-       Bool_t isMB = physSelMask & AliVEvent::kMB;
-       Bool_t isINT7 = physSelMask & AliVEvent::kINT7;
-       Bool_t isAnyINT = physSelMask & AliVEvent::kAnyINT;
+       Bool_t isPHOSPb          = physSelMask & AliVEvent::kPHOSPb;
 
+       Bool_t isMB              = physSelMask & AliVEvent::kMB;
+       Bool_t isINT7            = physSelMask & AliVEvent::kINT7;
+       Bool_t isAnyINT          = physSelMask & AliVEvent::kAnyINT;
 
+       FillHistogram("hTriggerPassedEvents", 0 );
        // All input events
-       FillHistogram("hTriggerPassedEvents", 0);
-       //if ( !isAny ) cout<<"Strange event"<<endl; // We loose some events O_o
-       if ( isAny ) FillHistogram("hTriggerPassedEvents", 1.);         
+       if ( isAny )             FillHistogram("hTriggerPassedEvents",  1.) ;           
 
        // PHOS events.
-       if ( isPHI1 ) FillHistogram("hTriggerPassedEvents",  2.);       
-       if ( isPHI7 ) FillHistogram("hTriggerPassedEvents",  3.);       
-       if ( isPHI8 ) FillHistogram("hTriggerPassedEvents",  4.); 
-       if ( isCentral ) FillHistogram("hTriggerPassedEvents", 5.);     
-       if ( isSemiCentral ) FillHistogram("hTriggerPassedEvents", 6.); 
-       if ( isPHOSPb ) FillHistogram("hTriggerPassedEvents", 7.);      
+       if ( isPHI1 )            FillHistogram("hTriggerPassedEvents",  2. );   
+       if ( isPHI7 )            FillHistogram("hTriggerPassedEvents",  3. );   
+       if ( isPHI8 )            FillHistogram("hTriggerPassedEvents",  4. ); 
+       if ( isCentral )         FillHistogram("hTriggerPassedEvents",  5. );   
+       if ( isSemiCentral ) FillHistogram("hTriggerPassedEvents",      6. ); 
+       if ( isPHOSPb )          FillHistogram("hTriggerPassedEvents",  7. );   
 
        // MB events.
-       if ( isMB ) FillHistogram("hTriggerPassedEvents", 8.);          
-       if ( isINT7 ) FillHistogram("hTriggerPassedEvents", 9.);
-       if ( isAnyINT ) FillHistogram("hTriggerPassedEvents", 10.);
+       if ( isMB )              FillHistogram("hTriggerPassedEvents",  8. );           
+       if ( isINT7 )            FillHistogram("hTriggerPassedEvents",  9. );
+       if ( isAnyINT )          FillHistogram("hTriggerPassedEvents", 10. );
 
 
        Bool_t isTriggerEvent ;
-       Bool_t isMIXEvent ;
+       Bool_t isMIXEvent         ;
 
-       fPHOSEvent = false;
-       fMBEvent = false;
+       fPHOSEvent      = false ;
+       fMBEvent        = false ;
 
        if(fPeriod == kLHC13) 
        {
@@ -1369,8 +1287,8 @@ Bool_t AliPHOSCorrelations::RejectTriggerMaskSelection()
                {
                        FillHistogram("hTriggerPassedEvents", 16.);
                        FillHistogram("hTriggerPassedEvents", 17.);
-                       fPHOSEvent = true;
-                       fMBEvent = true;
+                       fPHOSEvent      = true;
+                       fMBEvent        = true;
                        return ACCEPT;
                }
        }
@@ -1379,6 +1297,7 @@ Bool_t AliPHOSCorrelations::RejectTriggerMaskSelection()
        FillHistogram("hTriggerPassedEvents",  18.); 
        return REJECT;
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetVertex()
 {
@@ -1400,19 +1319,19 @@ void AliPHOSCorrelations::SetVertex()
 
        fVtxBin=0 ;// No support for vtx binning implemented.
 }
+
 //_______________________________________________________________________________
 Bool_t AliPHOSCorrelations::RejectEventVertex()
 {
-  if( ! fEvent->GetPrimaryVertex() )
-    return true; // reject
+  if( ! fEvent->GetPrimaryVertex() ) return true; // reject
   LogSelection(kHasVertex, fInternalRunNumber);
  
-  if ( TMath::Abs(fVertexVector.z()) > fMaxAbsVertexZ )
-    return true; // reject
+  if ( TMath::Abs(fVertexVector.z()) > fMaxAbsVertexZ ) return true; // reject
   LogSelection(kHasAbsVertex, fInternalRunNumber);
  
   return false; // accept event.
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SetCentrality()
 {
@@ -1425,63 +1344,73 @@ void AliPHOSCorrelations::SetCentrality()
                fCentrality = -1.;
        }
 
-       //cout<<"fCentrality: "<<fCentrality<<endl;
-       //FillHistogram("hCentrality",fCentrality,fInternalRunNumber-0.5) ;
        fCentBin = GetCentralityBin(fCentrality);
 }
+
 //_______________________________________________________________________________
 Bool_t AliPHOSCorrelations::RejectEventCentrality()
 {
-       if (fCentrality<fCentCutoffDown)
+       if (fCentrality<fCentralityLowLimit)
+               return true; //reject
+       if(fCentrality>fCentralityHightLimit)
                return true; //reject
-       if(fCentrality>fCentCutoffUp)
-               return true;
 
        return false;  // accept event.
 }
+
 //_______________________________________________________________________________
-void AliPHOSCorrelations::SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed){
-// Define centrality bins by their edges
-  for(int i=0; i<edges.GetSize()-1; ++i)
-    if(edges.At(i) > edges.At(i+1)) AliFatal("edges are not sorted");
-  if( edges.GetSize() != nMixed.GetSize()+1) AliFatal("edges and nMixed don't have appropriate relative sizes");
-                 
-  fCentEdges = edges;
-  fCentNMixed = nMixed;
+void AliPHOSCorrelations::SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed)
+{
+       // Define centrality bins by their edges
+       for(int i=0; i<edges.GetSize()-1; ++i)
+       {
+               if(edges.At(i) > edges.At(i+1)) AliFatal("edges are not sorted");
+               if( edges.GetSize() != nMixed.GetSize()+1) AliFatal("edges and nMixed don't have appropriate relative sizes");
+         
+               fCentEdges = edges;
+               fCentNMixed = nMixed;
+       }
 }
+
 //_______________________________________________________________________________
-Int_t AliPHOSCorrelations::GetCentralityBin(Float_t centralityV0M){
-  int lastBinUpperIndex = fCentEdges.GetSize() -1;
-  if( centralityV0M > fCentEdges[lastBinUpperIndex] ) {
-    if( fDebug >= 1 )
-      AliWarning( Form("centrality (%f) larger then upper edge of last centrality bin (%f)!", centralityV0M, fCentEdges[lastBinUpperIndex]) );
-    return lastBinUpperIndex-1;
-  }
-  if( centralityV0M < fCentEdges[0] ) {
-    if( fDebug >= 1 )
-      AliWarning( Form("centrality (%f) smaller then lower edge of first bin (%f)!", centralityV0M, fCentEdges[0]) );
-    return 0;
-  }
-                 
-  fCentBin = TMath::BinarySearch<Double_t> ( GetNumberOfCentralityBins(), fCentEdges.GetArray(), centralityV0M );
-  return fCentBin;
+Int_t AliPHOSCorrelations::GetCentralityBin(Float_t centralityV0M)
+{
+       int lastBinUpperIndex = fCentEdges.GetSize() -1;
+       if( centralityV0M > fCentEdges[lastBinUpperIndex] ) 
+       {
+               if( fDebug >= 1 )
+                       AliWarning( Form("centrality (%f) larger then upper edge of last centrality bin (%f)!", centralityV0M, fCentEdges[lastBinUpperIndex]) );
+               return lastBinUpperIndex-1;
+       }
+       if( centralityV0M < fCentEdges[0] ) 
+       {
+               if( fDebug >= 1 )
+               AliWarning( Form("centrality (%f) smaller then lower edge of first bin (%f)!", centralityV0M, fCentEdges[0]) );
+               return 0;
+       }
+
+       fCentBin = TMath::BinarySearch<Double_t> ( GetNumberOfCentralityBins(), fCentEdges.GetArray(), centralityV0M );
+       return fCentBin;
 }
+
 //_______________________________________________________________________________
-void AliPHOSCorrelations::SetCentralityBorders (double down , double up ){
-  if (down < 0. || up > 100 || up<=down)
-     AliError( Form("Warning. Bad value of centrality borders. Setting as default: fCentCutoffDown=%2.f, fCentCutoffUp=%2.f",fCentCutoffDown,fCentCutoffUp) );
-  else{
-    fCentCutoffDown = down; 
-    fCentCutoffUp = up;
-    AliInfo( Form("Centrality border was set as fCentCutoffDown=%2.f, fCentCutoffUp=%2.f",fCentCutoffDown,fCentCutoffUp) );
-  }
+void AliPHOSCorrelations::SetCentralityBorders (double downLimit , double upLimit )
+{
+       if (downLimit < 0. || upLimit > 100 || upLimit<=downLimit)
+               AliError( Form("Warning. Bad value of centrality borders. Setting as default: fCentralityLowLimit=%2.f, fCentralityHightLimit=%2.f", fCentralityLowLimit, fCentralityHightLimit) );
+       else
+       {
+       fCentralityLowLimit     = downLimit; 
+       fCentralityHightLimit   = upLimit;
+       AliInfo( Form("Centrality border was set as fCentralityLowLimit=%2.f, fCentralityHightLimit=%2.f", fCentralityLowLimit, fCentralityHightLimit ) );
+       }
 }
 
 //_______________________________________________________________________________
 void AliPHOSCorrelations::EvalReactionPlane()
 {
        // assigns: fHaveTPCRP and fRP
-       // also does a few histogram fills
+       // also does RP histogram fill
 
        AliEventplane *eventPlane = fEvent->GetEventplane();
        if( ! eventPlane ) { AliError("Event has no event plane"); return; }
@@ -1495,6 +1424,7 @@ void AliPHOSCorrelations::EvalReactionPlane()
        }
        else
        {
+               //reaction plain defined
                fHaveTPCRP = kTRUE;
        }
 
@@ -1505,22 +1435,22 @@ void AliPHOSCorrelations::EvalReactionPlane()
        
        FillHistogram("phiRPflat",fRP,fCentrality) ;
 }
+
 //_______________________________________________________________________________
 Int_t AliPHOSCorrelations::GetRPBin()
 {
        Double_t averageRP;
-       averageRP = fRP ;       // If possible, it is better to have EP bin from TPC
-                               // to have similar events for miximng (including jets etc)   (fRPV0A+fRPV0C+fRP) /3.;
-
+       averageRP = fRP ;               // If possible, it is better to have EP bin from TPC
+                                                       // to have similar events for miximng (including jets etc)   (fRPV0A+fRPV0C+fRP) /3.;
        fEMRPBin = Int_t(fNEMRPBins*(averageRP)/TMath::Pi());
-
-       if( fEMRPBin > (Int_t)fNEMRPBins-1 ) 
+       if(fEMRPBin > (Int_t)fNEMRPBins-1) 
                fEMRPBin = fNEMRPBins-1 ;
        else 
-       if(fEMRPBin < 0) fEMRPBin=0;
+               if(fEMRPBin < 0) fEMRPBin=0;
 
        return fEMRPBin;
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SelectPhotonClusters()
 {
@@ -1535,9 +1465,9 @@ void AliPHOSCorrelations::SelectPhotonClusters()
                fCaloPhotonsPHOS->SetOwner();
        }
 
-       Int_t inPHOS=0 ;
+       Int_t inPHOS = 0 ;
 
-       for (Int_t i=0;  i<fEvent->GetNumberOfCaloClusters();  i++) 
+       for (Int_t i = 0;  i < fEvent->GetNumberOfCaloClusters();  i++) 
        {
                AliVCluster *clu = fEvent->GetCaloCluster(i);   
                if (!clu->IsPHOS() || clu->E()< fMinClusterEnergy) continue; // reject cluster
@@ -1552,13 +1482,12 @@ void AliPHOSCorrelations::SelectPhotonClusters()
                Int_t cellZPHOS = relId[3] ;
                
                Double_t distBC=clu->GetDistanceToBadChannel();
-               if(distBC<fMinBCDistance)
-                       continue ;
-
-               if(clu->GetNCells() < fMinNCells) continue ;
-               if(clu->GetM02() < fMinM02)   continue ;
+               if(distBC<fMinBCDistance)                       continue ; // reject cluster
+               if(clu->GetNCells() < fMinNCells)       continue ; // reject cluster
+               if(clu->GetM02() < fMinM02)             continue ; // reject cluster
 
-               if(fTOFCutEnabled){
+               if(fTOFCutEnabled)
+               {
                        Double_t tof = clu->GetTOF();
                        if(TMath::Abs(tof) > fTOFCut ) continue ;
                }
@@ -1566,20 +1495,19 @@ void AliPHOSCorrelations::SelectPhotonClusters()
                Double_t ecore = clu->GetCoreEnergy();
                //Double_t ecore = clu->E();
 
-               FillHistogram("hCluEvsClu", clu->E(), clu->GetNCells()) ;
+               FillHistogram("hCluEvsClu", clu->E(), clu->GetNCells()) ; 
 
                Double_t origo[3] = {0,0,0}; // don't rely on event vertex, assume (0,0,0) ?
-               //clu->GetMomentum(lorentzMomentum, fVertex);
                clu->GetMomentum(lorentzMomentum, origo);
        
-               if(inPHOS>=fCaloPhotonsPHOS->GetSize()){
+               if(inPHOS>=fCaloPhotonsPHOS->GetSize())
                        fCaloPhotonsPHOS->Expand(inPHOS+50) ;
-               }
         
-               AliCaloPhoton * ph =new((*fCaloPhotonsPHOS)[inPHOS]) AliCaloPhoton(lorentzMomentum.X(),lorentzMomentum.Py(),lorentzMomentum.Z(),lorentzMomentum.E());
+               AliCaloPhoton * ph =new((*fCaloPhotonsPHOS)[inPHOS]) AliCaloPhoton(lorentzMomentum.X(), lorentzMomentum.Py(), lorentzMomentum.Z(), lorentzMomentum.E());
                inPHOS++ ;
                ph->SetCluster(clu);
 
+               // Manual PHOS module number calculation
                /*Float_t cellId=clu->GetCellAbsId(0) ;
                Int_t mod = (Int_t)TMath:: Ceil(cellId/(56*64) ) ; */
                ph->SetModule(modPHOS) ;
@@ -1588,12 +1516,13 @@ void AliPHOSCorrelations::SelectPhotonClusters()
 
                //ph->SetNCells(clu->GetNCells());
                ph->SetMomV2(&lorentzMomentum) ;
-               ph->SetDispBit(clu->GetDispersion()<2.5) ;
-               ph->SetCPVBit(clu->GetEmcCpvDistance()>2.) ;
+               ph->SetDispBit(clu->GetDispersion() < 2.5) ;
+               ph->SetCPVBit(clu->GetEmcCpvDistance() > 2.) ;
 
                FillHistogram(Form("QA_cluXZE_mod%i", modPHOS), cellXPHOS, cellZPHOS, lorentzMomentum.E() ) ;
        }
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SelectAccosiatedTracks()
 {
@@ -1604,81 +1533,79 @@ void AliPHOSCorrelations::SelectAccosiatedTracks()
        {
                fTracksTPC = new TClonesArray("TLorentzVector",12000);
        }
-       Int_t iTracks=0 ;
-       for (Int_t i=0; i<fEvent->GetNumberOfTracks(); i++) 
+       Int_t iTracks = 0 ;
+       for (Int_t i = 0; i < fEvent->GetNumberOfTracks(); i++) 
        {
          
                AliVParticle *track = fEvent->GetTrack(i);
-                       if(fEventESD){
-                       if(!SelectESDTrack((AliESDtrack*)track)) continue ;
+       if(fEventESD)
+       {
+                               if(!SelectESDTrack((AliESDtrack*)track)) continue ; // reject track
                }
-               else{
-                       if(!SelectAODTrack((AliAODTrack*)track)) continue ;               
+               else
+               {
+                       if(!SelectAODTrack((AliAODTrack*)track)) continue ;     // reject track  
                }
+
                Double_t px = track->Px();
                Double_t py = track->Py();
-               Double_t pz = track->Pz() ;
-               Double_t e = track->E() ;
+               Double_t pz = track->Pz();
+               Double_t e  = track->E() ;
                
-               if(iTracks>=fTracksTPC->GetSize())
-                               fTracksTPC->Expand(iTracks+50) ;
+               if(iTracks >= fTracksTPC->GetSize())
+            fTracksTPC->Expand(iTracks+50) ;
                
-               new((*fTracksTPC)[iTracks]) TLorentzVector(px, py, pz,e);
+               new((*fTracksTPC)[iTracks]) TLorentzVector(px, py, pz, e);
                iTracks++ ;
        }
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::SelectTriggerPi0ME()
 {
-    const Int_t nPHOS=fCaloPhotonsPHOS->GetEntriesFast() ;
-    for(Int_t i1=0; i1 < nPHOS-1; i1++)
+    const Int_t nPHOS = fCaloPhotonsPHOS->GetEntriesFast() ;
+    for(Int_t i1 = 0; i1 < nPHOS-1; i1++)
     {
-        AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
-        for (Int_t i2=i1+1; i2<nPHOS; i2++)
+        AliCaloPhoton * ph1 = (AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
+        for (Int_t i2 = i1+1; i2 < nPHOS; i2++)
         {
             AliCaloPhoton * ph2=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i2) ;
-            TLorentzVector p12  = *ph1  + *ph2;
+            TLorentzVector p12 = *ph1 + *ph2;
 
-            Double_t phiTrigger=p12.Phi() ;
-            Double_t etaTrigger=p12.Eta() ;
+            Double_t phiTrigger = p12.Phi() ;
+            Double_t etaTrigger = p12.Eta() ;
 
-            Double_t m=p12.M() ;
-            Double_t pt=p12.Pt() ;
+            Double_t m          = p12.M() ;
+            Double_t pt  = p12.Pt();
             Double_t eff = 1./GetEfficiency(pt);
             int mod1 = ph1->Module() ;
             int mod2 = ph2->Module() ;
 
-            FillHistogram("clu_phieta",phiTrigger,etaTrigger);
-            FillHistogram("clusingle_phieta",ph1->Phi(), ph1->Eta());
-            FillHistogram("clusingle_phieta",ph2->Phi(), ph2->Eta());
-
+            FillHistogram("clu_phieta",          phiTrigger, etaTrigger );
+            FillHistogram("clusingle_phieta", ph1->Phi(), ph1->Eta() );
+            FillHistogram("clusingle_phieta", ph2->Phi(), ph2->Eta() );
 
-            FillHistogram("all_mpt",m, pt);
-            FillHistogram("all_mpt_eff",m, pt, eff);
+            FillHistogram("all_mpt", m, pt, eff );
       
             if ( ph1->IsCPVOK() && ph2->IsCPVOK() )
             {
-                FillHistogram("cpv_mpt",m, pt);
-                FillHistogram("cpv_mpt_eff",m, pt, eff);
+                FillHistogram("cpv_mpt", m, pt, eff );
                }
 
             if ( ph1->IsDispOK() && ph2->IsDispOK() )
             {
-                FillHistogram("disp_mpt",m, pt);
-                FillHistogram("disp_mpt_eff",m, pt, eff);
+                FillHistogram("disp_mpt", m, pt, eff );
                 if ( ph1->IsCPVOK() && ph2->IsCPVOK() )
                 {
-                    FillHistogram("both_mpt",m, pt);
-                    FillHistogram("both_mpt_eff",m, pt, eff);
+                    FillHistogram("both_mpt", m, pt, eff );
                     if(mod1 == mod2) // for each module
                     {
-                        FillHistogram(Form("both%d_mpt",mod1),m, pt);
-                        FillHistogram(Form("both%d_mpt_eff",mod1),m, pt, eff);
+                        FillHistogram(Form("both%d_mpt", mod1), m, pt, eff );
                     }
                 }
             }
 
-            if(!TestMass(m,pt)) continue;
+            if(!TestMass(m,pt)) continue; //reject this pair
 
             Int_t modCase = GetModCase(mod1, mod2);
 
@@ -1699,228 +1626,24 @@ void AliPHOSCorrelations::SelectTriggerPi0ME()
 //_______________________________________________________________________________
 void AliPHOSCorrelations::ConsiderPi0s()
 {
-    // Consider all photons from PHOS
-       const Int_t nPHOS=fCaloPhotonsPHOS->GetEntriesFast() ;
-       for(Int_t i1=0; i1 < nPHOS-1; i1++)
-       {
-               AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
-               for (Int_t i2=i1+1; i2<nPHOS; i2++)
-               {
-                       AliCaloPhoton * ph2=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i2) ;
-                       TLorentzVector p12  = *ph1  + *ph2;
-
-                       Double_t phiTrigger=p12.Phi() ;
-                       Double_t etaTrigger=p12.Eta() ;
-
-                       Double_t m=p12.M() ;
-                       Double_t pt=p12.Pt() ;
-                       Double_t eff = 1./GetEfficiency(pt);
-                       int mod1 = ph1->Module() ;
-                       int mod2 = ph2->Module() ;                              
-
-                       FillHistogram("clu_phieta",phiTrigger,etaTrigger);
-                       FillHistogram("clusingle_phieta",ph1->Phi(), ph1->Eta());
-                       FillHistogram("clusingle_phieta",ph2->Phi(), ph2->Eta());
-
-
-                       FillHistogram("all_mpt",m, pt);
-                       FillHistogram("all_mpt_eff",m, pt, eff);
-                       if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                       {
-                               FillHistogram("cpv_mpt",m, pt);
-                               FillHistogram("cpv_mpt_eff",m, pt, eff);
-                       }
-
-                       if ( ph1->IsDispOK() && ph2->IsDispOK() )
-                       {
-                               FillHistogram("disp_mpt",m, pt);
-                               FillHistogram("disp_mpt_eff",m, pt, eff);
-                               if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                               {
-                                       FillHistogram("both_mpt",m, pt);
-                                       FillHistogram("both_mpt_eff",m, pt, eff);
-                                       if(mod1 == mod2) // for each module
-                                       {
-                                               FillHistogram(Form("both%d_mpt",mod1),m, pt);
-                                               FillHistogram(Form("both%d_mpt_eff",mod1),m, pt, eff);
-                                       }
-                               }
-                       }       
-
-                       if(!TestMass(m,pt)) continue;
-
-            FillHistogram("nTrigger_all", pt, eff);
-                       if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                               FillHistogram("nTrigger_cpv", pt, eff);
-                       if ( ph1->IsDispOK() && ph2->IsDispOK() )
-                       {
-                               FillHistogram("nTrigger_disp", pt, eff);
-                               if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                                       FillHistogram("nTrigger_both", pt, eff);
-                       }
-
-                       // Take track's angles and compare with cluster's angles.
-                       for(Int_t i3=0; i3<fTracksTPC->GetEntriesFast(); i3++){
-                               TLorentzVector * track = (TLorentzVector*)fTracksTPC->At(i3);
-
-                               Double_t phiAssoc = track->Phi();
-                               Double_t etaAssoc = track->Eta();
-                               Double_t ptAssoc = track->Pt();
-
-                               Double_t dPhi = phiTrigger - phiAssoc;
-                               while (dPhi > 1.5*TMath::Pi()) dPhi-=2*TMath::Pi();
-                               while (dPhi < -.5*TMath::Pi()) dPhi+=2*TMath::Pi();
-
-                               Double_t dEta = etaTrigger - etaAssoc;          
-
-                               Double_t ptAssocBin=GetAssocBin(ptAssoc) ;
-                               FillHistogram(Form("all_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff);                      
-                               if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                                       FillHistogram(Form("cpv_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff);                      
-
-                               if ( ph1->IsDispOK() && ph2->IsDispOK() ){
-                                       FillHistogram(Form("disp_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff);                     
-                                       if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                                               FillHistogram(Form("both_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff);                     
-                               }
-                       }
-               }
-       }
-}
-
-//_______________________________________________________________________________
-void AliPHOSCorrelations::ConsiderPi0sMix()
-{
-       TList * arrayList = GetCaloPhotonsPHOSList(fVtxBin, fCentBin, fEMRPBin);
-       for(Int_t evi=0; evi<arrayList->GetEntries();evi++)
-       {
-               TClonesArray * mixPHOS = static_cast<TClonesArray*>(arrayList->At(evi));
-               for (Int_t i1=0; i1 < fCaloPhotonsPHOS->GetEntriesFast(); i1++)
-               {
-                       AliCaloPhoton * ph1 = (AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
-                       for(Int_t i2=0; i2 < mixPHOS->GetEntriesFast(); i2++)
-                       {
-                               AliCaloPhoton * ph2 = (AliCaloPhoton*)mixPHOS->At(i2) ;
-                               TLorentzVector p12  = *ph1  + *ph2;
-                               Double_t m=p12.M() ;
-                               Double_t pt=p12.Pt() ;
-                               Double_t eff = 1./GetEfficiency(pt);
-                               
-                               int mod1 = ph1->Module() ;
-                               int mod2 = ph2->Module() ;
-
-                               FillHistogram("mix_all_mpt", m, pt);
-                               FillHistogram("mix_all_mpt_eff", m, pt, eff);
-                               if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
-                               {
-                                       FillHistogram("mix_cpv_mpt",m, pt);
-                                       FillHistogram("mix_cpv_mpt_eff",m, pt, eff);
-                               }
-                               if ( ph1->IsDispOK() && ph2->IsDispOK() )
-                               {
-                                       FillHistogram("mix_disp_mpt",m, pt);
-                                       FillHistogram("mix_disp_mpt_eff",m, pt, eff);
-                                       if ( ph1->IsCPVOK() && ph2->IsCPVOK() )
-                                       {
-                                               FillHistogram("mix_both_mpt",m, pt);
-                                               FillHistogram("mix_both_mpt_eff",m, pt, eff);
-                                               if (mod1 == mod2) // for each module
-                                               {
-                                                       FillHistogram(Form("mix_both%d_mpt",mod1),m, pt);
-                                                       FillHistogram(Form("mix_both%d_mpt_eff",mod1),m, pt, eff);
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-}
-//_______________________________________________________________________________
-void AliPHOSCorrelations::ConsiderTracksMix()
-{
-       TList * arrayList = GetTracksTPCList(fVtxBin, fCentBin, fEMRPBin);
-       for (Int_t i1=0; i1 < fCaloPhotonsPHOS->GetEntriesFast(); i1++) {
-               AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
-               for (Int_t i2=0; i2<fCaloPhotonsPHOS->GetEntriesFast(); i2++){
-                       AliCaloPhoton * ph2=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i2) ;
-                       TLorentzVector p12  = *ph1  + *ph2;
-                       Double_t phiTrigger=p12.Phi() ;
-                       Double_t etaTrigger=p12.Eta() ;
-
-                       Double_t m=p12.M() ;
-                       Double_t pt=p12.Pt() ;
-                       Double_t eff = 1./GetEfficiency(pt);
-                       Int_t mod1 = ph1->Module();
-                       Int_t mod2 = ph2->Module();
-
-
-            if(!TestMass(m,pt)) continue;
-
-                       for(Int_t evi=0; evi<arrayList->GetEntries();evi++){
-                               TClonesArray * mixTracks = static_cast<TClonesArray*>(arrayList->At(evi));
-                               for(Int_t i3=0; i3<mixTracks->GetEntriesFast(); i3++){
-                                       TLorentzVector * track = (TLorentzVector*)mixTracks->At(i3);            
-
-                                       Double_t phiAssoc = track->Phi();
-                                       Double_t etaAssoc = track->Eta();
-                    Double_t ptAssoc =  track->Pt();
-
-                                       Double_t ptAssocBin=GetAssocBin(ptAssoc) ;
-
-                                       Double_t dPhi = phiTrigger - phiAssoc;
-                                       while (dPhi > 1.5*TMath::Pi()) dPhi-=2*TMath::Pi();
-                                       while (dPhi < -.5*TMath::Pi()) dPhi+=2*TMath::Pi();
-
-                    Double_t dEta = etaTrigger - etaAssoc;
-
-                                       FillHistogram(Form("mix_all_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff);  
-                                       if(fMakePHOSModulesCorrFunctions) FillHistogram(Form("mix_all_ptphieta_ptAssoc_%3.1f_mod%i",ptAssocBin, GetModCase(mod1, mod2)), pt, dPhi, dEta, eff);  
-                    if(fMakeTPCHalfBarrelCorrFunctions) FillHistogram(Form("mix_all_ptphieta_ptAssoc_%3.1f_tpc%i",ptAssocBin, CheckTriggerEta(etaTrigger)), pt, dPhi, dEta, eff);
-
-                                       if ( ph1->IsCPVOK() && ph2->IsCPVOK() )
-                                       {
-                                               FillHistogram(Form("mix_cpv_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff);  
-                                               if(fMakePHOSModulesCorrFunctions) FillHistogram(Form("mix_cpv_ptphieta_ptAssoc_%3.1f_mod%i",ptAssocBin, GetModCase(mod1, mod2)), pt, dPhi, dEta, eff);  
-                                               if(fMakeTPCHalfBarrelCorrFunctions) FillHistogram(Form("mix_cpv_ptphieta_ptAssoc_%3.1f_tpc%i",ptAssocBin, CheckTriggerEta(etaTrigger)), pt, dPhi, dEta, eff);   
-                                       }                       
-
-                                       if ( ph1->IsDispOK() && ph2->IsDispOK() ) {
-                                               FillHistogram(Form("mix_disp_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff); 
-                                               if(fMakePHOSModulesCorrFunctions) FillHistogram(Form("mix_disp_ptphieta_ptAssoc_%3.1f_mod%i",ptAssocBin, GetModCase(mod1, mod2)), pt, dPhi, dEta, eff); 
-                                               if(fMakeTPCHalfBarrelCorrFunctions) FillHistogram(Form("mix_disp_ptphieta_ptAssoc_%3.1f_tpc%i",ptAssocBin, CheckTriggerEta(etaTrigger)), pt, dPhi, dEta, eff);                          
-                                               if ( ph1->IsCPVOK() && ph2->IsCPVOK() )
-                                               {
-                                                       FillHistogram(Form("mix_both_ptphieta_ptAssoc_%3.1f",ptAssocBin), pt, dPhi, dEta, eff); 
-                                                       if(fMakePHOSModulesCorrFunctions) FillHistogram(Form("mix_both_ptphieta_ptAssoc_%3.1f_mod%i",ptAssocBin, GetModCase(mod1, mod2)), pt, dPhi, dEta, eff);
-                                                       if(fMakeTPCHalfBarrelCorrFunctions) FillHistogram(Form("mix_both_ptphieta_ptAssoc_%3.1f_tpc%i",ptAssocBin, CheckTriggerEta(etaTrigger)), pt, dPhi, dEta, eff);  
-                                               }                               
-                                       }
-                               }
-                       } 
-               }
-       }
-}
-
-//_______________________________________________________________________________
-void AliPHOSCorrelations::ConsiderPi0sME()
-{
-       TString spid[4]={"all","cpv","disp","both"} ;
+       TString spid[4] = {"all","cpv","disp","both"} ;
     // Counting number of trigger particles.
        for (int ipid = 0; ipid < 4; ipid++)
        {
                if (fMEExists[ipid])
-            FillHistogram(Form("nTrigger_%s", spid[ipid].Data()), GetMEPt(ipid), 1./GetEfficiency(GetMEPt(ipid)));
+            FillHistogram( Form("nTrigger_%s", spid[ipid].Data()), GetMEPt(ipid), 1./GetEfficiency(GetMEPt(ipid)) );
        }
 
     // Take track's angles and compare with trigger's angles.
-    for(Int_t i3=0; i3<fTracksTPC->GetEntriesFast(); i3++){
+    for(Int_t i3 = 0; i3 < fTracksTPC->GetEntriesFast(); i3++)
+    {
                TLorentzVector * track = (TLorentzVector*)fTracksTPC->At(i3);
 
                Double_t phiAssoc = track->Phi();
                Double_t etaAssoc = track->Eta();
-               Double_t ptAssoc = track->Pt();
+               Double_t ptAssoc  = track->Pt() ;
 
-               Double_t ptAssocBin=GetAssocBin(ptAssoc) ;
+               Double_t ptAssocBin = GetAssocBin(ptAssoc) ;
                Double_t dPhi(0.), dEta(0.);
 
                for (int ipid = 0; ipid < 4; ipid++)
@@ -1928,37 +1651,39 @@ void AliPHOSCorrelations::ConsiderPi0sME()
             if (GetMEExists(ipid))
                        {
                 dPhi = GetMEPhi(ipid) - phiAssoc;
-                               while (dPhi > 1.5*TMath::Pi()) dPhi-=2*TMath::Pi();
-                               while (dPhi < -.5*TMath::Pi()) dPhi+=2*TMath::Pi();
+                               while (dPhi > 1.5*TMath::Pi()) dPhi -= 2*TMath::Pi();
+                               while (dPhi < -.5*TMath::Pi()) dPhi += 2*TMath::Pi();
                 dEta = GetMEEta(ipid) - etaAssoc;
-                FillHistogram(Form("%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), ptAssocBin),  GetMEPt(ipid), dPhi, dEta, 1./GetEfficiency(GetMEPt(ipid)) );
+                FillHistogram( Form("%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), ptAssocBin), GetMEPt(ipid), dPhi, dEta, 1./GetEfficiency(GetMEPt(ipid)) );
                        }       
                }
        } 
 }
+
 //_______________________________________________________________________________
-void AliPHOSCorrelations::ConsiderPi0sME_MBSelection()
+void AliPHOSCorrelations::ConsiderPi0s_MBSelection()
 {
-       TString spid[4]={"all","cpv","disp","both"} ;
+       TString spid[4] = {"all","cpv","disp","both"} ;
     // Counting number of trigger particles.
        for (int ipid = 0; ipid < 4; ipid++)
        {
                if (GetMEExists(ipid))
                {
                        
-            FillHistogram(Form("nTrigger_%s_MB", spid[ipid].Data()), GetMEPt(ipid), 1./GetEfficiency(GetMEPt(ipid)));
+            FillHistogram( Form("nTrigger_%s_MB", spid[ipid].Data()), GetMEPt(ipid), 1./GetEfficiency(GetMEPt(ipid)) );
                }
        }
 
     // Take track's angles and compare with trigger's angles.
-    for(Int_t i3=0; i3<fTracksTPC->GetEntriesFast(); i3++){
+    for(Int_t i3 = 0; i3 < fTracksTPC->GetEntriesFast(); i3++)
+    {
                TLorentzVector * track = (TLorentzVector*)fTracksTPC->At(i3);
 
                Double_t phiAssoc = track->Phi();
                Double_t etaAssoc = track->Eta();
-               Double_t ptAssoc = track->Pt();
+               Double_t ptAssoc  = track->Pt();
 
-               Double_t ptAssocBin=GetAssocBin(ptAssoc) ;
+               Double_t ptAssocBin = GetAssocBin(ptAssoc) ;
                Double_t dPhi(0.), dEta(0.);
 
                for (int ipid = 0; ipid < 4; ipid++)
@@ -1966,33 +1691,79 @@ void AliPHOSCorrelations::ConsiderPi0sME_MBSelection()
             if (GetMEExists(ipid))
                        {
                 dPhi = GetMEPhi(ipid) - phiAssoc;
-                               while (dPhi > 1.5*TMath::Pi()) dPhi-=2*TMath::Pi();
-                               while (dPhi < -.5*TMath::Pi()) dPhi+=2*TMath::Pi();
+                               while (dPhi > 1.5*TMath::Pi()) dPhi -= 2*TMath::Pi();
+                               while (dPhi < -.5*TMath::Pi()) dPhi += 2*TMath::Pi();
                 dEta = GetMEEta(ipid) - etaAssoc;
                 FillHistogram(Form("%s_ptphieta_ptAssoc_%3.1f_MB", spid[ipid].Data(), ptAssocBin),  GetMEPt(ipid), dPhi, dEta, 1./GetEfficiency(GetMEPt(ipid)) );
                        }       
                }
        } 
 }
+
 //_______________________________________________________________________________
-void AliPHOSCorrelations::ConsiderTracksMixME()
+void AliPHOSCorrelations::ConsiderPi0sMix()
 {
-       TString spid[4]={"all","cpv","disp","both"} ;
+       TList * arrayList = GetCaloPhotonsPHOSList(fVtxBin, fCentBin, fEMRPBin);
+       for(Int_t evi = 0; evi < arrayList->GetEntries(); evi++)
+       {
+               TClonesArray * mixPHOS = static_cast<TClonesArray*>(arrayList->At(evi));
+               for (Int_t i1 = 0; i1 < fCaloPhotonsPHOS->GetEntriesFast(); i1++)
+               {
+                       AliCaloPhoton * ph1 = (AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
+                       for(Int_t i2 = 0; i2 < mixPHOS->GetEntriesFast(); i2++)
+                       {
+                               AliCaloPhoton * ph2 = (AliCaloPhoton*)mixPHOS->At(i2) ;
+                               TLorentzVector p12 = *ph1 + *ph2;
+                               Double_t m       = p12.M() ;
+                               Double_t pt  = p12.Pt() ;
+                               Double_t eff = 1./GetEfficiency(pt);
+                               
+                               int mod1 = ph1->Module() ;
+                               int mod2 = ph2->Module() ;
+
+                               FillHistogram("mix_all_mpt", m, pt, eff);
+                               if ( ph1->IsCPVOK() && ph2->IsCPVOK() ) 
+                               {
+                                       FillHistogram("mix_cpv_mpt",m, pt, eff);
+                               }
+                               if ( ph1->IsDispOK() && ph2->IsDispOK() )
+                               {
+                                       FillHistogram("mix_disp_mpt",m, pt, eff);
+                                       if ( ph1->IsCPVOK() && ph2->IsCPVOK() )
+                                       {
+                                               FillHistogram("mix_both_mpt",m, pt, eff);
+                                               if (mod1 == mod2) // for each module
+                                               {
+                                                       FillHistogram(Form("mix_both%d_mpt",mod1),m, pt, eff);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
+//_______________________________________________________________________________
+void AliPHOSCorrelations::ConsiderTracksMix()
+{
+       TString spid[4] = {"all","cpv","disp","both"} ;
 
        TList * arrayList = GetTracksTPCList(fVtxBin, fCentBin, fEMRPBin);
 
-       for(Int_t evi=0; evi<arrayList->GetEntries();evi++){
+       for(Int_t evi = 0; evi < arrayList->GetEntries();evi++)
+       {
                TClonesArray * mixTracks = static_cast<TClonesArray*>(arrayList->At(evi));
-               for(Int_t i3=0; i3<mixTracks->GetEntriesFast(); i3++){
+               for(Int_t i3 = 0; i3 < mixTracks->GetEntriesFast(); i3++)
+               {
                        TLorentzVector * track = (TLorentzVector*)mixTracks->At(i3);            
 
                        Double_t phiAssoc = track->Phi();
                        Double_t etaAssoc = track->Eta();
-                       Double_t ptAssoc =  track->Pt();
+                       Double_t ptAssoc  =  track->Pt();
 
-                       Double_t ptAssocBin=GetAssocBin(ptAssoc) ;
+                       Double_t ptAssocBin = GetAssocBin(ptAssoc) ;
 
-            Double_t ptTrigger (0.);
+            Double_t ptTrigger(0.);
 
                        Double_t dPhi(0.), dEta(0.);
 
@@ -2001,63 +1772,75 @@ void AliPHOSCorrelations::ConsiderTracksMixME()
                 if (GetMEExists(ipid))
                                {
                     dPhi = GetMEPhi(ipid) - phiAssoc;
-                                       while (dPhi > 1.5*TMath::Pi()) dPhi-=2*TMath::Pi();
-                                       while (dPhi < -.5*TMath::Pi()) dPhi+=2*TMath::Pi();
+                                       while (dPhi > 1.5*TMath::Pi()) dPhi -= 2*TMath::Pi();
+                                       while (dPhi < -.5*TMath::Pi()) dPhi += 2*TMath::Pi();
                     dEta = GetMEEta(ipid) - etaAssoc;
                     ptTrigger = GetMEPt(ipid);
 
                     FillHistogram(Form("mix_%s_ptphieta_ptAssoc_%3.1f", spid[ipid].Data(), ptAssocBin), ptTrigger, dPhi, dEta, 1./GetEfficiency(ptTrigger));
-                    if(fMakePHOSModulesCorrFunctions)  FillHistogram(Form("mix_%s_ptphieta_ptAssoc_%3.1f_mod%i", spid[ipid].Data(), ptAssocBin, GetMEModCase(ipid)), ptTrigger, dPhi, dEta, 1./GetEfficiency(ptTrigger));
-                    if(fMakeTPCHalfBarrelCorrFunctions) FillHistogram(Form("mix_%s_ptphieta_ptAssoc_%3.1f_tpc%i", spid[ipid].Data(), ptAssocBin, CheckTriggerEta(GetMEEta(ipid))), ptTrigger, dPhi, dEta, 1./GetEfficiency(ptTrigger));
-                               }       
+                }      
                        }
                }
        } 
 }
 
 //_______________________________________________________________________________
-TList* AliPHOSCorrelations::GetCaloPhotonsPHOSList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin){
-
-  int offset = vtxBin * GetNumberOfCentralityBins() * fNEMRPBins + centBin * fNEMRPBins + rpBin;
-  if( fCaloPhotonsPHOSLists->At(offset) ) {
-    TList* list = dynamic_cast<TList*> (fCaloPhotonsPHOSLists->At(offset));
-    return list;
-  }
-  else{ // no list for this bin has been created, yet
-    TList* list = new TList();
-    fCaloPhotonsPHOSLists->AddAt(list, offset);
-    return list;
-  }
+TList* AliPHOSCorrelations::GetCaloPhotonsPHOSList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin)
+{
+       int offset = vtxBin * GetNumberOfCentralityBins() * fNEMRPBins + centBin * fNEMRPBins + rpBin;
+       if( fCaloPhotonsPHOSLists->At(offset) ) 
+       {
+               // list exists
+               TList* list = dynamic_cast<TList*> (fCaloPhotonsPHOSLists->At(offset));
+               return list;
+       }
+       else
+       { 
+               // no list for this bin has been created, yet
+               TList* list = new TList();
+               fCaloPhotonsPHOSLists->AddAt(list, offset);
+               return list;
+       }
 }
+
 //_______________________________________________________________________________
-TList* AliPHOSCorrelations::GetTracksTPCList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin){
-               
-  int offset = vtxBin * GetNumberOfCentralityBins() * fNEMRPBins + centBin * fNEMRPBins + rpBin;
-  if( fTracksTPCLists->At(offset) ) { // list exists
-     TList* list = dynamic_cast<TList*> (fTracksTPCLists->At(offset));
-     return list;
-  }
-  else { // no list for this bin has been created, yet
-    TList* list = new TList();
-    fTracksTPCLists->AddAt(list, offset);
-    return list;
-  }
+TList* AliPHOSCorrelations::GetTracksTPCList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin)
+{              
+       int offset = vtxBin * GetNumberOfCentralityBins() * fNEMRPBins + centBin * fNEMRPBins + rpBin;
+       if( fTracksTPCLists->At(offset) ) 
+       { 
+               // list exists
+               TList* list = dynamic_cast<TList*> (fTracksTPCLists->At(offset));
+               return list;
+       }
+       else 
+       { 
+               // no list for this bin has been created, yet
+               TList* list = new TList();
+               fTracksTPCLists->AddAt(list, offset);
+               return list;
+       }
 }
+
 //_______________________________________________________________________________
 Double_t AliPHOSCorrelations::GetAssocBin(Double_t pt) const
 {
-  //Calculates bin of associated particle pt.
-  for(Int_t i=1; i<fAssocBins.GetSize(); i++){
-    if(pt>fAssocBins.At(i-1) && pt<fAssocBins.At(i))
-      return fAssocBins.At(i) ;
-  }
-  return fAssocBins.At(fAssocBins.GetSize()-1) ;
+       //Calculates bin of associated particle pt.
+       for(Int_t i=1; i<fAssocBins.GetSize(); i++)
+       {
+               if(pt>fAssocBins.At(i-1) && pt<fAssocBins.At(i))
+                       return fAssocBins.At(i) ;
+       }
+
+       return fAssocBins.At(fAssocBins.GetSize()-1) ;
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::FillTrackEtaPhi()
 {
        // Distribution TPC's tracks by angles.
-       for (Int_t i1=0; i1<fTracksTPC->GetEntriesFast(); i1++){
+       for (Int_t i1=0; i1<fTracksTPC->GetEntriesFast(); i1++)
+       {
                TLorentzVector * track = (TLorentzVector*)fTracksTPC->At(i1);
                FillHistogram( "track_phieta", track->Phi(), track->Eta() );
        }
@@ -2066,92 +1849,101 @@ void AliPHOSCorrelations::FillTrackEtaPhi()
 //_______________________________________________________________________________
 void AliPHOSCorrelations::UpdatePhotonLists()
 {
-  //Now we either add current events to stack or remove
-  //If no photons in current event - no need to add it to mixed
-
-  TList * arrayList = GetCaloPhotonsPHOSList(fVtxBin, fCentBin, fEMRPBin);
-  if( fDebug >= 2 )
-    AliInfo( Form("fCentBin=%d, fCentNMixed[]=%d",fCentBin,fCentNMixed[fCentBin]) );
-  if(fCaloPhotonsPHOS->GetEntriesFast()>0)
-  {
-    arrayList->AddFirst(fCaloPhotonsPHOS) ;
-    fCaloPhotonsPHOS=0x0;
-    if(arrayList->GetEntries() > fCentNMixed[fCentBin])
-    { // Remove redundant events
-      TClonesArray * tmp = static_cast<TClonesArray*>(arrayList->Last()) ;
-      arrayList->RemoveLast() ;
-      delete tmp; 
-    }
-  }
+       //Now we either add current events to stack or remove
+       //If no photons in current event - no need to add it to mixed
+
+       TList * arrayList = GetCaloPhotonsPHOSList(fVtxBin, fCentBin, fEMRPBin);
+       if( fDebug >= 2 )
+               AliInfo( Form("fCentBin=%d, fCentNMixed[]=%d",fCentBin,fCentNMixed[fCentBin]) );
+       if(fCaloPhotonsPHOS->GetEntriesFast()>0)
+       {
+               arrayList->AddFirst(fCaloPhotonsPHOS) ;
+               fCaloPhotonsPHOS=0x0;
+               if(arrayList->GetEntries() > fCentNMixed[fCentBin])
+               { 
+                       // Remove redundant events
+                       TClonesArray * tmp = static_cast<TClonesArray*>(arrayList->Last()) ;
+                       arrayList->RemoveLast() ;
+                       delete tmp; 
+               }
+       }
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::UpdateTrackLists()
 {
-  //Now we either add current events to stack or remove
-  //If no photons in current event - no need to add it to mixed
-
-  TList * arrayList = GetTracksTPCList(fVtxBin, fCentBin, fEMRPBin);
-
-  if( fDebug >= 2 )
-    AliInfo( Form("fCentBin=%d, fCentNMixed[]=%d",fCentBin,fCentNMixed[fCentBin]) );
-  if(fTracksTPC->GetEntriesFast()>0)
-  {
-
-    arrayList->AddFirst(fTracksTPC) ;
-    fTracksTPC=0x0;
-    if(arrayList->GetEntries() > fCentNMixed[fCentBin])
-    { // Remove redundant events
-      TClonesArray * tmp = static_cast<TClonesArray*>(arrayList->Last()) ;
-      arrayList->RemoveLast() ;
-      delete tmp; 
-    }
-  }
+       //Now we either add current events to stack or remove
+       //If no photons in current event - no need to add it to mixed
+
+       TList * arrayList = GetTracksTPCList(fVtxBin, fCentBin, fEMRPBin);
+
+       if( fDebug >= 2 )
+               AliInfo( Form("fCentBin=%d, fCentNMixed[]=%d",fCentBin,fCentNMixed[fCentBin]) );
+       if(fTracksTPC->GetEntriesFast()>0)
+       {
+               arrayList->AddFirst(fTracksTPC) ;
+               fTracksTPC=0x0;
+               if(arrayList->GetEntries() > fCentNMixed[fCentBin])
+               { 
+                       // Remove redundant events
+                       TClonesArray * tmp = static_cast<TClonesArray*>(arrayList->Last()) ;
+                       arrayList->RemoveLast() ;
+                       delete tmp; 
+               }
+       }
 }
+
 //_______________________________________________________________________________
 Bool_t AliPHOSCorrelations::SelectESDTrack(AliESDtrack * t) const
-// Estimate if this track can be used for the RP calculation. If all right - return "TRUE"
 {
+       // Estimate if this track can be used for the RP calculation. If all right - return "TRUE"
        Float_t pt=t->Pt();
-       if(pt<0.5 || pt>20.) return kFALSE ;
-       if(fabs( t->Eta() )>0.8) return kFALSE;
-       if(!fESDtrackCuts->AcceptTrack(t)) return kFALSE ;
+       if(pt<0.5 || pt>20.)                            return kFALSE ;
+       if(fabs( t->Eta() )>0.8)                        return kFALSE;
+       if(!fESDtrackCuts->AcceptTrack(t))      return kFALSE ;
        return kTRUE ;
 }
+
 //_______________________________________________________________________________
 Bool_t AliPHOSCorrelations::SelectAODTrack(AliAODTrack * t) const
-// Estimate if this track can be used for the RP calculation. If all right - return "TRUE"
 {
+       // Estimate if this track can be used for the RP calculation. If all right - return "TRUE"
        Float_t pt=t->Pt();
-       if(pt<0.5 || pt>20.) return kFALSE ;
+       if(pt<0.5 || pt>20.)     return kFALSE ;
        if(fabs( t->Eta() )>0.8) return kFALSE;
+
        if(fCheckHibridGlobal == kOnlyHibridTracks)
        {
                if(!t->IsHybridGlobalConstrainedGlobal()) 
                        return kFALSE ;
        }
-
+       else
        if (fCheckHibridGlobal == kWithOutHibridTracks)
        {
                if(t->IsHybridGlobalConstrainedGlobal()) 
                        return kFALSE ;
        }
+       else
+       if(fCheckHibridGlobal == kAllTracks)
+               return kTRUE;
 
        return kTRUE ;
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::LogProgress(int step)
-// Fill "step by step" hist
 {
-  //FillHistogram("hSelEvents", step+0.5, internalRunNumber-0.5);
-  FillHistogram("hTotSelEvents", step+0.5);
+       // Fill "step by step" hist
+       FillHistogram("hTotSelEvents", step+0.5);
 }
+
 //_______________________________________________________________________________
 void AliPHOSCorrelations::LogSelection(int step, int internalRunNumber)
 {
-  // the +0.5 is not realy neccisarry, but oh well... -henrik
-  FillHistogram("hSelEvents", step+0.5, internalRunNumber-0.5);
-  //FillHistogram("hTotSelEvents", step+0.5);
-}
+       // the +0.5 is not realy neccisarry, but oh well... -henrik
+       FillHistogram("hSelEvents", step+0.5, internalRunNumber-0.5);
+ }
+
 //_______________________________________________________________________________
 Bool_t AliPHOSCorrelations::TestMass(Double_t m, Double_t pt)
 {
@@ -2171,8 +1963,9 @@ Bool_t AliPHOSCorrelations::TestMass(Double_t m, Double_t pt)
             return false;
         }
        }
-       else                    // Parametrization
+       else
        {
+               // Parametrization
                FillHistogram("massWindow", MassMeanFunktion(pt), MassSigmaFunktion(pt)*fSigmaWidth);
         if ( MassMeanFunktion(pt)-MassSigmaFunktion(pt)*fSigmaWidth<m && m<MassMeanFunktion(pt)+MassSigmaFunktion(pt)*fSigmaWidth )
         {
@@ -2186,96 +1979,114 @@ Bool_t AliPHOSCorrelations::TestMass(Double_t m, Double_t pt)
         }
        }
 } 
+
 //_______________________________________________________________________________
 Double_t AliPHOSCorrelations::MassMeanFunktion(Double_t &pt) const
 {
        // Parametrization mean of mass window
-       return ( fMassMeanP0*pt + fMassMeanP1 );
+       return ( fMassMean[0]*pt + fMassMean[1] );
 }
+
 //_______________________________________________________________________________
 Double_t AliPHOSCorrelations::MassSigmaFunktion(Double_t &pt) const
 {
        // Parametrization sigma of mass window
-    //TODO:: Fix falling at large pT.
-       return ( -1*fMassSigmaP3*TMath::Sqrt(fMassSigmaP0*pt + fMassSigmaP1) + fMassSigmaP2 );
+       return ( -1*fMassSigma[3]*TMath::Sqrt(fMassSigma[0]*pt + fMassSigma[1]) + fMassSigma[2] );
 }
+
 //_____________________________________________________________________________
-void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x)const{
-  //FillHistogram
-  TH1 * hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key)) ;
-  if(hist)
-    hist->Fill(x) ;
-  else
-    AliError(Form("can not find histogram (of instance TH1) <%s> ",key)) ;
+void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x)const
+{
+       //FillHistogram
+       TH1 * hist = dynamic_cast<TH1*>(fOutputContainer->FindObject(key)) ;
+       if(hist)
+               hist->Fill(x) ;
+       else
+               AliError(Form("can not find histogram (of instance TH1) <%s> ",key)) ;
 }
+
 //_____________________________________________________________________________
-void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x,Double_t y)const{
-  //FillHistogram
-  TH1 * th1 = dynamic_cast<TH1*> (fOutputContainer->FindObject(key));
-  if(th1)
-    th1->Fill(x, y) ;
-  else
-    AliError(Form("can not find histogram (of instance TH1) <%s> ",key)) ;
+void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x,Double_t y)const
+{
+       //FillHistogram
+       TH1 * th1 = dynamic_cast<TH1*> (fOutputContainer->FindObject(key));
+       if(th1)
+               th1->Fill(x, y) ;
+       else
+               AliError(Form("can not find histogram (of instance TH1) <%s> ",key)) ;
 }
 
 //_____________________________________________________________________________
-void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z) const{
-  //Fills 1D histograms with key
-  TObject * obj = fOutputContainer->FindObject(key);
-  
-  TH2 * th2 = dynamic_cast<TH2*> (obj);
-  if(th2) {
-    th2->Fill(x, y, z) ;
-    return;
-  }
-
-  TH3 * th3 = dynamic_cast<TH3*> (obj);
-  if(th3) {
-    th3->Fill(x, y, z) ;
-    return;
-  }
-  
-  AliError(Form("can not find histogram (of instance TH2) <%s> ",key)) ;
+void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z) const
+{
+       //Fills 1D histograms with key
+       TObject * obj = fOutputContainer->FindObject(key);
+
+       TH2 * th2 = dynamic_cast<TH2*> (obj);
+       if(th2) 
+       {
+               th2->Fill(x, y, z) ;
+               return;
+       }
+
+       TH3 * th3 = dynamic_cast<TH3*> (obj);
+       if(th3) 
+       {
+               th3->Fill(x, y, z) ;
+               return;
+       }
+
+       AliError(Form("can not find histogram (of instance TH2) <%s> ",key)) ;
 }
+
 //_____________________________________________________________________________
-void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z, Double_t w) const{
-  //Fills 1D histograms with key
-  TObject * obj = fOutputContainer->FindObject(key);
-  
-  TH3 * th3 = dynamic_cast<TH3*> (obj);
-  if(th3) {
-    th3->Fill(x, y, z, w) ;
-    return;
-  }
-  
-  AliError(Form("can not find histogram (of instance TH3) <%s> ",key)) ;
+void AliPHOSCorrelations::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z, Double_t w) const
+{
+       //Fills 1D histograms with key
+       TObject * obj = fOutputContainer->FindObject(key);
+
+       TH3 * th3 = dynamic_cast<TH3*> (obj);
+       if(th3) 
+       {
+               th3->Fill(x, y, z, w) ;
+               return;
+       }
+
+       AliError(Form("can not find histogram (of instance TH3) <%s> ",key)) ;
 }
+
 //_____________________________________________________________________________
 void AliPHOSCorrelations::SetGeometry()
 {
-  // Initialize the PHOS geometry
-  //Init geometry
-  if(!fPHOSGeo){
-     AliOADBContainer geomContainer("phosGeo");
-     geomContainer.InitFromFile("$ALICE_ROOT/OADB/PHOS/PHOSGeometry.root","PHOSRotationMatrixes");
-     TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(fRunNumber,"PHOSRotationMatrixes");
-     fPHOSGeo =  AliPHOSGeometry::GetInstance("IHEP") ;
-     for(Int_t mod=0; mod<5; mod++) {
-        if(!matrixes->At(mod)) {
-          if( fDebug )
-            AliInfo(Form("No PHOS Matrix for mod:%d, geo=%p\n", mod, fPHOSGeo));
-          continue;
-        }
-        else {
-             fPHOSGeo->SetMisalMatrix(((TGeoHMatrix*)matrixes->At(mod)),mod) ;
-             if( fDebug >1 )
-               AliInfo(Form("Adding PHOS Matrix for mod:%d, geo=%p\n", mod, fPHOSGeo));
-        }
-     }
-  } 
+       // Initialize the PHOS geometry
+       //Init geometry
+       if(!fPHOSGeo)
+       {
+               AliOADBContainer geomContainer("phosGeo");
+               geomContainer.InitFromFile("$ALICE_ROOT/OADB/PHOS/PHOSGeometry.root","PHOSRotationMatrixes");
+               TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(fRunNumber,"PHOSRotationMatrixes");
+               fPHOSGeo =  AliPHOSGeometry::GetInstance("IHEP") ;
+               for(Int_t mod=0; mod<5; mod++) 
+               {
+                       if(!matrixes->At(mod)) 
+                       {
+                               if( fDebug )
+                               AliInfo(Form("No PHOS Matrix for mod:%d, geo=%p\n", mod, fPHOSGeo));
+                               continue;
+                       }
+                       else 
+                       {
+                               fPHOSGeo->SetMisalMatrix(((TGeoHMatrix*)matrixes->At(mod)),mod) ;
+                               if( fDebug >1 )
+                                       AliInfo(Form("Adding PHOS Matrix for mod:%d, geo=%p\n", mod, fPHOSGeo));
+                       }
+               }
+       } 
 }
+
 //_____________________________________________________________________________
-Double_t AliPHOSCorrelations::GetEfficiency(Double_t x) const {
+Double_t AliPHOSCorrelations::GetEfficiency(Double_t x) const 
+{
        //Efficiency for Both2core only!
        if (!fUseEfficiency)
                return 1.;
@@ -2290,31 +2101,31 @@ Double_t AliPHOSCorrelations::GetEfficiency(Double_t x) const {
        5: 60-80%
        6: 0-20%
        7: 0-10%*/
-       Double_t par0[9] = {-798863, 339.714, 6407.1, -457.778, 1283.65, -117.075, -19.3764, 0, 0};
-       Double_t par1[9] = {-799344, -1852.1, 3326.29, -384.229, 504.046, 562.608, 130.518, 0, 0};
-       Double_t par2[9] = {-858904, -1923.28, 5350.74, -568.946, 945.497, 419.647, 101.911, 0, 0};
-       Double_t par3[9] = {-795652, -1495.97, 2926.46, -357.804, 478.961, 551.127, 128.86, 0, 0};
-       Double_t par4[9] = {-891951, 279626, -123110, -5464.75, 27470.8, 283264, 15355.1, 192762, 44828.6};
-       Double_t par5[9] = {-1.1094e+06, -986.915, 2127.71, -268.908, 375.594, 380.791, 89.4053, 0, 0};
+       Double_t par0[9] = {-798863,      339.714,       6407.1,  -457.778, 1283.65, -117.075, -19.3764,       0,               0       };
+       Double_t par1[9] = {-799344,      -1852.1,      3326.29,  -384.229, 504.046,  562.608,  130.518,       0,               0       };
+       Double_t par2[9] = {-858904,     -1923.28,  5350.74,  -568.946, 945.497,  419.647,  101.911,       0,           0       };
+       Double_t par3[9] = {-795652,     -1495.97,  2926.46,  -357.804, 478.961,  551.127,   128.86,       0,           0       };
+       Double_t par4[9] = {-891951,       279626,      -123110,  -5464.75, 27470.8,   283264,  15355.1,  192762, 44828.6       };
+       Double_t par5[9] = {-1.1094e+06, -986.915,  2127.71,  -268.908, 375.594,  380.791,  89.4053,       0,       0   };
        // Double_t par6[7] = {4.86106e+09, 4.47013e+08, -1.48079e+09, 1.47233e+08, -2.62356e+08, -1.00639e+08, -2.45629e+07, 0, 0};
        // Double_t par7[7] = {-1.36243e+06, -26011.1, 135838, -12161.3, 24956.8, 4985.4, 1285.57, 0, 0};
 
-       // 8 for pPb13 and 0-100%
-        Double_t par8[9] = {6.87095e+06, 8.36553e+06, -3.29572e+06, 2.18688e+06, -739490, 521666, 106661, 0, 0};
+       // 8 bin for pPb13 and 0-100%
+       Double_t par8[9] = {6.87095e+06, 8.36553e+06, -3.29572e+06, 2.18688e+06, -739490, 521666, 106661, 0, 0};
                
         
        Double_t* pFitPoint;
 
        if(fPeriod == kLHC11h)
        {
-               if(x<1.) x = 1.; 
+               if(x < 1.) x = 1.; 
 
-               if (fCentrality<=5)  pFitPoint = &par0[0];
-               if (fCentrality>5 && fCentrality<=10) pFitPoint = &par1[0];
-               if (fCentrality>10 && fCentrality<=20) pFitPoint = &par2[0];
-               if (fCentrality>20 && fCentrality<=40) pFitPoint = &par3[0];
-               if (fCentrality>40 && fCentrality<=60) pFitPoint = &par4[0];
-               if (fCentrality>60) pFitPoint = &par5[0];
+               if (fCentrality <= 5)                                           pFitPoint = &par0[0];
+               if (fCentrality > 5 && fCentrality <= 10)       pFitPoint = &par1[0];
+               if (fCentrality > 10 && fCentrality <= 20)      pFitPoint = &par2[0];
+               if (fCentrality > 20 && fCentrality <= 40)      pFitPoint = &par3[0];
+               if (fCentrality > 40 && fCentrality <= 60)      pFitPoint = &par4[0];
+               if (fCentrality > 60)                                           pFitPoint = &par5[0];
 
                Double_t pFit[9];
                for (int i = 0; i < 9; ++i)
@@ -2322,7 +2133,7 @@ Double_t AliPHOSCorrelations::GetEfficiency(Double_t x) const {
                        pFit[i] = *(pFitPoint+i);
                }
 
-               if (fCentrality>40 && fCentrality<=60)
+               if (fCentrality > 40 && fCentrality <= 60)
                        e = TMath::Exp(-(((((1.+(pFit[1]*x))+(pFit[2]*(x*x)))+(pFit[5]*(x*(x*x))))+(pFit[7]*(x*(x*(x*x)))))/((((pFit[3]*x)+(pFit[4]*(x*x)))+(pFit[6]*(x*(x*x))))+(pFit[8]*(x*(x*(x*x))))))) ;
                else
                        e = TMath::Exp(-((((1.+(pFit[1]*x))+(pFit[2]*(x*x)))+(pFit[5]*(x*(x*x))))/(((pFit[3]*x)+(pFit[4]*(x*x)))+(pFit[6]*(x*(x*x)))))) ;
@@ -2349,9 +2160,10 @@ Double_t AliPHOSCorrelations::GetEfficiency(Double_t x) const {
        return e;
        // return 1.; // For test.
 }
-//_____________________________________________________________________________
-Int_t AliPHOSCorrelations::GetModCase(Int_t &mod1, Int_t &mod2) const {
 
+//_____________________________________________________________________________
+Int_t AliPHOSCorrelations::GetModCase(Int_t &mod1, Int_t &mod2) const 
+{
        // Return modules pair namber.
        if(mod1 == mod2)
        {
@@ -2376,22 +2188,17 @@ Int_t AliPHOSCorrelations::GetModCase(Int_t &mod1, Int_t &mod2) const {
        AliError(Form("No choise for mod1 = %i, mod2 = %i", mod1, mod2));
        return 1;
 }
-//_____________________________________________________________________________
-Int_t AliPHOSCorrelations::CheckTriggerEta(Double_t eta){
-       if (eta>=0.) 
-               return 1;
-       return 2;
-}
+
 //_____________________________________________________________________________
 void AliPHOSCorrelations::TestPi0ME(Int_t ipid, TLorentzVector p12, Int_t modCase)
 {
-       Double_t phiTrigger=p12.Phi() ;
-       Double_t etaTrigger=p12.Eta() ;
-       Double_t pt=p12.Pt() ;
+       Double_t phiTrigger = p12.Phi() ;
+       Double_t etaTrigger = p12.Eta() ;
+       Double_t pt             = p12.Pt() ;
 
     if ( GetMEExists(ipid) )
     {
-        if ( pt>=GetMEPt(ipid) )
+        if ( pt >= GetMEPt(ipid) )
         {
             SetMEPt(ipid,pt);
             SetMEPhi(ipid, phiTrigger);
@@ -2408,8 +2215,10 @@ void AliPHOSCorrelations::TestPi0ME(Int_t ipid, TLorentzVector p12, Int_t modCas
         SetMEExists(ipid);
     }
 }
+
 //_____________________________________________________________________________
-void AliPHOSCorrelations::ZeroingVariables(){
+void AliPHOSCorrelations::ZeroingVariables()
+{
        // Set Phi, Eta, pT, modNumber andtrigger variable of moust energetic trigger particle to zero.
        for (int i = 0; i < 4; ++i)
        {
@@ -2419,3 +2228,20 @@ void AliPHOSCorrelations::ZeroingVariables(){
        }
 }
 
+//_____________________________________________________________________________
+void AliPHOSCorrelations::SetMassMeanParametrs(Double_t par[2])                                      
+{ 
+       for (int i = 0; i < 2; ++i)
+       {
+               fMassMean[i] = par[i] ;  
+       }                  
+} 
+
+//_____________________________________________________________________________
+void AliPHOSCorrelations::SetMassSigmaParametrs(Double_t par[4])                                   
+{ 
+       for (int i = 0; i < 4; ++i)
+       {
+               fMassSigma[i] = par[i] ;    
+       }                  
+}
index cac93b6..9bf9df2 100644 (file)
@@ -4,10 +4,9 @@
 /* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice     */
 
-// Analysis task for identified PHOS cluster from pi0 and extracting pi0-hadron correlation.
-// Authors:    Daniil Ponomarenko <Daniil.Ponomarenko@cern.ch>
-//             Dmitry Blau <Dmitry.Blau@cern.ch>
-// 09-Jul-2014
+// Analysis task for identifion PHOS cluster from Pi0 and extracting pi0-hadron correlation.
+// Author:     Daniil Ponomarenko <Daniil.Ponomarenko@cern.ch>
+// 20-Sept-2014
 
 class TClonesArray;
 class AliStack ;
@@ -34,240 +33,222 @@ class AliESDInputHandler;
 class AliPHOSCorrelations : public AliAnalysisTaskSE 
 {
 public:
-  enum Period { kUndefinedPeriod, kLHC10h, kLHC11h, kLHC13 };
-  enum EventSelection { kTotal, kEvent, kEventHandler, kTriggerMaskSelection, kHasVertex, kHasCentrality, kHasPHOSClusters, kHasTPCTracks, kPHOSEvent, kMBEvent, kTotalSelected, kHasAbsVertex };
-  enum HibridCheckVeriable { kOnlyHibridTracks, kWithOutHibridTracks, kAllTracks };
-  enum PID { kPidAll, kPidCPV, kPidDisp, kPidBoth};
+  enum Period               { kUndefinedPeriod, kLHC10h, kLHC11h, kLHC13 } ;
+  enum EventSelection       { kTotal, kEvent, kEventHandler, 
+                              kTriggerMaskSelection, kHasVertex, kHasCentrality, 
+                              kHasPHOSClusters, kHasTPCTracks, kPHOSEvent, 
+                              kMBEvent, kTotalSelected, kHasAbsVertex } ;
+  enum HibridCheckVeriable  { kOnlyHibridTracks, kWithOutHibridTracks, kAllTracks } ;
+  enum PID                  { kPidAll, kPidCPV, kPidDisp, kPidBoth} ;
 
 
 public:
-  AliPHOSCorrelations();
-  AliPHOSCorrelations(const char *name);
-  AliPHOSCorrelations(const char *name, Period period );
-  virtual ~AliPHOSCorrelations();
-
-  virtual void   UserCreateOutputObjects();
-  virtual void   UserExec(Option_t *option);
-//  virtual void   Terminate(Option_t *);
-
-  void SetHibridGlobalCheking(Int_t hibridCheck = kAllTracks) {fCheckHibridGlobal = hibridCheck; }
-  void SetAnalysisAlgoritmForReal(TString algoritm = "ME") {algoritm.Contains("ME")?fUseMEAlgoritmForReal = true:fUseMEAlgoritmForReal = false;}
-  void SetAnalysisAlgoritmForMix(TString algoritm = "ME") {algoritm.Contains("ME")?fUseMEAlgoritmForMix = true:fUseMEAlgoritmForMix = false;}
-  void SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed);
-  void EnableTOFCut(Bool_t enable = kTRUE, Double_t TOFCut = 100.e-9){fTOFCutEnabled=enable; fTOFCut=TOFCut;}
-  void SetMassWindow(Double_t massMean = 0.135, Double_t massSigma = 0.01) { fMassInvMean = massMean; fMassInvSigma = massSigma; }
-  void SetSigmaWidth(Double_t sigmaWidth= 0) { fSigmaWidth = sigmaWidth; }
-  void SetMassMeanParametrs(Double_t p0 = -20.9476, Double_t p1 = 0.1300) {fMassMeanP0 = p0; fMassMeanP1 = p1;}   // from mass fit
-  void SetMassSigmaParametrs(Double_t p0 = 0.001, Double_t p1 = -0.0000001, Double_t p2 = -0.06, Double_t p3 = -0.01) {fMassSigmaP0 = p0; fMassSigmaP1 = p1; fMassSigmaP2 = p2; fMassSigmaP3 = p3;}    // from mass fit
-  void SetPeriod(Period period) { fPeriod = period; }
-  void SetCentralityBorders (double down = 0., double up = 90.) ;
-  void SetUseMoreCorrFunctions(Bool_t makeForPHOS = false, Bool_t makeForTPC = false) {fMakePHOSModulesCorrFunctions = makeForPHOS; fMakeTPCHalfBarrelCorrFunctions = makeForTPC; }
-  void SetUseEfficiency(Bool_t useEff = true) {fUseEfficiency = useEff;}
-  void SetPtAssocBins(TArrayD * arr){fAssocBins.Set(arr->GetSize(), arr->GetArray()) ;} 
-
-  void SetCentralityEstimator(const char * centr) {fCentralityEstimator = centr;}
-  void SetEventMixingRPBinning(UInt_t nBins) { fNEMRPBins = nBins; }
-  void SetMaxAbsVertexZ(Float_t z) { fMaxAbsVertexZ = z; }
+  AliPHOSCorrelations() ;
+  AliPHOSCorrelations(const char *name) ;
+  AliPHOSCorrelations(const char *name, Period period ) ;
+  virtual ~AliPHOSCorrelations() ;
+
+  virtual void   UserCreateOutputObjects() ;
+  virtual void   UserExec(Option_t *option) ;
+
+  void SetPeriod(Period period)                                                   { fPeriod = period;                      }
+  void SetCentralityEstimator(const char * centr)                                 { fCentralityEstimator = centr;          }
+  void SetEventMixingRPBinning(UInt_t nBins)                                      { fNEMRPBins = nBins;                    }
+  void SetMaxAbsVertexZ(Float_t z)                                                { fMaxAbsVertexZ = z;                    }
+  void SetSigmaWidth(Double_t sigmaWidth)                                         { fSigmaWidth = sigmaWidth;              }
+  void SetUseEfficiency(Bool_t useEff)                                            { fUseEfficiency = useEff;               }
+  void SetHibridGlobalCheking(Int_t hibridCheck)                                  { fCheckHibridGlobal = hibridCheck;      }
+  void EnableTOFCut(Bool_t enable, Double_t TOFCut)                               { fTOFCutEnabled=enable; fTOFCut=TOFCut; }
+  void SetMassMeanParametrs(Double_t par[2])  ;
+  void SetMassSigmaParametrs(Double_t par[4]) ;
+  void SetPtAssocBins(TArrayD * arr)                                              { fAssocBins.Set(arr->GetSize(), arr->GetArray());    } 
+  void SetMassWindow(Double_t massMean, Double_t massSigma)                       { fMassInvMean = massMean; fMassInvSigma = massSigma; }
+  void SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed) ;
+  void SetCentralityBorders (double down, double up) ;
   
+
 protected: 
+  AliPHOSCorrelations           ( const AliPHOSCorrelations& ) ;                                 // not implemented
+  AliPHOSCorrelations& operator=( const AliPHOSCorrelations& ) ;                                 // not implemented
 
-  AliPHOSCorrelations(const AliPHOSCorrelations&);        // not implemented
-  AliPHOSCorrelations& operator=(const AliPHOSCorrelations&); // not implemented
-  
-  // Histograms and trees.
-    void SetHistPtNumTrigger(Int_t  ptMult, Double_t ptMin, Double_t ptMax);      // Set massive of histograms (1-5).
-    void SetHistPtAssoc(Int_t  ptMult, Double_t ptMin, Double_t ptMax);           // Set massive of histograms (1-5).
-    void SetHistMass(Int_t  ptMult, Double_t ptMin, Double_t ptMax);              // Set other histograms.
-    void SetHistEtaPhi();                       // Set hists, with track's and cluster's angle distributions.
-    void SetHistPHOSClusterMap();               // XZE distribution in PHOS.
-    void FillHistogram(const char * key,Double_t x) const ;                                     //Fill 1D histogram witn name key
-    void FillHistogram(const char * key,Double_t x, Double_t y) const ;                         //Fill 2D histogram witn name key
-    void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ;             //Fill 3D histogram witn name key
-    void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z, Double_t w) const ; //Fill 3D histogram witn name key
+  // Filling hists.
+  void FillHistogram( const char * key,Double_t x ) const ;                                      // Fill 1D histogram witn name key
+  void FillHistogram( const char * key,Double_t x, Double_t y ) const ;                          // Fill 2D histogram witn name key
+  void FillHistogram( const char * key,Double_t x, Double_t y, Double_t z ) const ;              // Fill 3D histogram witn name key
+  void FillHistogram( const char * key,Double_t x, Double_t y, Double_t z, Double_t w ) const ;  // Fill 3D histogram witn name key
 
-    void SetESDTrackCuts(); // AliESDtrack cuts ( for esd data )
-    
-    Bool_t TestMass(Double_t m, Double_t pt) ;
-    Double_t MassMeanFunktion(Double_t &pt) const ;
-    Double_t MassSigmaFunktion(Double_t &pt) const ;
+  // Setup hists.
+  void SetHistPtNumTrigger( Int_t  ptMult, Double_t ptMin, Double_t ptMax ) ;                    // Set massive of histograms (1-5).
+  void SetHistPtAssoc     ( Int_t  ptMult, Double_t ptMin, Double_t ptMax ) ;                    // Set massive of histograms (1-5).
+  void SetHistMass        ( Int_t  ptMult, Double_t ptMin, Double_t ptMax ) ;                    // Set other histograms.
+  void SetHistEtaPhi() ;                                                                         // Set hists, with track's and cluster's angle distributions.
+  void SetHistPHOSClusterMap() ;                                                                 // XZE distribution in PHOS.
 
-    Double_t GetAssocBin(Double_t pt) const ;   //Calculates bin of associated particle pt.
-    Double_t GetEfficiency(Double_t pt) const ; // Return Pi0 efficiency for current pT.
+  // Logical and debug.
+  void LogProgress    ( int step ) ;
+  void LogSelection   ( int step , int internalRunNumber ) ;
 
-    Int_t GetModCase(Int_t &mod1, Int_t &mod2) const; // Produce part of module neme for pTetaPhi histogram in mixed events.
 
-    Int_t ConvertToInternalRunNumber(Int_t run);
+  // Step 1(done once):
+  Int_t ConvertToInternalRunNumber(Int_t run) ;                                                  // Convert run number to local number. 
+  void SetESDTrackCuts() ;                                                                       // AliESDtrack cuts ( for esd data )
 
-    Bool_t RejectTriggerMaskSelection();    // Select event trigger and reject.
+  // Step 2: Preparation variables for new event
+  void ZeroingVariables() ;
+  void SetGeometry();                                                                            // Initialize the PHOS geometry
 
-    void    SetVertex();
-    Bool_t RejectEventVertex();
 
-    void  SetCentrality();   // Find centrality of event.
-    Bool_t RejectEventCentrality(); 
-    
-    Int_t     GetCentralityBin(Float_t centralityV0M);
-    UInt_t  GetNumberOfCentralityBins() { return fCentEdges.GetSize()-1; }
+  // Step 3: Event trigger selection
+  Bool_t RejectTriggerMaskSelection() ;                                                          // Select event trigger and reject.
 
-    void EvalReactionPlane();   // Find RP of event.
-    void EvalV0ReactionPlane(); // Find RP of event.
-    Int_t GetRPBin();           // Return RP (rad).
+  // Step 4: Vertex
+  void   SetVertex() ;                                                                           // Find vertex of event.
+  Bool_t RejectEventVertex() ;
 
-    Double_t ApplyFlattening(Double_t phi, Double_t c) ;    // Apply centrality-dependent flattening.
-    Double_t ApplyFlatteningV0A(Double_t phi, Double_t c) ; // Apply centrality-dependent flattening.
-    Double_t ApplyFlatteningV0C(Double_t phi, Double_t c) ; // Apply centrality-dependent flattening.
+  // Step 5: Centrality
+  void   SetCentrality() ;                                                                       // Find centrality of event.
+  Bool_t RejectEventCentrality() ; 
 
-    void ZeroingVariables();
-    
-    virtual void SelectPhotonClusters();
-    void SelectAccosiatedTracks();
+  Int_t  GetCentralityBin(Float_t centralityV0M) ;                                               // Find centrality bin.
+  UInt_t GetNumberOfCentralityBins() const { return fCentEdges.GetSize()-1 ; }                   // Get number of centrality bins.
 
-     void FillTrackEtaPhi();        // Distribution by track's angles.
+  // Step 6: Reaction Plane
+  void  EvalReactionPlane() ;                                                                    // Find RP of event.
+  Int_t GetRPBin() ;                                                                             // Return RP (rad).
 
-    void SelectTriggerPi0ME();      //Select most energetic Pi0 in event.
+  // Step 7: Event Photons (PHOS Clusters) selection
+  virtual void SelectPhotonClusters() ;
 
-    void ConsiderPi0s();            // Consider all Pi0 with all tracks in same event.
-    void ConsiderTracksMix();       // Consider all Pi0 in this event with tracks from MIXing pull.
+  // Step 8: Event Associated particles (TPC Tracks) selection
+  void SelectAccosiatedTracks() ;
 
-    void ConsiderPi0sME();             // Consider the most energetic Pi0 in this event with all tracks of this event.
-    void ConsiderPi0sME_MBSelection(); // Consider the most energetic Pi0 in this event with all tracks of this event using MB events.
-    void ConsiderTracksMixME();        // Consider the most energetic Pi0 in this event with all tracks from MIXing pull.
+  // Step 9: Fill TPC's track mask
+  void FillTrackEtaPhi() ;                                                                       // Distribution by track's angles.
 
-    void ConsiderPi0sMix();           // MIX for catch Mass
+  // Step 10: Extract one most energetic pi0 candidate in this event. 
+  void SelectTriggerPi0ME() ;                                                                    // Select most energetic Pi0 in event.
 
-    void TestPi0ME(Int_t ipid, TLorentzVector p12, Int_t modCase);  // Compare Pi0 particles and save most energetic.
-    Int_t CheckTriggerEta(Double_t eta);                            // Return 1 if eta>=0, else 2.
-    
-    TList* GetCaloPhotonsPHOSList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin);
-    TList* GetTracksTPCList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin);
+  void  TestPi0ME(Int_t ipid, TLorentzVector p12, Int_t modCase) ;                              // Compare Pi0 particles and remember most energetic in current event.
+  void  SetMEExists(const Int_t pid)                        { fMEExists[pid] = true     ; }
+  void  SetMEPhi(const Int_t pid, const Double_t phi)       { fMEPhi[pid] = phi         ; }
+  void  SetMEEta(const Int_t pid, const Double_t eta)       { fMEEta[pid] = eta         ; }
+  void  SetMEPt(const Int_t pid, const Double_t pT)         { fMEPt[pid] = pT           ; }
+  void  SetMEModCase(const Int_t pid, const Int_t modcase)  { fMEModCase[pid] = modcase ; }
+
+  Bool_t      GetMEExists(const Int_t pid)    const { return fMEExists[pid]   ; }
+  Double_t    GetMEPhi(const Int_t pid)       const { return fMEPhi[pid]      ; }
+  Double_t    GetMEEta(const Int_t pid)       const { return fMEEta[pid]      ; }
+  Double_t    GetMEPt(const Int_t pid)        const { return fMEPt[pid]       ; }
+  Int_t       GetMEModCase(const Int_t pid)   const { return fMEModCase[pid]  ; }
+
+  // Step 11: Start correlation analysis.
+  void ConsiderPi0s() ;                       // Consider the most energetic Pi0 in this event with all tracks of this event.
+  void ConsiderPi0s_MBSelection() ;           // Consider the most energetic Pi0 in this event with all tracks of this event using MB events.
+  
+  void ConsiderPi0sMix() ;                    // Use MIX for catch mass peck.
+  void ConsiderTracksMix() ;                  // Consider the most energetic Pi0 in this event with all tracks from MIXing pull.
 
-    void UpdatePhotonLists();   // Fill photons in MIXing pull.
-    void UpdateTrackLists();    // Fill Tracks in MIXing pull.
+  void UpdatePhotonLists() ;                  // Fill photons in MIXing pull.
+  void UpdateTrackLists() ;                   // Fill Tracks in MIXing pull.
 
-    void SetGeometry();
 
-    Bool_t SelectESDTrack(AliESDtrack * t) const; //estimate if this track can be used for the RP calculation
-    Bool_t SelectAODTrack(AliAODTrack * t) const; //estimate if this track can be used for the RP calculation
 
-    // Logical and debug.
-    void LogProgress(int step);
-    void LogSelection(int step, int internalRunNumber);
+  Bool_t TestMass(Double_t m, Double_t pt) ;                                                     // Check if mair in pi0 peak window.
 
-  // Set / Get parametrs
-    void SetManualV0EPCalc(Bool_t manCalc = true) {fManualV0EPCalc = manCalc;}
+  Double_t MassMeanFunktion(Double_t &pt) const ;                                                // Parametrization mean of mass window.
+  Double_t MassSigmaFunktion(Double_t &pt) const ;                                               // Parametrization sigma of mass window.
 
-    void SetMEExists(const Int_t pid) {fMEExists[pid] = true;}
-    Bool_t GetMEExists(const Int_t pid) const {return fMEExists[pid];}
+  Double_t GetAssocBin(Double_t pt) const ;                                                      //Calculates bin for current associated particle pT.
 
-    void SetMEPhi(const Int_t pid, const Double_t phi) {fMEPhi[pid] = phi;}
-    Double_t GetMEPhi(const Int_t pid) const {return fMEPhi[pid];}
+  Double_t GetEfficiency(Double_t pt) const ;                                                    // Return Pi0 efficiency for current pT (PID: both2core only).
 
-    void SetMEEta(const Int_t pid, const Double_t eta) {fMEEta[pid] = eta;}
-    Double_t GetMEEta(const Int_t pid) const {return fMEEta[pid];}
+  Int_t GetModCase(Int_t &mod1, Int_t &mod2) const ;                                             // Produce part of module neme for pTetaPhi histogram.
 
-    void SetMEPt(const Int_t pid, const Double_t pT) {fMEPt[pid] = pT;}
-    Double_t GetMEPt(const Int_t pid) const {return fMEPt[pid];}
+  TList* GetCaloPhotonsPHOSList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin) ;                   // Return photons from PHOS list from previous events.
+  TList* GetTracksTPCList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin) ;                         // Return tracks from TPC list from previous events.
 
-    void SetMEModCase(const Int_t pid, const Int_t modcase) {fMEModCase[pid] = modcase;}
-    Int_t GetMEModCase(const Int_t pid) const {return fMEModCase[pid];}
+  Bool_t SelectESDTrack(AliESDtrack * t) const ;                                                 // Estimate if this track can be used for the RP calculation.
+  Bool_t SelectAODTrack(AliAODTrack * t) const ;                                                 // Estimate if this track can be used for the RP calculation.
+
+  AliAnalysisUtils* GetAnalysisUtils() ;
 
 
-    AliAnalysisUtils* GetAnalysisUtils();
 private:
-  // Geometry
-    AliPHOSGeometry* fPHOSGeo;
-  // Make output histograms/conteiners.
-    TList * fOutputContainer;              //final histogram / tree container     
-   
-  // cluster cut variables:
-    Double_t fMinClusterEnergy; // Min energy PHOS's cluster.
-    Double_t fMinBCDistance;    // Min distance to nearest bad channel
-    Int_t    fMinNCells;        // Min count of Cells in cluster.
-    Double_t fMinM02;           // Min size of M02 in claster.
-    Bool_t fTOFCutEnabled;      // Use time of flight or not?
-    Double_t fTOFCut;           // Max time of flight.
-
-  // Binning, [vtx, centrality, reaction-plane]
-    Int_t   fNVtxZBins;
-    TArrayD fCentEdges;                 // Centrality Bin Lower edges.
-    TArrayI fCentNMixed;                // Number of mixed events for each centrality bin.
-    UInt_t  fNEMRPBins;                 // Binning of Reaction plane.
-    TArrayD fAssocBins;                 //  Assoc Pt Bin Lower edges.
-
-  // Control variables
-    Bool_t fUseMEAlgoritmForReal;        // Use common or ME algoritm for analysis real events.
-    Bool_t fUseMEAlgoritmForMix;         // Use common or ME algoritm for analysis mixed events.
-    Bool_t fUseEfficiency;                // Use efficiensy during analysis.
-    Bool_t fMakePHOSModulesCorrFunctions; // Turn on filling module Phi/Eta/Pt distribution.
-    Bool_t fMakeTPCHalfBarrelCorrFunctions; // Turn on filling half barrel TPC distribution.
-    Int_t fCheckHibridGlobal;      // For checking/dischecking/passingcheck: t->IsHybridGlobalConstrainedGlobal();
-
-  // Event selection
-    Bool_t fPHOSEvent;              // PHOS event trigger.
-    Bool_t fMBEvent;                // MB event trigger.
+  //General Data members
+  AliPHOSGeometry *   fPHOSGeo ;                        //! Geometry
+  TList *   fOutputContainer ;                          //! Output histograms container 
+
+  AliVEvent   *           fEvent;                       //! Current event
+  AliESDEvent *           fEventESD;                    //! Current event, if ESD.
+  AliAODEvent *           fEventAOD;                    //! Current event, if AOD.
+  AliInputEventHandler *  fEventHandler;                //! Event trigger bit.
+
+  TClonesArray *  fCaloPhotonsPHOS ;                    //! PHOS photons in current event
+  TClonesArray *  fTracksTPC ;                          //! TPC tracks in current event
+  TObjArray *     fCaloPhotonsPHOSLists;                //! array of TList, Containers for events with PHOS photons
+  TObjArray *     fTracksTPCLists;                      //! array of TList, Containers for events with TPC tracks
+
+  Int_t     fRunNumber;                                 //! Run number
+  Int_t     fInternalRunNumber ;                        //! Current internal run number 
+  Period    fPeriod;                                    //! kUndefinedPeriod, kLHC10h, kLHC11h, kLHC13
+
+  Bool_t    fPHOSEvent;                                 //! PHOS event trigger.
+  Bool_t    fMBEvent;                                   //! MB event trigger.
+
+  // Binning [vtx, centrality, reaction-plane]
+  Int_t     fNVtxZBins;                                 // Number of Z vertex bins
+  TArrayD   fCentEdges;                                 //! Centrality Bin Lower edges
+  TArrayI   fCentNMixed;                                // Number of mixed events for each centrality bin
+  UInt_t    fNEMRPBins;                                 // Binning of Reaction plane
+  TArrayD   fAssocBins;                                 //! Assoc Pt Bin Lower edges  
+
+  Double_t  fVertex[3];                                 //! Event vertex
+  TVector3  fVertexVector;                              //! The same
+  Int_t     fVtxBin;                                    //! Vertex bin
+
+  TString   fCentralityEstimator;                       //! Centrality estimator ("V0M", "ZNA")
+  Float_t   fCentrality ;                               //! Centrality of the current event
+  Int_t     fCentBin ;                                  //! Current centrality bin
+
+  Bool_t    fHaveTPCRP ;                                //! Is TPC RP defined?
+  Float_t   fRP ;                                       //! Reaction plane calculated with full TPC
+  Int_t     fEMRPBin;                                   //! Event Mixing Reaction Plane Bin
 
   // Behavior / cuts
-    Period fPeriod;
-    Float_t fMaxAbsVertexZ;       // Maximum distence Z component of vertix in cm.
-    Bool_t fManualV0EPCalc;       //
-
-    Double_t fCentCutoffDown;   // Ignore Centrality less %. (def = 0%)
-    Double_t fCentCutoffUp;     // Ignore Centrality over %. (def = 90%)
-
-    Double_t fMassInvMean ;     // Mass Pi0.
-    Double_t fMassInvSigma ;    // Mass width Pi0.
-    Double_t fSigmaWidth;       // *N sigma. if 0 will use fMassInvMean+/-fMassInvSigma. Else will calculate using function.
-
-  // Funktion of window mass parametrs: [mass, pt]
-    Double_t fMassMeanP0;
-    Double_t fMassMeanP1;
-    Double_t fMassSigmaP0;
-    Double_t fMassSigmaP1;
-    Double_t fMassSigmaP2;
-    Double_t fMassSigmaP3;
-
-    AliVEvent* fEvent;          //! Current event
-    AliESDEvent* fEventESD;     //! Current event, if ESD.
-    AliAODEvent* fEventAOD;     //! Current event, if AOD.
-    AliInputEventHandler *fEventHandler; //! Event trigger bit.
-    AliESDtrackCuts *fESDtrackCuts;     // Track cut
-
-    Int_t fRunNumber;           //! run number
-    Int_t fInternalRunNumber ;  //! Current internal run number
-
-    TProfile* fMultV0;          // Object containing VZERO calibration information
-    Float_t fV0Cpol,fV0Apol;    // oaded by OADB
-    Float_t fMeanQ[9][2][2];    // and recentering
-    Float_t fWidthQ[9][2][2];   //       
-    TString fEPcalibFileName;   //
-
-    Double_t fVertex[3];          //! Event vertex.
-    TVector3 fVertexVector;       //! The same.
-    Int_t fVtxBin;                //! Vertex bin.
-
-    TString fCentralityEstimator; //! Centrality estimator ("V0M", "ZNA")
-    Float_t fCentrality ;         //! Centrality of the current event
-    Int_t   fCentBin ;            //! Current centrality bin
-
-    Bool_t fHaveTPCRP ; //! Is TPC RP defined?
-    Float_t fRP ;       //! Reaction plane calculated with full TPC
-    Int_t fEMRPBin;     //! Event Mixing Reaction Plane Bin
-
-    // ME Pi0 selection veriables. 1...4 = all...both pid.
-    Bool_t fMEExists[4];    // Does trigger Pi0 exists?
-    Double_t fMEPhi[4];     // Phi ME pi0.
-    Double_t fMEEta[4];     // Eta ME Pi0.
-    Double_t fMEPt[4];      // pT ME Pi0.
-    Int_t fMEModCase[4];    // Pair of modules where photons are observed.
-
-    TClonesArray * fCaloPhotonsPHOS ;      //! PHOS photons in current event
-    TClonesArray * fTracksTPC ;            //! TPC Tracks in current event
-
-    TObjArray * fCaloPhotonsPHOSLists;  //! array of TList, Containers for events with PHOS photons
-    TObjArray * fTracksTPCLists;        //! array of TList, Containers for events with PHOS photons
-
-  ClassDef(AliPHOSCorrelations, 2);    // PHOS analysis task
+  Float_t   fMaxAbsVertexZ;                             // Maximum distence Z component of vertix in cm
+  Double_t  fCentralityLowLimit;                        // Ignore Centrality less % 
+  Double_t  fCentralityHightLimit;                      // Ignore Centrality over % 
+
+  AliESDtrackCuts *   fESDtrackCuts;                    // Track cut
+  Int_t     fCheckHibridGlobal ;                        // For checking/dischecking/passingcheck: t->IsHybridGlobalConstrainedGlobal();
+
+  Double_t  fMinClusterEnergy;                          // Min energy PHOS's cluster
+  Double_t  fMinBCDistance;                             // Min distance to nearest bad channel
+  Int_t     fMinNCells;                                 // Min count of Cells in cluster
+  Double_t  fMinM02;                                    // Min size of M02 in claster
+  Bool_t    fTOFCutEnabled;                             // Use time of flight or not?
+  Double_t  fTOFCut;                                    // Max time of flight
+
+  Double_t fMassInvMean ;                               // Mass Pi0
+  Double_t fMassInvSigma ;                              // Mass width Pi0
+  Double_t fSigmaWidth;                                 // Width in sigma (*N). If fSigmaWidth = 0 code will use fMassInvMean+/-fMassInvSigma
+
+  // Funktion of mass window parametrs: [mass, pt]
+  Double_t  fMassMean[2];                               // Mass mean parametrisation
+  Double_t  fMassSigma[4];                              // Mass sigma parametrisation
+
+  // ME Pi0 selection veriables ([n] = pid).
+  Bool_t    fMEExists[4];                               // Does trigger Pi0 candidate exists?
+  Double_t  fMEPhi[4];                                  // Phi of ME Pi0 candidate
+  Double_t  fMEEta[4];                                  // Eta of ME Pi0 candidate
+  Double_t  fMEPt[4];                                   // pT of ME Pi0 candidate
+  Int_t     fMEModCase[4];                              // Pair of modules where photons are observed
+
+  Bool_t    fUseEfficiency ;                            // Use efficiensy correction during analysis
+
+  ClassDef(AliPHOSCorrelations, 2);                     // PHOS analysis task
 };
 
 #endif