updated analysis (Jason Ulery)
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Mar 2012 16:07:27 +0000 (16:07 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Mar 2012 16:07:27 +0000 (16:07 +0000)
PWGCF/Correlations/DPhi/AliAnalysisTaskDiHadron.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskDiHadron.h
PWGCF/Correlations/macros/3particlecorrelations/AddTask_DiHadron.C [new file with mode: 0644]
PWGCF/Correlations/macros/AddTaskDiHadron.C [deleted file]

index 7c979df..d380682 100755 (executable)
@@ -17,6 +17,7 @@
 //version: 3.4,  last revised: 2010/08/15
 
 #include "Riostream.h"
+#include "TROOT.h"
 #include "TChain.h"
 #include "TTree.h"
 #include "TH1F.h"
 #include "TF3.h"
 #include "TVector3.h"
 #include "TMath.h"
+#include "TRandom3.h"
+#include "TSystem.h"
 
 
 #include "AliAnalysisTask.h"
+#include "AliAnalysisTaskSE.h"
 #include "AliAnalysisManager.h"
-
+#include "AliAnalysisTaskSE.h"
 #include "AliESDEvent.h"
 #include "AliESDInputHandler.h"
+#include "AliESDtrack.h"
+#include "AliAODEvent.h"
+#include "AliAODHeader.h"
+#include "AliAODInputHandler.h"
+#include "AliAODTrack.h"
 #include "AliMCEvent.h"
 #include "AliMCEventHandler.h"
 #include "AliMCParticle.h"
 #include "AliStack.h"
 #include "AliESDVertex.h"
 #include "AliMultiplicity.h"
+#include "AliESDVZERO.h"
 #include "TParticle.h"
-
+#include "AliCentrality.h"
 
 //#include "AliHeader.h"
 //#include "AliGenEventHeader.h"
@@ -56,10 +66,11 @@ ClassImp(AliAnalysisTaskDiHadron)
 
 //----------------------------------------
 AliAnalysisTaskDiHadron::AliAnalysisTaskDiHadron(const char *name):
-AliAnalysisTask(name,""), fESD(0), fMC(0), fOutput(0),fMinClustersTPC(0),fMinClusterRatio(0),fMaxTPCchi2(0),fMinClustersITS(0),fEtaCut(0),fTrigEtaCut(0),fNearPhiCut(0),fXECut(0),fMaxDCA(0),fMaxDCAXY(0),fMaxDCAZ(0),fDCA2D(0),fTPCRefit(0),fITSRefit(0),fSPDCut(0),fMinPtAssoc(0),fMaxPtAssoc(0),fVzCut(0),fEfficiencyCorr(0),fDEBUG(0),fnBinPhi(0),fnBinEta(0),fnBinPhiEtaPhi(0),fnBinPhiEtaEta(0),fnBinPhi3(0),fnBinEta3(0),fPi(3.1415926535898),fdPhiMin(0),fdPhiMax(0),fNTPtBins(0),fNMix(0),fNCentBins(0),fNAPtBins(0),fNAPt3Bins(0),fNVertexBins(0),fNXEBins(0),fNIDs(0),fEffFitPt(0),fNFitLowParam(0),fNFitHighParam(0),fMCHistos(0),fFitLow(NULL),fFitHigh(NULL),fFitLowParam(NULL),fFitHighParam(NULL),fPtTrigArray(NULL),fPtAssocArray(NULL),fPtAssoc3Array1(NULL),fPtAssoc3Array2(NULL),fCentArrayMin(NULL),fCentArrayMax(NULL),fXEArray(NULL),fTrigIDArray(NULL),ftPhi(NULL),ftEta(NULL),ftPt(NULL),ftCharge(NULL),ftEff(NULL),ftPtAssoc3(NULL),ftNPtAssoc3(NULL)
+AliAnalysisTaskSE(name), fESD(0), fAOD(0), fMC(0), fOutput(0),fMinClustersTPC(0),fMinClusterRatio(0),fMaxTPCchi2(0),fMinClustersITS(0),fEtaCut(0),fTrigEtaCut(0),fNearPhiCut(0),fXECut(0),fMaxDCA(0),fMaxDCAXY(0),fMaxDCAZ(0),fDCA2D(0),fTPCRefit(0),fITSRefit(0),fSPDCut(0),fMinPtAssoc(0),fMaxPtAssoc(0),fVzCut(0),fAODData(0),fEfficiencyCorr(0),fDEBUG(0),fnBinPhi(0),fnBinEta(0),fnBinPhiEtaPhi(0),fnBinPhiEtaEta(0),fnBinPhi3(0),fnBinEta3(0),fPi(3.1415926535898),fdPhiMin(0),fdPhiMax(0),fNTPtBins(0),fNMix(0),fNCentBins(0),fCentPercent(0),fNAPtBins(0),fNAPt3Bins(0),fNVertexBins(0),fNXEBins(0),fNIDs(0),fEffFitPt(0),fNFitLowParam(0),fNFitHighParam(0),fV2FitPt(0),fV3FitPt(0),fV4FitPt(0),fNFitLowParamV2(0),fNFitHighParamV2(0),fNFitLowParamV3(0),fNFitHighParamV3(0),fNFitLowParamV4(0),fNFitHighParamV4(0),fMCHistos(0),fFitLow(NULL),fFitHigh(NULL),fFitLowParam(NULL),fFitHighParam(NULL),fFitLowV2(NULL),fFitHighV2(NULL),fFitLowParamV2(NULL),fFitHighParamV2(NULL),fFitLowV3(NULL),fFitHighV3(NULL),fFitLowParamV3(NULL),fFitHighParamV3(NULL),fFitLowV4(NULL),fFitHighV4(NULL),fFitLowParamV4(NULL),fFitHighParamV4(NULL),fPtTrigArray(NULL),fPtAssocArray(NULL),fPtAssoc3Array1(NULL),fPtAssoc3Array2(NULL),fCentArrayMin(NULL),fCentArrayMax(NULL),fXEArray(NULL),fTrigIDArray(NULL),fSimulate(0),fSimNBgPart(0),fSimNJetPart(0),fSimNJet(0),fSimNEvents(0),ftPhi(NULL),ftEta(NULL),ftPt(NULL),ftCharge(NULL),ftEff(NULL),ftV2(NULL),ftV3(NULL),ftV4(NULL),ftPtAssoc3(NULL),ftNPtAssoc3(NULL)
   
   {
+    //TRandom *gRandom=new TRandom3();
+  
   //IO Slots
   DefineInput(0, TChain::Class());
   DefineOutput(0,TList::Class());
@@ -68,12 +79,16 @@ AliAnalysisTask(name,""), fESD(0), fMC(0), fOutput(0),fMinClustersTPC(0),fMinClu
   for(int c=0;c<fNCentBins;c++){
     for(int v=0;v<fNVertexBins;v++){
       for(int jmc=0;jmc<2;jmc++){
-       fMixPointer[c][v][jmc]=-1;
-       fMixEnd[c][v][jmc]=-1;
+       fMixPointer[c][v][jmc]=0;
+       fMixEnd[c][v][jmc]=0;
        for(int ievts=0;ievts<fNMix;ievts++){
          fMPt[ievts][c][v][jmc]=NULL;
          fMPhi[ievts][c][v][jmc]=NULL;
          fMEta[ievts][c][v][jmc]=NULL;
+         fMCharge[ievts][c][v][jmc]=NULL;
+         fMEff[ievts][c][v][jmc]=NULL;
+         fMV2[ievts][c][v][jmc]=NULL;
+         fMV4[ievts][c][v][jmc]=NULL;
          for(int dd=0;dd<10;dd++)fMPtAssoc3[ievts][c][v][jmc][dd]=NULL;
          fMNPtAssoc3[ievts][c][v][jmc]=NULL;
          fMixTrack[ievts][c][v][jmc]=0;
@@ -86,6 +101,7 @@ AliAnalysisTask(name,""), fESD(0), fMC(0), fOutput(0),fMinClustersTPC(0),fMinClu
 //--------------------------------------
 void AliAnalysisTaskDiHadron::SetCuts(Int_t MinClustersTPC,  Float_t MinClusterRatio, Float_t MaxTPCchi2, Int_t MinClustersITS, Float_t EtaCut, Float_t TrigEtaCut, Float_t NearPhiCut, Float_t XECut, Float_t MaxDCA, Float_t MaxDCAXY, Float_t MaxDCAZ, Int_t DCA2D, Int_t TPCRefit, Int_t ITSRefit, Int_t SPDCut, Float_t MinPtAssoc, Float_t MaxPtAssoc, Float_t VzCut, Int_t NIDs, const char * TrigIDArray){
 //Sets the varibles for track and event cuts
+  if(fDEBUG)Printf("Setting Cuts");
   fMinClustersTPC=MinClustersTPC;
   fMinClusterRatio=MinClusterRatio;
   fMaxTPCchi2=MaxTPCchi2;
@@ -108,15 +124,18 @@ void AliAnalysisTaskDiHadron::SetCuts(Int_t MinClustersTPC,  Float_t MinClusterR
   fTrigIDArray=(char*)TrigIDArray;
 }
 //--------------------------------------------------------
-void AliAnalysisTaskDiHadron::SetOptions(Int_t EfficiencyCorr, Int_t ffDEBUG,  Int_t MCHistos){
+void AliAnalysisTaskDiHadron::SetOptions(Int_t AODData, Int_t EfficiencyCorr, Int_t ffDEBUG,  Int_t MCHistos){
 //Sets some options
+  if(fDEBUG) Printf("Setting Options");
+  fAODData=AODData;
   fEfficiencyCorr=EfficiencyCorr;
   fDEBUG=ffDEBUG;
   fMCHistos=MCHistos;
 }
 //------------------------------------------------------
-void AliAnalysisTaskDiHadron::SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPhiEtaPhi, Int_t nBinPhiEtaEta, Int_t nBinPhi3, Int_t nBinEta3,Float_t dPhiMin, Float_t dPhiMax, Int_t NTPtBins, Int_t NMixBins, Int_t NCentBins,Int_t NAPtBins, Int_t NAPt3Bins, Int_t NVertexBins, Int_t NXEBins,Float_t *PtTrigArray, Float_t *PtAssocArray,Float_t *PtAssoc3Array1, Float_t *PtAssoc3Array2, Int_t *CentArrayMin, Int_t *CentArrayMax, Float_t *XEArray){
+void AliAnalysisTaskDiHadron::SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPhiEtaPhi, Int_t nBinPhiEtaEta, Int_t nBinPhi3, Int_t nBinEta3,Float_t dPhiMin, Float_t dPhiMax, Int_t NTPtBins, Int_t NMixBins, Int_t NCentBins, Int_t CentPercent, Int_t NAPtBins, Int_t NAPt3Bins, Int_t NVertexBins, Int_t NXEBins,Float_t *PtTrigArray, Float_t *PtAssocArray,Float_t *PtAssoc3Array1, Float_t *PtAssoc3Array2, Int_t *CentArrayMin, Int_t *CentArrayMax, Float_t *XEArray){
 //sets up the histogram binning
+  if(fDEBUG)Printf("Setting Binning");
   fnBinPhi=nBinPhi;
   fnBinEta=nBinEta;
   fnBinPhiEtaPhi=nBinPhiEtaPhi;
@@ -128,6 +147,7 @@ void AliAnalysisTaskDiHadron::SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPh
   fNTPtBins=NTPtBins;
   fNMix=NMixBins;
   fNCentBins=NCentBins;
+  fCentPercent=CentPercent;
   fNAPtBins=NAPtBins;
   fNAPt3Bins=NAPt3Bins;
   fNVertexBins=NVertexBins;
@@ -135,7 +155,7 @@ void AliAnalysisTaskDiHadron::SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPh
   fPtTrigArray=new Float_t [fNTPtBins];
   for(int i=0;i<fNTPtBins;i++)fPtTrigArray[i]=PtTrigArray[i];
   fPtAssocArray=new Float_t [fNAPtBins];
-  for(int i=0;i<fNAPtBins;i++)fPtAssocArray[i]=PtAssocArray[i];
+  for(int i=0;i<=fNAPtBins;i++)fPtAssocArray[i]=PtAssocArray[i];
   fPtAssoc3Array1=new Float_t [fNAPt3Bins];
   for(int i=0;i<fNAPt3Bins;i++)fPtAssoc3Array1[i]=PtAssoc3Array1[i];
   fPtAssoc3Array2=new Float_t [fNAPt3Bins];
@@ -151,6 +171,7 @@ void AliAnalysisTaskDiHadron::SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPh
 //-------------------------------------------------------
 void AliAnalysisTaskDiHadron::SetEfficiencies(Float_t EffFitPt, const TF1 *FitLow, const TF1 *FitHigh, Int_t NFitLowParam, Int_t NFitHighParam, Float_t *FitLowParam, Float_t *FitHighParam){
 //Sets up the efficiency corrections
+  if(fDEBUG)Printf("Setting Efficiencies");
   fEffFitPt=EffFitPt;
   fFitLow=(TF1*)FitLow;
   fFitHigh=(TF1*)FitHigh;
@@ -161,7 +182,51 @@ void AliAnalysisTaskDiHadron::SetEfficiencies(Float_t EffFitPt, const TF1 *FitLo
   fFitHighParam=new Float_t [fNFitHighParam*fNCentBins];
   for(int i=0;i<fNFitHighParam*fNCentBins;i++)fFitHighParam[i]=FitHighParam[i];
 }
+//-----------------------------------------------------------
+void AliAnalysisTaskDiHadron::SetFlow(Float_t V2FitPt, Float_t V3FitPt, Float_t V4FitPt, const TF1 *FitLowV2, const TF1 *FitHighV2, const TF1 *FitLowV3, const TF1 *FitHighV3, const TF1 *FitLowV4, const TF1 *FitHighV4, Int_t NFitLowParamV2, Int_t NFitHighParamV2, Int_t NFitLowParamV3, Int_t NFitHighParamV3, Int_t NFitLowParamV4, Int_t NFitHighParamV4, Float_t *FitLowParamV2, Float_t *FitHighParamV2, Float_t *FitLowParamV3, Float_t *FitHighParamV3, Float_t *FitLowParamV4, Float_t *FitHighParamV4){
+  if(fDEBUG)Printf("Setting Flow");
+  fV2FitPt=V2FitPt;
+  fV3FitPt=V3FitPt;
+  fV4FitPt=V4FitPt;
+  fFitLowV2=(TF1*)FitLowV2;
+  fFitHighV2=(TF1*)FitHighV2;
+  fFitLowV3=(TF1*)FitLowV3;
+  fFitHighV3=(TF1*)FitHighV3;
+  fFitLowV4=(TF1*)FitLowV4;
+  fFitHighV4=(TF1*)FitHighV4;
+  fNFitLowParamV2=NFitLowParamV2;
+  fNFitHighParamV2=NFitHighParamV2;
+  fNFitLowParamV3=NFitLowParamV3;
+  fNFitHighParamV3=NFitHighParamV3;
+  fNFitLowParamV4=NFitLowParamV4;
+  fNFitHighParamV4=NFitHighParamV4;
+
+  fFitLowParamV2=new Float_t [fNFitLowParamV2*fNCentBins];
+  for(int i=0;i<fNFitLowParamV2*fNCentBins;i++)fFitLowParamV2[i]=FitLowParamV2[i];
+  fFitHighParamV2=new Float_t [fNFitHighParamV2*fNCentBins];
+  for(int i=0;i<fNFitHighParamV2*fNCentBins;i++)fFitHighParamV2[i]=FitHighParamV2[i];
+
+  fFitLowParamV3=new Float_t [fNFitLowParamV3*fNCentBins];
+  for(int i=0;i<fNFitLowParamV3*fNCentBins;i++)fFitLowParamV3[i]=FitLowParamV3[i];
+  fFitHighParamV3=new Float_t [fNFitHighParamV3*fNCentBins];
+  for(int i=0;i<fNFitHighParamV3*fNCentBins;i++)fFitHighParamV3[i]=FitHighParamV3[i];
+
+  fFitLowParamV4=new Float_t [fNFitLowParamV4*fNCentBins];
+  for(int i=0;i<fNFitLowParamV4*fNCentBins;i++)fFitLowParamV4[i]=FitLowParamV4[i];
+  fFitHighParamV4=new Float_t [fNFitHighParamV4*fNCentBins];
+  for(int i=0;i<fNFitHighParamV4*fNCentBins;i++)fFitHighParamV4[i]=FitHighParamV4[i];
+  if(fDEBUG)Printf("FlowSet");
+  }
+//----------------------------------------------------------
+void AliAnalysisTaskDiHadron::SetSimulation(Int_t Simulate, Float_t SimNBgPart, Float_t SimNJetPart, Float_t SimNJet, Int_t SimNEvents){
+  fSimulate=Simulate;
+  fSimNBgPart=SimNBgPart;
+  fSimNJetPart=SimNJetPart;
+  fSimNJet=SimNJet;
+  fSimNEvents=SimNEvents;
 
+}
+  
 //-----------------------------------------------------------
 void AliAnalysisTaskDiHadron::ConnectInputData(Option_t *){
   //Connect to ESD
@@ -169,20 +234,25 @@ void AliAnalysisTaskDiHadron::ConnectInputData(Option_t *){
    TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
    if (!tree&&fDEBUG) {Printf("ERROR: Could not read chain from input slot 0");} 
   else {
-    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-    
-    if (!esdH){
-      if(fDEBUG)Printf("ERROR: Could not get ESDInputHandler");
+    if(!fAODData){
+AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+    if (!esdH){if(fDEBUG) Printf("ERROR: Could not get ESDInputHandler");}
+    else fESD = esdH->GetEvent();
     }
-    else{ 
-      fESD = esdH->GetEvent();
+    else{
+        AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+     if (!aodH) {
+       Printf("ERROR: Could not get AODInputHandler");
+     }
+     else{
+       fAOD = aodH->GetEvent();
+     }
     }
-    
     //MC Data handler (so one can calcualte eff)
     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*>((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
     if(mcH)fMC=mcH->MCEvent();
   }
-  if(fDEBUG)Printf("Connected");
+   if(fDEBUG)Printf("Connected");
 }
   
 //---------------------------------------------------------  
@@ -191,9 +261,8 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
   if(fDEBUG)Printf("Output");
   fOutput=new TList();
   fOutput->SetName(GetName());
-  const Int_t buffersize = 256;
-  char histname[buffersize];
-  char histtitle[buffersize];
+  char histname[300];
+  char histtitle[300];
   int nptbins=fNAPtBins;
   int lptbins=0;
   const char *cmc1[2]={"","_MC"};
@@ -207,6 +276,7 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
   Float_t etaArray[fnBinEta+1];
   Float_t phiEtaArrayPhi[fnBinPhiEtaPhi+1];
   Float_t phiEtaArrayEta[fnBinPhiEtaEta+1];
+  Int_t BufferSize=256;
   for(int iphi=0;iphi<=fnBinPhi;iphi++){
     phiArray[iphi]=fdPhiMin+iphi*2*fPi/fnBinPhi;
   }
@@ -222,8 +292,8 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
   for(int imc=0;imc<=1;imc++){//MC loop
     if(imc==1&&!fMCHistos) continue;
     //Create the histograms
-    snprintf(histname,buffersize,"fHistMult%s",cmc1[imc]);
-    snprintf(histtitle,buffersize,"Multiplicity%s",cmc2[imc]);
+    snprintf(histname,BufferSize,"fHistMult%s",cmc1[imc]);
+    snprintf(histtitle,BufferSize,"Multiplicity%s",cmc2[imc]);
     fHistMult[imc]=new TH1F(histname,histtitle,2000,-0.5,1999.5);
     fHistMult[imc]->Sumw2();
     fHistMult[imc]->GetXaxis()->SetTitle("Number of tracks");
@@ -233,89 +303,89 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
     for(int imult=0;imult<fNCentBins;imult++){//loop for multiplicity bins
       
       //Histograms that are independent of the trigger
-      snprintf(histname,buffersize,"fHistPt_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T} Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistPt_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T} Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPt[imult][imc]=new TH1F(histname,histtitle,nptbins,fPtAssocArray);
       fHistPt[imult][imc]->Sumw2();
       fHistPt[imult][imc]->GetXaxis()->SetTitle("p_{T}");
       fHistPt[imult][imc]->GetYaxis()->SetTitle("Counts");
       fOutput->Add(fHistPt[imult][imc]);
 
-      //Histograms that are independent of the trigger
-      snprintf(histname,buffersize,"fHistPtEff_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T} Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+ //Histograms that are independent of the trigger
+      snprintf(histname,BufferSize,"fHistPtEff_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T} Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPtEff[imult][imc]=new TH1F(histname,histtitle,1000,0,100);
       fHistPtEff[imult][imc]->Sumw2();
       fHistPtEff[imult][imc]->GetXaxis()->SetTitle("p_{T}");
       fHistPtEff[imult][imc]->GetYaxis()->SetTitle("Counts");
       fOutput->Add(fHistPtEff[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistPhi_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"#phi Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistPhi_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#phi Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPhi[imult][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,nptbins,fPtAssocArray);
       fHistPhi[imult][imc]->Sumw2();
       fHistPhi[imult][imc]->GetXaxis()->SetTitle("#phi");
       fHistPhi[imult][imc]->GetYaxis()->SetTitle("P_{T}");
       fOutput->Add(fHistPhi[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistPhiPt_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T} weighted #phi Distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistPhiPt_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T} weighted #phi Distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPhiPt[imult][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,nptbins,fPtAssocArray);
       fHistPhiPt[imult][imc]->Sumw2();
       fHistPhiPt[imult][imc]->GetXaxis()->SetTitle("#phi");
       fHistPhiPt[imult][imc]->GetYaxis()->SetTitle("P_{T}");
       fOutput->Add(fHistPhiPt[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistEta_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"#eta Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistEta_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#eta Distribution of Tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistEta[imult][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,nptbins,fPtAssocArray);
       fHistEta[imult][imc]->Sumw2();
       fHistEta[imult][imc]->GetXaxis()->SetTitle("#eta");
       fHistEta[imult][imc]->GetYaxis()->SetTitle("P_{T}");
       fOutput->Add(fHistEta[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistEtaPt_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T} weighted #eta Distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistEtaPt_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T} weighted #eta Distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistEtaPt[imult][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,nptbins,fPtAssocArray);
       fHistEtaPt[imult][imc]->Sumw2();
       fHistEtaPt[imult][imc]->GetXaxis()->SetTitle("#eta");
       fHistEtaPt[imult][imc]->GetYaxis()->SetTitle("P_{T}");
       fOutput->Add(fHistEtaPt[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistNEvents_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"Number of Events and Number Passing Cuts %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistNEvents_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"Number of Events and Number Passing Cuts %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistNEvents[imult][imc]=new TH1F(histname,histtitle,2,-0.5,1.5);
       fHistNEvents[imult][imc]->Sumw2();
       fHistNEvents[imult][imc]->GetXaxis()->SetTitle("Events,Passing Cuts");
       fHistNEvents[imult][imc]->GetYaxis()->SetTitle("Number of Events");
       fOutput->Add(fHistNEvents[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistNTrigger_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"Number of Triggers %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistNTrigger_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"Number of Triggers %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistNTrigger[imult][imc]=new TH1F(histname,histtitle,fNTPtBins,-0.5,fNTPtBins-0.5);
       fHistNTrigger[imult][imc]->Sumw2();
       fHistNTrigger[imult][imc]->GetXaxis()->SetTitle("Trigger Number");
       fHistNTrigger[imult][imc]->GetYaxis()->SetTitle("Number of Triggers");
       fOutput->Add(fHistNTrigger[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistNTriggerPt_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T} Weighted Number of Triggers %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistNTriggerPt_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T} Weighted Number of Triggers %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistNTriggerPt[imult][imc]=new TH1F(histname,histtitle,fNTPtBins,-0.5,fNTPtBins-0.5);
       fHistNTriggerPt[imult][imc]->Sumw2();
       fHistNTriggerPt[imult][imc]->GetXaxis()->SetTitle("Trigger Number");
       fHistNTriggerPt[imult][imc]->GetYaxis()->SetTitle("Number of Triggers");
       fOutput->Add(fHistNTriggerPt[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistNMix_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"Number of Mixed Events %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistNMix_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"Number of Mixed Events %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistNMix[imult][imc]=new TH1F(histname,histtitle,fNTPtBins,-0.5,fNTPtBins-0.5);
       fHistNMix[imult][imc]->Sumw2();
       fHistNMix[imult][imc]->GetXaxis()->SetTitle("Trigger Number");
       fHistNMix[imult][imc]->GetYaxis()->SetTitle("Number of Mixed Events");
       fOutput->Add(fHistNMix[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistPhiEta_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"#phi-#eta distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistPhiEta_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#phi-#eta distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPhiEta[imult][imc]=new TH3F(histname, histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,nptbins,fPtAssocArray);
       fHistPhiEta[imult][imc]->Sumw2();
       fHistPhiEta[imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -323,8 +393,8 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
       fHistPhiEta[imult][imc]->GetZaxis()->SetTitle("p_{T}");
       fOutput->Add(fHistPhiEta[imult][imc]);
       
-      snprintf(histname,buffersize,"fHistPhiEtaPt_C%d%s",imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"Pt Weighted #phi-#eta distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistPhiEtaPt_C%d%s",imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"Pt Weighted #phi-#eta distribution of tracks %dMult%d%s",fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPhiEtaPt[imult][imc]=new TH3F(histname, histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,nptbins,fPtAssocArray);
       fHistPhiEtaPt[imult][imc]->Sumw2();
       fHistPhiEtaPt[imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -343,56 +413,56 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
        
        //Ones with no centrality binning
        if(imult==0){
-         snprintf(histname,buffersize,"fHistMultTrig_P%d%s",i,cmc1[imc]);
-         snprintf(histtitle,buffersize,"Distrubition of number of tracks in triggered events with %3.1f<p_{T}^{Trig}<%3.1f%s",fPtTrigArray[i],fPtTrigArray[i+1],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistMultTrig_P%d%s",i,cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Distrubition of number of tracks in triggered events with %3.1f<p_{T}^{Trig}<%3.1f%s",fPtTrigArray[i],fPtTrigArray[i+1],cmc2[imc]);
          fHistMultTrig[i][imc]=new TH1F(histname,histtitle,2000,0,2000);
          fHistMultTrig[i][imc]->Sumw2();
          fHistMultTrig[i][imc]->GetXaxis()->SetTitle("Number of Tracks");
          fHistMultTrig[i][imc]->GetYaxis()->SetTitle("Counts");
          fOutput->Add(fHistMultTrig[i][imc]);
        }
-       snprintf(histname,buffersize,"fHistPtTrig_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"P_{T} distribution in triggered events with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistPtTrig_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"P_{T} distribution in triggered events with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistPtTrig[i][imult][imc]=new TH1F(histname,histtitle,nptbins,fPtAssocArray);
        fHistPtTrig[i][imult][imc]->Sumw2();
        fHistPtTrig[i][imult][imc]->GetXaxis()->SetTitle("p_{T}");
        fHistPtTrig[i][imult][imc]->GetYaxis()->SetTitle("Counts");
        fOutput->Add(fHistPtTrig[i][imult][imc]);
        
-       snprintf(histname,buffersize,"fHistPhiTrig_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"Phi Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistPhiTrig_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"Phi Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistPhiTrig[i][imult][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
        fHistPhiTrig[i][imult][imc]->Sumw2();
        fHistPhiTrig[i][imult][imc]->GetXaxis()->SetTitle("#phi");
        fHistPhiTrig[i][imult][imc]->GetYaxis()->SetTitle("p_{T}");
        fOutput->Add(fHistPhiTrig[i][imult][imc]);
        
-       snprintf(histname,buffersize,"fHistPhiTrigPt_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"P_{T} Weighted Phi Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f%s",fPtTrigArray[i],fPtTrigArray[i+1],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistPhiTrigPt_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"P_{T} Weighted Phi Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f%s",fPtTrigArray[i],fPtTrigArray[i+1],cmc2[imc]);
        fHistPhiTrigPt[i][imult][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
        fHistPhiTrigPt[i][imult][imc]->Sumw2();
        fHistPhiTrigPt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
        fHistPhiTrigPt[i][imult][imc]->GetYaxis()->SetTitle("p_{T}");
        fOutput->Add(fHistPhiTrigPt[i][imult][imc]);
        
-       snprintf(histname,buffersize,"fHistEtaTrig_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"Eta Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistEtaTrig_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"Eta Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistEtaTrig[i][imult][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
        fHistEtaTrig[i][imult][imc]->Sumw2();
        fHistEtaTrig[i][imult][imc]->GetXaxis()->SetTitle("#eta");
        fHistEtaTrig[i][imult][imc]->GetYaxis()->SetTitle("p_{T}");
        fOutput->Add(fHistEtaTrig[i][imult][imc]);
        
-       snprintf(histname,buffersize,"fHistEtaTrigPt_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"P_{T} Weighted Eta Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f%s",fPtTrigArray[i],fPtTrigArray[i+1],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistEtaTrigPt_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"P_{T} Weighted Eta Distribution of triggered events with %3.1f<p_{T}^{Trig}<%3.1f%s",fPtTrigArray[i],fPtTrigArray[i+1],cmc2[imc]);
        fHistEtaTrigPt[i][imult][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
        fHistEtaTrigPt[i][imult][imc]->Sumw2();
        fHistEtaTrigPt[i][imult][imc]->GetXaxis()->SetTitle("#eta");
        fHistEtaTrigPt[i][imult][imc]->GetYaxis()->SetTitle("p_{T}");
        fOutput->Add(fHistEtaTrigPt[i][imult][imc]);
        
-       snprintf(histname,buffersize,"fHistPhiEtaTrig_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"#phi-#eta distribution in triggered events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistPhiEtaTrig_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"#phi-#eta distribution in triggered events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistPhiEtaTrig[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
        fHistPhiEtaTrig[i][imult][imc]->Sumw2();
        fHistPhiEtaTrig[i][imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -400,29 +470,29 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
        fHistPhiEtaTrig[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
        fOutput->Add(fHistPhiEtaTrig[i][imult][imc]);
 
-       snprintf(histname,buffersize,"fHistXEN_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"Near-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistXEN_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"Near-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistXEN[i][imult][imc]=new TH1F(histname,histtitle,fNXEBins,fXEArray);
        fHistXEN[i][imult][imc]->Sumw2();
        fHistXEN[i][imult][imc]->GetXaxis()->SetTitle("X_{E}");
        fOutput->Add(fHistXEN[i][imult][imc]);
 
-       snprintf(histname,buffersize,"fHistXENMixed_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"Mixed Near-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistXENMixed_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"Mixed Near-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistXENMix[i][imult][imc]=new TH1F(histname,histtitle,fNXEBins,fXEArray);
        fHistXENMix[i][imult][imc]->Sumw2();
        fHistXENMix[i][imult][imc]->GetXaxis()->SetTitle("X_{E}");
        fOutput->Add(fHistXENMix[i][imult][imc]);
        
-       snprintf(histname,buffersize,"fHistXEA_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"Away-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistXEA_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"Away-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistXEA[i][imult][imc]=new TH1F(histname,histtitle,fNXEBins,fXEArray);
        fHistXEA[i][imult][imc]->Sumw2();
        fHistXEA[i][imult][imc]->GetXaxis()->SetTitle("X_{E}");
        fOutput->Add(fHistXEA[i][imult][imc]);
 
-       snprintf(histname,buffersize,"fHistXEAMixed_P%d_C%d%s",i,imult,cmc1[imc]);
-       snprintf(histtitle,buffersize,"Mixed Away-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+       snprintf(histname,BufferSize,"fHistXEAMixed_P%d_C%d%s",i,imult,cmc1[imc]);
+       snprintf(histtitle,BufferSize,"Mixed Away-Side X_{E} distribution for %3.1f<p_{T}^{Lead}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
        fHistXEAMix[i][imult][imc]=new TH1F(histname,histtitle,fNXEBins,fXEArray);
        fHistXEAMix[i][imult][imc]->Sumw2();
        fHistXEAMix[i][imult][imc]->GetXaxis()->SetTitle("X_{E}");
@@ -430,109 +500,257 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
 
        //signloop
        for(int isign=0;isign<3;isign++){
-         snprintf(histname,buffersize,"fHistDeltaPhi_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"#Delta#phi Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhi_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"#Delta#phi Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaPhi[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
          fHistDeltaPhi[i][imult][isign][imc]->Sumw2();
          fHistDeltaPhi[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
          fHistDeltaPhi[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaPhi[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaPhiPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"P_{T} Weighted #Delta#phi Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhiPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"P_{T} Weighted #Delta#phi Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaPhiPt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
          fHistDeltaPhiPt[i][imult][isign][imc]->Sumw2();
          fHistDeltaPhiPt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
          fHistDeltaPhiPt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaPhiPt[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaPhiMix_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"#Delta#phi Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhiMix_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"#Delta#phi Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaPhiMix[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
          fHistDeltaPhiMix[i][imult][isign][imc]->Sumw2();
          fHistDeltaPhiMix[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
          fHistDeltaPhiMix[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaPhiMix[i][imult][isign][imc]);
+
+           snprintf(histname,BufferSize,"fHistDeltaPhiMixV2_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"#Delta#phi Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaPhiMixV2[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
+         fHistDeltaPhiMixV2[i][imult][isign][imc]->Sumw2();
+         fHistDeltaPhiMixV2[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
+         fHistDeltaPhiMixV2[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaPhiMixV2[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaPhiMixV3_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"#Delta#phi Mixed Event V3 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaPhiMixV3[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
+         fHistDeltaPhiMixV3[i][imult][isign][imc]->Sumw2();
+         fHistDeltaPhiMixV3[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
+         fHistDeltaPhiMixV3[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaPhiMixV3[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaPhiMixV4_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"#Delta#phi Mixed Event V4 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaPhiMixV4[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
+         fHistDeltaPhiMixV4[i][imult][isign][imc]->Sumw2();
+         fHistDeltaPhiMixV4[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
+         fHistDeltaPhiMixV4[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaPhiMixV4[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaPhiMixPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"P_{T} Weighted #Delta#phi Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhiMixPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"P_{T} Weighted #Delta#phi Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaPhiMixPt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
          fHistDeltaPhiMixPt[i][imult][isign][imc]->Sumw2();
          fHistDeltaPhiMixPt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
          fHistDeltaPhiMixPt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaPhiMixPt[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaPhiMixV2Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"P_{T} Weighted #Delta#phi Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaPhiMixV2Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
+         fHistDeltaPhiMixV2Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaPhiMixV2Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
+         fHistDeltaPhiMixV2Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaPhiMixV2Pt[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaPhiMixV3Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"P_{T} Weighted #Delta#phi Mixed Event V3 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaPhiMixV3Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
+         fHistDeltaPhiMixV3Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaPhiMixV3Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
+         fHistDeltaPhiMixV3Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaPhiMixV3Pt[i][imult][isign][imc]);
          
+         snprintf(histname,BufferSize,"fHistDeltaPhiMixV4Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"P_{T} Weighted #Delta#phi Mixed Event V4 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaPhiMixV4Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinPhi,phiArray,lptbins,fPtAssocArray);
+         fHistDeltaPhiMixV4Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaPhiMixV4Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#phi");
+         fHistDeltaPhiMixV4Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaPhiMixV4Pt[i][imult][isign][imc]);
+
+
          //etaNear
-         snprintf(histname,buffersize,"fHistDeltaEtaN_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Near-Side #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaN_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaN[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaN[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaN[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaN[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaN[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaEtaNPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Near-Side P_{T} Weighted #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaNPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side P_{T} Weighted #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaNPt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaNPt[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaNPt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaNPt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaNPt[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaEtaNMix_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Near-Side #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaNMix_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaNMix[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaNMix[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaNMix[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaNMix[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaNMix[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaNMixV2_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side #Delta#eta Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaNMixV2[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaNMixV2[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaNMixV2[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaNMixV2[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaNMixV2[i][imult][isign][imc]);
+
+  snprintf(histname,BufferSize,"fHistDeltaEtaNMixV3_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side #Delta#eta Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaNMixV3[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaNMixV3[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaNMixV3[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaNMixV3[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaNMixV3[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaNMixV4_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side #Delta#eta Mixed Event V4 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaNMixV4[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaNMixV4[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaNMixV4[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaNMixV4[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaNMixV4[i][imult][isign][imc]);
+
          
-         snprintf(histname,buffersize,"fHistDeltaEtaNMixPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Near-Side P_{T} Weighted #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaNMixPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side P_{T} Weighted #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaNMixPt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaNMixPt[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaNMixPt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaNMixPt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaNMixPt[i][imult][isign][imc]);
-         
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaNMixV2Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side P_{T} Weighted #Delta#eta Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaNMixV2Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaNMixV2Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaNMixV2Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaNMixV2Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaNMixV2Pt[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaNMixV3Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side P_{T} Weighted #Delta#eta Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaNMixV3Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaNMixV3Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaNMixV3Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaNMixV3Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaNMixV3Pt[i][imult][isign][imc]);
+
+          snprintf(histname,BufferSize,"fHistDeltaEtaNMixV4Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Near-Side P_{T} Weighted #Delta#eta V4 Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaNMixV4Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaNMixV4Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaNMixV4Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaNMixV4Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaNMixV4Pt[i][imult][isign][imc]);
+
          //Away Eta
-         snprintf(histname,buffersize,"fHistDeltaEtaA_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Away-Side #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaA_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaA[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaA[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaA[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaA[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaA[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaEtaAPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Away-Side P_{T} Weighted #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaAPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side P_{T} Weighted #Delta#eta Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaAPt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaAPt[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaAPt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaAPt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaAPt[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaEtaAMix_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Away-Side #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaAMix_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaAMix[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaAMix[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaAMix[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaAMix[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaAMix[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaAMixV2_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side #Delta#eta Mixed Event V2 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaAMixV2[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaAMixV2[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaAMixV2[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaAMixV2[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaAMixV2[i][imult][isign][imc]);
+
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaAMixV3_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side #Delta#eta Mixed Event V3 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaAMixV3[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaAMixV3[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaAMixV3[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaAMixV3[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaAMixV3[i][imult][isign][imc]);
+
+
+           snprintf(histname,BufferSize,"fHistDeltaEtaAMixV4_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side #Delta#eta Mixed Event V4 Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaAMixV4[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaAMixV4[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaAMixV4[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaAMixV4[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaAMixV4[i][imult][isign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaEtaAMixPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
-         snprintf(histtitle,buffersize,"Away-Side P_{T} Weighted #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaAMixPt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side P_{T} Weighted #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
          fHistDeltaEtaAMixPt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
          fHistDeltaEtaAMixPt[i][imult][isign][imc]->Sumw2();
          fHistDeltaEtaAMixPt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
          fHistDeltaEtaAMixPt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
          fOutput->Add(fHistDeltaEtaAMixPt[i][imult][isign][imc]);
 
+          snprintf(histname,BufferSize,"fHistDeltaEtaAMixV2Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side P_{T} Weighted V2 #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaAMixV2Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaAMixV2Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaAMixV2Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaAMixV2Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaAMixV2Pt[i][imult][isign][imc]);
+
+          snprintf(histname,BufferSize,"fHistDeltaEtaAMixV3Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side P_{T} Weighted V3 #Delta#eta Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaAMixV3Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaAMixV3Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaAMixV3Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaAMixV3Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaAMixV3Pt[i][imult][isign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaAMixV4Pt_P%d_C%d%s%s",i,imult,sign1[isign],cmc1[imc]);
+         snprintf(histtitle,BufferSize,"Away-Side P_{T} Weighted #Delta#eta V4 Mixed Event Distribution with %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],sign2[isign],cmc2[imc]);
+         fHistDeltaEtaAMixV4Pt[i][imult][isign][imc]=new TH2F(histname,histtitle,fnBinEta,etaArray,lptbins,fPtAssocArray);
+         fHistDeltaEtaAMixV4Pt[i][imult][isign][imc]->Sumw2();
+         fHistDeltaEtaAMixV4Pt[i][imult][isign][imc]->GetXaxis()->SetTitle("#Delta#eta");
+         fHistDeltaEtaAMixV4Pt[i][imult][isign][imc]->GetYaxis()->SetTitle("p_{T}");
+         fOutput->Add(fHistDeltaEtaAMixV4Pt[i][imult][isign][imc]);
+
 
       //====
        }//end isignloop
-      snprintf(histname,buffersize,"fHistDeltaPhiEta_P%d_C%d%s",i,imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"#Delta#phi-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistDeltaPhiEta_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#Delta#phi-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistDeltaPhiEta[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
       fHistDeltaPhiEta[i][imult][imc]->Sumw2();
       fHistDeltaPhiEta[i][imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -540,17 +758,45 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
       fHistDeltaPhiEta[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
       fOutput->Add(fHistDeltaPhiEta[i][imult][imc]);
       
-      snprintf(histname,buffersize,"fHistDeltaPhiEtaMix_P%d_C%d%s",i,imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"#Delta#phi-#Delta#eta from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      
+      snprintf(histname,BufferSize,"fHistDeltaPhiEtaMix_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#Delta#phi-#Delta#eta from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistDeltaPhiEtaMix[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
       fHistDeltaPhiEtaMix[i][imult][imc]->Sumw2();
       fHistDeltaPhiEtaMix[i][imult][imc]->GetXaxis()->SetTitle("#phi");
       fHistDeltaPhiEtaMix[i][imult][imc]->GetYaxis()->SetTitle("#eta");
       fHistDeltaPhiEtaMix[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
       fOutput->Add(fHistDeltaPhiEtaMix[i][imult][imc]);
+
+      snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixV2_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#Delta#phi-#Delta#eta V2 from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      fHistDeltaPhiEtaMixV2[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
+      fHistDeltaPhiEtaMixV2[i][imult][imc]->Sumw2();
+      fHistDeltaPhiEtaMixV2[i][imult][imc]->GetXaxis()->SetTitle("#phi");
+      fHistDeltaPhiEtaMixV2[i][imult][imc]->GetYaxis()->SetTitle("#eta");
+      fHistDeltaPhiEtaMixV2[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
+      fOutput->Add(fHistDeltaPhiEtaMixV2[i][imult][imc]);
+
+ snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixV3_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#Delta#phi-#Delta#eta V3 from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      fHistDeltaPhiEtaMixV3[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
+      fHistDeltaPhiEtaMixV3[i][imult][imc]->Sumw2();
+      fHistDeltaPhiEtaMixV3[i][imult][imc]->GetXaxis()->SetTitle("#phi");
+      fHistDeltaPhiEtaMixV3[i][imult][imc]->GetYaxis()->SetTitle("#eta");
+      fHistDeltaPhiEtaMixV3[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
+      fOutput->Add(fHistDeltaPhiEtaMixV3[i][imult][imc]);
+
+       snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixV4_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"#Delta#phi-#Delta#eta V4 from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      fHistDeltaPhiEtaMixV4[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
+      fHistDeltaPhiEtaMixV4[i][imult][imc]->Sumw2();
+      fHistDeltaPhiEtaMixV4[i][imult][imc]->GetXaxis()->SetTitle("#phi");
+      fHistDeltaPhiEtaMixV4[i][imult][imc]->GetYaxis()->SetTitle("#eta");
+      fHistDeltaPhiEtaMixV4[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
+      fOutput->Add(fHistDeltaPhiEtaMixV4[i][imult][imc]);
       
-      snprintf(histname,buffersize,"fHistPhiEtaTrigPt_P%d_C%d%s",i,imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T}-Weighted #phi-#eta distribution in triggered events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistPhiEtaTrigPt_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T}-Weighted #phi-#eta distribution in triggered events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistPhiEtaTrigPt[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
       fHistPhiEtaTrigPt[i][imult][imc]->Sumw2();
       fHistPhiEtaTrigPt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -558,8 +804,8 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
       fHistPhiEtaTrigPt[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
       fOutput->Add(fHistPhiEtaTrigPt[i][imult][imc]);
     
-      snprintf(histname,buffersize,"fHistDeltaPhiEtaPt_P%d_C%d%s",i,imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T}-Weighted #Delta#phi-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistDeltaPhiEtaPt_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T}-Weighted #Delta#phi-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistDeltaPhiEtaPt[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
       fHistDeltaPhiEtaPt[i][imult][imc]->Sumw2();
       fHistDeltaPhiEtaPt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -567,8 +813,8 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
       fHistDeltaPhiEtaPt[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
       fOutput->Add(fHistDeltaPhiEtaPt[i][imult][imc]);
       
-      snprintf(histname,buffersize,"fHistDeltaPhiEtaMixPt_P%d_C%d%s",i,imult,cmc1[imc]);
-      snprintf(histtitle,buffersize,"P_{T}-Weighted #Delta#phi-#Delta#eta from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixPt_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T}-Weighted #Delta#phi-#Delta#eta from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
       fHistDeltaPhiEtaMixPt[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
       fHistDeltaPhiEtaMixPt[i][imult][imc]->Sumw2();
       fHistDeltaPhiEtaMixPt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
@@ -576,51 +822,167 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
       fHistDeltaPhiEtaMixPt[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
       fOutput->Add(fHistDeltaPhiEtaMixPt[i][imult][imc]);
 
+      snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixV2Pt_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T}-Weighted #Delta#phi-#Delta#eta V2 from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      fHistDeltaPhiEtaMixV2Pt[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
+      fHistDeltaPhiEtaMixV2Pt[i][imult][imc]->Sumw2();
+      fHistDeltaPhiEtaMixV2Pt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
+      fHistDeltaPhiEtaMixV2Pt[i][imult][imc]->GetYaxis()->SetTitle("#eta");
+      fHistDeltaPhiEtaMixV2Pt[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
+      fOutput->Add(fHistDeltaPhiEtaMixV2Pt[i][imult][imc]);
+
+  snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixV3Pt_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T}-Weighted #Delta#phi-#Delta#eta V3 from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      fHistDeltaPhiEtaMixV3Pt[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
+      fHistDeltaPhiEtaMixV3Pt[i][imult][imc]->Sumw2();
+      fHistDeltaPhiEtaMixV3Pt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
+      fHistDeltaPhiEtaMixV3Pt[i][imult][imc]->GetYaxis()->SetTitle("#eta");
+      fHistDeltaPhiEtaMixV3Pt[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
+      fOutput->Add(fHistDeltaPhiEtaMixV3Pt[i][imult][imc]);
+
+      snprintf(histname,BufferSize,"fHistDeltaPhiEtaMixV4Pt_P%d_C%d%s",i,imult,cmc1[imc]);
+      snprintf(histtitle,BufferSize,"P_{T}-Weighted #Delta#phi-#Delta#eta V4 from Mixed Events %3.1f<p_{T}^{Trig}<%3.1f %dMult%d%s",fPtTrigArray[i],fPtTrigArray[i+1],fCentArrayMin[imult],fCentArrayMax[imult],cmc2[imc]);
+      fHistDeltaPhiEtaMixV4Pt[i][imult][imc]=new TH3F(histname,histtitle,fnBinPhiEtaPhi,phiEtaArrayPhi,fnBinPhiEtaEta,phiEtaArrayEta,lptbins,fPtAssocArray);
+      fHistDeltaPhiEtaMixV4Pt[i][imult][imc]->Sumw2();
+      fHistDeltaPhiEtaMixV4Pt[i][imult][imc]->GetXaxis()->SetTitle("#phi");
+      fHistDeltaPhiEtaMixV4Pt[i][imult][imc]->GetYaxis()->SetTitle("#eta");
+      fHistDeltaPhiEtaMixV4Pt[i][imult][imc]->GetZaxis()->SetTitle("p_{T}");
+      fOutput->Add(fHistDeltaPhiEtaMixV4Pt[i][imult][imc]);
+
       //Three-Particle Histograms
       for(int ipt=0;ipt<fNAPt3Bins;ipt++){
        for(int iSign=0;iSign<4;iSign++){
-         snprintf(histname,buffersize,"fHistDeltaPhiPhi_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
-         snprintf(histtitle,buffersize,"Raw #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhiPhi_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Raw #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
          fHistDeltaPhiPhi[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
          fHistDeltaPhiPhi[i][ipt][imult][iSign][imc]->Sumw2();
          fHistDeltaPhiPhi[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
          fHistDeltaPhiPhi[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
          fOutput->Add(fHistDeltaPhiPhi[i][ipt][imult][iSign][imc]);
          
-         snprintf(histname,buffersize,"fHistDeltaPhiPhiMix_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
-         snprintf(histtitle,buffersize,"Mixed #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhiPhiMix_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
          fHistDeltaPhiPhiMix[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
          fHistDeltaPhiPhiMix[i][ipt][imult][iSign][imc]->Sumw2();
          fHistDeltaPhiPhiMix[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
          fHistDeltaPhiPhiMix[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
          fOutput->Add(fHistDeltaPhiPhiMix[i][ipt][imult][iSign][imc]);
 
-         snprintf(histname,buffersize,"fHistDeltaPhiPhiSS_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
-         snprintf(histtitle,buffersize,"Soft-Soft #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaPhiPhiMixV2_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#phi-#Delta#phi V2 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiMixV2[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiMixV2[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiMixV2[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiMixV2[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiMixV2[i][ipt][imult][iSign][imc]);
+
+  snprintf(histname,BufferSize,"fHistDeltaPhiPhiMixV3_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#phi-#Delta#phi V3 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiMixV3[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiMixV3[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiMixV3[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiMixV3[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiMixV3[i][ipt][imult][iSign][imc]);
+
+           snprintf(histname,BufferSize,"fHistDeltaPhiPhiMixV4_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#phi-#Delta#phi V4 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiMixV4[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiMixV4[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiMixV4[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiMixV4[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiMixV4[i][ipt][imult][iSign][imc]);
+
+           snprintf(histname,BufferSize,"fHistDeltaPhiPhiMixV2V2V4_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiMixV2V2V4[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiMixV2V2V4[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiMixV2V2V4[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiMixV2V2V4[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiMixV2V2V4[i][ipt][imult][iSign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaPhiPhiSS_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Soft-Soft #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
          fHistDeltaPhiPhiSS[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
          fHistDeltaPhiPhiSS[i][ipt][imult][iSign][imc]->Sumw2();
          fHistDeltaPhiPhiSS[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
          fHistDeltaPhiPhiSS[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
          fOutput->Add(fHistDeltaPhiPhiSS[i][ipt][imult][iSign][imc]);
 
-         snprintf(histname,buffersize,"fHistDeltaEtaEta_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
-         snprintf(histtitle,buffersize,"Raw #Delta#eta-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+          snprintf(histname,BufferSize,"fHistDeltaPhiPhiSSV2_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Soft-Soft V2  #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiSSV2[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiSSV2[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiSSV2[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiSSV2[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiSSV2[i][ipt][imult][iSign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaPhiPhiSSV3_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Soft-Soft V3 #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiSSV3[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiSSV3[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiSSV3[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiSSV3[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiSSV3[i][ipt][imult][iSign][imc]);
+
+          snprintf(histname,BufferSize,"fHistDeltaPhiPhiSSV4_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Soft-Soft V4 #Delta#phi-#Delta#phi %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaPhiPhiSSV4[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinPhi3,fdPhiMin,fdPhiMax,fnBinPhi3,fdPhiMin,fdPhiMax);
+         fHistDeltaPhiPhiSSV4[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaPhiPhiSSV4[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#phi_{1}");
+         fHistDeltaPhiPhiSSV4[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#phi_{2}");
+         fOutput->Add(fHistDeltaPhiPhiSSV4[i][ipt][imult][iSign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaEta_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Raw #Delta#eta-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
          fHistDeltaEtaEta[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
          fHistDeltaEtaEta[i][ipt][imult][iSign][imc]->Sumw2();
          fHistDeltaEtaEta[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
          fHistDeltaEtaEta[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#eta_{2}");
          fOutput->Add(fHistDeltaEtaEta[i][ipt][imult][iSign][imc]);
 
-    snprintf(histname,buffersize,"fHistDeltaEtaEtaMix_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
-         snprintf(histtitle,buffersize,"Mixed #Delta#eta-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+snprintf(histname,BufferSize,"fHistDeltaEtaEtaMix_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#eta-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
          fHistDeltaEtaEtaMix[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
          fHistDeltaEtaEtaMix[i][ipt][imult][iSign][imc]->Sumw2();
          fHistDeltaEtaEtaMix[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
          fHistDeltaEtaEtaMix[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#eta_{2}");
          fOutput->Add(fHistDeltaEtaEtaMix[i][ipt][imult][iSign][imc]);
 
-    snprintf(histname,buffersize,"fHistDeltaEtaEtaSS_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
-         snprintf(histtitle,buffersize,"Soft-Soft #Delta#eta-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         snprintf(histname,BufferSize,"fHistDeltaEtaEtaMixV2_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#eta-#Delta#eta V2 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaEtaEtaMixV2[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
+         fHistDeltaEtaEtaMixV2[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaEtaEtaMixV2[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
+         fHistDeltaEtaEtaMixV2[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#eta_{2}");
+         fOutput->Add(fHistDeltaEtaEtaMixV2[i][ipt][imult][iSign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaEtaMixV3_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#eta-#Delta#eta V3 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaEtaEtaMixV3[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
+         fHistDeltaEtaEtaMixV3[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaEtaEtaMixV3[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
+         fHistDeltaEtaEtaMixV3[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#eta_{2}");
+         fOutput->Add(fHistDeltaEtaEtaMixV3[i][ipt][imult][iSign][imc]);
+
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaEtaMixV4_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#eta-#Delta#eta V4 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaEtaEtaMixV4[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
+         fHistDeltaEtaEtaMixV4[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaEtaEtaMixV4[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
+         fHistDeltaEtaEtaMixV4[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#eta_{2}");
+         fOutput->Add(fHistDeltaEtaEtaMixV4[i][ipt][imult][iSign][imc]);
+
+         snprintf(histname,BufferSize,"fHistDeltaEtaEtaMixV2V2V4_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Mixed #Delta#eta-#Delta#eta V2V2V4 %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
+         fHistDeltaEtaEtaMixV2V2V4[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
+         fHistDeltaEtaEtaMixV2V2V4[i][ipt][imult][iSign][imc]->Sumw2();
+         fHistDeltaEtaEtaMixV2V2V4[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
+         fHistDeltaEtaEtaMixV2V2V4[i][ipt][imult][iSign][imc]->GetYaxis()->SetTitle("#Delta#eta_{2}");
+         fOutput->Add(fHistDeltaEtaEtaMixV2V2V4[i][ipt][imult][iSign][imc]);
+
+snprintf(histname,BufferSize,"fHistDeltaEtaEtaSS_P%dp%d_C%d%s%s",i,ipt,imult,cmc1[imc],sign31[iSign]);
+         snprintf(histtitle,BufferSize,"Soft-Soft #Delta#eta-#Delta#eta %3.1f<p_{T}^{Trig}<%3.1f %3.2f<p_{T}^{Assoc}<%3.2f %dMult%d%s%s",fPtTrigArray[i],fPtTrigArray[i+1],fPtAssoc3Array1[ipt],fPtAssoc3Array2[ipt],fCentArrayMin[imult],fCentArrayMax[imult],sign32[iSign],cmc2[imc]);
          fHistDeltaEtaEtaSS[i][ipt][imult][iSign][imc]=new TH2F(histname,histtitle,fnBinEta3,-etaEdge,etaEdge,fnBinEta3,-etaEdge,etaEdge);
          fHistDeltaEtaEtaSS[i][ipt][imult][iSign][imc]->Sumw2();
          fHistDeltaEtaEtaSS[i][ipt][imult][iSign][imc]->GetXaxis()->SetTitle("#Delta#eta_{1}");
@@ -634,7 +996,7 @@ void AliAnalysisTaskDiHadron::CreateOutputObjects(){
   }//imc
   if(fDEBUG)Printf("OutPut Created");
 }//CreateOutputObjects    
-
+/////////////////////////////////
 Int_t AliAnalysisTaskDiHadron::CheckVertex(const AliESDEvent *rESD){
   //checks whether the vertex passes cuts
   Int_t rGood=-1;
@@ -642,17 +1004,34 @@ Int_t AliAnalysisTaskDiHadron::CheckVertex(const AliESDEvent *rESD){
   vtx[0]=rESD->GetPrimaryVertex()->GetX();
   vtx[1]=rESD->GetPrimaryVertex()->GetY();
   vtx[2]=rESD->GetPrimaryVertex()->GetZ();
-  if((vtx[0]*vtx[0]+vtx[1]*vtx[1])<9) rGood=0; //vertex out of beam pipe
-  if(fabs(vtx[2])<fVzCut)rGood=0;//Vertex Z cut
+  if((vtx[0]*vtx[0]+vtx[1]*vtx[1])<9&&fabs(vtx[2])<fVzCut) rGood=0; //vertex out of beam pipe
+  //if(fabs(vtx[2])<fVzCut)rGood=0;//Vertex Z cut
   if(fDEBUG)Printf("vtxZ %f",vtx[2]);
   for(int i=0;i<fNVertexBins;i++){
     if(vtx[2]>fVertexArray[i]&&vtx[2]<=fVertexArray[i+1]&&rGood==0)rGood=i;
   }
   return rGood;
 }
-
+///////////////////////////
+Int_t AliAnalysisTaskDiHadron::CheckVertexAOD(const AliAODEvent *rAOD){
+  //checks whether the vertex passes cuts
+  Int_t rGood=-1;
+  Float_t vtx[3];
+  vtx[0]=rAOD->GetPrimaryVertex()->GetX();
+  vtx[1]=rAOD->GetPrimaryVertex()->GetY();
+  vtx[2]=rAOD->GetPrimaryVertex()->GetZ();
+  if((vtx[0]*vtx[0]+vtx[1]*vtx[1])<9&&fabs(vtx[2])<fVzCut) rGood=0; //vertex out of beam pipe
+  //if(fabs(vtx[2])<fVzCut)rGood=0;//Vertex Z cut
+  if(fDEBUG)Printf("vtxZ %f",vtx[2]);
+  for(int i=0;i<fNVertexBins;i++){
+    if(vtx[2]>fVertexArray[i]&&vtx[2]<=fVertexArray[i+1]&&rGood==0)rGood=i;
+  }
+  return rGood;
+}
+///////////////////////////////
 Int_t AliAnalysisTaskDiHadron::CheckTrigger(const AliESDEvent *rESD){
   //checks whether the trigger passes cuts
+  if(fDEBUG)Printf("Checking Trigger");
   Int_t rGood=0;
   TString trigID=rESD->GetFiredTriggerClasses();
   int count=0;
@@ -672,8 +1051,33 @@ Int_t AliAnalysisTaskDiHadron::CheckTrigger(const AliESDEvent *rESD){
   }
     return rGood;
 }
+///////////////////////////////////////////
+Int_t AliAnalysisTaskDiHadron::CheckTriggerAOD(const AliAODEvent *rAOD){
+  //checks whether the trigger passes cuts
+  if(fDEBUG)Printf("Checking Trigger");
+  Int_t rGood=0;
+  TString trigID=rAOD->GetFiredTriggerClasses();
+  int count=0;
+  char trigID2[50];
+  int stop=0;//in as a safety
+
+  for(int i=0;i<fNIDs;i++){
+    if(stop==1)continue;
+    for(int j=0;j<50;j++){
+      if(fTrigIDArray[count]==',')trigID2[j]='\0';
+      else if(fTrigIDArray[count]=='\0'){trigID2[j]='\0';stop=1;}
+      else trigID2[j]=fTrigIDArray[count];
+      count++;
+      if(trigID2[j]=='\0') break;
+      }
+      if(trigID.Contains(trigID2)) rGood=1;
+  }
+    return rGood;
+}
+/////////////////////////////////////////////
 
-Int_t AliAnalysisTaskDiHadron::TrackCuts(const AliESDEvent *rESD, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks){
+Int_t AliAnalysisTaskDiHadron::TrackCuts(const AliESDEvent *rESD, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks){
+  if(fDEBUG) Printf("Selecting Tracks");
     //fills arrays with all of the tracks passing cuts
   rGoodTracks[0]=0;
   Int_t lead=0;
@@ -691,6 +1095,7 @@ Int_t AliAnalysisTaskDiHadron::TrackCuts(const AliESDEvent *rESD, Float_t *rPt,
     sEta=conTrack->Eta();
     sPhi=conTrack->Phi();
     sCharge=conTrack->Charge();
+    if(fDEBUG) Printf("Pt%2.2f Eta%2.2f Phi%2.2f ", sPt,sEta,sPhi);
     if(sPhi<fdPhiMin)sPhi+=2*fPi;
     if(sPhi>fdPhiMax)sPhi-=2*fPi;
     if(sPt<fMinPtAssoc||sPt>fMaxPtAssoc)continue;//set Pt range
@@ -699,20 +1104,23 @@ Int_t AliAnalysisTaskDiHadron::TrackCuts(const AliESDEvent *rESD, Float_t *rPt,
     sNcls=eSDtrack->GetTPCNcls();
     //if(fDEBUG)Printf("NCLS%d",sNcls);
     if(sNcls<fMinClustersTPC)continue;
-    sNclsF=eSDtrack->GetTPCNclsF();
-    if((1.0*sNcls/sNclsF)<fMinClusterRatio)continue;//Clusters fit/ Possible
+    sNclsF=eSDtrack->GetTPCnclsS();
+    if((1-1.0*sNclsF/sNcls)<fMinClusterRatio)continue;//Clusters fit/ total
     sChi=(eSDtrack->GetTPCchi2())/sNcls;
     if(sChi>fMaxTPCchi2)continue;
     sITScls=eSDtrack->GetNcls(0);
     if(sITScls<fMinClustersITS)continue;
     eSDtrack->GetImpactParameters(sb,sbCov);
+    if(fDEBUG)Printf("dca %2.2f %2.2f",sb[0],sb[1]);
     if(!fDCA2D&&(sb[0]*sb[0]+sb[1]*sb[1])>(fMaxDCA*fMaxDCA))continue;//DCA cut
     if(fDCA2D==1&&(sb[0]*sb[0]/fMaxDCAXY/fMaxDCAXY+sb[1]*sb[1]/fMaxDCAZ/fMaxDCAZ)>1)continue;
     if(fDCA2D==2&&(0.35+0.42*std::pow(double(sPt),-0.9))<(sb[0]*sb[0]))continue;
     if(eSDtrack->GetKinkIndex(0)>0)continue;//removes kinked tracks
-    if(!eSDtrack->GetStatus()&&AliESDtrack::kTPCrefit&&fTPCRefit)continue;//refit in TPC
-    if((fITSRefit==1||(fITSRefit==2&&sPt>5))&&!eSDtrack->GetStatus()&&AliESDtrack::kITSrefit)continue;//refit of its tracks either for none,all, or >5 GeV/c
+    if(!eSDtrack->GetStatus()&AliESDtrack::kTPCrefit&&fTPCRefit)continue;//refit in TPC
+    if((fITSRefit==1||(fITSRefit==2&&sPt>5))&&!eSDtrack->GetStatus()&AliESDtrack::kITSrefit)continue;//refit of its tracks either for none,all, or >5 GeV/c
+    if(fDEBUG)Printf("SPD %d %d ", eSDtrack->HasPointOnITSLayer(0), eSDtrack->HasPointOnITSLayer(1));
     if(fSPDCut&&!eSDtrack->HasPointOnITSLayer(0)&&!eSDtrack->HasPointOnITSLayer(1))continue;
+    if(fDEBUG)Printf("Pass \n");
     rPt[rGoodTracks[0]]=sPt;
     rEta[rGoodTracks[0]]=sEta;
     rPhi[rGoodTracks[0]]=sPhi;
@@ -722,7 +1130,27 @@ Int_t AliAnalysisTaskDiHadron::TrackCuts(const AliESDEvent *rESD, Float_t *rPt,
     else rEff[rGoodTracks[0]]=1./fFitHigh->Eval(sPt);
     }
     else rEff[rGoodTracks[0]]=1;
+    if(rEff[rGoodTracks[0]]!=rEff[rGoodTracks[0]]||rEff[rGoodTracks[0]]>1E8||rEff[rGoodTracks[0]]<-1E8){
+      Printf("Efficiency Error %f %f",rEff[rGoodTracks[0]],rPt[rGoodTracks[0]]);
+      continue;
+    }
     if(sPt>leadPt)lead=rGoodTracks[0];
+    if(sPt<fV2FitPt)rV2[rGoodTracks[0]]=fFitLowV2->Eval(sPt);
+    else rV2[rGoodTracks[0]]=fFitHighV2->Eval(sPt);
+    if(sPt<fV3FitPt)rV3[rGoodTracks[0]]=fFitLowV3->Eval(sPt);
+    else rV3[rGoodTracks[0]]=fFitHighV3->Eval(sPt);
+    if(sPt<fV4FitPt)rV4[rGoodTracks[0]]=fFitLowV4->Eval(sPt);
+    else rV4[rGoodTracks[0]]=fFitHighV4->Eval(sPt);
+    if(rV2[rGoodTracks[0]]!=rV2[rGoodTracks[0]]||rV2[rGoodTracks[0]]>1E8||rV2[rGoodTracks[0]]<-1E8){
+      Printf("V2 Error %f %f",rV2[rGoodTracks[0]],rPt[rGoodTracks[0]]);
+      continue;
+    }
+      if(rV4[rGoodTracks[0]]!=rV4[rGoodTracks[0]]||rV4[rGoodTracks[0]]>1E8||rV4[rGoodTracks[0]]<-1E8){
+       Printf("V4 Error %f %f",rV4[rGoodTracks[0]],rPt[rGoodTracks[0]]);
+      continue;
+    }
+      
+      //Printf("V2 %2.2f V4 %2.4f 1.15V2V2 %2.4f",rV2[rGoodTracks[0]],rV4[rGoodTracks[0]],1.15*pow(rV2[rGoodTracks[0]],2));
     //rPtAssoc3[rGoodTracks[0]]=new Int_t [10];
     rNPtAssoc3[rGoodTracks[0]]=0;
     for(int apt3=0;apt3<fNAPt3Bins;apt3++){
@@ -737,9 +1165,97 @@ Int_t AliAnalysisTaskDiHadron::TrackCuts(const AliESDEvent *rESD, Float_t *rPt,
   }
   return lead;
 }
+/////////////////////////////////////////////
+
+Int_t AliAnalysisTaskDiHadron::TrackCutsAOD(const AliAODEvent *rAOD, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks){
+  if(fDEBUG) Printf("Selecting Tracks");
+    //fills arrays with all of the tracks passing cuts
+  rGoodTracks[0]=0;
+  Int_t lead=0;
+  Float_t leadPt=0;
+  Int_t rTrack=fAOD->GetNTracks();
+  Float_t sPt, sEta, sPhi, sChi, sb[2];
+  Int_t sNcls, sNclsF, sITScls;
+  Short_t sCharge;
+  for(int iTrack=0;iTrack<rTrack;iTrack++){
+    AliAODTrack *aodTrack=rAOD->GetTrack(iTrack);
+    sPt=aodTrack->Pt();
+    sEta=aodTrack->Eta();
+    sPhi=aodTrack->Phi();
+    sCharge=aodTrack->Charge();
+    if(fDEBUG) Printf("Pt%2.2f Eta%2.2f Phi%2.2f ", sPt,sEta,sPhi);
+    if(sPhi<fdPhiMin)sPhi+=2*fPi;
+    if(sPhi>fdPhiMax)sPhi-=2*fPi;
+    if(sPt<fMinPtAssoc||sPt>fMaxPtAssoc)continue;//set Pt range
+    if(fabs(sEta)>fEtaCut)continue;//set Eta Range
+    if(!sCharge)continue;
+    sNcls=aodTrack->GetTPCNcls();
+    if(sNcls<fMinClustersTPC)continue;
+    sNclsF=aodTrack->GetTPCSharedMap().CountBits();
+    if((1-1.0*sNclsF/sNcls)<fMinClusterRatio)continue;//Clusters shared/ total;
+    sChi=aodTrack->Chi2perNDF();
+    if(sChi>fMaxTPCchi2)continue;
+    sITScls=aodTrack->GetNcls(0);
+    if(sITScls<fMinClustersITS)continue;
+    sb[0]=aodTrack->DCA();
+    sb[1]=aodTrack->ZAtDCA();
+    if(fDEBUG)Printf("dca %2.2f %2.2f",sb[0],sb[1]);
+    if(!fDCA2D&&(sb[0]*sb[0]+sb[1]*sb[1])>(fMaxDCA*fMaxDCA))continue;//DCA cut
+    if(fDCA2D==1&&(sb[0]*sb[0]/fMaxDCAXY/fMaxDCAXY+sb[1]*sb[1]/fMaxDCAZ/fMaxDCAZ)>1)continue;
+    if(fDCA2D==2&&(0.35+0.42*std::pow(double(sPt),-0.9))<(sb[0])*sb[0])continue;
+    //if(eSDtrack->GetKinkIndex(0)>0)continue;//removes kinked tracks
+    if(!aodTrack->IsPrimaryCandidate())continue;//I assume this removes kinks
+    //if(!aodTrack->GetStatus()&AliAODTrack::kTPCrefit&&fTPCRefit)continue;//refit in TPC
+    //if((fITSRefit==1||(fITSRefit==2&&sPt>5))&&!aodTrack->GetStatus()&AliAODTrack::kITSrefit)continue;//refit of its tracks either for none,all, or >5 GeV/c
+    if(fDEBUG)Printf("SPD %d %d ", aodTrack->HasPointOnITSLayer(0), aodTrack->HasPointOnITSLayer(1));
+    if(fSPDCut&&!aodTrack->HasPointOnITSLayer(0)&&!aodTrack->HasPointOnITSLayer(1))continue;
+    if(fDEBUG)Printf("Pass \n");
+    rPt[rGoodTracks[0]]=sPt;
+    rEta[rGoodTracks[0]]=sEta;
+    rPhi[rGoodTracks[0]]=sPhi;
+    rCharge[rGoodTracks[0]]=sCharge;
+    if(fEfficiencyCorr){
+    if(sPt<fEffFitPt)rEff[rGoodTracks[0]]=1./fFitLow->Eval(sPt);
+    else rEff[rGoodTracks[0]]=1./fFitHigh->Eval(sPt);
+    }
+    else rEff[rGoodTracks[0]]=1;
+    if(rEff[rGoodTracks[0]]!=rEff[rGoodTracks[0]]||rEff[rGoodTracks[0]]>1E8||rEff[rGoodTracks[0]]<-1E8){
+      Printf("Efficiency Error %f %f",rEff[rGoodTracks[0]],rPt[rGoodTracks[0]]);
+      continue;
+    }
+    if(sPt>leadPt)lead=rGoodTracks[0];
+    if(sPt<fV2FitPt)rV2[rGoodTracks[0]]=fFitLowV2->Eval(sPt);
+    else rV2[rGoodTracks[0]]=fFitHighV2->Eval(sPt);
+    if(sPt<fV3FitPt)rV3[rGoodTracks[0]]=fFitLowV3->Eval(sPt);
+    else rV3[rGoodTracks[0]]=fFitHighV3->Eval(sPt);
+    if(sPt<fV4FitPt)rV4[rGoodTracks[0]]=fFitLowV4->Eval(sPt);
+    else rV4[rGoodTracks[0]]=fFitHighV4->Eval(sPt);
+    if(rV2[rGoodTracks[0]]!=rV2[rGoodTracks[0]]||rV2[rGoodTracks[0]]>1E8||rV2[rGoodTracks[0]]<-1E8){
+      Printf("V2 Error %f %f",rV2[rGoodTracks[0]],rPt[rGoodTracks[0]]);
+      continue;
+    }
+      if(rV4[rGoodTracks[0]]!=rV4[rGoodTracks[0]]||rV4[rGoodTracks[0]]>1E8||rV4[rGoodTracks[0]]<-1E8){
+       Printf("V4 Error %f %f",rV4[rGoodTracks[0]],rPt[rGoodTracks[0]]);
+      continue;
+    }
+      
+    rNPtAssoc3[rGoodTracks[0]]=0;
+    for(int apt3=0;apt3<fNAPt3Bins;apt3++){
+      if(sPt<fPtAssoc3Array2[apt3]&&sPt>=fPtAssoc3Array1[apt3]){
+       rPtAssoc3[rGoodTracks[0]][rNPtAssoc3[rGoodTracks[0]]]=apt3;
+       rNPtAssoc3[rGoodTracks[0]]++;
+      }
+    }
+
+    rGoodTracks[0]++;
+    
+  }
+  return lead;
+}
+///////////////////////////////////////////////////////
 
-Int_t AliAnalysisTaskDiHadron::TrackCutsMC(AliMCEvent *rMC, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks){
-//Fills Arrays of MC particles
+Int_t AliAnalysisTaskDiHadron::TrackCutsMC(AliMCEvent *rMC, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks){
+  //Fills Arrays of MC particles
   rGoodTracks[1]=0;
   AliStack *rStack=rMC->Stack();
   Int_t rTrack=rStack->GetNtrack();
@@ -765,6 +1281,9 @@ Int_t AliAnalysisTaskDiHadron::TrackCutsMC(AliMCEvent *rMC, Float_t *rPt, Float_
     rPhi[rGoodTracks[1]]=sPhi;
     rCharge[rGoodTracks[1]]=sCharge;
     rEff[rGoodTracks[1]]=1;
+    rV2[rGoodTracks[1]]=0;
+    rV3[rGoodTracks[1]]=0;
+    rV4[rGoodTracks[1]]=0;
     if(sPt>leadPt)lead=rGoodTracks[1];
     rNPtAssoc3[rGoodTracks[1]]=0;
     for(int apt3=0;apt3<fNAPt3Bins;apt3++){
@@ -777,6 +1296,158 @@ Int_t AliAnalysisTaskDiHadron::TrackCutsMC(AliMCEvent *rMC, Float_t *rPt, Float_
   }
   return lead;
 }
+//---------------------------------------------------------
+Int_t AliAnalysisTaskDiHadron::TrackCutsSim(Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks){
+
+  float v2=fFitHighV2->Eval(3.);
+  float v3=fFitHighV3->Eval(3.);
+  float v4=fFitHighV4->Eval(3.);
+   Int_t lead=0;
+  rGoodTracks[0]=0;
+
+  TF1 *SimFlow=new TF1("SimFlow","1+2*[0]*cos(2*x)+2*[1]*cos(3*(x-[2]))+2*[3]*cos(4*x)",-TMath::Pi(),TMath::Pi());
+  Float_t V3PlaneAngle=2*TMath::Pi()*gRandom->Rndm();
+  SimFlow->SetParameters(v2,v3,V3PlaneAngle,v4);
+ // SimFlow->SetParameters(0,0,0,0);
+  TF1 *SimNear=new TF1("SimNear","exp(-0.5*x*x/[0]/[0])",-TMath::Pi(),TMath::Pi());
+  SimNear->SetParameter(0,0.3);
+  TF1 *SimAway=new TF1("SimAway","exp(-0.5*x*x/[0]/[0])",-TMath::Pi(),TMath::Pi());
+ SimAway->SetParameter(0,0.5);//0.5 for DiJet 0.3 for cone
+  
+  TF1 *SimAway2=new TF1("SimAway2","exp(-0.5*(x-[1])*(x-[1])/[0]/[0])+exp(-0.5*(x+[1])*(x+[1])/[0]/[0])",-TMath::Pi(),TMath::Pi());
+  SimAway2->SetParameter(0,0.3);//0.5 for DiJet 0.3 for cone
+  SimAway2->SetParameter(1,1.4);//Cone Angle
+
+  // TF1 *AwayProb=new TF1("AwayProb","[0]");
+   TF1 *AwayProb=new TF1("AwayProb","[0]*cos(2*x)*cos(2*x)");
+   //AwayProb->SetParameter(0,0.5);
+  AwayProb->SetParameter(0,1);
+  Int_t AwayDeflected=0;
+  
+
+  // TF1 *SimAway=new TF1("SimAway","0.035+2*[0]*[0]*cos(2*x)+2*[1]*[1]*cos(3*x)+2*[2]*[2]*cos(4*x)",1.0,TMath::Pi()*2-1.0);
+  // SimAway->SetParameters(v2,v3,v4);
+  // TF1 *SimAway2=new TF1("SimAway2","0.035+2*[0]*[0]*cos(2*x)+2*[1]*[1]*cos(3*x)+2*[2]*[2]*cos(4*x)",1.05,TMath::Pi()*2-1.05);
+  //SimAway->SetParameters(v2,v3,v4);
+  Float_t RPAngle=2*TMath::Pi()*gRandom->Rndm();
+  Float_t TrigAngle;
+  Float_t sPt,sPhi;
+  Int_t InAccpt;
+  Int_t AccptPercent=4;//1 over this is % in aceptance on away-side 
+  Int_t AwaySidePM=0;
+
+  Int_t AwaySide1=1;
+  //Use SimAway1 or 2
+  // if(gRandom->Rndm()<AwayProb->Eval(RPAngle))AwaySide1=1;
+  //else AwaySide1=2;
+
+  for(int i=0;i<gRandom->Poisson(fSimNBgPart);i++){
+    sPt=1.5;
+    rPt[rGoodTracks[0]]=sPt;
+    rEta[rGoodTracks[0]]=0;
+    sPhi=SimFlow->GetRandom()+RPAngle;
+    if(sPhi<fdPhiMin)sPhi+=2*fPi;
+    if(sPhi>fdPhiMax)sPhi-=2*fPi;
+    rPhi[rGoodTracks[0]]=sPhi;
+    rCharge[rGoodTracks[0]]=1;
+    rEff[rGoodTracks[0]]=1;
+    rV2[rGoodTracks[0]]=v2;
+    rV3[rGoodTracks[0]]=v3;
+    rV4[rGoodTracks[0]]=v4;
+    rNPtAssoc3[rGoodTracks[0]]=0;
+    for(int apt3=0;apt3<fNAPt3Bins;apt3++){
+      if(sPt<fPtAssoc3Array2[apt3]&&sPt>=fPtAssoc3Array1[apt3]){
+       rPtAssoc3[rGoodTracks[0]][rNPtAssoc3[rGoodTracks[0]]]=apt3;
+       rNPtAssoc3[rGoodTracks[0]]++;
+      }
+    } 
+    rGoodTracks[0]++;
+  }
+  for(int i=0;i<gRandom->Poisson(fSimNJet);i++){
+    TrigAngle=SimFlow->GetRandom()+RPAngle;
+     if(gRandom->Rndm()<AwayProb->Eval(TrigAngle-RPAngle))AwaySide1=1;
+     else AwaySide1=2;
+    sPhi=TrigAngle;
+    if(sPhi<fdPhiMin)sPhi+=2*fPi;
+    if(sPhi>fdPhiMax)sPhi-=2*fPi;
+    sPt=3.1;
+    rPt[rGoodTracks[0]]=sPt;
+    rEta[rGoodTracks[0]]=0;
+    rPhi[rGoodTracks[0]]=sPhi;
+    rCharge[rGoodTracks[0]]=1;
+    rEff[rGoodTracks[0]]=1;
+    rV2[rGoodTracks[0]]=v2;
+    rV3[rGoodTracks[0]]=v3;
+    rV4[rGoodTracks[0]]=v4;
+    rNPtAssoc3[rGoodTracks[0]]=0;
+    lead=rGoodTracks[0];
+    rGoodTracks[0]++;
+    
+    for(int k=0;k<gRandom->Poisson(fSimNJetPart);k++){
+      sPhi=SimNear->GetRandom()+TrigAngle;
+      if(sPhi<fdPhiMin)sPhi+=2*fPi;
+      if(sPhi>fdPhiMax)sPhi-=2*fPi;
+      sPt=1.5;
+      rPt[rGoodTracks[0]]=sPt;
+      rEta[rGoodTracks[0]]=0;
+      rPhi[rGoodTracks[0]]=sPhi;
+      rCharge[rGoodTracks[0]]=1;
+      rEff[rGoodTracks[0]]=1;
+      rV2[rGoodTracks[0]]=v2;
+      rV3[rGoodTracks[0]]=v3;
+      rV4[rGoodTracks[0]]=v4;
+      rNPtAssoc3[rGoodTracks[0]]=0;
+      for(int apt3=0;apt3<fNAPt3Bins;apt3++){
+       if(sPt<fPtAssoc3Array2[apt3]&&sPt>=fPtAssoc3Array1[apt3]){
+         rPtAssoc3[rGoodTracks[0]][rNPtAssoc3[rGoodTracks[0]]]=apt3;
+         rNPtAssoc3[rGoodTracks[0]]++;
+       }
+      } 
+      rGoodTracks[0]++;
+    }
+
+    if(gRandom->Rndm()<1./AccptPercent)InAccpt=1;
+    else InAccpt=0;
+    if(gRandom->Rndm()<0.5)AwaySidePM=0;
+    else AwaySidePM=1;
+    for(int k=0;k<gRandom->Poisson(InAccpt*AccptPercent*fSimNJetPart);k++){
+      //sPhi=SimAway->GetRandom()+TrigAngle+TMath::Pi();
+      if(AwaySide1==1)sPhi=SimAway->GetRandom();
+      else(sPhi=SimAway2->GetRandom());
+      if(AwayDeflected){
+       if(sPhi>0&&AwaySidePM)sPhi=-sPhi;
+       else if(sPhi<0&&!AwaySidePM)sPhi=-sPhi;
+      }
+       sPhi+=TrigAngle+fPi;
+       if(sPhi<fdPhiMin)sPhi+=2*fPi;
+       if(sPhi>fdPhiMax)sPhi-=2*fPi;
+       sPt=1.5;
+       rPt[rGoodTracks[0]]=sPt;
+       rEta[rGoodTracks[0]]=0;
+       rPhi[rGoodTracks[0]]=sPhi;
+       rCharge[rGoodTracks[0]]=1;
+       rEff[rGoodTracks[0]]=1;
+       rV2[rGoodTracks[0]]=v2;
+       rV3[rGoodTracks[0]]=v3;
+       rV4[rGoodTracks[0]]=v4;
+       rNPtAssoc3[rGoodTracks[0]]=0;
+       for(int apt3=0;apt3<fNAPt3Bins;apt3++){
+         if(sPt<fPtAssoc3Array2[apt3]&&sPt>=fPtAssoc3Array1[apt3]){
+           rPtAssoc3[rGoodTracks[0]][rNPtAssoc3[rGoodTracks[0]]]=apt3;
+           rNPtAssoc3[rGoodTracks[0]]++;
+         }
+       }
+       rGoodTracks[0]++;
+    }
+
+
+  }//njet
+
+  return lead;
+}
+
+
 //------------------------------------------------------------
 void AliAnalysisTaskDiHadron::Exec(Option_t *)
 { 
@@ -787,395 +1458,565 @@ void AliAnalysisTaskDiHadron::Exec(Option_t *)
   const int nCentBins=fNCentBins;
   for(int ievent=0;ievent<=1;ievent++){
 
-  if(!fESD&&ievent==0){
-    if(fDEBUG)Printf("Error: fESD not found");
-    break;
-  }
-  if(!fMC&&ievent==1){
-    break;
-  }
-  if(ievent==1&&!fMCHistos)break;//break out if MC event and we don't have fill of those set
-  //Secondary check
-  if(ievent==0){
-    if(fESD->GetNumberOfTracks()<=0){
-      if(fDEBUG)Printf("Error: no tracks");
+    if((!fESD&&!fAOD)&&ievent==0){
+      if(fDEBUG)Printf("Error: fESD not found");
       break;
     }
-  }
-  //The previous check doesn't seem to work as a fMC is bad not NULL
-  if(ievent==1){
-    if(fMC->GetNumberOfTracks()<=0){
-      if(fDEBUG)Printf("<=0 MCTracks");
+    if(!fMC&&ievent==1){
       break;
     }
-  }
-  
-  //Check for Trigger only on real data
-  if(!fMC){
-    if(!CheckTrigger(fESD)) break;
-  }
-  //I'll only cut on the reconstructed vertex since these are the events that will be used
-  int vertexBin;
-  vertexBin=CheckVertex(fESD);
-  //else vertexBin=CheckVertex(fMC);
-  if(vertexBin<0)break;
-
-  Int_t nGoodTracks[2]={0,0}, nTriggers[nTPtBins][nCentBins][2];
-  Int_t nTrack;
-  if(!ievent)nTrack=fESD->GetNumberOfTracks();
-  else nTrack=fMC->Stack()->GetNtrack();
-  Float_t tdPhi, tdEta, tXE;
-  Float_t tdPhi2, tdEta2;
-  ftPhi=new Float_t [nTrack];
-  ftEta=new Float_t [nTrack];
-  ftPt=new Float_t [nTrack];
-  ftCharge=new Short_t [nTrack];
-  ftEff=new Float_t [nTrack];
-  ftPtAssoc3=new Int_t *[nTrack];
-  for(int i=0;i<nTrack;i++){
-    ftPtAssoc3[i]=new Int_t [10];
-  }
-  ftNPtAssoc3=new Int_t [nTrack];
-  Short_t sign;
-
-  //will need to do something exta for the effieiency once it comes from embedding
-  for(int i=0;i<fNTPtBins;i++){
-    for(int c=0;c<fNCentBins;c++){
-    nTriggers[i][c][ievent]=0;
+    // Printf("fSimulate %d",fSimulate);
+    if(fSimulate==1&&ievent==1) break;
+    if(ievent==1&&!fMCHistos)break;//break out if MC event and we don't have fill of those set
+    //Secondary check
+    if(ievent==0){
+      if(!fAODData){
+       if(fESD->GetNumberOfTracks()<=0){
+         if(fDEBUG)Printf("Error: no tracks");
+         break;
+       }
+      }
+      else{
+       if(fAOD->GetNTracks()<=0){
+         if(fDEBUG)Printf("Error: no tracks");
+         break;
+       }
+      }
+    }
+    //The previous check doesn't seem to work as a fMC is bad not NULL
+    if(ievent==1){
+      if(fMC->GetNumberOfTracks()<=0){
+       if(fDEBUG)Printf("<=0 MCTracks");
+       break;
+      }
     }
-  }
-  Int_t tMult=fESD->GetMultiplicity()->GetNumberOfTracklets();//I think this is the correct multiplicity to use
-  if(fDEBUG)Printf("Mult%d",tMult);
   
-  //Decide what multiplicy bins are filled with this event, note set to max of 4 as I didn't think more then 2 overlapping bins likely at one time, easliy changed
-  Int_t multArray[4]={0,0,0,0};
-  Int_t maxArray=0;
-  for(int imult=0;imult<fNCentBins;imult++){
-    if(tMult>=fCentArrayMin[imult]&&tMult<fCentArrayMax[imult]){
-      multArray[maxArray]=imult;
-      maxArray++;
+    //Check for Trigger only on real data
+    if(!fMC){
+      if(!fAODData){
+       if(!CheckTrigger(fESD)) break;
+      }
+      else{
+       if(!CheckTriggerAOD(fAOD)) break;
+      }
     }
-  }
-  if(fDEBUG)Printf("maxArray%d",maxArray);
-  //Set Efficiency for the centrality bin (lowest bin used in array if multiple overlap)
-  for(int ipar=0;ipar<fNFitLowParam;ipar++){
-    fFitLow->SetParameter(ipar,fFitLowParam[multArray[0]*fNCentBins+ipar]);
-  }
-   for(int ipar=0;ipar<fNFitHighParam;ipar++){
-    fFitHigh->SetParameter(ipar,fFitHighParam[multArray[0]*fNCentBins+ipar]);
-  }
-  fHistMult[ievent]->Fill(tMult);
-  for(int c=0;c<maxArray;c++){fHistNEvents[multArray[c]][ievent]->Fill(0);}//count the number of events used
-  Int_t leadPart;
   
-  //returns arrays filled up to nGoodTracks with tracks passing cuts
-  if(!ievent)leadPart=TrackCuts(fESD,ftPt,ftEta,ftPhi,ftCharge,ftEff,ftPtAssoc3,ftNPtAssoc3,nGoodTracks);
-  else leadPart=TrackCutsMC(fMC,ftPt,ftEta,ftPhi,ftCharge,ftEff,ftPtAssoc3,ftNPtAssoc3,nGoodTracks);
-  int nearEta=0,NearXE=0;
-  int nearEta2=0;
-  if(fDEBUG)Printf("Track Loop");
-  for(int iTrack=0;iTrack<nGoodTracks[ievent];iTrack++){
-    if(fDEBUG)Printf("Track%d Pt%f",iTrack,ftPt[iTrack]);
-    //if(ftPhi[iTrack]<fdPhiMin)ftPhi[iTrack]+=2*fPi;
-    //if(ftPhi[iTrack]>fdPhiMax)ftPhi[iTrack]-=2*fPi;
-    for(int c=0;c<maxArray;c++){
-      fHistPt[multArray[c]][ievent]->Fill(ftPt[iTrack],ftEff[iTrack]);
-    fHistPtEff[multArray[c]][ievent]->Fill(ftPt[iTrack]);
-    fHistPhi[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftPt[iTrack],ftEff[iTrack]);
-    fHistPhiPt[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftPt[iTrack],ftPt[iTrack]*ftEff[iTrack]);
-    fHistEta[multArray[c]][ievent]->Fill(ftEta[iTrack],ftPt[iTrack],ftEff[iTrack]);
-    fHistEtaPt[multArray[c]][ievent]->Fill(ftEta[iTrack],ftPt[iTrack],ftPt[iTrack]*ftEff[iTrack]);
-    fHistPhiEta[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftEta[iTrack],ftPt[iTrack],ftEff[iTrack]);
-    fHistPhiEtaPt[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftEta[iTrack],ftPt[iTrack],ftPt[iTrack]*ftEff[iTrack]);
+    //I'll only cut on the reconstructed vertex since these are the events that will be used
+    int vertexBin;
+    if(!fAODData)vertexBin=CheckVertex(fESD);
+    else vertexBin=CheckVertexAOD(fAOD);
+    if(vertexBin<0)break;
+
+    
+    Int_t nGoodTracks[2]={0,0}, nTriggers[nTPtBins][nCentBins][2];
+    Int_t nTrack;
+    if(!ievent){
+      if(!fAODData)nTrack=fESD->GetNumberOfTracks();
+      else nTrack=fAOD->GetNumberOfTracks();
+    }
+    else nTrack=fMC->Stack()->GetNtrack();
+    if(fSimulate)nTrack=10*(fSimNBgPart+10*fSimNJetPart);
+    gRandom->SetSeed(time(0)+gSystem->GetPid());
+    Float_t tdPhi, tdEta, tXE;
+    Float_t tdPhi2, tdEta2;
+    Float_t V2_T1, V2_T2, V3_T1, V3_T2, V4_T1, V4_T2, V42_T12, V42_1T2, V42_2T1, V2V2V4, V2, V3, V4;
+    Float_t V2_A, V3_A, V4_A;
+    ftPhi=new Float_t [nTrack];
+    ftEta=new Float_t [nTrack];
+    ftPt=new Float_t [nTrack];
+    ftCharge=new Short_t [nTrack];
+    ftEff=new Float_t [nTrack];
+    ftV2=new Float_t [nTrack];
+    ftV3=new Float_t [nTrack];
+    ftV4=new Float_t [nTrack];
+    ftPtAssoc3=new Int_t *[nTrack];
+    for(int i=0;i<nTrack;i++){
+      ftPtAssoc3[i]=new Int_t [10];
     }
+    ftNPtAssoc3=new Int_t [nTrack];
+    Short_t sign;
+    //trigger particle arrays
     for(int i=0;i<fNTPtBins;i++){
-      if(ftPt[iTrack]>fPtTrigArray[i]&&ftPt[iTrack]<fPtTrigArray[i+1]&&fabs(ftEta[iTrack])<fTrigEtaCut){
-       if(fDEBUG)Printf("In %fpt%f",fPtTrigArray[i],fPtTrigArray[i+1]);
-       fHistMultTrig[i][ievent]->Fill(tMult);
+      for(int c=0;c<fNCentBins;c++){
+       nTriggers[i][c][ievent]=0;
+      }
+    }
+    //Int_t tMult=fESD->GetMultiplicity()->GetNumberOfTracklets();//I think this is the correct multiplicity to use
+    
+    //AliESDVZERO* esdV0 = fESD->GetVZEROData();
+    Float_t tMult=0;
+    if(!fAODData){
+      if(fCentPercent) tMult=fESD->GetCentrality()->GetCentralityPercentile("V0M");
+      else tMult=fESD->GetVZEROData()->GetMTotV0A()+fESD->GetVZEROData()->GetMTotV0C();
+    }
+    else{
+      AliAODHeader *tHeader=fAOD->GetHeader();
+      tMult=tHeader->GetCentrality();
+    }
+
+    if(fDEBUG)Printf("Mult/Cent%6.1f",tMult);
+  
+    //Decide what multiplicy bins are filled with this event, note set to max of 4 overlapping bins as I didn't think more then 2 overlapping bins likely at one time, easliy changed
+    Int_t multArray[4]={0,0,0,0};
+    Int_t maxArray=0;
+    
+    for(int imult=0;imult<fNCentBins;imult++){
+      if(tMult>=fCentArrayMin[imult]&&tMult<fCentArrayMax[imult]){
+       multArray[maxArray]=imult;
+       maxArray++;
+      }
+    }
+    if(maxArray==0)break;
+    //Printf("maxArray%d Mult%1.2f",maxArray,tMult);
+    if(fDEBUG)Printf("maxArray%d",maxArray);
+    //Set Efficiency and flow for the centrality bin (lowest bin used in array if multiple overlap)
+    for(int ipar=0;ipar<fNFitLowParam;ipar++){
+      fFitLow->SetParameter(ipar,fFitLowParam[multArray[0]*fNFitLowParam+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitHighParam;ipar++){
+      fFitHigh->SetParameter(ipar,fFitHighParam[multArray[0]*fNFitHighParam+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitLowParamV2;ipar++){
+      fFitLowV2->SetParameter(ipar,fFitLowParamV2[multArray[0]*fNFitLowParamV2+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitHighParamV2;ipar++){
+      fFitHighV2->SetParameter(ipar,fFitHighParamV2[multArray[0]*fNFitHighParamV2+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitLowParamV3;ipar++){
+      fFitLowV3->SetParameter(ipar,fFitLowParamV3[multArray[0]*fNFitLowParamV3+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitHighParamV3;ipar++){
+      fFitHighV3->SetParameter(ipar,fFitHighParamV3[multArray[0]*fNFitHighParamV2+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitLowParamV4;ipar++){
+      fFitLowV4->SetParameter(ipar,fFitLowParamV4[multArray[0]*fNFitLowParamV4+ipar]);
+    }
+    for(int ipar=0;ipar<fNFitHighParamV4;ipar++){
+      fFitHighV4->SetParameter(ipar,fFitHighParamV4[multArray[0]*fNFitHighParamV4+ipar]);
+    }
+    fHistMult[ievent]->Fill(tMult);
+    for(int c=0;c<maxArray;c++){fHistNEvents[multArray[c]][ievent]->Fill(0);}//count the number of events used
+    Int_t leadPart=-1;
+    
+    //returns arrays filled up to nGoodTracks with tracks passing cuts
+    for(int nSimEvents=0;nSimEvents<=(fSimulate*fSimNEvents);nSimEvents++){//only 1 loop if not simulation
+      //Printf("nSimEvents %d",nSimEvents);
+      if(fSimulate)leadPart=TrackCutsSim(ftPt,ftEta,ftPhi,ftCharge,ftEff,ftV2,ftV3,ftV4,ftPtAssoc3,ftNPtAssoc3,nGoodTracks);
+      else if(!ievent){
+       if(!fAODData)leadPart=TrackCuts(fESD,ftPt,ftEta,ftPhi,ftCharge,ftEff,ftV2,ftV3,ftV4,ftPtAssoc3,ftNPtAssoc3,nGoodTracks);
+       else leadPart=TrackCutsAOD(fAOD,ftPt,ftEta,ftPhi,ftCharge,ftEff,ftV2,ftV3,ftV4,ftPtAssoc3,ftNPtAssoc3,nGoodTracks);
+      }
+      else leadPart=TrackCutsMC(fMC,ftPt,ftEta,ftPhi,ftCharge,ftEff,ftV2,ftV3,ftV4,ftPtAssoc3,ftNPtAssoc3,nGoodTracks);
+      //Printf("nGoodTracks %d",nGoodTracks[0]);
+      int nearEta=0,NearXE=0;
+      int nearEta2=0;
+      if(fDEBUG)Printf("Track Loop");
+      for(int iTrack=0;iTrack<nGoodTracks[ievent];iTrack++){
+       if(fDEBUG)Printf("Track%d Pt%f",iTrack,ftPt[iTrack]);
+       //if(ftPhi[iTrack]<fdPhiMin)ftPhi[iTrack]+=2*fPi;
+       //if(ftPhi[iTrack]>fdPhiMax)ftPhi[iTrack]-=2*fPi;
        for(int c=0;c<maxArray;c++){
-         nTriggers[i][multArray[c]][ievent]++;
-         fHistNTrigger[multArray[c]][ievent]->Fill(i);
-         fHistNTriggerPt[multArray[c]][ievent]->Fill(i,ftPt[iTrack]);
+         // Printf("c%d mult%d",c,multArray[c]);
+         fHistPt[multArray[c]][ievent]->Fill(ftPt[iTrack],ftEff[iTrack]);
+         fHistPtEff[multArray[c]][ievent]->Fill(ftPt[iTrack]);
+         fHistPhi[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftPt[iTrack],ftEff[iTrack]);
+         fHistPhiPt[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftPt[iTrack],ftPt[iTrack]*ftEff[iTrack]);
+         fHistEta[multArray[c]][ievent]->Fill(ftEta[iTrack],ftPt[iTrack],ftEff[iTrack]);
+         fHistEtaPt[multArray[c]][ievent]->Fill(ftEta[iTrack],ftPt[iTrack],ftPt[iTrack]*ftEff[iTrack]);
+         fHistPhiEta[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftEta[iTrack],ftPt[iTrack],ftEff[iTrack]);
+         fHistPhiEtaPt[multArray[c]][ievent]->Fill(ftPhi[iTrack],ftEta[iTrack],ftPt[iTrack],ftPt[iTrack]*ftEff[iTrack]);
        }
-       if(fDEBUG)Printf("Assiciated Particle Loop");
-       for(int iTrack2=0;iTrack2<nGoodTracks[ievent];iTrack2++){
-         if(iTrack==iTrack2) continue;
-         if(ftPt[iTrack2]>ftPt[iTrack])continue;
-         tdPhi=ftPhi[iTrack]-ftPhi[iTrack2];
-         if(tdPhi<-fPi)tdPhi+=2*fPi;
-         if(tdPhi>fPi)tdPhi-=2*fPi;
-         if(fabs(tdPhi)<fNearPhiCut)nearEta=1;
-         else nearEta=0;
-         if(fabs(tdPhi)<fXECut)NearXE=1;
-         else NearXE=0;
-         if(fabs(tdPhi)<(fPi/2))tdEta=ftEta[iTrack]-ftEta[iTrack2];
-         else tdEta=ftEta[iTrack]+ftEta[iTrack2];
-         if(tdPhi<fdPhiMin)tdPhi+=2*fPi;
-         if(tdPhi>fdPhiMax)tdPhi-=2*fPi;
-         if((ftCharge[iTrack]<0&&ftCharge[iTrack2]<0)||(ftCharge[iTrack]>0&&ftCharge[iTrack2]>0))sign=1;
-         else sign=2;
-         if(fDEBUG) Printf("dPhi %f  dEta %f",tdPhi,tdEta);
-         for(int c=0;c<maxArray;c++){//loop over multiplicity bins
-           fHistPtTrig[i][multArray[c]][ievent]->Fill(ftPt[iTrack2],ftEff[iTrack2]);
-           fHistPhiTrig[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftPt[iTrack2],ftEff[iTrack2]);
-           fHistPhiTrigPt[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           fHistEtaTrig[i][multArray[c]][ievent]->Fill(ftEta[iTrack2],ftPt[iTrack2],ftEff[iTrack2]);
-           fHistEtaTrigPt[i][multArray[c]][ievent]->Fill(ftEta[iTrack2],ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-
-           fHistPhiEtaTrig[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftEta[iTrack2],ftPt[iTrack2],ftEff[iTrack2]);
-           fHistPhiEtaTrigPt[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftEta[iTrack2],ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           fHistDeltaPhi[i][multArray[c]][0][ievent]->Fill(tdPhi,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaPhiPt[i][multArray[c]][0][ievent]->Fill(tdPhi,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           fHistDeltaPhi[i][multArray[c]][sign][ievent]->Fill(tdPhi,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaPhiPt[i][multArray[c]][sign][ievent]->Fill(tdPhi,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-
-           if(nearEta){
-           fHistDeltaEtaN[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaEtaNPt[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           fHistDeltaEtaN[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaEtaNPt[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           }
-           else{
-           fHistDeltaEtaA[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaEtaAPt[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           fHistDeltaEtaA[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaEtaAPt[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
+       for(int i=0;i<fNTPtBins;i++){
+         if(ftPt[iTrack]>fPtTrigArray[i]&&ftPt[iTrack]<=fPtTrigArray[i+1]&&fabs(ftEta[iTrack])<fTrigEtaCut){
+           if(fDEBUG)Printf("In %fpt%f",fPtTrigArray[i],fPtTrigArray[i+1]);
+           fHistMultTrig[i][ievent]->Fill(tMult);
+           for(int c=0;c<maxArray;c++){
+             nTriggers[i][multArray[c]][ievent]++;
+             fHistNTrigger[multArray[c]][ievent]->Fill(i,ftEff[iTrack]);
+             fHistNTriggerPt[multArray[c]][ievent]->Fill(i,ftPt[iTrack]*ftEff[iTrack]);
            }
-           fHistDeltaPhiEta[i][multArray[c]][ievent]->Fill(tdPhi,tdEta,ftPt[iTrack2],ftEff[iTrack2]);
-           fHistDeltaPhiEtaPt[i][multArray[c]][ievent]->Fill(tdPhi,tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]);
-           
-           //only fill these if trigger particle is the leading particle
-           if(iTrack==leadPart){
-             if(NearXE){
-               tXE=ftPt[iTrack2]*cos(tdPhi)/ftPt[iTrack];
-               fHistXEN[i][multArray[c]][ievent]->Fill(tXE,ftEff[iTrack2]);
-             }
-             else{
-               tXE=ftPt[iTrack2]*cos(tdPhi+fPi)/ftPt[iTrack];
-               fHistXEA[i][multArray[c]][ievent]->Fill(tXE,ftEff[iTrack2]);
-             }
-           }
-
-         }//Centrality loop (c)
-
-         //3-particle Correlations
-         for(int iTrack3=0;iTrack3<nGoodTracks[ievent];iTrack3++){
-           if(iTrack2==iTrack3)continue;
-           if(ftPt[iTrack3]>ftPt[iTrack])continue;
-           tdPhi2=ftPhi[iTrack]-ftPhi[iTrack3];
-           if(tdPhi2<-fPi)tdPhi2+=2*fPi;
-           if(tdPhi2>fPi)tdPhi2-=2*fPi;
-           if(fabs(tdPhi2)<fNearPhiCut&&nearEta==1)nearEta2=1;
-           else nearEta2=0;
-           //if(fabs(tdPhi)<fXECut)NearXE=1;
-           //else NearXE=0;
-           if(fabs(tdPhi2)<(fPi/2))tdEta2=ftEta[iTrack]-ftEta[iTrack3];
-           else tdEta2=ftEta[iTrack]+ftEta[iTrack3];
-           if(tdPhi2<fdPhiMin)tdPhi2+=2*fPi;
-           if(tdPhi2>fdPhiMax)tdPhi2-=2*fPi;
-           // if((ftCharge[iTrack]<0&&ftCharge[iTrack2]<0)||(ftCharge[iTrack]>0&&ftCharge[iTrack2]>0))sign=1;
-           if((ftCharge[iTrack]<0&&ftCharge[iTrack2]<0&&ftCharge[iTrack3]<0)||(ftCharge[iTrack]>0&&ftCharge[iTrack2]>0&&ftCharge[iTrack3]>0))sign=1;
-           else if((ftCharge[iTrack3]<0&&ftCharge[iTrack2]<0)||(ftCharge[iTrack3]>0&&ftCharge[iTrack2]>0))sign=2;
-           else sign=3;
-           for(int e=0;e<ftNPtAssoc3[iTrack2];e++){//check associated pT bin
-             for(int f=0;f<ftNPtAssoc3[iTrack3];f++){
-               if(ftPtAssoc3[iTrack2][e]==ftPtAssoc3[iTrack3][f]){
-                 for(int c=0;c<maxArray;c++){//loop over multiplicity bins
-                   fHistDeltaPhiPhi[i][ftPtAssoc3[iTrack2][e]][multArray[c]][0][ievent]->Fill(tdPhi,tdPhi2,ftEff[iTrack2]*ftEff[iTrack3]);
-                   fHistDeltaPhiPhi[i][ftPtAssoc3[iTrack2][e]][multArray[c]][sign][ievent]->Fill(tdPhi2,tdPhi,ftEff[iTrack2]*ftEff[iTrack3]);
-                
-
-                   if(nearEta2){
-                     fHistDeltaEtaEta[i][ftPtAssoc3[iTrack2][e]][multArray[c]][0][ievent]->Fill(tdEta,tdEta2,ftEff[iTrack2]*ftEff[iTrack3]);
-                     fHistDeltaEtaEta[i][ftPtAssoc3[iTrack2][e]][multArray[c]][sign][ievent]->Fill(tdEta,tdEta2,ftEff[iTrack2]*ftEff[iTrack3]);
-                   }
-                 }//multiplicity loop (c)
-               }
-             }
-           }//track checking loops
-         }//iTrack3
-       }//iTrack2 (associated track loop)
-       
-       if(fDEBUG)Printf("Mixed Event Loop");
-       for(int c=0;c<maxArray;c++){
-         int d=multArray[c];//Centrality bin we are in
-         if(fMixEnd[d][vertexBin][ievent]>=0){//check if there are any mixed events for this bin
-           for(int imix=0;imix<=fMixEnd[d][vertexBin][ievent];imix++){//loop over the stored mixed events
-             fHistNMix[d][ievent]->Fill(i);
-             for(int iTrack2=0;iTrack2<fMixTrack[imix][d][vertexBin][ievent];iTrack2++){
-               if(ftPt[iTrack]<fMPt[imix][d][vertexBin][ievent][iTrack2])continue;
-               tdPhi=ftPhi[iTrack]-fMPhi[imix][d][vertexBin][ievent][iTrack2];
-               if(tdPhi<-fPi)tdPhi+=2*fPi;
-               if(tdPhi>fPi)tdPhi-=2*fPi;
-               if(fabs(tdPhi)<fNearPhiCut)nearEta=1;
-               else nearEta=0;
-               if(fabs(tdPhi)<fXECut)NearXE=1;
-               else NearXE=0;
-               if(fabs(tdPhi)<(fPi/2))tdEta=ftEta[iTrack]-fMEta[imix][d][vertexBin][ievent][iTrack2];
-               else tdEta=ftEta[iTrack]+fMEta[imix][d][vertexBin][ievent][iTrack2];
-               if(tdPhi<fdPhiMin)tdPhi+=2*fPi; 
-               if(tdPhi>fdPhiMax)tdPhi-=2*fPi;
-               if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=1;
-               else sign=2;
-
-               fHistDeltaPhiMix[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaPhiMixPt[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaPhiMix[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaPhiMixPt[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+         
+           if(fDEBUG)Printf("Assiciated Particle Loop");
+           //  Printf("GoodTracks %d Cent%d",nGoodTracks[ievent],multArray[0]);
+           for(int iTrack2=0;iTrack2<nGoodTracks[ievent];iTrack2++){
+             if(iTrack==iTrack2) continue;
+             if(ftPt[iTrack2]>ftPt[iTrack])continue;
+             tdPhi=ftPhi[iTrack]-ftPhi[iTrack2];
+             if(tdPhi<-fPi)tdPhi+=2*fPi;
+             if(tdPhi>fPi)tdPhi-=2*fPi;
+             if(fabs(tdPhi)<fNearPhiCut)nearEta=1;
+             else nearEta=0;
+             if(fabs(tdPhi)<fXECut)NearXE=1;
+             else NearXE=0;
+             if(fabs(tdPhi)<(fPi/2))tdEta=ftEta[iTrack]-ftEta[iTrack2];
+             else tdEta=ftEta[iTrack]+ftEta[iTrack2];
+             if(tdPhi<fdPhiMin)tdPhi+=2*fPi;
+             if(tdPhi>fdPhiMax)tdPhi-=2*fPi;
+             if((ftCharge[iTrack]<0&&ftCharge[iTrack2]<0)||(ftCharge[iTrack]>0&&ftCharge[iTrack2]>0))sign=1;
+             else sign=2;
+             if(fDEBUG) Printf("dPhi %f  dEta %f",tdPhi,tdEta);
+             for(int c=0;c<maxArray;c++){//loop over multiplicity bins
+               fHistPtTrig[i][multArray[c]][ievent]->Fill(ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistPhiTrig[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistPhiTrigPt[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+               fHistEtaTrig[i][multArray[c]][ievent]->Fill(ftEta[iTrack2],ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistEtaTrigPt[i][multArray[c]][ievent]->Fill(ftEta[iTrack2],ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+             
+               fHistPhiEtaTrig[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftEta[iTrack2],ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistPhiEtaTrigPt[i][multArray[c]][ievent]->Fill(ftPhi[iTrack2],ftEta[iTrack2],ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+               fHistDeltaPhi[i][multArray[c]][0][ievent]->Fill(tdPhi,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistDeltaPhiPt[i][multArray[c]][0][ievent]->Fill(tdPhi,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+               fHistDeltaPhi[i][multArray[c]][sign][ievent]->Fill(tdPhi,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistDeltaPhiPt[i][multArray[c]][sign][ievent]->Fill(tdPhi,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+             
                if(nearEta){
-                 fHistDeltaEtaNMix[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaEtaNMixPt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaEtaNMix[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaEtaNMixPt[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                 fHistDeltaEtaN[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+                 fHistDeltaEtaNPt[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+                 fHistDeltaEtaN[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+                 fHistDeltaEtaNPt[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
                }
                else{
-                 fHistDeltaEtaAMix[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaEtaAMixPt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaEtaAMix[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaEtaAMixPt[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               }       
-
-               fHistDeltaPhiEtaMix[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
-               fHistDeltaPhiEtaMixPt[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
-
+                 fHistDeltaEtaA[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+                 fHistDeltaEtaAPt[i][multArray[c]][0][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+                 fHistDeltaEtaA[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+                 fHistDeltaEtaAPt[i][multArray[c]][sign][ievent]->Fill(tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+               }
+               fHistDeltaPhiEta[i][multArray[c]][ievent]->Fill(tdPhi,tdEta,ftPt[iTrack2],ftEff[iTrack2]*ftEff[iTrack]);
+               fHistDeltaPhiEtaPt[i][multArray[c]][ievent]->Fill(tdPhi,tdEta,ftPt[iTrack2],ftPt[iTrack2]*ftEff[iTrack2]*ftEff[iTrack]);
+             
+               //only fill these if trigger particle is the leading particle
                if(iTrack==leadPart){
                  if(NearXE){
-                   tXE=fMPt[imix][d][vertexBin][ievent][iTrack2]*cos(tdPhi)/ftPt[iTrack];
-                   fHistXENMix[i][d][ievent]->Fill(tXE,fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   tXE=ftPt[iTrack2]*cos(tdPhi)/ftPt[iTrack];
+                   fHistXEN[i][multArray[c]][ievent]->Fill(tXE,ftEff[iTrack2]*ftEff[iTrack]);
                  }
                  else{
-                   tXE=fMPt[imix][d][vertexBin][ievent][iTrack2]*cos(tdPhi+fPi)/ftPt[iTrack];
-                   fHistXEAMix[i][multArray[c]][ievent]->Fill(tXE,fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   tXE=ftPt[iTrack2]*cos(tdPhi+fPi)/ftPt[iTrack];
+                   fHistXEA[i][multArray[c]][ievent]->Fill(tXE,ftEff[iTrack2]*ftEff[iTrack]);
                  }
                }
-               //3-particle correlation soft-soft term (both associated from the same event)
-               for(int iTrack3=0;iTrack3<fMixTrack[imix][d][vertexBin][ievent];iTrack3++){
-                 if(iTrack3==iTrack2)continue;
-                 if(ftPt[iTrack]<fMPt[imix][d][vertexBin][ievent][iTrack3])continue;
-               tdPhi2=ftPhi[iTrack]-fMPhi[imix][d][vertexBin][ievent][iTrack3];
+             
+             }//Centrality loop (c)
+           
+             //3-particle Correlations
+             for(int iTrack3=0;iTrack3<nGoodTracks[ievent];iTrack3++){
+               if(iTrack2==iTrack3)continue;
+               if(ftPt[iTrack3]>ftPt[iTrack])continue;
+               tdPhi2=ftPhi[iTrack]-ftPhi[iTrack3];
                if(tdPhi2<-fPi)tdPhi2+=2*fPi;
                if(tdPhi2>fPi)tdPhi2-=2*fPi;
-               if(fabs(tdPhi2)<fNearPhiCut&&nearEta)nearEta2=1;
+               if(fabs(tdPhi2)<fNearPhiCut&&nearEta==1)nearEta2=1;
                else nearEta2=0;
-               if(fabs(tdPhi2)<(fPi/2))tdEta2=ftEta[iTrack]-fMEta[imix][d][vertexBin][ievent][iTrack3];
-               else tdEta2=ftEta[iTrack]+fMEta[imix][d][vertexBin][ievent][iTrack3];
-               if(tdPhi2<fdPhiMin)tdPhi2+=2*fPi;       
+               //if(fabs(tdPhi)<fXECut)NearXE=1;
+               //else NearXE=0;
+               if(fabs(tdPhi2)<(fPi/2))tdEta2=ftEta[iTrack]-ftEta[iTrack3];
+               else tdEta2=ftEta[iTrack]+ftEta[iTrack3];
+               if(tdPhi2<fdPhiMin)tdPhi2+=2*fPi;
                if(tdPhi2>fdPhiMax)tdPhi2-=2*fPi;
-               //if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=1;
-               //else sign=2;
-               if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack3]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack3]>0))sign=1;
-               else if((fMCharge[imix][d][vertexBin][ievent][iTrack3]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(fMCharge[imix][d][vertexBin][ievent][iTrack3]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=2;
+               // if((ftCharge[iTrack]<0&&ftCharge[iTrack2]<0)||(ftCharge[iTrack]>0&&ftCharge[iTrack2]>0))sign=1;
+               if((ftCharge[iTrack]<0&&ftCharge[iTrack2]<0&&ftCharge[iTrack3]<0)||(ftCharge[iTrack]>0&&ftCharge[iTrack2]>0&&ftCharge[iTrack3]>0))sign=1;
+               else if((ftCharge[iTrack3]<0&&ftCharge[iTrack2]<0)||(ftCharge[iTrack3]>0&&ftCharge[iTrack2]>0))sign=2;
                else sign=3;
-               for(int e=0;e<fMNPtAssoc3[imix][d][vertexBin][ievent][iTrack2];e++){//check associated pT bin
-                 for(int f=0;f<fMNPtAssoc3[imix][d][vertexBin][ievent][iTrack3];f++){
-                   if(fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]==fMPtAssoc3[imix][d][vertexBin][ievent][f][iTrack3]){
-                     fHistDeltaPhiPhiSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]);
-                     fHistDeltaPhiPhiSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]); 
-
-                     if(nearEta2){
-                       fHistDeltaEtaEtaSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]);
-                       fHistDeltaEtaEtaSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]);
-                     }//near-side
+               for(int e=0;e<ftNPtAssoc3[iTrack2];e++){//check associated pT bin
+                 for(int f=0;f<ftNPtAssoc3[iTrack3];f++){
+                   if(ftPtAssoc3[iTrack2][e]==ftPtAssoc3[iTrack3][f]){
+                     for(int c=0;c<maxArray;c++){//loop over multiplicity bins
+                       fHistDeltaPhiPhi[i][ftPtAssoc3[iTrack2][e]][multArray[c]][0][ievent]->Fill(tdPhi,tdPhi2,ftEff[iTrack2]*ftEff[iTrack3]*ftEff[iTrack]);
+                       fHistDeltaPhiPhi[i][ftPtAssoc3[iTrack2][e]][multArray[c]][sign][ievent]->Fill(tdPhi2,tdPhi,ftEff[iTrack2]*ftEff[iTrack3]*ftEff[iTrack]);
+                     
+                     
+                       if(nearEta2){
+                         fHistDeltaEtaEta[i][ftPtAssoc3[iTrack2][e]][multArray[c]][0][ievent]->Fill(tdEta,tdEta2,ftEff[iTrack2]*ftEff[iTrack3]*ftEff[iTrack]);
+                         fHistDeltaEtaEta[i][ftPtAssoc3[iTrack2][e]][multArray[c]][sign][ievent]->Fill(tdEta,tdEta2,ftEff[iTrack2]*ftEff[iTrack3]*ftEff[iTrack]);
+                       }
+                     }//multiplicity loop (c)
                    }
                  }
-               }//associated pt bin
-               }//iTrack3
-
-               //3-particle mixed event (associated from different events)
-               //for(int imix2=0;imix2<=fMixEnd[d][vertexBin][ievent];imix2++){//loop over the stored mixed events
-               //if(imix2==imix)continue;
-                 int imix2=imix+1;
-                 if(imix2>=fMixEnd[d][vertexBin][ievent])imix2=0;
-                 if(imix2==imix)continue;//will kill it when there is only 1 mixed event (remember to scale by 1 less then the number of mixed events in others (number of mixed-mixed is 2*(mixed-1)))
-                 for(int iTrack3=0;iTrack3<fMixTrack[imix2][d][vertexBin][ievent];iTrack3++){
-                   if(ftPt[iTrack]<fMPt[imix2][d][vertexBin][ievent][iTrack3])continue;
-                   tdPhi2=ftPhi[iTrack]-fMPhi[imix2][d][vertexBin][ievent][iTrack3];
-                   if(tdPhi2<-fPi)tdPhi2+=2*fPi;
-                   if(tdPhi2>fPi)tdPhi2-=2*fPi;
-                   if(fabs(tdPhi2)<fNearPhiCut&&nearEta)nearEta2=1;
-                   else nearEta2=0;
-                   if(fabs(tdPhi2)<(fPi/2))tdEta2=ftEta[iTrack]-fMEta[imix2][d][vertexBin][ievent][iTrack3];
-                   else tdEta2=ftEta[iTrack]+fMEta[imix2][d][vertexBin][ievent][iTrack3];
-                   if(tdPhi2<fdPhiMin)tdPhi2+=2*fPi;   
-                   if(tdPhi2>fdPhiMax)tdPhi2-=2*fPi;
-                   //if((ftCharge[iTrack]<0&&fMCharge[imix2][d][vertexBin][ievent][iTrack2]<0)||(ftCharge[iTrack]>0&&fMCharge[imix2][d][vertexBin][ievent][iTrack2]>0))sign=1;
-                   //else sign=2;
-                   if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0&&fMCharge[imix2][d][vertexBin][ievent][iTrack3]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0&&fMCharge[imix2][d][vertexBin][ievent][iTrack3]>0))sign=1;
-                   else if((fMCharge[imix2][d][vertexBin][ievent][iTrack3]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(fMCharge[imix2][d][vertexBin][ievent][iTrack3]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=2;
-                   else sign=3;
-                   for(int e=0;e<fMNPtAssoc3[imix][d][vertexBin][ievent][iTrack2];e++){//check associated pT bin
-                     for(int f=0;f<fMNPtAssoc3[imix2][d][vertexBin][ievent][iTrack3];f++){
-                       if(fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]==fMPtAssoc3[imix2][d][vertexBin][ievent][f][iTrack3]){
-                         fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
-                         fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]); 
-                         fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);//free factor of 2 in statistics
-                         fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]); 
-                     if(nearEta2){
-                       fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
-                       fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
-                       fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
-                       fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
-                     }//near-side
-                       }
+               }//track checking loops
+             }//iTrack3
+           }//iTrack2 (associated track loop)
+         
+           if(fDEBUG)Printf("Mixed Event Loop");
+           for(int c=0;c<maxArray;c++){
+             //Printf("c%d mult%d",c,multArray[c]);
+             int d=multArray[c];//Centrality bin we are in
+             if(fMixEnd[d][vertexBin][ievent]>2){//check if there are any mixed events for this bin, require 2 for soft-soft mixing
+               for(int imix=0;imix<fMixEnd[d][vertexBin][ievent];imix++){//loop over the stored mixed events
+                 fHistNMix[d][ievent]->Fill(i);
+                 //Printf("GoodTracksMixed %d Cent%d fMixEnd%d",fMixTrack[imix][d][vertexBin][ievent],d,fMixEnd[d][vertexBin][ievent]);
+                 for(int iTrack2=0;iTrack2<fMixTrack[imix][d][vertexBin][ievent];iTrack2++){
+                   if(ftPt[iTrack]<fMPt[imix][d][vertexBin][ievent][iTrack2])continue;
+                   tdPhi=ftPhi[iTrack]-fMPhi[imix][d][vertexBin][ievent][iTrack2];
+                   if(tdPhi<-fPi)tdPhi+=2*fPi;
+                   if(tdPhi>fPi)tdPhi-=2*fPi;
+                   if(fabs(tdPhi)<fNearPhiCut)nearEta=1;
+                   else nearEta=0;
+                   if(fabs(tdPhi)<fXECut)NearXE=1;
+                   else NearXE=0;
+                   if(fabs(tdPhi)<(fPi/2))tdEta=ftEta[iTrack]-fMEta[imix][d][vertexBin][ievent][iTrack2];
+                   else tdEta=ftEta[iTrack]+fMEta[imix][d][vertexBin][ievent][iTrack2];
+                   if(tdPhi<fdPhiMin)tdPhi+=2*fPi;     
+                   if(tdPhi>fdPhiMax)tdPhi-=2*fPi;
+                   if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=1;
+                   else sign=2;
+                   V2_T1=2*fMV2[imix][d][vertexBin][ievent][iTrack2]*ftV2[iTrack]*cos(2*tdPhi);
+                   V3_T1=2*fMV3[imix][d][vertexBin][ievent][iTrack2]*ftV3[iTrack]*cos(3*tdPhi);
+                   V4_T1=2*fMV4[imix][d][vertexBin][ievent][iTrack2]*ftV4[iTrack]*cos(4*tdPhi);
+                 
+                   fHistDeltaPhiMix[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV2[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1);
+                   fHistDeltaPhiMixV3[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1);
+                   fHistDeltaPhiMixV4[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1);
+                   fHistDeltaPhiMixPt[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV2Pt[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV3Pt[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV4Pt[i][d][0][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMix[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV2[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1);
+                   fHistDeltaPhiMixV3[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1);
+                   fHistDeltaPhiMixV4[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1);
+                   fHistDeltaPhiMixPt[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV2Pt[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV3Pt[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiMixV4Pt[i][d][sign][ievent]->Fill(tdPhi,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                 
+                   if(nearEta){
+                     fHistDeltaEtaNMix[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaNMixV2[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1);
+                     fHistDeltaEtaNMixV3[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1);
+                     fHistDeltaEtaNMixV4[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1);
+                     fHistDeltaEtaNMixPt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaNMix[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaNMixPt[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaNMixV2Pt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaNMixV3Pt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaNMixV4Pt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   }
+                   else{
+                     fHistDeltaEtaAMix[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaAMixV2[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1);
+                     fHistDeltaEtaAMixV3[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1);
+                     fHistDeltaEtaAMixV4[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1);
+                     fHistDeltaEtaAMixPt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaAMix[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaAMixPt[i][d][sign][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaAMixV2Pt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaAMixV3Pt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                     fHistDeltaEtaAMixV4Pt[i][d][0][ievent]->Fill(tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1*fMPt[imix][d][vertexBin][ievent][iTrack2]);
+                   }   
+                 
+                   fHistDeltaPhiEtaMix[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                   fHistDeltaPhiEtaMixV2[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V2_T1);
+                   fHistDeltaPhiEtaMixV3[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V3_T1);
+                   fHistDeltaPhiEtaMixV4[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMEff[imix][d][vertexBin][ievent][iTrack2]*V4_T1);
+                   fHistDeltaPhiEtaMixPt[i][d][ievent]->Fill(tdPhi,tdEta,fMPt[imix][d][vertexBin][ievent][iTrack2],fMPt[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                 
+                   if(iTrack==leadPart){
+                     if(NearXE){
+                       tXE=fMPt[imix][d][vertexBin][ievent][iTrack2]*cos(tdPhi)/ftPt[iTrack];
+                       fHistXENMix[i][d][ievent]->Fill(tXE,fMEff[imix][d][vertexBin][ievent][iTrack2]);
                      }
-                   }//associated pt bin
-                 }//iTrack3
-
-             }//iTrack2
-             }//imix
-           }//fMixEnd
-         }//Centrality bins (c)
-       }//pt trig cuts
-      }//i Pt Trig
-    }//itrack    
+                     else{
+                       tXE=fMPt[imix][d][vertexBin][ievent][iTrack2]*cos(tdPhi+fPi)/ftPt[iTrack];
+                       fHistXEAMix[i][multArray[c]][ievent]->Fill(tXE,fMEff[imix][d][vertexBin][ievent][iTrack2]);
+                     }
+                   }
+                
+                   //3-particle correlation soft-soft term (both associated from the same event)
+                   for(int iTrack3=0;iTrack3<fMixTrack[imix][d][vertexBin][ievent];iTrack3++){
+                     if(iTrack3==iTrack2)continue;
+                     if(ftPt[iTrack]<fMPt[imix][d][vertexBin][ievent][iTrack3])continue;
+                     tdPhi2=ftPhi[iTrack]-fMPhi[imix][d][vertexBin][ievent][iTrack3];
+                     if(tdPhi2<-fPi)tdPhi2+=2*fPi;
+                     if(tdPhi2>fPi)tdPhi2-=2*fPi;
+                     if(fabs(tdPhi2)<fNearPhiCut&&nearEta)nearEta2=1;
+                     else nearEta2=0;
+                     if(fabs(tdPhi2)<(fPi/2))tdEta2=ftEta[iTrack]-fMEta[imix][d][vertexBin][ievent][iTrack3];
+                     else tdEta2=ftEta[iTrack]+fMEta[imix][d][vertexBin][ievent][iTrack3];
+                     if(tdPhi2<fdPhiMin)tdPhi2+=2*fPi; 
+                     if(tdPhi2>fdPhiMax)tdPhi2-=2*fPi;
+                    
+                     if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack3]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack3]>0))sign=1;
+                     else if((fMCharge[imix][d][vertexBin][ievent][iTrack3]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(fMCharge[imix][d][vertexBin][ievent][iTrack3]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=2;
+                     else sign=3;
+                     for(int e=0;e<fMNPtAssoc3[imix][d][vertexBin][ievent][iTrack2];e++){//check associated pT bin
+                       for(int f=0;f<fMNPtAssoc3[imix][d][vertexBin][ievent][iTrack3];f++){
+                         if(fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]==fMPtAssoc3[imix][d][vertexBin][ievent][f][iTrack3]){
+                           fHistDeltaPhiPhiSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]);
+                           fHistDeltaPhiPhiSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]); 
+                         
+                           if(nearEta2){
+                             fHistDeltaEtaEtaSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]);
+                             fHistDeltaEtaEtaSS[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix][d][vertexBin][ievent][iTrack3]);
+                           }//near-side
+                         }
+                       }
+                     }//associated pt bin
+                   }//iTrack3
+                 
+                   //3-particle mixed event (associated from different events)
+                   int imix2=imix+1;
+                   if(imix2>=fMixEnd[d][vertexBin][ievent])imix2=0;
+                   if(imix2==imix)continue;
+                   for(int iTrack3=0;iTrack3<fMixTrack[imix2][d][vertexBin][ievent];iTrack3++){
+                     if(ftPt[iTrack]<fMPt[imix2][d][vertexBin][ievent][iTrack3])continue;
+                     tdPhi2=ftPhi[iTrack]-fMPhi[imix2][d][vertexBin][ievent][iTrack3];
+                     if(tdPhi2<-fPi)tdPhi2+=2*fPi;
+                     if(tdPhi2>fPi)tdPhi2-=2*fPi;
+                     if(fabs(tdPhi2)<fNearPhiCut&&nearEta)nearEta2=1;
+                     else nearEta2=0;
+                     if(fabs(tdPhi2)<(fPi/2))tdEta2=ftEta[iTrack]-fMEta[imix2][d][vertexBin][ievent][iTrack3];
+                     else tdEta2=ftEta[iTrack]+fMEta[imix2][d][vertexBin][ievent][iTrack3];
+                     if(tdPhi2<fdPhiMin)tdPhi2+=2*fPi; 
+                     if(tdPhi2>fdPhiMax)tdPhi2-=2*fPi;
+                     V2_T2=2*ftV2[iTrack]*fMV2[imix2][d][vertexBin][ievent][iTrack3]*cos(2*tdPhi2);
+                     V3_T2=2*ftV3[iTrack]*fMV3[imix2][d][vertexBin][ievent][iTrack3]*cos(3*tdPhi2);
+                     V4_T2=2*ftV4[iTrack]*fMV4[imix2][d][vertexBin][ievent][iTrack3]*cos(4*tdPhi2);
+                     V42_T12=2*ftV4[iTrack]*fMV2[imix2][d][vertexBin][ievent][iTrack3]*fMV2[imix][d][vertexBin][ievent][iTrack2]*cos(2*tdPhi+2*tdPhi2);
+                     V42_1T2=2*fMV4[imix][d][vertexBin][ievent][iTrack2]*ftV2[iTrack]*fMV2[imix2][d][vertexBin][ievent][iTrack3]*cos(4*tdPhi-2*tdPhi2);
+                     V42_2T1=2*fMV4[imix2][d][vertexBin][ievent][iTrack3]*ftV2[iTrack]*fMV2[imix][d][vertexBin][ievent][iTrack2]*cos(4*tdPhi2-2*tdPhi);
+                     V2_A=2*fMV2[imix2][d][vertexBin][ievent][iTrack3]*fMV2[imix][d][vertexBin][ievent][iTrack2]*cos(2*(tdPhi-tdPhi2));
+                     V3_A=2*fMV3[imix2][d][vertexBin][ievent][iTrack3]*fMV3[imix][d][vertexBin][ievent][iTrack2]*cos(3*(tdPhi-tdPhi2));
+                     V4_A=2*fMV4[imix2][d][vertexBin][ievent][iTrack3]*fMV4[imix][d][vertexBin][ievent][iTrack2]*cos(4*(tdPhi-tdPhi2)); 
+                   
+                     V2=V2_T1+V2_T2;
+                     V3=V3_T1+V3_T2;
+                     V4=V4_T1+V4_T2;
+                     V2V2V4=V42_T12+V42_1T2+V42_2T1;
+                   
+                     if((ftCharge[iTrack]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0&&fMCharge[imix2][d][vertexBin][ievent][iTrack3]<0)||(ftCharge[iTrack]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0&&fMCharge[imix2][d][vertexBin][ievent][iTrack3]>0))sign=1;
+                     else if((fMCharge[imix2][d][vertexBin][ievent][iTrack3]<0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]<0)||(fMCharge[imix2][d][vertexBin][ievent][iTrack3]>0&&fMCharge[imix][d][vertexBin][ievent][iTrack2]>0))sign=2;
+                     else sign=3;
+                     for(int e=0;e<fMNPtAssoc3[imix][d][vertexBin][ievent][iTrack2];e++){//check associated pT bin
+                       for(int f=0;f<fMNPtAssoc3[imix2][d][vertexBin][ievent][iTrack3];f++){
+                         if(fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]==fMPtAssoc3[imix2][d][vertexBin][ievent][f][iTrack3]){
+                           fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
+                           fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]); 
+                           fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);//free factor of 2 in statistics
+                           fHistDeltaPhiPhiMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
+                           //v2
+                           fHistDeltaPhiPhiMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);
+                           fHistDeltaPhiPhiMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2); 
+                           fHistDeltaPhiPhiMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);//free factor of 2 in statistics
+                           fHistDeltaPhiPhiMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);
+                           fHistDeltaPhiPhiSSV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2_A);
+                           fHistDeltaPhiPhiSSV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2_A);
+                           //v3
+                           fHistDeltaPhiPhiMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);
+                           fHistDeltaPhiPhiMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3); 
+                           fHistDeltaPhiPhiMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);//free factor of 2 in statistics
+                           fHistDeltaPhiPhiMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);
+                           fHistDeltaPhiPhiSSV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3_A);
+                           fHistDeltaPhiPhiSSV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3_A);
+                           //v4
+                           fHistDeltaPhiPhiMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);
+                           fHistDeltaPhiPhiMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4); 
+                           fHistDeltaPhiPhiMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);//free factor of 2 in statistics
+                           fHistDeltaPhiPhiMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);
+                           fHistDeltaPhiPhiSSV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4_A);
+                           fHistDeltaPhiPhiSSV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4_A);
+                           //v2v2v4
+                           fHistDeltaPhiPhiMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);
+                           fHistDeltaPhiPhiMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi,tdPhi2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4); 
+                           fHistDeltaPhiPhiMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);//free factor of 2 in statistics
+                           fHistDeltaPhiPhiMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdPhi2,tdPhi,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);
+                         
+                           if(nearEta2){
+                             fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
+                             fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
+                             fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
+                             fHistDeltaEtaEtaMix[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]);
+                             //v2
+                             fHistDeltaEtaEtaMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);
+                             fHistDeltaEtaEtaMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);
+                             fHistDeltaEtaEtaMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);
+                             fHistDeltaEtaEtaMixV2[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2);
+                             //v3
+                             fHistDeltaEtaEtaMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);
+                             fHistDeltaEtaEtaMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);
+                             fHistDeltaEtaEtaMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);
+                             fHistDeltaEtaEtaMixV3[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V3);
+                             //v4
+                             fHistDeltaEtaEtaMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);
+                             fHistDeltaEtaEtaMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);
+                             fHistDeltaEtaEtaMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);
+                             fHistDeltaEtaEtaMixV4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V4);
+                             //v2v2v4  
+                             fHistDeltaEtaEtaMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);
+                             fHistDeltaEtaEtaMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta,tdEta2,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);
+                             fHistDeltaEtaEtaMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][0][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);
+                             fHistDeltaEtaEtaMixV2V2V4[i][fMPtAssoc3[imix][d][vertexBin][ievent][e][iTrack2]][d][sign][ievent]->Fill(tdEta2,tdEta,fMEff[imix][d][vertexBin][ievent][iTrack2]*fMEff[imix2][d][vertexBin][ievent][iTrack3]*V2V2V4);
+                       
+                           }//near-side
+                         }
+                       }
+                     }//associated pt bin
+                   }//iTrack3
+                 }//iTrack2
+               }//imix
+             }//fMixEnd
+           }//Centrality bins (c)
+         }//pt trig cuts
+       }//i Pt Trig
+      }//itrack    
   
-  //now store this event for mixing (using these dynamic arrays instead of the other fix to save memory)
-    if(fDEBUG)Printf("Store Event For Mixing");
-  for(int c=0;c<maxArray;c++){//loops over centrality bins
-    int d=multArray[c];//too many nested arrays looked confusing d=which centrality bin
-    if(fMixEnd[d][vertexBin][ievent]<(fNMix-1))fMixEnd[d][vertexBin][ievent]++;
-    if(fMixPointer[d][vertexBin][ievent]<(fNMix-1))fMixPointer[d][vertexBin][ievent]++;
-    else fMixPointer[d][vertexBin][ievent]=0;
-    int e=fMixPointer[d][vertexBin][ievent];//nested arrays (e is event number in pool)
-    delete [] fMPt[e][d][vertexBin][ievent];
-    delete [] fMPhi[e][d][vertexBin][ievent];
-    delete [] fMEta[e][d][vertexBin][ievent];
-    delete [] fMCharge[e][d][vertexBin][ievent];
-    delete [] fMEff[e][d][vertexBin][ievent];
-    delete [] fMNPtAssoc3[e][d][vertexBin][ievent];
-    for(int jj=0;jj<10;jj++){
-    delete [] fMPtAssoc3[e][d][vertexBin][ievent][jj];
-    }
-    fMPt[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
-    fMPhi[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
-    fMEta[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
-    fMCharge[e][d][vertexBin][ievent]=new Short_t [nGoodTracks[ievent]];
-    fMEff[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
-    fMixTrack[e][d][vertexBin][ievent]=nGoodTracks[ievent];
-    fMNPtAssoc3[e][d][vertexBin][ievent]=new Short_t [nGoodTracks[ievent]];
-    for(int jj=0;jj<10;jj++){
-    fMPtAssoc3[e][d][vertexBin][ievent][jj]=new Short_t [nGoodTracks[ievent]];
-    }
+      //now store this event for mixing (using these dynamic arrays to save memory)
+      if(fDEBUG)Printf("Store Event For Mixing");
+      for(int c=0;c<maxArray;c++){//loops over centrality bins
+       int d=multArray[c];//too many nested arrays looked confusing d=which centrality bin
+       if(fMixEnd[d][vertexBin][ievent]<=fNMix)fMixEnd[d][vertexBin][ievent]++;
+       if(fMixPointer[d][vertexBin][ievent]<(fNMix-1)&&fMixEnd[d][vertexBin][ievent]!=1)fMixPointer[d][vertexBin][ievent]++;
+       else fMixPointer[d][vertexBin][ievent]=0;
+       int e=fMixPointer[d][vertexBin][ievent];//nested arrays (e is event number in pool)
+       delete [] fMPt[e][d][vertexBin][ievent];
+       delete [] fMPhi[e][d][vertexBin][ievent];
+       delete [] fMEta[e][d][vertexBin][ievent];
+       delete [] fMCharge[e][d][vertexBin][ievent];
+       delete [] fMEff[e][d][vertexBin][ievent];
+       delete [] fMV2[e][d][vertexBin][ievent];
+       delete [] fMV3[e][d][vertexBin][ievent];
+       delete [] fMV4[e][d][vertexBin][ievent];
+       delete [] fMNPtAssoc3[e][d][vertexBin][ievent];
+       for(int jj=0;jj<10;jj++){
+         delete [] fMPtAssoc3[e][d][vertexBin][ievent][jj];
+       }
+       fMPt[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMPhi[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMEta[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMCharge[e][d][vertexBin][ievent]=new Short_t [nGoodTracks[ievent]];
+       fMEff[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMV2[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMV3[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMV4[e][d][vertexBin][ievent]=new Float_t [nGoodTracks[ievent]];
+       fMixTrack[e][d][vertexBin][ievent]=nGoodTracks[ievent];
+       fMNPtAssoc3[e][d][vertexBin][ievent]=new Short_t [nGoodTracks[ievent]];
+       for(int jj=0;jj<10;jj++){
+         fMPtAssoc3[e][d][vertexBin][ievent][jj]=new Short_t [nGoodTracks[ievent]];
+       }
 
-    for(int iTrack=0;iTrack<nGoodTracks[ievent];iTrack++){
-      fMPt[e][d][vertexBin][ievent][iTrack]=ftPt[iTrack];
-      fMPhi[e][d][vertexBin][ievent][iTrack]=ftPhi[iTrack];
-      fMEta[e][d][vertexBin][ievent][iTrack]=ftEta[iTrack];
-      fMCharge[e][d][vertexBin][ievent][iTrack]=ftCharge[iTrack];
-      fMEff[e][d][vertexBin][ievent][iTrack]=ftEff[iTrack];
-      fMNPtAssoc3[e][d][vertexBin][ievent][iTrack]=ftNPtAssoc3[iTrack];
-      // fMPtAssoc3[e][d][vertexBin][ievent][iTrack]=new Int_t [ftNPtAssoc3[iTrack]];
-      for(int jj=0;jj<ftNPtAssoc3[iTrack];jj++){
-       //if(fDEBUG) Printf("%d",ftPtAssoc3[iTrack][jj]);
-       fMPtAssoc3[e][d][vertexBin][ievent][jj][iTrack]=ftPtAssoc3[iTrack][jj];
-      }
-      
-    }//iTracks
-  }//Centrality (c)
-  }//ievent
+       for(int iTrack=0;iTrack<nGoodTracks[ievent];iTrack++){
+         fMPt[e][d][vertexBin][ievent][iTrack]=ftPt[iTrack];
+         fMPhi[e][d][vertexBin][ievent][iTrack]=ftPhi[iTrack];
+         fMEta[e][d][vertexBin][ievent][iTrack]=ftEta[iTrack];
+         fMCharge[e][d][vertexBin][ievent][iTrack]=ftCharge[iTrack];
+         fMEff[e][d][vertexBin][ievent][iTrack]=ftEff[iTrack];
+         fMV2[e][d][vertexBin][ievent][iTrack]=ftV2[iTrack];
+         fMV3[e][d][vertexBin][ievent][iTrack]=ftV3[iTrack];
+         fMV4[e][d][vertexBin][ievent][iTrack]=ftV4[iTrack];
+         fMNPtAssoc3[e][d][vertexBin][ievent][iTrack]=ftNPtAssoc3[iTrack];
+         for(int jj=0;jj<ftNPtAssoc3[iTrack];jj++){
+           fMPtAssoc3[e][d][vertexBin][ievent][jj][iTrack]=ftPtAssoc3[iTrack][jj];
+         }
+       }//iTracks
+      }//Centrality (c)
+    } //sim
+    }//ievent
+  
   //track=0;
   //track2=0;
+  
 
   PostData(0, fOutput);
   //get rid of these arrays from memory
@@ -1184,6 +2025,9 @@ void AliAnalysisTaskDiHadron::Exec(Option_t *)
   delete [] ftPt;
   delete [] ftCharge;
   delete [] ftEff;
+  delete [] ftV2;
+  delete [] ftV3;
+  delete [] ftV4;
   delete [] ftNPtAssoc3;
   delete [] ftPtAssoc3;
   ftPhi=NULL;
@@ -1191,10 +2035,13 @@ void AliAnalysisTaskDiHadron::Exec(Option_t *)
   ftPt=NULL;
   ftCharge=NULL;
   ftEff=NULL;
+  ftV2=NULL;
+  ftV3=NULL;
+  ftV4=NULL;
   ftNPtAssoc3=NULL;
   ftPtAssoc3=NULL;
 
-}//Exec
+  }//Exec
 
 //---------------------------------------------------
 void AliAnalysisTaskDiHadron::Terminate(Option_t *){
@@ -1208,6 +2055,9 @@ void AliAnalysisTaskDiHadron::Terminate(Option_t *){
          delete [] fMEta[ii][cc][vtx][jj];
          delete [] fMCharge[ii][cc][vtx][jj];
          delete [] fMEff[ii][cc][vtx][jj];
+         delete [] fMV2[ii][cc][vtx][jj];
+         delete [] fMV3[ii][cc][vtx][jj];
+         delete [] fMV4[ii][cc][vtx][jj];
          delete [] fMNPtAssoc3[ii][cc][vtx][jj];
          for(int qq=0;qq<10;qq++){
            delete [] fMPtAssoc3[ii][cc][vtx][jj][qq];
@@ -1218,6 +2068,9 @@ void AliAnalysisTaskDiHadron::Terminate(Option_t *){
          fMEta[ii][cc][vtx][jj]=NULL;
          fMCharge[ii][cc][vtx][jj]=NULL;
          fMEff[ii][cc][vtx][jj]=NULL;
+         fMV2[ii][cc][vtx][jj]=NULL;
+         fMV3[ii][cc][vtx][jj]=NULL;
+         fMV4[ii][cc][vtx][jj]=NULL;
          fMNPtAssoc3[ii][cc][vtx][jj]=NULL;
 
        }
index 82df1c4..c862aa8 100755 (executable)
 
 //2- and 3-particle trigger particle correlation analysis
 //Author: Jason Glyndwr Ulery, ulery@uni-frankfurt.de
-//version 3.4, last revised 2010/08/15
+//version 3.5, last revised 2010/11/04
 
 #ifndef ALIANALYSISTASKDIHADRON_H
 #define ALIANALYSISTASKDIHADRON_H
 
-
 class TF1;
 class TH1F;
 class TH2F;
 class TH3F;
 class AliESDEvent;
 
-#include "AliAnalysisTask.h"
+//#include "AliAnalysisTask.h"
+#include "AliAnalysisTaskSE.h"
 
 
-class AliAnalysisTaskDiHadron : public AliAnalysisTask{
+class AliAnalysisTaskDiHadron : public AliAnalysisTaskSE{
   //Default constructor
  public:
 
@@ -51,20 +51,26 @@ class AliAnalysisTaskDiHadron : public AliAnalysisTask{
  
 
   void SetEfficiencies(Float_t EffFitPt, const TF1 *FitLow, const TF1 *FitHigh, Int_t NFitLowParam, Int_t NFitHighParam, Float_t *FitLowParam, Float_t *FitHighParam);
-  void SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPhiEtaPhi, Int_t nBinPhiEtaEta, Int_t nBinPhi3, Int_t nBinEta3, Float_t dPhiMin, Float_t dPhiMax, Int_t NTPtBins, Int_t NMixBins, Int_t NCentBins,Int_t NAPtBins, Int_t NAPt3Bins, Int_t NVertexBins, Int_t NXEBin,Float_t *PtTrigArray, Float_t *PtAssocArray, Float_t *PtAssoc3Array1, Float_t *PtAssoc3Array2, Int_t *CentArrayMin, Int_t *CentArrayMax, Float_t *XEArray);
-  void SetOptions(Int_t fEfficiencyCorr, Int_t fDEBUG,Int_t fMCHistos);
+  void SetFlow(Float_t V2FitPt, Float_t V3FitPt, Float_t V4FitPt, const TF1 *FitLowV2, const TF1 *FitHighV2, const TF1 *FitLowV3, const TF1 *FitHighV3, const TF1 *FitLowV4, const TF1 *FitHighV4, Int_t NFitLowParamV2, Int_t NFitHighParamV2, Int_t NFitLowParamV3, Int_t NFitHighParamV3, Int_t NFitLowParamV4, Int_t NFitHighParamV4, Float_t *FitLowParamV2, Float_t *FitHighParamV2, Float_t *FitLowParamV3, Float_t *FitHighParamV3, Float_t *FitLowParamV4, Float_t *FitHighParamV4);
+  void SetBins(Int_t nBinPhi, Int_t nBinEta, Int_t nBinPhiEtaPhi, Int_t nBinPhiEtaEta, Int_t nBinPhi3, Int_t nBinEta3, Float_t dPhiMin, Float_t dPhiMax, Int_t NTPtBins, Int_t NMixBins, Int_t NCentBins,Int_t fCentPercent, Int_t NAPtBins, Int_t NAPt3Bins, Int_t NVertexBins, Int_t NXEBin,Float_t *PtTrigArray, Float_t *PtAssocArray, Float_t *PtAssoc3Array1, Float_t *PtAssoc3Array2, Int_t *CentArrayMin, Int_t *CentArrayMax, Float_t *XEArray);
+  void SetOptions(Int_t fAODData, Int_t fEfficiencyCorr, Int_t fDEBUG,Int_t fMCHistos);
   void SetCuts(Int_t MinClutersTPC, Float_t MinClusterRatio, Float_t MaxTPCchi2, Int_t MinClustersITS, Float_t EtaCut, Float_t TrigEtaCut, Float_t NearPhiCut, Float_t XECut, Float_t MaxDCA, Float_t MaxDCAXY, Float_t MaxDCAZ, Int_t DCA2D, Int_t TPCRefit, Int_t ITSRefit, Int_t SPDCut, Float_t MinPtAssoc, Float_t MaxPtAssoc, Float_t VzCut, Int_t NIDs, const char *TrigIDArray);
+  void SetSimulation(Int_t Simulate,Float_t SimNBgPart,Float_t SimNJetPart,Float_t SimNJet,Int_t SimNEvents);
   Int_t CheckVertex(const AliESDEvent *rESD);
+  Int_t CheckVertexAOD(const AliAODEvent *rAOD);
   Int_t CheckTrigger(const AliESDEvent *rESD);
-  Int_t TrackCuts(const AliESDEvent *rESD, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks);
-  Int_t TrackCutsMC(AliMCEvent *rMC, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks);
+  Int_t CheckTriggerAOD(const AliAODEvent *rAOD);
+  Int_t TrackCuts(const AliESDEvent *rESD, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks);
+  Int_t TrackCutsAOD(const AliAODEvent *rAOD, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks);
+  Int_t TrackCutsMC(AliMCEvent *rMC, Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks);
+  Int_t TrackCutsSim(Float_t *rPt, Float_t *rEta, Float_t *rPhi, Short_t *rCharge, Float_t *rEff, Float_t *rV2, Float_t *rV3, Float_t *rV4, Int_t **rPtAssoc3, Int_t *rNPtAssoc3, Int_t *rGoodTracks);
 
   
  private:
 
 //Maximum numbers for creating the arrays
   enum{kNumberOfPtBins=20, 
-       kNumberOfCentBins=10, 
+       kNumberOfCentBins=11, 
        kNumberOfAPtBins=50,
        kNumberOfApt3Bins=50,
        kNumberOfTriggerIDs=10,
@@ -73,11 +79,11 @@ class AliAnalysisTaskDiHadron : public AliAnalysisTask{
        kNumberOfEventsToMix=100};
   // virtual void SetParameters();
   AliESDEvent *fESD; //ESD data file
+  AliAODEvent *fAOD;//AOD data file
   AliMCEvent *fMC;//Monty Carlo event file
   TList *fOutput;//List used to store all the histograms for output
   
-   //Cuts
-  
+  //Cuts
   Int_t fMinClustersTPC;//Minimum Clusters in the TPC
   Float_t fMinClusterRatio;//Ratio of MinClusters to Number of Possible Clusters in TPC
   Float_t fMaxTPCchi2;//Max chi^2/ndf for TPC fit
@@ -96,141 +102,215 @@ class AliAnalysisTaskDiHadron : public AliAnalysisTask{
   Float_t fMinPtAssoc;//Minimum pT to look at 
   Float_t fMaxPtAssoc;//Maximum pT to look at  
   Float_t fVzCut;//z-vertex cut |z-vertex|<fVzCut in cm
-    Int_t fEfficiencyCorr;//Toggle correcting of efficiencies when filling histograms
-    Int_t fDEBUG;//if 1 extra printfs for debugging
-
-    //Binning
-    Int_t fnBinPhi;//Number of bins for DeltaPhi histograms
-    Int_t fnBinEta;//Number of bins for DeltaEta histograms
-    Int_t fnBinPhiEtaPhi;//Number of bins for DeltaPhi-DeltaEta histograms in Phi
-    Int_t fnBinPhiEtaEta;//Number of bins for DeltaPhi-DeltaEta histograms in Eta
-    Int_t fnBinPhi3;//Number of bins in 3-particle DeltaPhi-DeltaPhi (along each axis)
-    Int_t fnBinEta3;//Number of bins in 3-particle DeltaEta-DeltaEta (along each axis)
-    Float_t fPi;//Pi=3.14....
-    Float_t fdPhiMin;//lowest edge of the first bin in DeltaPhi plots
-    Float_t fdPhiMax;//maximum in DeltaPhi plots (should be 2*Pi+fdPhiMin)
-
-    //Parameters for settings
-    Int_t fNTPtBins;//Number of trigger pt bins
-    Int_t fNMix;//Number of events to mix
-    Int_t fNCentBins;//Number of centrality bins (they are allowed to overlap)
-    Int_t fNAPtBins;//Number of associated particle bins for 2-particle correlations (overlap not allowed)
-    Int_t fNAPt3Bins;//Number of associated particle bins for 3-particle correlations (overlap allowed)
-    Int_t fNVertexBins;//Number of bins in z-vertex for mixing
-    Int_t fNXEBins;//Number of bins for XE distribution (not finished)
-    Int_t fNIDs;//Number of trigger IDs (such as CINT1B)
-    Float_t fEffFitPt;//Pt cut used to divide efficiciency fits into low and high pt
-    Int_t fNFitLowParam;//Number of fit parameters for low pt efficeincy fit
-    Int_t fNFitHighParam;//Number of fit parameters for high pt efficeincy fit
-    Int_t fMCHistos;//Toggle whether to make Monty Carlo histograms (if made and ran on data will simply be empty not cause a crash)
-
-    TF1 *fFitLow;//Low pt efficiency fit function
-    TF1 *fFitHigh;//High pt efficiency fit function
-    Float_t *fFitLowParam; //fit parameters for low pt efficiency fit function
-    Float_t *fFitHighParam;//fit parameters for high pt efficiency fit function
-
-    Float_t *fPtTrigArray;//Array for trigger pt bins
-    Float_t *fPtAssocArray;//Array for associated pt bins (2-particle correlations)
-    //2 arrays to allow overlaping bins
-    Float_t *fPtAssoc3Array1;//lower bin edge for 3-particle correlations associated pt bins 
-    Float_t *fPtAssoc3Array2; //upper bin eged for 3-particle correlations associated pt bins
-    //2 arrays to allow oeverlaping bins 
-    Int_t *fCentArrayMin;//lower bin edge for centrality bins (based on SPD tracklet multiplicity)
-    Int_t *fCentArrayMax;//upper bin edge for centraily bins
-    Float_t *fXEArray;//XE bin array
-    char *fTrigIDArray;//array of trigger ids (such as CINT1B)
-    
-    Float_t fVertexArray[(kNumberOfVertexBins+1)];//array for dividing z vertex into bins for event mixing
+  Int_t fAODData;//0 ESDs, 1 AODs needs properly set event for simulations
+  Int_t fEfficiencyCorr;//Toggle correcting of efficiencies when filling histograms
+  Int_t fDEBUG;//if 1 extra printfs for debugging
+  
+  //Binning
+  Int_t fnBinPhi;//Number of bins for DeltaPhi histograms
+  Int_t fnBinEta;//Number of bins for DeltaEta histograms
+  Int_t fnBinPhiEtaPhi;//Number of bins for DeltaPhi-DeltaEta histograms in Phi
+  Int_t fnBinPhiEtaEta;//Number of bins for DeltaPhi-DeltaEta histograms in Eta
+  Int_t fnBinPhi3;//Number of bins in 3-particle DeltaPhi-DeltaPhi (along each axis)
+  Int_t fnBinEta3;//Number of bins in 3-particle DeltaEta-DeltaEta (along each axis)
+  Float_t fPi;//Pi=3.14....
+  Float_t fdPhiMin;//lowest edge of the first bin in DeltaPhi plots
+  Float_t fdPhiMax;//maximum in DeltaPhi plots (should be 2*Pi+fdPhiMin)
+  
+  //Parameters for settings
+  Int_t fNTPtBins;//Number of trigger pt bins
+  Int_t fNMix;//Number of events to mix
+  Int_t fNCentBins;//Number of centrality bins (they are allowed to overlap)
+  Int_t fCentPercent;//if 1 centralities are defined in % and uses the centrality task if 0 centralities define in V0Mult
+  Int_t fNAPtBins;//Number of associated particle bins for 2-particle correlations (overlap not allowed)
+  Int_t fNAPt3Bins;//Number of associated particle bins for 3-particle correlations (overlap allowed)
+  Int_t fNVertexBins;//Number of bins in z-vertex for mixing
+  Int_t fNXEBins;//Number of bins for XE distribution (not finished)
+  Int_t fNIDs;//Number of trigger IDs (such as CINT1B)
+  Float_t fEffFitPt;//Pt cut used to divide efficiciency fits into low and high pt
+  Int_t fNFitLowParam;//Number of fit parameters for low pt efficeincy fit
+  Int_t fNFitHighParam;//Number of fit parameters for high pt efficeincy fit
+  Float_t fV2FitPt;//Pt cut used to divide v2 fits into low and high pt
+  Float_t fV3FitPt;//Pt cut used to divide v3 fits into low and high pt
+  Float_t fV4FitPt;//Pt cut used to divied v4 fits into low and high pt
+  Int_t fNFitLowParamV2;//Number of fit parameters in low pt v2 fit
+  Int_t fNFitHighParamV2;//Number of fit parameters in high pt V2 fit
+  Int_t fNFitLowParamV3;//Number of fit parameters in low pt v3 fit
+  Int_t fNFitHighParamV3;//Number of fit parameters in high pt V3 fit
+  Int_t fNFitLowParamV4;//Number of fit parameters in low pt v4 fit
+  Int_t fNFitHighParamV4;//Number of fit parameters in high pt v4 fit
+  Int_t fMCHistos;//Toggle whether to make Monty Carlo histograms (if made and ran on data will simply be empty not cause a crash)
+  
+  TF1 *fFitLow;//Low pt efficiency fit function
+  TF1 *fFitHigh;//High pt efficiency fit function
+  Float_t *fFitLowParam; //fit parameters for low pt efficiency fit function
+  Float_t *fFitHighParam;//fit parameters for high pt efficiency fit function
+  TF1 *fFitLowV2;//Low pt efficiency fit function
+  TF1 *fFitHighV2;//High pt efficiency fit function
+  Float_t *fFitLowParamV2; //fit parameters for low pt efficiency fit function
+  Float_t *fFitHighParamV2;//fit parameters for high pt efficiency fit function
+  TF1 *fFitLowV3;//Low pt efficiency fit function
+  TF1 *fFitHighV3;//High pt efficiency fit function
+  Float_t *fFitLowParamV3; //fit parameters for low pt efficiency fit function
+  Float_t *fFitHighParamV3;//fit parameters for high pt efficiency fit function
+  TF1 *fFitLowV4;//Low pt efficiency fit function
+  TF1 *fFitHighV4;//High pt efficiency fit function
+  Float_t *fFitLowParamV4; //fit parameters for low pt efficiency fit function
+  Float_t *fFitHighParamV4;//fit parameters for high pt efficiency fit function
+  
+  Float_t *fPtTrigArray;//Array for trigger pt bins
+  Float_t *fPtAssocArray;//Array for associated pt bins (2-particle correlations)
+  //2 arrays to allow overlaping bins
+  Float_t *fPtAssoc3Array1;//lower bin edge for 3-particle correlations associated pt bins 
+  Float_t *fPtAssoc3Array2; //upper bin eged for 3-particle correlations associated pt bins
+  //2 arrays to allow oeverlaping bins 
+  Int_t *fCentArrayMin;//lower bin edge for centrality bins (based on SPD tracklet multiplicity)
+  Int_t *fCentArrayMax;//upper bin edge for centraily bins
+  Float_t *fXEArray;//XE bin array
+  char *fTrigIDArray;//array of trigger ids (such as CINT1B)
+
+  Int_t fSimulate;//if 1 run a simulation
+  Float_t fSimNBgPart;//Number of background particles in simulation
+  Float_t fSimNJetPart;//Number of particles in 1 of the jet peaks in simulation
+  Float_t fSimNJet;//Average Number of Jets per event.
+  Int_t fSimNEvents;//Number of events to simulate
+  
+  
+  Float_t fVertexArray[(kNumberOfVertexBins+1)];//array for dividing z vertex into bins for event mixing
   
   //Histograms
-    TH1F *fHistPt[kNumberOfCentBins][2];//Pt Distribution of tracks (no efficency correction)
-    TH1F *fHistPtEff[kNumberOfCentBins][2];//Pt Distribution of tracks (efficnecy corrected if set)
-    TH1F *fHistPtTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Pt Distributions of tracks from triggered events
-    TH1F *fHistMult[2];//Multipuliciy Distributions
-    TH1F *fHistMultTrig[kNumberOfPtBins][2];//Multiplicity Distributions of triggered events
-
-    TH2F *fHistPhi[kNumberOfCentBins][2];//Phi Distributions of tracks
-    TH2F *fHistPhiTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Phi Distributions fo tracks in triggered events
-    TH2F *fHistDeltaPhi[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions
-    TH2F *fHistDeltaPhiMix[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions from mixed events
-
-    TH2F *fHistPhiPt[kNumberOfCentBins][2];//Pt weighed phi distributions
-    TH2F *fHistPhiTrigPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt weighted phi distributions from triggered events
-    TH2F *fHistDeltaPhiPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-partricle pt weighted distributions
-    TH2F *fHistDeltaPhiMixPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle pt weigthed distributions from mixed events
-
-    TH2F *fHistEta[kNumberOfCentBins][2];//Eta distributions
-    TH2F *fHistEtaTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Eta distributions from mixed events
-
-    TH2F *fHistEtaPt[kNumberOfCentBins][2];//Pt-weighted Eta distributions
-    TH2F *fHistEtaTrigPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weighted Eta diestibutions from mixed events
-
-    TH2F *fHistDeltaEtaN[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions
-    TH2F *fHistDeltaEtaNMix[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions from mxied events
-
-    TH2F *fHistDeltaEtaNPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side pt weighted 2-particle DeltaEta distributions
-    TH2F *fHistDeltaEtaNMixPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side pt-weighted 2-particle DeltaEta distributions from mixed events
-
-    TH2F *fHistDeltaEtaA[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side DeltaEta distributions
-    TH2F *fHistDeltaEtaAMix[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side DeltaEta distributions from mixed events
-
-    TH2F *fHistDeltaEtaAPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weighted DeltaEta distributions from mixed events
-    TH2F *fHistDeltaEtaAMixPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weigthed DeltaEta distributions from mixed events
-
-    TH1F *fHistNEvents[kNumberOfCentBins][2];//Number of events count
-    TH1F *fHistNTrigger[kNumberOfCentBins][2];//Number of triggers count
-    TH1F *fHistNTriggerPt[kNumberOfCentBins][2];//Pt-weighted number of triggers count
-    TH1F *fHistNMix[kNumberOfCentBins][2];//Number of mixed events count
-
-    TH3F *fHistPhiEta[kNumberOfCentBins][2];//Phi-Eta distributions
-    TH3F *fHistPhiEtaTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Phi-Eta distributions in triggered events
-    TH3F *fHistDeltaPhiEta[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions
-    TH3F *fHistDeltaPhiEtaMix[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions from mixed events
-
-    TH3F *fHistPhiEtaPt[kNumberOfCentBins][2];//Pt-weighted Phi-Eta distributions
-    TH3F *fHistPhiEtaTrigPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weighted Phi-Eta distributions from triggered events
-    TH3F *fHistDeltaPhiEtaPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weighted DeltaPhi-DeltaEta 2-particle distributions
-    TH3F *fHistDeltaPhiEtaMixPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weigthed DeltaPhi-DeltaEta 2-particle distributions from mixed events
-
-    TH1F *fHistXEN[kNumberOfPtBins][kNumberOfCentBins][2];//XE Near-side (not finished)
-    TH1F *fHistXENMix[kNumberOfPtBins][kNumberOfCentBins][2];//XE near-side from mixed events (not finished)
-    TH1F *fHistXEA[kNumberOfPtBins][kNumberOfCentBins][2];//XE away-side (not finished)
-    TH1F *fHistXEAMix[kNumberOfPtBins][kNumberOfCentBins][2];//XE away-side from mxied events (not finished)
+  TH1F *fHistPt[kNumberOfCentBins][2];//Pt Distribution of tracks (no efficency correction)
+  TH1F *fHistPtEff[kNumberOfCentBins][2];//Pt Distribution of tracks (efficnecy corrected if set)
+  TH1F *fHistPtTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Pt Distributions of tracks from triggered events
+  TH1F *fHistMult[2];//Multipuliciy Distributions
+  TH1F *fHistMultTrig[kNumberOfPtBins][2];//Multiplicity Distributions of triggered events
+  
+  TH2F *fHistPhi[kNumberOfCentBins][2];//Phi Distributions of tracks
+  TH2F *fHistPhiTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Phi Distributions fo tracks in triggered events
+  TH2F *fHistDeltaPhi[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions
+  TH2F *fHistDeltaPhiMix[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions from mixed events
+  TH2F *fHistDeltaPhiMixV2[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions for v2
+ TH2F *fHistDeltaPhiMixV3[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions for v3
+  TH2F *fHistDeltaPhiMixV4[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle distributions for v4
+  
+  TH2F *fHistPhiPt[kNumberOfCentBins][2];//Pt weighed phi distributions
+  TH2F *fHistPhiTrigPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt weighted phi distributions from triggered events
+  TH2F *fHistDeltaPhiPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-partricle pt weighted distributions
+  TH2F *fHistDeltaPhiMixPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle pt weigthed distributions from mixed events
+  TH2F *fHistDeltaPhiMixV2Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle pt weighted distributions for v2
+  TH2F *fHistDeltaPhiMixV3Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle pt weighted distributions for v2
+  TH2F *fHistDeltaPhiMixV4Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//DeltaPhi 2-particle pt weighted distributions for v4
 
+  
+  TH2F *fHistEta[kNumberOfCentBins][2];//Eta distributions
+  TH2F *fHistEtaTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Eta distributions from mixed events
+  TH2F *fHistEtaPt[kNumberOfCentBins][2];//Pt-weighted Eta distributions
+  TH2F *fHistEtaTrigPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weighted Eta diestibutions from mixed events
+  
+  TH2F *fHistDeltaEtaN[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions
+  TH2F *fHistDeltaEtaNMix[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions from mixed events
+  TH2F *fHistDeltaEtaNMixV2[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions for v2
+  TH2F *fHistDeltaEtaNMixV3[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions for v3
+  TH2F *fHistDeltaEtaNMixV4[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta distributions for v4
+  TH2F *fHistDeltaEtaNPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side pt weighted 2-particle DeltaEta distributions
+  TH2F *fHistDeltaEtaNMixPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side pt-weighted 2-particle DeltaEta distributions from mixed events
+  TH2F *fHistDeltaEtaNMixV2Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta pt weighted distributions for v2
+  TH2F *fHistDeltaEtaNMixV3Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta pt weighted distributions for v2
+  TH2F *fHistDeltaEtaNMixV4Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Near-side 2-particle DeltaEta pt weighted distributions for v4
+
+  TH2F *fHistDeltaEtaA[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side DeltaEta distributions
+  TH2F *fHistDeltaEtaAMix[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side DeltaEta distributions from mixed events
+  TH2F *fHistDeltaEtaAMixV2[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side 2-particle DeltaEta distributions for v2
+  TH2F *fHistDeltaEtaAMixV3[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side 2-particle DeltaEta distributions for v2
+  TH2F *fHistDeltaEtaAMixV4[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side 2-particle DeltaEta distributions for v4
+  
+  TH2F *fHistDeltaEtaAPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weighted DeltaEta distributions from mixed events
+  TH2F *fHistDeltaEtaAMixPt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weigthed DeltaEta distributions from mixed events
+  TH2F *fHistDeltaEtaAMixV2Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weighted 2-particle DeltaEta distributions for v2
+  TH2F *fHistDeltaEtaAMixV3Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weighted 2-particle DeltaEta distributions for v2
+  TH2F *fHistDeltaEtaAMixV4Pt[kNumberOfPtBins][kNumberOfCentBins][3][2];//Away-side pt-weighted 2-particle DeltaEta distributions for v4  
+
+  TH1F *fHistNEvents[kNumberOfCentBins][2];//Number of events count
+  TH1F *fHistNTrigger[kNumberOfCentBins][2];//Number of triggers count
+  TH1F *fHistNTriggerPt[kNumberOfCentBins][2];//Pt-weighted number of triggers count
+  TH1F *fHistNMix[kNumberOfCentBins][2];//Number of mixed events count
+  
+  TH3F *fHistPhiEta[kNumberOfCentBins][2];//Phi-Eta distributions
+  TH3F *fHistPhiEtaTrig[kNumberOfPtBins][kNumberOfCentBins][2];//Phi-Eta distributions in triggered events
+  TH3F *fHistDeltaPhiEta[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions
+  TH3F *fHistDeltaPhiEtaMix[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions from mixed events
+  TH3F *fHistDeltaPhiEtaMixV2[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions for V2
+  TH3F *fHistDeltaPhiEtaMixV3[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions for V3
+  TH3F *fHistDeltaPhiEtaMixV4[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta 2-particle distributions for V4
+
+  TH3F *fHistPhiEtaPt[kNumberOfCentBins][2];//Pt-weighted Phi-Eta distributions
+  TH3F *fHistPhiEtaTrigPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weighted Phi-Eta distributions from triggered events
+  TH3F *fHistDeltaPhiEtaPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weighted DeltaPhi-DeltaEta 2-particle distributions
+  TH3F *fHistDeltaPhiEtaMixPt[kNumberOfPtBins][kNumberOfCentBins][2];//Pt-weigthed DeltaPhi-DeltaEta 2-particle distributions from mixed events
+  TH3F *fHistDeltaPhiEtaMixV2Pt[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta pt weighted 2-particle distributions for V2
+  TH3F *fHistDeltaPhiEtaMixV3Pt[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta pt weighted 2-particle distributions for V3
+  TH3F *fHistDeltaPhiEtaMixV4Pt[kNumberOfPtBins][kNumberOfCentBins][2];//DeltaPhi-DeltaEta pt weighted  2-particle distributions for V4
+  
+  TH1F *fHistXEN[kNumberOfPtBins][kNumberOfCentBins][2];//XE Near-side (not finished)
+  TH1F *fHistXENMix[kNumberOfPtBins][kNumberOfCentBins][2];//XE near-side from mixed events (not finished)
+  TH1F *fHistXEA[kNumberOfPtBins][kNumberOfCentBins][2];//XE away-side (not finished)
+  TH1F *fHistXEAMix[kNumberOfPtBins][kNumberOfCentBins][2];//XE away-side from mxied events (not finished)
+  
   //Three-Particle Histograms
-    TH2F *fHistDeltaPhiPhi[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions
-    TH2F *fHistDeltaPhiPhiMix[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions from mixed events
-    TH2F *fHistDeltaPhiPhiSS[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle soft-soft background term (from mixing)
-    TH2F *fHistDeltaEtaEta[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions
-    TH2F *fHistDeltaEtaEtaMix[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions from Mixed Events
-    TH2F *fHistDeltaEtaEtaSS[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions soft-soft background term (from mixing)
-
-
-
+  TH2F *fHistDeltaPhiPhi[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions
+  TH2F *fHistDeltaPhiPhiMix[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions from mixed events
+  TH2F *fHistDeltaPhiPhiMixV2[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions from mixed events
+  TH2F *fHistDeltaPhiPhiMixV3[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions from mixed events
+  TH2F *fHistDeltaPhiPhiMixV4[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions from mixed events
+  TH2F *fHistDeltaPhiPhiMixV2V2V4[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle distributions from mixed events
+  TH2F *fHistDeltaPhiPhiSS[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle soft-soft background term (from mixing)
+  TH2F *fHistDeltaPhiPhiSSV2[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle soft-soft background term v2 (from mixing)
+  TH2F *fHistDeltaPhiPhiSSV3[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle soft-soft background term v3 (from mixing)
+  TH2F *fHistDeltaPhiPhiSSV4[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaPhi-DeltaPhi 3-particle soft-soft background term v4 (from mixing)
+  
+  TH2F *fHistDeltaEtaEta[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions
+  TH2F *fHistDeltaEtaEtaMix[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions from Mixed Events
+  TH2F *fHistDeltaEtaEtaMixV2[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions for V2
+  TH2F *fHistDeltaEtaEtaMixV3[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions for V2
+  TH2F *fHistDeltaEtaEtaMixV4[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions for V4
+  TH2F *fHistDeltaEtaEtaMixV2V2V4[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions for v2*v2*v4 terms
+  TH2F *fHistDeltaEtaEtaSS[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions soft-soft background term (from mixing)
+  TH2F *fHistDeltaEtaEtaSSV2[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions soft-soft background term v2 (from mixing)
+  TH2F *fHistDeltaEtaEtaSSV3[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions soft-soft background term v3  (from mixing)
+  
+ TH2F *fHistDeltaEtaEtaSSV4[kNumberOfPtBins][kNumberOfApt3Bins][kNumberOfCentBins][4][2];//DeltaEta-DeltaEta 3-particle distributions soft-soft background term v4 (from mixing)
+  
+  
+  
   //Arrays for event mixing (only need parameters of tracks passing cuts kept)
-    Float_t *fMPt[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Pt array (mixed events)
-    Float_t *fMPhi[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2]; //Phi array (mixed events)
-    Int_t fMixTrack[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Number of tracks in the event stored (mixed events)
-    Float_t *fMEta[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Eta Array (mixed events)
-    Short_t *fMCharge[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Charge array (mixed events)
-    Float_t *fMEff[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Efficiency correction array (mixed events)
-    Int_t fMixPointer[kNumberOfCentBins][kNumberOfVertexBins][2];//which event should be replaced with newest mixed event (mixed events)
-    Int_t fMixEnd[kNumberOfCentBins][kNumberOfVertexBins][2]; //current depth of mixed event pool (mixed events)
+  Float_t *fMPt[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Pt array (mixed events)
+  Float_t *fMPhi[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2]; //Phi array (mixed events)
+  Int_t fMixTrack[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Number of tracks in the event stored (mixed events)
+  Float_t *fMEta[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Eta Array (mixed events)
+  Short_t *fMCharge[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Charge array (mixed events)
+  Float_t *fMEff[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//Efficiency correction array (mixed events)
+  Float_t *fMV2[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//v2
+ Float_t *fMV3[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//v2
+  Float_t *fMV4[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//v4
+  Int_t fMixPointer[kNumberOfCentBins][kNumberOfVertexBins][2];//which event should be replaced with newest mixed event (mixed events)
+  Int_t fMixEnd[kNumberOfCentBins][kNumberOfVertexBins][2]; //current depth of mixed event pool (mixed events)
   //additional ones to speed up the 3-particle correlations
   Short_t *fMPtAssoc3[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2][10];//which 3-particle pt bin(s) the track is in, using a bit extra memory fixing the pt bins to 10, but makes the arrays much easier (mixed events)
   Short_t *fMNPtAssoc3[kNumberOfEventsToMix][kNumberOfCentBins][kNumberOfVertexBins][2];//number of 3-particle pt bins the track is in (mixed events)
   
-
+  
   //Arrays for Main Events
   Float_t *ftPhi;//Phi array (current event)
   Float_t *ftEta;//Eta array (current event)
   Float_t *ftPt;//Pt Array (current event)
   Short_t *ftCharge;//Charge Array (current event)
   Float_t *ftEff;//Efficneicy Array (current event)
+  Float_t *ftV2;//V2 Array (current event)
+  Float_t *ftV3;//V3 Array (current event)
+  Float_t *ftV4;//V4 Array (current event)
   Int_t **ftPtAssoc3;//which 3-particle bins the track is in (current event)
   Int_t *ftNPtAssoc3;//number of 3-particle bins the track is in (current event)
-
+  
   AliAnalysisTaskDiHadron(const AliAnalysisTaskDiHadron&);//not implimented
   AliAnalysisTaskDiHadron& operator=(const AliAnalysisTaskDiHadron&);//not implimnted
 
diff --git a/PWGCF/Correlations/macros/3particlecorrelations/AddTask_DiHadron.C b/PWGCF/Correlations/macros/3particlecorrelations/AddTask_DiHadron.C
new file mode 100644 (file)
index 0000000..086c9ff
--- /dev/null
@@ -0,0 +1,222 @@
+//#include "exception.h"
+//For running on PbPb data 0-50% most central
+AliAnalysisTask *AddTask_DiHadron(Int_t IncludeLowPtBins=0){
+
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTask_sma_PriVtx", "No analysis manager found.");
+    return 0;
+  }
+
+  //========= SetInitial Parameters =====
+  //Int_t IncludeLowPtBins=0;//Set to 1 to include low pt triggers
+
+  //Track Quality Cuts
+  Int_t MinimumClustersTPC=70;
+  Float_t MinClusterRatio=0.51;//Must have at least this ratio not shared
+  Float_t MaxTPCchi2=4;
+  Int_t MinimumClustersITS=0;
+  Float_t EtaCut=0.9;//Tracks in +/- Eta are used
+  Float_t TriggerEtaCut=0.5;//Trigger particle restriction so flat area in acceptanc can be created
+  Float_t NearPhiCut=1.5;//Cut used to seperate near and away side for delta eta plots
+  Float_t XECut=NearPhiCut;//For XE distribution near and away seperation
+  Float_t MaxDCA=3;//Total DCA Cut
+  Float_t MaxDCAXY=2.4;
+  Float_t MaxDCAZ=3.2;
+  Int_t DCAMethod=1;//0 MaxDCA used, 1 MaxDCAXY and MaxDCAZ used 2 pT dependent DCA cut
+  Int_t TPCRefit=1;
+  Int_t ITSRefit=0;//1 for all particles, 2 for particles above 5 GeV/c
+  Int_t SPDCut=0;//check for a point in 1 of first 2 layers of the its
+ Float_t MinimumPt=0.25;//Minimum Pt considered by the code
+  Float_t MaximumPt=50;
+  Float_t ZVertexCut=10;//in cm
+
+  //Options
+  Int_t RunOnAOD=1;
+  Int_t EfficiencyCorrection=1;//do efficiency corrections in this code
+  Int_t MakeMCHistos=0;//if 0 MC histograms are not made (will be empty if 1 and ran on real data)
+  Int_t DEBUG=0;//for debugging
+  
+  //Binning
+  Int_t nBinPhi=60;//Number of bins for #Delta#phi histograms
+  Int_t nBinEta=54;//Number of bins for #Delta#eta histograms
+  Int_t nBinsPhiEtaPhi=20;//Number of bins for #Delta#phi-#Delta#eta in #Delta#phi
+  Int_t nBinsPhiEtaEta=18;//Number of bins for #Delta#phi-#Delta#eta in #Delta#phi
+  Int_t nBinsPhiPhi=30;//Number of bins for #Delta#phi-#Delta#phi
+  Int_t nBinsEtaEta=27;//Number of bins for #Delta#eta-#Delta#eta
+  const Float_t fPi=3.1415926535898;
+  Float_t PhiPlotMin=-fPi/3;//Min bin edge in #Delta#phi
+  Float_t PhiPlotMax=2*fPi+PhiPlotMin;//Max bin edge
+  
+  //Size of some arrays change array contents below
+  if(IncludeLowPtBins)const Int_t NTriggerPtBins=11;
+  else const Int_t NTriggerPtBins=8;//max=20
+  const Int_t NEventsToMix=10;//max=100
+  const Int_t NCentralityBins=7;//max=10  //6
+  const Int_t PercentageCentralityBins=1;//0 or 1
+  const Int_t NAssociatedPtBins=25;//max=50
+  const Int_t N3ParticleAssociatedPtBins=4;//max=50
+  const Int_t NZVertexBinsForMixing=1;//max=20
+  const Int_t NXEBins=1;//max=20
+  const Int_t NumberOfTriggerIDs=1;
+  Float_t EffFitPtCut=3;
+
+  TF1 *EfficiencyFitLow=new TF1("EfficiencyFitLow","[0]/[1]*exp(-0.5*pow(x/[1],2))+[2]+[3]*x+[4]*x**2+[5]*x**3",MinimumPt,EffFitPtCut);
+  TF1 *EfficiencyFitHigh=new TF1("EfficiencyFitHigh","[0]+[1]*(x-3)",EffFitPtCut,MaximumPt);
+  const Int_t NParamFitLow=6;
+  const Int_t NParamFitHigh=2;
+  
+  //Not high enough occupancy to worry about the centrality in pp
+  //For overlapping centrality bins efficiencies from first bin are used
+  //For 1% bins from pass2 
+Float_t FitLowParam[NCentralityBins*NParamFitLow]={
+  -0.0227546, 0.21379, 0.916013, 0.0586031, -0.0429047, 0.0064962,
+  -0.0224257, 0.215105, 0.916696, 0.0593096, -0.0429726, 0.00650312,
+  -0.0220935, 0.208194, 0.915207, 0.0613371, -0.0416018, 0.00576639,
+  -0.0229694, 0.208645, 0.919995, 0.0527738, -0.0344433, 0.00430404,
+  -0.0235676, 0.206099, 0.922875, 0.0476261, -0.0298983, 0.0032692,
+  -0.0238139, 0.206366, 0.925183, 0.0430703, -0.0264516, 0.00250388,
+  -0.024815, 0.204409, 0.928448, 0.03423, -0.019894, 0.00121746
+};
+ Float_t FitHighParam[NCentralityBins*NParamFitHigh]={
+   0.881078, 0.00158217,
+   0.883456, 0.00144851,
+   0.880495, 0.00369636,
+   0.884535, 0.00297087,
+   0.884937, 0.00166201,
+   0.883934, 0.00290625,
+   0.884964, -0.000784607
+ };
+  Float_t V2FitPtCut=2.75;
+  Float_t V3FitPtCut=2.75;
+  Float_t V4FitPtCut=2.75;
+  TF1 *V2FitLow=new TF1("V2FitLow","[0]*(x+[1]*x**2+[2]*x**3+[3]*x**4)",MinimumPt,V2FitPtCut);
+  TF1 *V2FitHigh=new TF1("V2FitHigh","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]",V2FitPtCut,MaximumPt);
+  TF1 *V3FitLow=new TF1("V3FitLow","[0]*(x+[1]*x**2+[2]*x**3+[3]*x**4)",MinimumPt,V2FitPtCut);
+  TF1 *V3FitHigh=new TF1("V3FitHigh","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]",V2FitPtCut,MaximumPt);
+ TF1 *V4FitLow=new TF1("V4FitLow","[0]*(x+[1]*x**2+[2]*x**3+[3]*x**4)",MinimumPt,V2FitPtCut);
+  TF1 *V4FitHigh=new TF1("V4FitHigh","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]",V2FitPtCut,MaximumPt);
+
+  const Int_t NParamV2FitLow=4;
+  const Int_t NParamV2FitHigh=4;
+  const Int_t NParamV3FitLow=4;
+  const Int_t NParamV3FitHigh=4;
+  const Int_t NParamV4FitLow=4;
+  const Int_t NParamV4FitHigh=4;
+
+  //From FlowScale2 macro
+Float_t FitLowParamV2[NCentralityBins*NParamV2FitLow]={
+0.046931, -0.504895, 0.186345, -0.030504,
+0.060953, -0.503882, 0.197361, -0.030849,
+0.088939, -0.396433, 0.127467, -0.016969,
+0.122602, -0.347615, 0.098626, -0.012576,
+0.155403, -0.296297, 0.065681, -0.007492,
+0.177546, -0.271958, 0.049388, -0.005644,
+0.187634, -0.223967, 0.011281, 0.001462};
+Float_t FitHighParamV2[NCentralityBins*NParamV2FitHigh]={
+0.000000, 4.478095, 0.500000, 0.049007,
+0.012659, 3.603740, 0.656049, 0.071827,
+0.043836, 3.623140, 1.414293, 0.089569,
+0.071277, 3.490653, 1.454361, 0.112755,
+0.082163, 3.324474, 1.429585, 0.145809,
+0.085348, 3.194132, 1.562318, 0.163847,
+0.061056, 2.994950, 1.442946, 0.194451};
+Float_t FitLowParamV3[NCentralityBins*NParamV3FitLow]={
+0.019078, 0.793599, -0.436079, 0.075946,
+0.025818, 0.088555, 0.070194, -0.026702,
+0.028562, 0.297268, -0.112696, 0.013257,
+0.034723, 0.137282, -0.008578, -0.009524,
+0.041567, -0.002427, 0.093642, -0.032998,
+0.045574, 0.059023, 0.029342, -0.019022,
+0.052432, -0.067332, 0.087218, -0.028239};
+Float_t FitHighParamV3[NCentralityBins*NParamV3FitHigh]={
+0.079111, 3.802577, 3.182298, 0.000000,
+0.105446, 4.216029, 2.377002, 0.000000,
+0.106553, 4.500000, 2.825647, 0.009652,
+0.099684, 3.875928, 1.968600, 0.022106,
+0.103187, 3.597519, 1.980556, 0.022403,
+0.123473, 3.773586, 2.099909, 0.011130,
+0.140945, 3.618698, 1.852780, 0.000000};
+Float_t FitLowParamV4[NCentralityBins*NParamV4FitLow]={
+0.005289, 1.000000, 0.398581, -0.095251,
+0.018611, -1.000000, 0.837275, -0.163058,
+0.022107, -1.000000, 0.847701, -0.168469,
+0.025434, -1.000000, 0.854238, -0.176690,
+0.030768, -1.000000, 0.811683, -0.164335,
+0.037000, -1.000000, 0.781250, -0.158122,
+0.043484, -1.000000, 0.752546, -0.153147};
+  Float_t FitHighParamV4[NCentralityBins*NParamV4FitHigh]={
+0.061365, 3.669890, 1.724126, 0.014456,
+0.086516, 4.194769, 1.723464, 0.000000,
+0.030263, 4.008413, 0.563914, 0.067831,
+0.073456, 4.255665, 1.551659, 0.025494,
+0.058771, 4.102898, 1.191926, 0.048796,
+0.054682, 4.221963, 1.119594, 0.064515,
+0.094564, 4.500000, 1.568750, 0.038027};
+
+
+
+  if(IncludeLowPtBins) Float_t TriggerPtBins[(NTriggerPtBins+1)]={0.75,1,2,2.5,3,4,6,8,10,15,20,25};
+  else  Float_t TriggerPtBins[(NTriggerPtBins+1)]={2.5,3,4,6,8,10,15,20,25};
+
+  Float_t AssociatedPtBins[(NAssociatedPtBins+1)]={0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,12,15,20,25,30,40,50,70,100};
+  Float_t AssociatedPtBins31[N3ParticleAssociatedPtBins]={0.5,0.75,1,2};
+  Float_t AssociatedPtBins32[N3ParticleAssociatedPtBins]={0.75,1,2,3};
+  Int_t CentralityBins1[NCentralityBins]={0,0,5,10,20,30,40};
+  Int_t CentralityBins2[NCentralityBins]={2,5,10,20,30,40,50};
+
+  Float_t XEBins[(NXEBins+1)]={0,0.01};
+  //char *TriggerIDArray="CINT1B";//seperate multiple with ,
+  //char *TriggerIDArray="CSH1-B";//seperate multiple with ,
+  char *TriggerIDArray="C";//PbPb test, using SelectCollisionsCanidates instead
+
+  ////////////////////////
+  //Add the task
+  ////////////////////////
+  AliAnalysisTaskDiHadron *task = new AliAnalysisTaskDiHadron("julery_DiHadron");
+  task->SetCuts(MinimumClustersTPC,MinClusterRatio,MaxTPCchi2,MinimumClustersITS, EtaCut,TriggerEtaCut,NearPhiCut,XECut,MaxDCA,MaxDCAXY,MaxDCAZ, DCAMethod, TPCRefit,ITSRefit,SPDCut,MinimumPt,MaximumPt,ZVertexCut,NumberOfTriggerIDs,TriggerIDArray);
+  task->SetOptions(RunOnAOD,EfficiencyCorrection,DEBUG,MakeMCHistos);
+  task->SetBins(nBinPhi,nBinEta,nBinsPhiEtaPhi,nBinsPhiEtaEta,nBinsPhiPhi,nBinsEtaEta,PhiPlotMin,PhiPlotMax,NTriggerPtBins,NEventsToMix,NCentralityBins,PercentageCentralityBins,NAssociatedPtBins,N3ParticleAssociatedPtBins,NZVertexBinsForMixing,NXEBins,TriggerPtBins,AssociatedPtBins,AssociatedPtBins31,AssociatedPtBins32,CentralityBins1,CentralityBins2,XEBins);
+  task->SetEfficiencies(EffFitPtCut,EfficiencyFitLow,EfficiencyFitHigh,NParamFitLow,NParamFitHigh,FitLowParam,FitHighParam);
+  task->SetFlow(V2FitPtCut,V3FitPtCut,V4FitPtCut,V2FitLow,V2FitHigh,V3FitLow,V3FitHigh,V4FitLow,V4FitHigh,NParamV2FitLow,NParamV2FitHigh,NParamV3FitLow,NParamV3FitHigh,NParamV4FitLow,NParamV4FitHigh,FitLowParamV2,FitHighParamV2,FitLowParamV3,FitHighParamV3,FitLowParamV4,FitHighParamV4);
+
+// physics selection
+Int_t isMC=0;//1 for MC 0 for DATA
+//gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+//AliPhysicsSelectionTask *PhysicsTask=AddTaskPhysicsSelection(isMC, 0); //isMC is true when processing monte carlo, the second 0 disables the cluster vs tracklets
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+  //AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC,0);
+  task->SelectCollisionCandidates(AliVEvent::kMB);
+  //AliCentralitySelectionTask *centSelTask = AliCentralitySelectionTask("CentralitySelection");
+  mgr->AddTask(task);
+
+  //================================================
+  //              data containers
+  //================================================
+  //            find input container
+  //below the trunk version
+  //   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer();
+  //this is the old way!!!
+  AliAnalysisDataContainer *cinput  = (AliAnalysisDataContainer*)mgr->GetContainers()->FindObject("cAUTO_INPUT");
+  
+  //            define output containers, please use 'username'_'somename'
+  AliAnalysisDataContainer *coutput1 = 
+    mgr->CreateContainer("julery_DiHadron", TList::Class(),
+                            AliAnalysisManager::kOutputContainer,"julery_DiHadron.root");
+
+  //           connect containers
+  mgr->ConnectInput  (task,  0, cinput );
+  mgr->ConnectOutput (task,  0, coutput1);
+
+  return task;
+  
+}
diff --git a/PWGCF/Correlations/macros/AddTaskDiHadron.C b/PWGCF/Correlations/macros/AddTaskDiHadron.C
deleted file mode 100644 (file)
index 191fd67..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-//#include "exception.h"
-//For running at CERN
-AliAnalysisTask *AddTaskDiHadron(){
-  //get the current analysis manager
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
-    Error("AddTask_DiHadron", "No analysis manager found.");
-    return 0;
-  }
-
-  
-  //=========  Set initial parameters=====
-
-  //Track Quality Cuts
-  Int_t MinimumClustersTPC=70;
-  Float_t MinClusterRatio=0.1;//1/2 would remove split tracks if not for sharing of clusters
-  Float_t MaxTPCchi2=4;
-  Int_t MinimumClustersITS=0;
-  Float_t EtaCut=0.8;//Tracks in +/- Eta are used
-  Float_t TriggerEtaCut=0.5;//Smaller trigger for flat acceptance on near-side
-  Float_t NearPhiCut=1.5;//Cut used to seperate near and away side for delta eta plots
-  Float_t XECut=NearPhiCut;//For XE distribution near and away seperation
-  Float_t MaxDCA=3;//Total DCA Cut
-  Float_t MaxDCAXY=2.4;
-  Float_t MaxDCAZ=3.2;
-  Int_t DCAMethod=2;//0 MaxDCA used, 1 MaxDCAXY and MaxDCAZ used 2 pT dependent DCA cut
-  Int_t TPCRefit=1;
-  Int_t ITSRefit=1;//1 for all particles, 2 for particles above 5 GeV/c
-  Int_t SPDCut=1;//check for a point in 1 of first 2 layers of the its
- Float_t MinimumPt=0.25;//Minimum Pt considered by the code
-  Float_t MaximumPt=50;
-  Float_t ZVertexCut=10;//in cm
-
-  Int_t EfficiencyCorrection=1;//do efficiency corrections in this code
-  Int_t MakeMCHistos=1;//if 0 MC histograms are not made (will be empty if 1 and ran on real data)
-  Int_t DEBUG=0;//for debugging
-  
-  //Binning
-  Int_t nBinPhi=60;//Number of bins for #Delta#phi histograms
-  Int_t nBinEta=54;//Number of bins for #Delta#eta histograms
-  Int_t nBinsPhiEtaPhi=20;//Number of bins for #Delta#phi-#Delta#eta in #Delta#phi
-  Int_t nBinsPhiEtaEta=18;//Number of bins for #Delta#phi-#Delta#eta in #Delta#phi
-  Int_t nBinsPhiPhi=30;//Number of bins for #Delta#phi-#Delta#phi
-  Int_t nBinsEtaEta=27;//Number of bins for #Delta#eta-#Delta#eta
-  const Float_t fPi=3.1415926535898;
-  Float_t PhiPlotMin=-fPi/3;//Min bin edge in #Delta#phi
-  Float_t PhiPlotMax=2*fPi+PhiPlotMin;//Max bin edge
-  
-  //Size of some arrays change array contents below
-  const Int_t NTriggerPtBins=12;//max=20
-  const Int_t NEventsToMix=100;//max=100
-  const Int_t NCentralityBins=4;//max=10
-  const Int_t NAssociatedPtBins=25;//max=50
-  const Int_t N3ParticleAssociatedPtBins=10;//max=50
-  const Int_t NZVertexBinsForMixing=7;//max=20
-  const Int_t NXEBins=11;//max=20
-  const Int_t NumberOfTriggerIDs=1;
-  Float_t EffFitPtCut=3;
-
-  TF1 *EfficiencyFitLow=new TF1("EfficiencyFitLow","[0]/[1]*exp(-0.5*pow(x/[1],2))+[2]+[3]*x",MinimumPt,EffFitPtCut);
-   TF1 *EfficiencyFitHigh=new TF1("EfficiencyFitHigh","[0]",EffFitPtCut,MaximumPt);
-   const Int_t NParamFitLow=4;
-   const Int_t NParamFitHigh=1;
-
-   //Not high enough occupancy to worry about the centrality in pp
-   //For overlapping centrality bins efficiencies from first bin are used
-   //7Pythia_LHC10b5
-   Float_t FitLowParam[NCentralityBins*NParamFitLow]={
-     -0.030749, 0.254311, 0.858824, -0.0323708,
-     -0.0304332, 0.252195, 0.851405, -0.03164,
-     -0.0295618, 0.248594, 0.869159, -0.0354148,
-     -0.0300529, 0.236693, 0.875875, -0.0370379};
-   
-   Float_t FitHighParam[NCentralityBins*NParamFitHigh]={
-     0.75813,
-     0.750521,
-     0.751902,
-     0.68658};
-
-   /*
-   //LHC10c6_900Pythia
-   Float_t FitLowParam[NCentralityBins*NParamFitLow]={
-     -0.027393, 0.236723, 0.814427, -0.023897,
-     -0.0271116, 0.232689, 0.809889, -0.0246341,
-     -0.0284658, 0.245163, 0.856043, -0.0318309,
-     -0.117114, 0.0355117, 0.828829, -0.0207492}
-   
-   Float_t FightHighParam[NCentralityBins*NParamFitHigh]={
-     0.729888,
-     0.719402,
-     0.708409,
-     0.829268}
-   */
-
-
-  Float_t TriggerPtBins[(NTriggerPtBins+1)]={2,2.5,3,4,6,8,10,15,20,30,40,50};
-  Float_t AssociatedPtBins[(NAssociatedPtBins+1)]={0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,12,15,20,25,30,40,50,70,100};
-  Float_t AssociatedPtBins31[N3ParticleAssociatedPtBins]={0.5,1.0,1.5,2.0,3,4,1};
-  Float_t AssociatedPtBins32[N3ParticleAssociatedPtBins]={1.0,1.5,2.0,3.0,4,5,2};
-  Int_t CentralityBins1[NCentralityBins]={0,     0, 20, 40};
-  Int_t CentralityBins2[NCentralityBins]={500,20,40,500};
-  Float_t XEBins[(NXEBins+1)]={0,0.05,0.1,0.15,0.2,0.3,0.4,0.5,0.6,0.7,0.8,1};
-  char *TriggerIDArray[NumberOfTriggerIDs]={"CINT1B"};
-
-  //==================================
-  //Add the task
-  //===================================
-  AliAnalysisTaskDiHadron *task = new AliAnalysisTaskDiHadron("DiHadron");
-  task->SetCuts(MinimumClustersTPC,MinClusterRatio,MaxTPCchi2,MinimumClustersITS, EtaCut,TriggerEtaCut,NearPhiCut,XECut,MaxDCA,MaxDCAXY,MaxDCAZ, DCAMethod, TPCRefit,ITSRefit,SPDCut,MinimumPt,MaximumPt,ZVertexCut,NumberOfTriggerIDs,TriggerIDArray);
-  task->SetOptions(EfficiencyCorrection,DEBUG,MakeMCHistos);
-  task->SetBins(nBinPhi,nBinEta,nBinsPhiEtaPhi,nBinsPhiEtaEta,nBinsPhiPhi,nBinsEtaEta,PhiPlotMin,PhiPlotMax,NTriggerPtBins,NEventsToMix,NCentralityBins,NAssociatedPtBins,N3ParticleAssociatedPtBins,NZVertexBinsForMixing,NXEBins,TriggerPtBins,AssociatedPtBins,AssociatedPtBins31,AssociatedPtBins32,CentralityBins1,CentralityBins2,XEBins);
-  task->SetEfficiencies(EffFitPtCut,EfficiencyFitLow,EfficiencyFitHigh,NParamFitLow,NParamFitHigh,FitLowParam,FitHighParam);
-  mgr->AddTask(task);
-
-
-  //================================================
-  //              data containers
-  //================================================
- AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
-  mgr->ConnectInput(task, 0, cinput); 
-
-  
-  //            define output containers, please use 'username'_'somename'
-  AliAnalysisDataContainer *coutput1 = 
-    mgr->CreateContainer("DiHadron", TList::Class(),
-                            AliAnalysisManager::kOutputContainer,"DiHadron.root");
-
-  //           connect containers
-  mgr->ConnectInput  (task,  0, cinput );
-  mgr->ConnectOutput (task,  0, coutput1);
-
-  return task;
-}