Revert to previous version of dphi task
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 22 Nov 2013 13:29:33 +0000 (13:29 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 22 Nov 2013 13:29:33 +0000 (13:29 +0000)
PWGGA/GammaConv/AliAnalysisTaskdPhi.cxx
PWGGA/GammaConv/AliAnalysisTaskdPhi.h

index 5b48681..17c8db0 100644 (file)
@@ -37,9 +37,9 @@
 #include "AliConversionMesonCuts.h"
 #include "AliAODConversionPhoton.h"
 #include "AliAODConversionMother.h"
-// #include "AliAnaConvCorrPhoton.h"
-// #include "AliAnaConvCorrPion.h"
-// #include "AliAnaConvIsolation.h"
+#include "AliAnaConvCorrPhoton.h"
+#include "AliAnaConvCorrPion.h"
+#include "AliAnaConvIsolation.h"
 #include "AliV0ReaderV1.h"
 // Author Svein Lindal <slindal@fys.uio.no>
 using namespace std;
@@ -50,151 +50,134 @@ ClassImp(AliAnalysisTaskdPhi)
 //________________________________________________________________________
 AliAnalysisTaskdPhi::AliAnalysisTaskdPhi(const char *name) : AliAnalysisTaskSE(name),
   fHistograms(NULL),
-  fCorrSparse(NULL),
-  fTrigSparse(NULL),
-  fTrackSparse(NULL),
-  fMassSparse(NULL),
   fV0Reader(NULL),
   fSaveReaderHists(kFALSE),
   fV0Filter(NULL),
-  fV0Filters(),
   fPhotonFilter(NULL),
   fMesonFilter(NULL),
-  fMesonFilters(),
-  fTrackFilter(NULL),
-  fTrackFilters(),
+  fTrackCuts(NULL),
   hMEvents(NULL),
   hTrackCent(NULL),
-  // fPhotonCorr(NULL),
-  // fPionCorr(NULL), 
+  fPhotonCorr(NULL),
+  fPionCorr(NULL), 
   fDeltaAODBranchName("AliAODGammaConversion_gamma"), 
   fAxistPt(),
   fAxiscPt(),
   fAxisdEta(),
   fAxisTrigEta(),
   fAxisAssEta(),
-  fAxisdPhi(),
+  fAxisPhi(),
   fAxisCent(),
   fAxisZ(), 
   fAxisPiM(), 
-  fAxisTrackFilters(),                                                      
-  fAxisV0Filters(),                                                         
-  fAxisMesonFilters(),                                                      
-  fkTrackAxis(kFALSE),
-  fkV0Axis(kFALSE),
-  fkPionAxis(kFALSE),
-  fAxesList(), 
-  fTrigAxesList(), 
-  fTrackAxesList(), 
-  fMassAxesList(),
   fDoPhoton(kFALSE)
- {
-   //constructor
-   SetUpBins();
+{
+  //constructor
+                                                                                                                                                                                   
+  Double_t tptbins[10] = {0.1, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 15, 50, 100};                                                                                                        
+  fAxistPt.SetNameTitle("tPtAxis", "tPt");
+  fAxistPt.Set(9, tptbins);
 
-   DefineInput(0, TChain::Class());
-   DefineOutput(1, TList::Class());
- }
+  Double_t cptbins[13] = {0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 8.0, 10.0, 25, 50, 100};                                                                                         
+  fAxiscPt.SetNameTitle("cPtAxis", "cPt");
+  fAxiscPt.Set(12, cptbins);
 
+  fAxisdEta.SetNameTitle("dEtaAxis", "Eta");
+  fAxisdEta.Set(36, -1.8, 1.8);
 
+  fAxisTrigEta.SetNameTitle("TrigEtaAxis", "Eta");
+  fAxisTrigEta.Set(320, -0.8, 0.8);
 
- //________________________________________________________________________
- AliAnalysisTaskdPhi::~AliAnalysisTaskdPhi(){
-   //destructor
+  fAxisAssEta.SetNameTitle("AssEtaAxis", "Eta");
+  fAxisAssEta.Set(360, -0.9, 0.9);
 
-   if(fV0Filter)
-        delete fV0Filter;
-   fV0Filter = NULL;
+  fAxisPhi.SetNameTitle("PhiAxis", "Phi");
+  fAxisPhi.Set(128, 0, TMath::TwoPi());
 
-   if(fMesonFilter)
-        delete fMesonFilter;
-   fMesonFilter = NULL;
+  fAxisZ.SetNameTitle("ZAxis", "Z");
+  fAxisZ.Set(4, -10, 10);
 
-   if(fPhotonFilter)
-        delete fPhotonFilter;
-   fPhotonFilter = NULL;
+  fAxisCent.SetNameTitle("CentAxis", "Cent");
 
-   if(fHistograms)
-        delete fHistograms;
-   fHistograms = NULL;
+  Double_t centbins[5] = {0, 10, 30, 60, 100.1};
+  fAxisCent.Set(4, centbins);
 
-   if(fTrackFilter)
-     delete fTrackFilter;
-   fTrackFilter = NULL;
+  Double_t mbins[7] = {0.1, 0.11, 0.12, 0.15, 0.16, 0.18, 0.2};
+  fAxisPiM.SetNameTitle("InvMassPi0", "Invariant mass");
+  fAxisPiM.Set(6, mbins);
 
- }
 
- ///________________________________________________________________________
-void AliAnalysisTaskdPhi::SetUpBins() {
-
-   fAxisTrigEta.SetNameTitle("tEta", "Eta");
-   fAxisTrigEta.Set(320, -0.8, 0.8);
+  DefineInput(0, TChain::Class());
+  DefineOutput(1, TList::Class());
+}
 
-   fAxisAssEta.SetNameTitle("aEta", "Eta");
-   fAxisAssEta.Set(360, -0.9, 0.9);
 
-   fAxisdEta.SetNameTitle("dEta", "Eta");
-   fAxisdEta.Set(34, -1.7, 1.7);
 
-   fAxisdPhi.SetNameTitle("dPhi", "delta Phi");
-   fAxisdPhi.Set(32, -TMath::PiOver2(), 3*TMath::PiOver2());
+//________________________________________________________________________
+AliAnalysisTaskdPhi::~AliAnalysisTaskdPhi(){
+  //destructor
+  
+  if(fV0Filter)
+       delete fV0Filter;
+  fV0Filter = NULL;
 
-   Double_t tptbins[10] = {0.1, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 15, 50, 100};                                    fAxistPt.SetNameTitle("tPt", "tPt");
-   fAxistPt.Set(9, tptbins);
+  if(fMesonFilter)
+       delete fMesonFilter;
+  fMesonFilter = NULL;
 
-   Double_t cptbins[13] = {0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 8.0, 10.0, 25, 50, 100};                     fAxiscPt.SetNameTitle("cPt", "cPt");
-   fAxiscPt.Set(12, cptbins);
+  if(fPhotonFilter)
+       delete fPhotonFilter;
+  fPhotonFilter = NULL;
 
-   fAxisZ.SetNameTitle("vertexz", "Z");
-   fAxisZ.Set(4, -10, 10);
+  if(fHistograms)
+       delete fHistograms;
+  fHistograms = NULL;
 
-   Double_t centbins[5] = {0, 10, 30, 60, 100.1};
-   fAxisCent.SetNameTitle("centrality", "Cent");
-   fAxisCent.Set(4, centbins);
+  if(fTrackCuts)
+    delete fTrackCuts;
+  fTrackCuts = NULL;
 
-   fAxisPiM.SetNameTitle("InvMassPi0", "Invariant mass");
-   Double_t mbins[7] = {0.1, 0.11, 0.12, 0.15, 0.16, 0.18, 0.2};
-   fAxisPiM.Set(6, mbins);
+}
 
+///________________________________________________________________________
+void AliAnalysisTaskdPhi::SetUpCorrObjects() {
+  //Set up corr objects
+  AliDebug(AliLog::kDebug + 5, "Set Up corr objects");
+
+  if(fDoPhoton) {
+    fPhotonCorr = new AliAnaConvCorrPhoton("PhotonCorr","photon %s");
+    SetUpCorrAxes(fPhotonCorr);
+    fPhotonCorr->CreateHistograms();
+    fHistograms->Add(fPhotonCorr->GetHistograms());
+  }
+  
+  fPionCorr = new AliAnaConvCorrPion("PionCorr", "pion");
+  SetUpCorrAxes(fPionCorr);
+  fPionCorr->GetAxisM().Set(fAxisPiM.GetNbins(), fAxisPiM.GetXbins()->GetArray());
+  fPionCorr->CreateHistograms();
+  fHistograms->Add(fPionCorr->GetHistograms());
 }
 
+///________________________________________________________________________    
+void AliAnalysisTaskdPhi::SetUpCorrAxes(AliAnaConvCorrBase * corr) {
+  ///Set up axes in corr object
+  corr->GetAxisCent().Set(fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
+  const Double_t * zbins = fAxisZ.GetXbins()->GetArray();
+  if(zbins) {
+    corr->GetAxisZ().Set(fAxisZ.GetNbins(), fAxisZ.GetXbins()->GetArray());
+  } else {
+    corr->GetAxisZ().Set(fAxisZ.GetNbins(), fAxisZ.GetBinLowEdge(1), fAxisZ.GetBinUpEdge(fAxisZ.GetNbins()));
+  }
+  
+  corr->GetAxistPt().Set(fAxistPt.GetNbins(), fAxistPt.GetXbins()->GetArray());
+  corr->GetAxiscPt().Set(fAxiscPt.GetNbins(), fAxiscPt.GetXbins()->GetArray());
+  corr->GetAxisdEta().Set(fAxisdEta.GetNbins(), fAxisdEta.GetBinLowEdge(1), fAxisdEta.GetBinUpEdge(fAxisdEta.GetNbins()));
+  corr->GetAxisTrigEta().Set(fAxisTrigEta.GetNbins(), fAxisTrigEta.GetBinLowEdge(1), fAxisTrigEta.GetBinUpEdge(fAxisTrigEta.GetNbins()));
+  corr->GetAxisAssEta().Set(fAxisAssEta.GetNbins(), fAxisAssEta.GetBinLowEdge(1), fAxisAssEta.GetBinUpEdge(fAxisAssEta.GetNbins()));
+}    
+       
+         
 
- ///________________________________________________________________________
-// void AliAnalysisTaskdPhi::SetUpCorrObjects() {
-   // //Set up corr objects
-   // AliDebug(AliLog::kDebug + 5, "Set Up corr objects");
-
-   // if(fDoPhoton) {
-   //   fPhotonCorr = new AliAnaConvCorrPhoton("PhotonCorr","photon %s");
-   //   SetUpCorrAxes(fPhotonCorr);
-   //   fPhotonCorr->CreateHistograms();
-   //   fHistograms->Add(fPhotonCorr->GetHistograms());
-   // }
-
-   // fPionCorr = new AliAnaConvCorrPion("PionCorr", "pion");
-   // SetUpCorrAxes(fPionCorr);
-   // fPionCorr->GetAxisM().Set(fAxisPiM.GetNbins(), fAxisPiM.GetXbins()->GetArray());
-   // fPionCorr->CreateHistograms();
-   // fHistograms->Add(fPionCorr->GetHistograms());
-   //}
-
- ///________________________________________________________________________    
-// void AliAnalysisTaskdPhi::SetUpCorrAxes(AliAnaConvCorrBase * corr) {
-   ///Set up axes in corr object
-   // corr->GetAxisCent().Set(fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
-   // const Double_t * zbins = fAxisZ.GetXbins()->GetArray();
-   // if(zbins) {
-   //   corr->GetAxisZ().Set(fAxisZ.GetNbins(), fAxisZ.GetXbins()->GetArray());
-   // } else {
-   //   corr->GetAxisZ().Set(fAxisZ.GetNbins(), fAxisZ.GetBinLowEdge(1), fAxisZ.GetBinUpEdge(fAxisZ.GetNbins()));
-   // }
-
-   // corr->GetAxistPt().Set(fAxistPt.GetNbins(), fAxistPt.GetXbins()->GetArray());
-   // corr->GetAxiscPt().Set(fAxiscPt.GetNbins(), fAxiscPt.GetXbins()->GetArray());
-   //   corr->GetAxisdEta().Set(fAxisdEta.GetNbins(), fAxisdEta.GetBinLowEdge(1), fAxisdEta.GetBinUpEdge(fAxisdEta.GetNbins()));
-   // corr->GetAxisTrigEta().Set(fAxisTrigEta.GetNbins(), fAxisTrigEta.GetBinLowEdge(1), fAxisTrigEta.GetBinUpEdge(fAxisTrigEta.GetNbins()));
-   // corr->GetAxisAssEta().Set(fAxisAssEta.GetNbins(), fAxisAssEta.GetBinLowEdge(1), fAxisAssEta.GetBinUpEdge(fAxisAssEta.GetNbins()));
-// }    
 
 
 //________________________________________________________________________
@@ -204,8 +187,8 @@ void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
   fHistograms = new TList();
   fHistograms->SetName("dPhi_histograms");
   fHistograms->SetOwner(kTRUE);
-  
-  
+
+
   if(!fV0Reader){
     fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
   }
@@ -213,8 +196,8 @@ void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
   if(!fV0Reader){
     printf("Error: No V0 Reader");
   } // GetV0Reader
-  
-  
+
+
   if(fSaveReaderHists) {
     AliConversionCuts * v0cuts = fV0Reader->GetConversionCuts();
     if(v0cuts) {
@@ -229,38 +212,6 @@ void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
       }
     }
   }
-  
-  for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf ++){
-    AliConversionCuts * f = dynamic_cast<AliConversionCuts*>(fV0Filters[0].At(igf));
-    if(f) {
-      f->InitCutHistograms(Form("V0Filter_%d", -(igf+1)), kFALSE);
-      fHistograms->Add(f->GetCutHistograms());
-    }
-  }
-
-  for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf ++){
-    AliConversionCuts * f = dynamic_cast<AliConversionCuts*>(fV0Filters[1].At(igf));
-    if(f) {
-      f->InitCutHistograms(Form("V0Filter_%d", igf+1), kFALSE);
-      fHistograms->Add(f->GetCutHistograms());
-    }
-  }
-
-  for(Int_t igf = 0; igf < fMesonFilters[0].GetEntriesFast(); igf ++){
-    AliConversionMesonCuts * f = dynamic_cast<AliConversionMesonCuts*>(fMesonFilters[0].At(igf));
-    if(f) {
-      f->InitCutHistograms(Form("PionFilter_%d", -(igf+1)), kFALSE);
-      fHistograms->Add(f->GetCutHistograms());
-    }
-  }
-
-  for(Int_t igf = 0; igf < fMesonFilters[1].GetEntriesFast(); igf ++){
-    AliConversionMesonCuts * f = dynamic_cast<AliConversionMesonCuts*>(fMesonFilters[1].At(igf));
-    if(f) {
-      f->InitCutHistograms(Form("PionFilter_%d", igf+1), kFALSE);
-      fHistograms->Add(f->GetCutHistograms());
-    }
-  }
 
   if(fV0Filter) {
     fV0Filter->InitCutHistograms("V0Filter", kFALSE);
@@ -274,228 +225,182 @@ void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
     fPhotonFilter->InitCutHistograms("PhotonFilter", kFALSE);
     fHistograms->Add(fPhotonFilter->GetCutHistograms());
   }
-
-
-  AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackFilter);
-  if(tc) {
-    fHistograms->Add(tc->CreateHistograms());
-  }
-
-
-   // for(Int_t i = 0; i < fTrackFilters.GetEntriesFast(); i++) {
-   //   AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackFilters.At(i));
-   //   if(tc) fHistograms->Add(tc->CreateHistograms());
-   // }
-
-  //SetUpCorrObjects();
-
-   ///Set up ME histograms
-   TList * MEHistograms = new TList();
-   MEHistograms->SetName("MEHistograms");
-   MEHistograms->SetOwner(kTRUE);
-   fHistograms->Add(MEHistograms);
-   
-   hMEvents = new TH2I("hMEvents", "Nevents vs centrality vertexz",
-                      fAxisZ.GetNbins(), fAxisZ.GetXbins()->GetArray(),
-                      fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
-   MEHistograms->Add(hMEvents);
-
-   hTrackCent = new TH2I("hTrackCent", "N accepted tracks vs centrality",
-                        fAxisCent.GetNbins() > 2 ? 100 : 1, fAxisCent.GetBinLowEdge(1), fAxisCent.GetBinUpEdge(fAxisCent.GetNbins()),
-                        750, 0, 1500);
-   MEHistograms->Add(hTrackCent);
-
-   Int_t ntrackfilters[2] = {fTrackFilters[0].GetEntriesFast(), fTrackFilters[1].GetEntriesFast()};
-   fkTrackAxis = kTRUE;
-   fAxisTrackFilters.SetNameTitle("trackCuts", "trackCuts");
-   fAxisTrackFilters.Set(ntrackfilters[0] + ntrackfilters[1] + 1, -ntrackfilters[0] -0.5, ntrackfilters[1]  + 0.5);
-
-   Int_t nV0filters[2] = {fV0Filters[0].GetEntriesFast(), fV0Filters[1].GetEntriesFast()};
-   fkV0Axis = kTRUE;
-   fAxisV0Filters.SetNameTitle("V0Cuts", "V0Cuts");
-   fAxisV0Filters.Set(nV0filters[0] + nV0filters[1] + 1, -nV0filters[0] -0.5, nV0filters[1]  + 0.5);
-   
-   Int_t nmesonfilters[2] = {fMesonFilters[0].GetEntriesFast(), fMesonFilters[1].GetEntriesFast()};
-   fkPionAxis = kTRUE;
-   fAxisMesonFilters.SetNameTitle("mesonCuts", "mesonCuts");
-   fAxisMesonFilters.Set(nmesonfilters[0] + nmesonfilters[1] + 1, -nmesonfilters[0] -0.5, nmesonfilters[1]  + 0.5);
-  fAxesList.AddAt(&fAxisdEta, 0);
-  fAxesList.AddAt(&fAxisdPhi, 1);
-  fAxesList.AddAt(&fAxistPt, 2);
-  fAxesList.AddAt(&fAxiscPt, 3);
-  fAxesList.AddAt(&fAxisCent, 4);
-  fAxesList.AddAt(&fAxisZ, 5);
-  fAxesList.AddAt(&fAxisPiM, 6);
-  fAxesList.AddAt(&fAxisTrackFilters, 7);
-  fAxesList.AddAt(&fAxisV0Filters, 8);
-  fAxesList.AddAt(&fAxisMesonFilters, 9);
-  
-  fTrackAxesList.AddAt(&fAxisAssEta, 0);
-  fTrackAxesList.AddAt(&fAxistPt, 1);
-  fTrackAxesList.AddAt(&fAxiscPt, 2);
-  fTrackAxesList.AddAt(&fAxisCent, 3);
-  fTrackAxesList.AddAt(&fAxisZ, 4);
-  //fTrackAxesList.AddAt(&fAxisPiM, 5);
-  fTrackAxesList.AddAt(&fAxisTrackFilters, 5);
-  fTrackAxesList.AddAt(&fAxisV0Filters, 6);
-  fTrackAxesList.AddAt(&fAxisMesonFilters, 7);
-   
-  fTrigAxesList.AddAt(&fAxisTrigEta, 0);
-  fTrigAxesList.AddAt(&fAxistPt, 1);
-  fTrigAxesList.AddAt(&fAxisCent, 2);
-  fTrigAxesList.AddAt(&fAxisZ, 3);
-  fTrigAxesList.AddAt(&fAxisPiM, 4);
-  fTrigAxesList.AddAt(&fAxisV0Filters, 5);
-  fTrigAxesList.AddAt(&fAxisMesonFilters, 6);
-   
-  TList masslist;
-  TAxis massax;
-  massax.SetNameTitle("mass", "mass");
-  massax.Set(360, 0.04, 0.4); //hardcoded! change also in filling!
-  
-  masslist.AddAt(&massax, 0);
-  masslist.AddAt(&fAxistPt, 1);
-  masslist.AddAt(&fAxisCent, 2);
-  masslist.AddAt(&fAxisV0Filters, 3);
-  masslist.AddAt(&fAxisMesonFilters, 4);
-  
-  fCorrSparse = CreateSparse(TString("pionSparse"), TString("pionSparse"), &fAxesList);
-  fTrackSparse = CreateSparse(TString("trackSparse"), TString("trackSparse"), &fTrackAxesList);
-  fTrigSparse = CreateSparse(TString("trigSparse"), TString("trigSparse"), &fTrigAxesList);
-  fMassSparse = CreateSparse("massSparse", "massSparse", &masslist);
   
-  fHistograms->Add(fCorrSparse);
-  fHistograms->Add(fTrackSparse);
-  fHistograms->Add(fTrigSparse);
-  fHistograms->Add(fMassSparse);
+
+  AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackCuts);
+  if(tc) fHistograms->Add(tc->CreateHistograms());
+
+  SetUpCorrObjects();
+
+
+  ///Set up ME histograms
+  TList * MEHistograms = new TList();
+  MEHistograms->SetName("MEHistograms");
+  MEHistograms->SetOwner(kTRUE);
+  fHistograms->Add(MEHistograms);
+
+  // hMETracks = new TObjArray();
+  // hMETracks->SetName("TrackArray");
+  // hMETracks->SetOwner(kTRUE);
+  // hMEPhotons = new TObjArray();
+  // hMEPhotons->SetName("PhotonArray");
+  // hMEPhotons->SetOwner(kTRUE);
+  // hMEPions = new TObjArray();
+  // hMEPions->SetName("PionArray");
+  // hMEPions->SetOwner(kTRUE);
+
+  // MEHistograms->Add(hMETracks);
+  // MEHistograms->Add(hMEPions);
+  // MEHistograms->Add(hMEPhotons);
+
+  hMEvents = new TH2I("hMEvents", "Nevents vs centrality vertexz",
+                     fAxisZ.GetNbins(), fAxisZ.GetXbins()->GetArray(),
+                     fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
+  MEHistograms->Add(hMEvents);
+
+  hTrackCent = new TH2I("hTrackCent", "N accepted tracks vs centrality",
+                       fAxisCent.GetNbins() > 2 ? 100 : 1, fAxisCent.GetBinLowEdge(1), fAxisCent.GetBinUpEdge(fAxisCent.GetNbins()),
+                       750, 0, 1500);
+  MEHistograms->Add(hTrackCent);
+
+  // TList axesList;
+  // axesList.AddAt(&GetAxisEta(), 0);
+  // axesList.AddAt(&GetAxisPhi(), 1);
+  // axesList.AddAt(&GetAxistPt(), 2);
+  // axesList.SetOwner(kFALSE);
+  
+  // TList piAxesList;
+  // piAxesList.AddAt(&GetAxisEta(), 0);
+  // piAxesList.AddAt(&GetAxisPhi(), 1);
+  // piAxesList.AddAt(&GetAxistPt(), 2);
+  // piAxesList.AddAt(&GetAxisPiMass(), 3);
+  // piAxesList.SetOwner(kFALSE);
+
+  // TList * outAxesList = new TList();
+  // outAxesList->Add(&fAxisCent);
+  // outAxesList->Add(&fAxisZ);
+  // fHistograms->Add(outAxesList);
+
+  // for(Int_t iz = 0; iz < fAxisZ.GetNbins(); iz++) {
+  //   TObjArray * trackArray = new TObjArray();
+  //   trackArray->SetName(Form("METracks_%d", iz));
+  //   trackArray->SetOwner(kTRUE);
+  //   TObjArray * photonArray = new TObjArray();
+  //   photonArray->SetName(Form("MEPhotons_%d", iz));
+  //   photonArray->SetOwner(kTRUE);
+  //   TObjArray * pionArray = new TObjArray();
+  //   pionArray->SetName(Form("MEPions_%d", iz));
+  //   pionArray->SetOwner(kTRUE);
+
+
+  //   hMEPions->AddAt(pionArray, iz);
+  //   hMETracks->AddAt(trackArray, iz);
+  //   hMEPhotons->AddAt(photonArray, iz);
+
+  //   for(Int_t ic = 0; ic < fAxisCent.GetNbins(); ic++) {
+
+  //     TString nameString = Form("%d_%d", iz, ic);
+  //     TString titleString = Form("%f < Z < %f ... %f cent %f", 
+  //                                                            fAxisZ.GetBinLowEdge(iz+1), fAxisZ.GetBinUpEdge(iz+1), 
+  //                                                            fAxisCent.GetBinLowEdge(ic+1), fAxisCent.GetBinUpEdge(ic+1));
+
+
+  //     THnSparseF * trackHistogram = CreateSparse(Form("tracks_%s", nameString.Data()), 
+  //                                                                                            Form("tracks %s", titleString.Data()), &axesList );
+  //     trackArray->AddAt(trackHistogram, ic);
+
+  //     THnSparseF * photonHistogram = CreateSparse(Form("photons_%s", nameString.Data()), 
+  //                                                                                            Form("photons %s", titleString.Data()), &axesList );
+  //     photonArray->AddAt(photonHistogram, ic);
+
+  //     THnSparseF * pionHistogram = CreateSparse(Form("pions_%s", nameString.Data()), 
+  //                                                                                            Form("pions %s", titleString.Data()), &piAxesList );
+  //     pionArray->AddAt(pionHistogram, ic);
+  //   }
+  // }
 
   PostData(1, fHistograms);
+
 }
 
 ///________________________________________________________________________
 THnSparseF * AliAnalysisTaskdPhi::CreateSparse(TString nameString, TString titleString, TList * axesList) {
-  //Create sparse
+  ///Create sparse
   const Int_t dim = axesList->GetSize();
-  
+
   TAxis * axes[dim];
-  Int_t   bins[dim];
+  Int_t bins[dim];
   Double_t min[dim];
   Double_t max[dim];
 
   for(Int_t i = 0; i<dim; i++) {
-    TAxis * axis = dynamic_cast<TAxis*>(axesList->At(i));
-    if(axis) axes[i] = axis;
-    else {
-      cout << "AliAnalysisTaskdPhi::CreateSparse: Error error, all the axes are not present in axis list" << endl;
-      return NULL;
-    }
+       TAxis * axis = dynamic_cast<TAxis*>(axesList->At(i));
+       if(axis) {
+         axes[i] = axis;
+       } else {
+         cout << "AliAnalysisTaskdPhi::CreateSparse: Error error, all the axes are not present in axis list" << endl;
+         return NULL;
+       }
   }
-  
+
   for(Int_t i = 0; i<dim; i++) {
-    //cout << axes[i]->GetTitle() << endl;
-    bins[i] = axes[i]->GetNbins(); 
-    min[i] = axes[i]->GetBinLowEdge(1);
-    max[i] = axes[i]->GetBinUpEdge(axes[i]->GetNbins());
+       bins[i] = axes[i]->GetNbins(); 
+       min[i] = axes[i]->GetBinLowEdge(1);
+       max[i] = axes[i]->GetBinUpEdge(axes[i]->GetNbins());
   }
 
-  THnSparseF * sparse = new THnSparseF(Form("%s", nameString.Data()), 
-                                      Form("%s", titleString.Data()), 
-                                      dim, bins, min, max);
+  THnSparseF * sparse = new THnSparseF(Form("METracks_%s", nameString.Data()), 
+                                                                                          Form("tracks %s", titleString.Data()), 
+                                                                                          dim, bins, min, max);
   
   for(Int_t i = 0; i<dim; i++) {
-    sparse->GetAxis(i)->SetNameTitle(axes[i]->GetName(), axes[i]->GetTitle() );
-    if(axes[i]->GetXbins()->GetSize() > 0) {
-      sparse->SetBinEdges(i, axes[i]->GetXbins()->GetArray() );
-    }
+       sparse->GetAxis(i)->SetNameTitle(axes[i]->GetName(), axes[i]->GetTitle() );
+       if(axes[i]->GetXbins()->GetSize() > 0) {
+         sparse->SetBinEdges(i, axes[i]->GetXbins()->GetArray() );
+       }
   }
+
   return sparse;
 }
 
 //________________________________________________________________________
 void AliAnalysisTaskdPhi::UserExec(Option_t *) {
   ///User exec. 
-  ///This is a very ugly function, cut the complexity of the logic demands it.
-  
+
   //if(! fV0Filter->EventIsSelected(fInputEvent)) return;
   if(!fV0Reader){
     AliError("Error: No V0 Reader");
     return;
   } // GetV0Reader
-  
+
   if(!fV0Reader->IsEventSelected()) {
-    return;
+       return;
   }
-  AliDebug(5, "Processing event");
-  
+   AliDebug(5, "Processing event");
  
-
-  
   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
   Bool_t isAOD=man->GetInputEventHandler()->IsA()==AliAODInputHandler::Class();
   
   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
   if (!inputHandler) {
-    cout << "cout no input event handler"<<endl;
-    return;
-  }
-
-  
-
-
-  for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf++) {
-    AliConversionCuts * f = dynamic_cast<AliConversionCuts*>(fV0Filters[0].At(igf));
-    if ( f && !f->GetPIDResponse() ) {
-      if ( inputHandler->GetPIDResponse() ){
-       f->SetPIDResponse( inputHandler->GetPIDResponse() );
-      } else {
-       if (isAOD){
-         if (!f->GetPIDResponse()){
-           f->InitAODpidUtil(1);
-         }
-       }
-      }
-    } else {
-      break;
-    }
-  }
-
-  for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf++) {
-    AliConversionCuts * f = dynamic_cast<AliConversionCuts*>(fV0Filters[1].At(igf));
-    if ( f && !f->GetPIDResponse() ) {
-      if ( inputHandler->GetPIDResponse() ){
-       f->SetPIDResponse( inputHandler->GetPIDResponse() );
-      } else {
-       if (isAOD){
-         if (!f->GetPIDResponse()){
-           f->InitAODpidUtil(1);
-         }
-       }
-      }
-    } else {
-      break;
-    }
+       cout << "cout no input event handler"<<endl;
+       return;
   }
 
   
   if ( fV0Filter && !fV0Filter->GetPIDResponse() ) {
-    if ( inputHandler->GetPIDResponse() ){
-      fV0Filter->SetPIDResponse( inputHandler->GetPIDResponse() );
-    } else {
-      
-      //AOD case
-      if (isAOD){
-       if (!fV0Filter->GetPIDResponse()){
-         fV0Filter->InitAODpidUtil(1);
+    cout << "aaaa"<<endl;
+       if ( inputHandler->GetPIDResponse() ){
+         fV0Filter->SetPIDResponse( inputHandler->GetPIDResponse() );
+       } else {
+         
+         //AOD case
+         if (isAOD){
+               if (!fV0Filter->GetPIDResponse()){
+                 fV0Filter->InitAODpidUtil(1);
+               }
+         }
        }
-      }
-    }
-  }
-
-  AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackFilter);
-  if(tc) {
-    tc->SetEvent(fInputEvent);
-    tc->DeleteTracks();
   }
 
   Double_t centrality = 0.0;
@@ -503,636 +408,143 @@ void AliAnalysisTaskdPhi::UserExec(Option_t *) {
   Double_t vertexz = fInputEvent->GetPrimaryVertex()->GetZ();
   if(isAOD) {
     AliAODHeader * header = static_cast<AliAODHeader*>(fInputEvent->GetHeader());
-    centrality = header->GetCentrality();
-    eventPlane = header->GetEventplane();
+       centrality = header->GetCentrality();
+       eventPlane = header->GetEventplane();
   } else {
-    centrality = static_cast<AliESDEvent*>(fInputEvent)->GetCentrality()->GetCentralityPercentile("V0M");
-    eventPlane = fInputEvent->GetEventplane()->GetEventplane("Q");
+       centrality = static_cast<AliESDEvent*>(fInputEvent)->GetCentrality()->GetCentralityPercentile("V0M");
+       eventPlane = fInputEvent->GetEventplane()->GetEventplane("Q");
   }
-  
-  
+
+
   const Int_t centBin = GetBin(fAxisCent, centrality);
   const Int_t vertexBin = GetBin(fAxisZ, vertexz);
-  
-  
+
+
   if(DebugLevel () > 4) {
-    cout << "centrality: " << centrality <<  " " << GetBin(fAxisCent, centrality) << endl;
-    cout << "vertexz: " << vertexz <<  " " << GetBin(fAxisZ, vertexz) << endl;
-    cout << "eventPlane: " << eventPlane <<  " " << endl;
+       cout << "centrality: " << centrality <<  " " << GetBin(fAxisCent, centrality) << endl;
+       cout << "vertexz: " << vertexz <<  " " << GetBin(fAxisZ, vertexz) << endl;
+       cout << "eventPlane: " << eventPlane <<  " " << endl;
   }
-  
-  
-  
+
+
+
   if(centBin < 0 || vertexBin < 0) {
     // AliError("bin out of range");
-    return;
+       return;
   }
-  
-  const Int_t ngfilters = fV0Filters[1].GetEntriesFast() + 1;
-  TObjArray gammas[ngfilters];
-  
-  
+
+  TObjArray gammas;
+
   //TClonesArray * aodGammas = GetConversionGammas(isAOD);
   TClonesArray * aodGammas = fV0Reader->GetReconstructedGammas();
   if(!aodGammas) {
     AliError("no aod gammas found!");
     return;
   }
-  
 
-  ///Fill arrays of accepted gammas
+  
   if(DebugLevel() > 1) printf("Number of conversion gammas %d \n", aodGammas->GetEntriesFast());
   for(Int_t ig = 0; ig < aodGammas->GetEntriesFast(); ig++) {
     AliAODConversionPhoton * photon = dynamic_cast<AliAODConversionPhoton*>(aodGammas->At(ig));
+    
     if(!photon) continue;
-    if(!fV0Filter || fV0Filter->PhotonIsSelected(photon, fInputEvent)) {
-      gammas[0].Add(static_cast<TObject*>(photon));
-    } else {
-      for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf++) {
-       AliConversionCuts * gfilter = dynamic_cast<AliConversionCuts*>(fV0Filters[1].At(igf));
-       if(gfilter && gfilter->PhotonIsSelected(photon, fInputEvent)) {
-         gammas[igf+1].Add(static_cast<TObject*>(photon));
-       }
-      }
-    }
-  }
-
-  Bool_t lowgmap[fV0Filters[0].GetEntriesFast()][gammas[0].GetEntriesFast()];
-
-  for(Int_t ig = 0; ig < gammas[0].GetEntriesFast(); ig++ ) {
-    AliAODConversionPhoton * gamma = static_cast<AliAODConversionPhoton*>(gammas[0].At(ig));
-    for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf++) {
-      
-      AliConversionCuts * v0cuts = static_cast<AliConversionCuts*>(fV0Filters[0].At(igf));
-      if(!(v0cuts->PhotonIsSelected(gamma, fInputEvent))) {
-       lowgmap[igf][ig] = kTRUE;
-      } else {
-       lowgmap[igf][ig] = kFALSE;
-      }
+    if(!fV0Filter || fV0Filter->PhotonIsSelected(static_cast<AliConversionPhotonBase*>(photon), fInputEvent)) {
+      gammas.Add(static_cast<TObject*>(photon));
     }
   }
   
-
-  if(DebugLevel() > 4) printf("Number of accepted gammas %d \n", gammas[0].GetEntriesFast());
+  if(DebugLevel() > 4) printf("Number of accepted gammas %d \n", gammas.GetEntriesFast());
   hMEvents->Fill(vertexz, centrality);
   
   ///create track array
-  const Int_t ntrackfilters[2] = { fTrackFilters[0].GetEntriesFast(), fTrackFilters[1].GetEntriesFast()};
-  TObjArray tracks[ntrackfilters[1] + 1];
-  
-
-
-  const Double_t aetalim[2] = { fAxisAssEta.GetXmin(), fAxisAssEta.GetXmax()};
-  const Double_t aptlim[2] = { fAxiscPt.GetXmin(), fAxiscPt.GetXmax()};
+  TObjArray tracks;
+  const Double_t etalim[2] = { fAxisTrigEta.GetBinLowEdge(1), fAxisTrigEta.GetBinUpEdge(fAxisTrigEta.GetNbins())};
   for(Int_t iTrack = 0; iTrack < fInputEvent->GetNumberOfTracks(); iTrack++) {
     AliVTrack * track = static_cast<AliVTrack*>(fInputEvent->GetTrack(iTrack));
-    if(track->Pt() < aptlim[0] || track->Pt() > aptlim[1]) continue;
-    if(track->Eta() < aetalim[0] || track->Eta() > aetalim[1]) continue;
-    if(fTrackFilter->IsSelected(track)) {
-      tracks[0].Add(track);
-    } else {
-      ///upside cuts
-      for(Int_t itf = 1; itf < ntrackfilters[1] + 1; itf++) {
-       AliAnalysisCuts * trackCuts = static_cast<AliAnalysisCuts*>(fTrackFilters[1].At(itf -1));
-       if(trackCuts->IsSelected(track)) {
-         tracks[itf].Add(track);
-       }
-      }
+    if(track->Pt() < fAxiscPt.GetBinLowEdge(1) ) continue;
+    if(track->Eta() < etalim[0] || track->Eta() > etalim[1]) continue;
+    if(!fTrackCuts || fTrackCuts->IsSelected(track)) {
+      tracks.Add(track);
     }
   }
 
+  hTrackCent->Fill(centrality, tracks.GetEntriesFast());
+  Process(&gammas, &tracks, centrality, vertexz);
 
-  Bool_t lowtrackmap[ntrackfilters[0]][tracks[0].GetEntriesFast()];
-  ///Check lowside cuts
-  for(Int_t iTrack = 0; iTrack < tracks[0].GetEntriesFast(); iTrack++ ) {
-    AliVTrack * track = static_cast<AliVTrack*>(tracks[0].At(iTrack));
-    for(Int_t itf = 0; itf < ntrackfilters[0]; itf++) {
-      AliAnalysisCuts * trackCuts = static_cast<AliAnalysisCuts*>(fTrackFilters[0].At(itf));
-      if(!trackCuts->IsSelected(track)) {
-       lowtrackmap[itf][iTrack] = kTRUE;
-      } else {
-       lowtrackmap[itf][iTrack] = kFALSE;
-      }
-    }
-  }
-
-  hTrackCent->Fill(centrality, tracks[0].GetEntriesFast());
-  
-  const Double_t etalim[2] = { fAxisTrigEta.GetXmin(), fAxisTrigEta.GetXmax()};
-  if(DebugLevel() > 4) printf("Number of accepted gammas, tracks %d  %d \n", gammas[0].GetEntriesFast(), tracks[0].GetEntriesFast());
-  //AliAnaConvCorrBase * gCorr = fPhotonCorr; //GetCorrObject(vertexBin, centBin, fPhotonCorr);
-  //  AliAnaConvCorrPion * piCorr = fPionCorr; //static_cast<AliAnaConvCorrPion*>(GetCorrObject(vertexBin, centBin, fPionCorr));
-  
-  // if(!piCorr) {
-  //   AliError("corr object missing");
-  //   return;
-  // }
+  PostData(1, fHistograms);
   
-  TObjArray pions;
-
-  ///corr values
-  Double_t dphivalues[fAxesList.GetSize()];
-  dphivalues[4] = centrality;
-  dphivalues[5] = vertexz;
+}
 
-  ///Trigger me counters
-  Double_t trigValues[7];
-  trigValues[2] = centrality;
-  trigValues[3] = vertexz;
+//________________________________________________________________________
+void AliAnalysisTaskdPhi::Process(TObjArray * gammas, TObjArray * tracks, const Float_t cent, const Float_t vtxz) {
+  ///Process stuff
 
-  ///Mass histogram
-  Double_t massval[5];
-  massval[2] = centrality;
-  
-  ///Set up track me counters and initialize
-  const Int_t nbins = fAxistPt.GetNbins();
-  Bool_t tmap[fAxistPt.GetNbins()];
-  Bool_t lv0tmap[fAxistPt.GetNbins()][fV0Filters[0].GetEntriesFast()];
-  Bool_t uv0tmap[fAxistPt.GetNbins()][fV0Filters[1].GetEntriesFast()];
-
-  Bool_t lpitmap[fAxistPt.GetNbins()][fMesonFilters[0].GetEntriesFast()];
-  Bool_t upitmap[fAxistPt.GetNbins()][fMesonFilters[1].GetEntriesFast()];
-  
+  const Double_t etalim[2] = { fAxisTrigEta.GetBinLowEdge(1), fAxisTrigEta.GetBinUpEdge(fAxisTrigEta.GetNbins())};
+  if(DebugLevel() > 4) printf("Number of accepted gammas, tracks %d  %d \n", gammas->GetEntriesFast(), tracks->GetEntriesFast());
+  AliAnaConvCorrBase * gCorr = fPhotonCorr; //GetCorrObject(vertexBin, centBin, fPhotonCorr);
+  AliAnaConvCorrPion * piCorr = fPionCorr; //static_cast<AliAnaConvCorrPion*>(GetCorrObject(vertexBin, centBin, fPionCorr));
   
-
-  for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf++) {
-    for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
-      lv0tmap[ptbin][igf] = kFALSE;
-    }
-  }
-
-  for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf++) {
-    for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
-      uv0tmap[ptbin][igf] = kFALSE;
-    }
-  }
-
-  for(Int_t igf = 0; igf < fMesonFilters[0].GetEntriesFast(); igf++) {
-    for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
-      lpitmap[ptbin][igf] = kFALSE;
-    }
-  }
-
-  for(Int_t igf = 0; igf < fMesonFilters[1].GetEntriesFast(); igf++) {
-    for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
-      upitmap[ptbin][igf] = kFALSE;
-    }
-  }
-
-  for(Int_t ptbin = 0; ptbin < nbins; ptbin++){
-    tmap[ptbin] = kFALSE;
+  if(!piCorr) {
+    AliError("corr object missing");
+    return;
   }
+  
+  TObjArray photons;
+  TObjArray pions;
 
-  /////////////////////////////////////////
-
-
-  for(Int_t igf1 = 0; igf1 < ngfilters; igf1++) {
-    for(Int_t i1 = 0; i1 < gammas[igf1].GetEntriesFast(); i1++) {
-      AliAODConversionPhoton * ph1 = static_cast<AliAODConversionPhoton*>(gammas[igf1].UncheckedAt(i1));
-      Int_t tIDs[4] = {ph1->GetLabel(0), ph1->GetLabel(1), -1, -1};
-      
-      ///Combine gamma into pions
-      Int_t igmax = 0;
-      for(Int_t igf2 = 0; igf2 <= igf1; igf2++) {
-       if(igf2 == igf1) {
-         igmax = i1;
-       } else {
-         igmax = gammas[igf2].GetEntriesFast();
-       }
-
-
-       
-       for(Int_t i2 = 0; i2 < igmax; i2++) {
-         AliAODConversionPhoton * ph2 = static_cast<AliAODConversionPhoton*>(gammas[igf2].UncheckedAt(i2));
-         
-         if( ph2->GetTrackLabelPositive()==ph1->GetTrackLabelPositive() 
-             || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelNegative()
-             || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelPositive()
-             || ph2->GetTrackLabelPositive()==ph1->GetTrackLabelNegative()) {
-           continue;
-         }
-         
-         AliAODConversionMother * pion = new AliAODConversionMother(ph1, ph2);
-         if(pion->Eta() < etalim[0] || pion->Eta() > etalim[1]) continue;
-         pion->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());     
-
-
-         tIDs[2] = ph2->GetLabel(0);
-         tIDs[3] = ph2->GetLabel(1);
-
-         massval[0] = pion->M();
-         massval[1] = pion->Pt();
-         massval[3] = igf1;
-         massval[4] = 0;
-
-         dphivalues[2] = pion->Pt();
-         dphivalues[6] = pion->M();
-         dphivalues[8] = igf1;
-         dphivalues[9] = 0;
-         
-         trigValues[0] = pion->Eta();
-         trigValues[1] = pion->Pt();
-         trigValues[4] = pion->M();
-         trigValues[5] = igf1; 
-         trigValues[6] = 0;
-         
-
-         ///Check that particle is in histo phase space
-         if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && pion->Pt() < fAxistPt.GetXmax() &&
-            pion->Eta() > etalim[0] && pion->Eta() < etalim[1] &&
-            pion->M() > 0.04 && pion->M() < 0.4
-            ) {
-           
-           
-           if(fMesonFilter->MesonIsSelected(pion, kTRUE)) {
-
-             fMassSparse->Fill(massval);
-
-             Bool_t lpimap[fMesonFilters[0].GetEntriesFast()];
-             ///See if it passes lowside cuts
-             if(igf1 == 0 && igf2 == 0) {
-
-               ///Low side pion
-               massval[3] = 0;
-               for(Int_t ilpf = 0; ilpf < fMesonFilters[0].GetEntriesFast(); ilpf++) {
-                 if(!(static_cast<AliConversionMesonCuts*>(fMesonFilters[0].At(ilpf))->MesonIsSelected(pion, kTRUE))) {
-                   lpimap[ilpf] = kTRUE;
-                   massval[4] = -(ilpf + 1);
-                   fMassSparse->Fill(massval);
-                 } else {
-                   lpimap[ilpf] = kFALSE;
-                 }
-                 massval[4] = 0;
-               }
-               ///Lowside v0
-               for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
-                 if(lowgmap[iglf][i1] || lowgmap[iglf][i2]){
-                   massval[3] = -(iglf+1);
-                   fMassSparse->Fill(massval);
-                 }
-               }
-               massval[3] = 0;
-             }  /// End lowside mass histo fillers
-                     
-             
-             ///Check that particle is in histo phase space
-             if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && pion->Pt() < fAxistPt.GetXmax() &&
-                pion->M() > fAxisPiM.GetXmin() && pion->M() < fAxisPiM.GetXmax() &&
-                pion->Eta() > etalim[0] && pion->Eta() < etalim[1]) {
-               
-               
-               const Int_t tbin = fAxistPt.FindFixBin(pion->Pt());
-
-               ///Fill standard triggers including upside v0 filters
-               fTrigSparse->Fill(trigValues);
-
-               
-               if(igf1 == 0 && igf2 == 0) {
-                 // piCorr->FillTriggerCounters(pion);
-                 // piCorr->CorrelateWithTracks(pion, &tracks[0], tIDs, centrality, vertexz);
-                 
-                 
-                 ////Only mix events with pion in signal region
-                 if(pion->M() > 0.1 && pion->M() < 0.15) {
-
-
-                   ///Check trigger bin
-                   if (tbin > 0 && tbin < (nbins + 1)) {
-                     tmap[tbin-1] = kTRUE;
-                   }
-                 
-                   ///Check if trigger also in low side (both gamma present in low side!)
-                   for(Int_t ilgf = 0; ilgf < fV0Filters[0].GetEntriesFast(); ilgf++) {
-                     if(!lowgmap[ilgf][i1] && !lowgmap[ilgf][i2]) {
-                       lv0tmap[tbin-1][ilgf] = kTRUE;
-                     }
-                   }
-                 
-                   ///See if the lowside pion filter also passes this, if not
-                   for(Int_t ilpf = 0; ilpf < fMesonFilters[0].GetEntriesFast(); ilpf++) {
-                     if(!lpimap[ilpf]) {
-                       lpitmap[tbin-1][ilpf] = kTRUE;
-                     }
-                   }
-                 }
-
-               } else {
-                 if(pion->M() > 0.1 && pion->M() < 0.15) {
-                   uv0tmap[tbin-1][igf1 - 1] = kTRUE;
-                 }
-               }
-                   
-             
-               ///Fill the triggers not selected in lowside filters only if passsing standard v0 filter
-               if(igf1 == 0 && igf2 == 0) {
-                 
-                 ///Lowside v0 filters
-                 for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
-                   if(lowgmap[iglf][i1] || lowgmap[iglf][i2]){
-                     trigValues[5] = -(iglf+1);
-                     fTrigSparse->Fill(trigValues);
-                   }
-                 }
-                 
-                 ////Low side pion filters
-                 trigValues[5] = 0;
-                 for(Int_t iplf = 0; iplf < fMesonFilters[0].GetEntriesFast(); iplf ++) {
-                   if(lpimap[iplf]) {
-                     trigValues[6] = -(iplf + 1);
-                     fTrigSparse->Fill(trigValues);
-                   }
-                 }
-               } // ifg1 == 0 
-             
-               trigValues[5] = igf1; 
-               trigValues[6] = 0;
-
-               ///////////////////////////////////////////////
-               /// Correlate with tracks
-               ///////////////////////////////////////////////
-
-               Int_t ntf = 1;
-               if(igf1 == 0 && igf2 == 0) { 
-                 ntf = fTrackFilters[1].GetEntriesFast() + 1;
-               }
-
-               for(Int_t itf = 0; itf < ntf; itf++) {
-                 for(int ij = 0; ij < tracks[itf].GetEntriesFast(); ij++) {
-                   AliVTrack * track = static_cast<AliVTrack*>(tracks[itf].At(ij));
-                   Int_t tid = track->GetID();
-                 
-                   if((tid > 0) && (tid == tIDs[0] || tid == tIDs[1] || tid == tIDs[2] || tid == tIDs[3]) ) {
-                     continue;
-                   }
-                 
-                   dphivalues[0] = pion->Eta() - track->Eta();
-                   dphivalues[1] = GetDPhi(pion->Phi() - track->Phi());
-                   dphivalues[3] = track->Pt();
-                   dphivalues[7] = itf;
-                   dphivalues[8] = igf1;
-                   dphivalues[9] = 0;
-                   fCorrSparse->Fill(dphivalues);
+  for(Int_t i1 = 0; i1 < gammas->GetEntriesFast(); i1++) {
+    AliAODConversionPhoton * ph1 = static_cast<AliAODConversionPhoton*>(gammas->UncheckedAt(i1));
+    Int_t tIDs[4] = {ph1->GetLabel(0), ph1->GetLabel(1), -1, -1};
        
 
-                   if(itf == 0 && igf1 == 0 && igf2 == 0) {
-                     ///Fill the low side track filters
-                     for(Int_t itlf = 0; itlf < fTrackFilters[0].GetEntriesFast(); itlf++) {
-                       if(lowtrackmap[itlf][ij]){
-                         dphivalues[7] = -(itlf+1);
-                         fCorrSparse->Fill(dphivalues);
-                       }
-                     }
-                     ///Fill the low side v0 filters
-                     dphivalues[7] = 0;
-                     for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
-                       if(lowgmap[iglf][i1] || lowgmap[iglf][i2]){
-                         dphivalues[8] = -(iglf+1);
-                         fCorrSparse->Fill(dphivalues);
-                       }
-                     }
-
-                     ///Fill the low side pi filter
-                     dphivalues[7] = 0;
-                     dphivalues[8] = 0;
-                     for(Int_t iplf = 0; iplf < fMesonFilters[0].GetEntriesFast(); iplf ++) {
-                       if(lpimap[iplf]) {
-                         dphivalues[9] = -(iplf + 1);
-                         fCorrSparse->Fill(dphivalues);
-                       }
-                     }
-                   }  /// end non standard filters track corr
-                 
-                 } // end for tracks
-               } // end trackfilters loop
-             } //end check pion in histogram range to prevent overflow
-           } else {
-             /////////////////////////////
-             //// Not passing standard meson cuts, check upside filters        
-             ////////////////////////////
-            
-             ///Only check the pions from standard v0 filter 
-             if(igf1 == 0 && igf2 == 0) {
-               for(Int_t ipuf = 0; ipuf < fMesonFilters[1].GetEntriesFast(); ipuf++) {
-                 if(static_cast<AliConversionMesonCuts*>(fMesonFilters[1].At(ipuf))->MesonIsSelected(pion, kTRUE)) {
-                   ///Fill invariant mass hist
-                   massval[4] = (ipuf + 1);
-                   fMassSparse->Fill(massval);
-                   ///Check that particle is in histo phase space --- redundant!
-                   
-                   
-
-                   if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && pion->Pt() < fAxistPt.GetXmax() &&
-                      pion->M() > fAxisPiM.GetXmin() && pion->M() < fAxisPiM.GetXmax() &&
-                      pion->Eta() > etalim[0] && pion->Eta() < etalim[1]) {
-                     
-                   
-                     ////Only mix events with pion in signal region
-                     if(pion->M() > 0.1 && pion->M() < 0.15) {
-                       const Int_t tbin = fAxistPt.FindFixBin(pion->Pt());
-                       upitmap[tbin-1][ipuf] = kTRUE;
-                     }
-                   
-                     ///Fill trigger counters
-                     trigValues[6] = (ipuf + 1);
-                     fTrigSparse->Fill(trigValues);
-                     
-                     ///Correlate with standard tracks
-                     for(int ij = 0; ij < tracks[0].GetEntriesFast(); ij++) {
-                       AliVTrack * track = static_cast<AliVTrack*>(tracks[0].At(ij));
-                       Int_t tid = track->GetID();
-                       
-                       if((tid > 0) && (tid == tIDs[0] || tid == tIDs[1] || tid == tIDs[2] || tid == tIDs[3]) ) {
-                         continue;
-                       }
-                       
-                       dphivalues[0] = pion->Eta() - track->Eta();
-                       dphivalues[1] = GetDPhi(pion->Phi() - track->Phi());
-                       dphivalues[3] = track->Pt();
-                       dphivalues[7] = 0; // track filter
-                       dphivalues[8] = 0; // v0 filter
-                       dphivalues[9] = ipuf + 1; // pion filter
-                       fCorrSparse->Fill(dphivalues);
-                     } /// end track corr
-                   }
-                 } // MesonIsSelected
-               }
-             }
-           } /// end else ..  end upside meson filters
-           /////////////////////////////////////////////
-         } ///Etalim && pt limits
-
-
-       } // i2 second gamma
-      }
-    } // i1 first gamma
-  }
-  //FillCounters(&pions, tracks, ntrackfilters, centrality, vertexz);
-  
-  ///////Fill track counters after entire event has been passed through
-  ////
-  
-  Double_t trackValues[fTrackAxesList.GetSize()];
-  trackValues[3] = centrality;
-  trackValues[4] = vertexz;
-  //trackValues[5] = particle->M(); remove !!!
-  
-  for(Int_t tbin = 0; tbin < fAxistPt.GetNbins(); tbin++) {
-    trackValues[1] = fAxistPt.GetBinCenter(tbin+1);
-    
-    if(tmap[tbin]) {
-      
-      for(Int_t itf = 0; itf < fTrackFilters[1].GetEntriesFast() + 1; itf++) {
-       for(Int_t iTrack = 0; iTrack < tracks[itf].GetEntriesFast(); iTrack++) {
-         AliVTrack * track = static_cast<AliVTrack*>(tracks[itf].At(iTrack));
-         trackValues[0] = track->Eta();
-         trackValues[2] = track->Pt();
-         trackValues[5] = itf;
-         trackValues[6] = 0;  ///v0 filter
-         trackValues[7] = 0; ////Pi filter
-         fTrackSparse->Fill(trackValues);
-
-         if(itf == 0) {
-           for(Int_t itlf = 0; itlf < fTrackFilters[0].GetEntriesFast(); itlf++) {
-             if(lowtrackmap[itlf][iTrack]) {
-               trackValues[5] = -(itlf + 1);
-               fTrackSparse->Fill(trackValues);
-             }
-           }
-           trackValues[5] = 0;
-           
-           ///Check lowside gamma
-           for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
-             if(!lv0tmap[tbin][iglf]) {
-               trackValues[6] = -(iglf + 1);
-               fTrackSparse->Fill(trackValues);
-             }
-           }
-           trackValues[6] = 0;
-
-           ////Check lowside pion
-           for(Int_t iplf = 0; iplf < fMesonFilters[0].GetEntriesFast(); iplf++) {
-             if(!lpitmap[tbin][iplf]) {
-               trackValues[7] = -(iplf + 1);
-               fTrackSparse->Fill(trackValues);
-             }
-           }
-
-
-
-         } // itf == 00
-       }
-      }
-    } else {
-      ///If not in main, see if in upside filters
-      ///Do upside v0 filters
-      for(Int_t iguf = 0; iguf < fV0Filters[1].GetEntriesFast(); iguf++) {
-       if (uv0tmap[tbin][iguf] ) {
-
-         cout << "c vtx " <<  centrality << vertexz << endl;
-
-         for(Int_t iTrack = 0; iTrack < tracks[0].GetEntriesFast(); iTrack++) {
-           AliVTrack * track = static_cast<AliVTrack*>(tracks[0].At(iTrack));
-           trackValues[0] = track->Eta();
-           trackValues[2] = track->Pt();
-           trackValues[5] = 0;
-           trackValues[6] = iguf+1;  ///v0 filter
-           trackValues[7] = 0; ////Pi filter
-           fTrackSparse->Fill(trackValues);
+    if(gCorr) {
+      if(!fPhotonFilter || fPhotonFilter->PhotonIsSelected(static_cast<AliConversionPhotonBase*>(ph1), fInputEvent)) {
+       if(ph1->Pt() > fAxistPt.GetBinLowEdge(1)) {
+         if(ph1->Eta() > etalim[0] && ph1->Eta() < etalim[1]) {
+           gCorr->CorrelateWithTracks( static_cast<AliAODConversionParticle*>(ph1), tracks, tIDs, cent, vtxz);
+           photons.Add(ph1);
          }
        }
       }
-      ///Do upside pi filter
-      for(Int_t ipuf = 0; ipuf < fMesonFilters[1].GetEntriesFast(); ipuf++) {
-       if (upitmap[tbin][ipuf] ) {
-
-         cout << "c2 vtx2 " <<  centrality << vertexz << endl;
+    }
 
+    for(Int_t i2 = 0; i2 < i1; i2++) {
+      AliAODConversionPhoton * ph2 = static_cast<AliAODConversionPhoton*>(gammas->UncheckedAt(i2));
+         
+      if( ph2->GetTrackLabelPositive()==ph1->GetTrackLabelPositive() 
+         || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelNegative()
+         || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelPositive()
+         || ph2->GetTrackLabelPositive()==ph1->GetTrackLabelNegative()) {
+       continue;
+      }
 
-         for(Int_t iTrack = 0; iTrack < tracks[0].GetEntriesFast(); iTrack++) {
-           AliVTrack * track = static_cast<AliVTrack*>(tracks[0].At(iTrack));
-           trackValues[0] = track->Eta();
-           trackValues[2] = track->Pt();
-           trackValues[5] = 0;
-           trackValues[6] = 0;  ///v0 filter
-           trackValues[7] = ipuf+1; ////Pi filter
-           fTrackSparse->Fill(trackValues);
-         }
+      AliAODConversionMother * pion = new AliAODConversionMother(ph1, ph2);
+      pion->SetLabels(i1, i2);
+      pion->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+      
+      if(!fMesonFilter || fMesonFilter->MesonIsSelected(pion, kTRUE) ) {
+       tIDs[2] = ph2->GetLabel(0);
+       tIDs[3] = ph2->GetLabel(1);
+       piCorr->FillTriggerCounters(pion);
+       AliDebug(AliLog::kDebug + 5, "We have a pion");
+       if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && 
+          pion->M() > fAxisPiM.GetBinLowEdge(1) && 
+          pion->M() < fAxisPiM.GetBinUpEdge(fAxisPiM.GetNbins()) &&
+          pion->Eta() > etalim[0] && pion->Eta() < etalim[1]) {
+         piCorr->CorrelateWithTracks(pion, tracks, tIDs, cent, vtxz);
+         pions.Add(static_cast<TObject*>(pion));
        }
       }
-
     }
   }
 
-
-
-  //////
-  //////
-
-
-  
-  //piCorr->FillCounters(&pions, tracks, centrality, vertexz);
-  
-  PostData(1, fHistograms);
-
+  piCorr->FillCounters(&pions, tracks, cent, vtxz);
+  if(gCorr) {
+    gCorr->FillCounters(&photons, tracks, cent, vtxz);
+  }
 }
 
-//_______________________________________________________________________________
-// void AliAnalysisTaskdPhi::FillCounters(TObjArray * particles, TObjArray tracks[], Int_t ntrackfilters, Float_t cent, Float_t vtxz) {
-  
-//   return;
-  
-  
-//  //Fill ME Counters
-//   const Int_t nbins = fAxistPt.GetNbins();
-//   Bool_t tmap[nbins];
-//   for(Int_t ptbin = 0; ptbin < nbins; ptbin++){
-//       tmap[ptbin] = kFALSE;
-//     }
-//   }
-
-
-//   Double_t trackValues[fTrackAxesList.GetSize()];
-//   trackValues[3] = cent;
-//   trackValues[4] = vtxz;
-
-//   for(Int_t ip = 0; ip < particles->GetEntriesFast(); ip++){
-//     AliAODConversionParticle * particle = static_cast<AliAODConversionParticle*>(particles->At(ip));
-
-//     Int_t tbin = fAxistPt.FindFixBin(particle->Pt());
-//     if (tbin > 0 && tbin < nbins + 1) {
-//       if(tmap[tbin - 1] == kTRUE) {
-//     continue;
-//       } else {
-//     tmap[tbin -1 ] = kTRUE;
-
-//     trackValues[5] = particle->M();
-//     trackValues[1] = particle->Pt();
-       
-//     for(Int_t itf = 0; itf < ntrackfilters; itf++) {
-//       if(fkTrackAxis) trackValues[6] = itf;
-//       for(int ij = 0; ij < tracks[itf].GetEntriesFast(); ij++) {
-//         AliVTrack * track = static_cast<AliVTrack*>(tracks->UncheckedAt(ij));
-//         trackValues[0] = track->Eta();
-//         trackValues[2] = track->Pt();
-//         fTrackSparse->Fill(trackValues);    
-//       }
-//     }
-//       }
-//     }
-//   }
-// }
-
-
-
-
-// //________________________________________________________________
-// void AliAnalysisTaskdPhi::CorrelateWithTracks(AliAODConversionParticle * particle, TObjArray tracks[], Int_t ntrackfilters, Bool_t ** lowtrackmap, Int_t nltf, Int_t const tIDs[4], Double_t dphivalues[]) {
-//   //Correlate particle with tracks
-//   ///Correlate with tracks
-
-// }
-
 //________________________________________________________________________
 void AliAnalysisTaskdPhi::Terminate(Option_t *) {
  
@@ -1142,22 +554,24 @@ void AliAnalysisTaskdPhi::Terminate(Option_t *) {
 
 //________________________________________________________________________
 TClonesArray * AliAnalysisTaskdPhi::GetConversionGammas(Bool_t isAOD) {
+  
+
   if(isAOD) {
 
-    TClonesArray * gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
-    if(gammas) {
-      return gammas;
-    }
-    
-    FindDeltaAODBranchName(fInputEvent);
-    gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
-    return gammas;
-    
+       TClonesArray * gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
+       if(gammas) {
+         return gammas;
+       }
+
+       FindDeltaAODBranchName(fInputEvent);
+       gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
+       return gammas;
+
   } else {
     TClonesArray * gammas = dynamic_cast<TClonesArray*>(GetInputData(1));
     return gammas;
   }
-  
+
 }
 
 //________________________________________________________________________
@@ -1165,12 +579,12 @@ void AliAnalysisTaskdPhi::FindDeltaAODBranchName(AliVEvent * event){
   ///Find aod branch
   TList *list=event->GetList();
   for(Int_t ii=0;ii<list->GetEntries();ii++){
-    TString name((list->At(ii))->GetName());
-    if(name.BeginsWith("GammaConv")&&name.EndsWith("gamma")){
-      fDeltaAODBranchName=name;
-      AliDebug(AliLog::kDebug + 5, Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
-      return;
-    }
+       TString name((list->At(ii))->GetName());
+       if(name.BeginsWith("GammaConv")&&name.EndsWith("gamma")){
+         fDeltaAODBranchName=name;
+         AliDebug(AliLog::kDebug + 5, Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
+         return;
+       }
   }
 }
   
index 50d929d..936c2f5 100644 (file)
 #include <THnSparse.h>
 //#include <AliAnalysisFilter.h>
 #include <iostream>
-//#include <AliAnaConvCorrBase.h>
+#include <AliAnaConvCorrBase.h>
 #include <AliLog.h>
 #include <AliAnalysisCuts.h>
-//class AliAnaConvCorrPion;
+class AliAnaConvCorrPion;
 class AliConversionCuts;
 class AliConversionMesonCuts;
 class AliV0ReaderV1;
@@ -29,88 +29,63 @@ class TH2I;
 using namespace std;
 
 class AliAnalysisTaskdPhi : public AliAnalysisTaskSE {
-  
+
 public:
   AliAnalysisTaskdPhi(const char *name="slindal_dPhi");
   virtual ~AliAnalysisTaskdPhi();
-  
+
   virtual void   UserCreateOutputObjects();
-  //virtual void   SetUpCorrObjects();
-  //  virtual void   SetUpCorrAxes(AliAnaConvCorrBase * corr);
-  virtual void   SetUpBins();
+  virtual void   SetUpCorrObjects();
+  virtual void   SetUpCorrAxes(AliAnaConvCorrBase * corr);
   virtual void   UserExec(Option_t *option);
   virtual void   Terminate(Option_t *);
-  
+
   TAxis& GetAxistPt()     { return fAxistPt;      }
   TAxis& GetAxiscPt()     { return fAxiscPt;      }
   TAxis& GetAxisdEta()    { return fAxisdEta;     }
   TAxis& GetAxisTrigEta() { return fAxisTrigEta;  }
   TAxis& GetAxisAssEta()  { return fAxisAssEta;   }
-  TAxis& GetAxisPhi()     { return fAxisdPhi;     }
+  TAxis& GetAxisPhi()     { return fAxisPhi;      }
   TAxis& GetAxisZ()       { return fAxisZ;        }
   TAxis& GetAxisCent()    { return fAxisCent;     }
   TAxis& GetAxisPiMass()  { return fAxisPiM;      }
-  
+
   void SetV0Filter(AliConversionCuts * filter) { fV0Filter = filter; }
-  void AddV0Filter(TObject * filter, Bool_t high = kTRUE) { fV0Filters[high].AddLast(filter); }
-  void AddMesonFilter(TObject * filter, Bool_t high = kTRUE) { fMesonFilters[high].AddLast(filter); }
-  void AddTrackFilter(TObject * filter, Bool_t high = kTRUE) { fTrackFilters[high].AddLast(filter); }
   
   void SetMesonFilter(AliConversionMesonCuts * filter) { fMesonFilter = filter; }
   void SetPhotonFilter(AliConversionCuts * filter) { fPhotonFilter = filter; }
   void SetV0Reader(AliV0ReaderV1 * reader) { fV0Reader = reader; }
   void SaveReaderHists(Bool_t save = kTRUE) { fSaveReaderHists = save; }
-  AliAnalysisCuts * GetTrackCuts() const { return fTrackFilter; }
-  void SetTrackFilter( AliAnalysisCuts * cuts) { if (fTrackFilter) delete fTrackFilter; fTrackFilter = cuts; }
+  AliAnalysisCuts * GetTrackCuts() const { return fTrackCuts; }
+  void SetTrackCuts( AliAnalysisCuts * cuts) { if (fTrackCuts) delete fTrackCuts; fTrackCuts = cuts; }
   
 protected:
   
   TClonesArray * GetConversionGammas(Bool_t isAOD);
-  
-private:
-
-  //void CorrelateWithTracks(AliAODConversionParticle * particle, TObjArray tracks[], Int_t ntrackfilters, Bool_t ** lowtrackmap, Int_t nltf, Int_t const tIDs[4], Double_t dphiValues[]);
-  //void FillCounters(TObjArray * particles, TObjArray tracks[], Int_t ntrackfilters, Float_t cent, Float_t vtxz);
-  
-  ///Get the distance in phi between trigger particle and correlated particle
-  Float_t GetDPhi(Float_t dPhi) { 
-    if ( dPhi < 3*TMath::PiOver2() && dPhi > - TMath::PiOver2() ) return dPhi;
-    else return ( (dPhi>0)? dPhi - TMath::TwoPi() : dPhi + TMath::TwoPi() ); 
-  }
-
 
+private:
   
   THnSparseF * CreateSparse(TString nameString, TString titleString, TList * axesList);
   Int_t GetBin(TAxis &axis, Double_t value);
   THnSparseF * GetMEHistogram(Int_t binz, Int_t binc, TObjArray * array);
-  //  AliAnaConvCorrBase * GetCorrObject(Int_t binz, Int_t binc, TObjArray * array);
+  AliAnaConvCorrBase * GetCorrObject(Int_t binz, Int_t binc, TObjArray * array);
   void Process(TObjArray * gammas, TObjArray * tracks, Float_t cent, Float_t vtxz);
   void FindDeltaAODBranchName(AliVEvent * event);
   
-
-  ///Members
   TList * fHistograms; //histograms
-  THnSparseF * fCorrSparse;
-  THnSparseF * fTrigSparse;
-  THnSparseF * fTrackSparse;
-  THnSparseF * fMassSparse;
 
   AliV0ReaderV1 * fV0Reader; // V0 reader
   Bool_t fSaveReaderHists; // save histograms from v0 reader
   AliConversionCuts * fV0Filter; //additional v0 filter on top of v0 reader
-  TObjArray fV0Filters[2]; // Array of v0 filters, increasingly loose ideally.
   AliConversionCuts * fPhotonFilter; //additional v0 filter for photons only
   AliConversionMesonCuts * fMesonFilter; //additional meson filter behind fv0filter
-  TObjArray fMesonFilters[2]; // Array of Meson filters
-  AliAnalysisCuts * fTrackFilter; //Cuts for corr tracks
-  TObjArray fTrackFilters[2]; // Array of track cuts
-  //Int_t fTFBin; // Axis for track filters
+  AliAnalysisCuts * fTrackCuts; //Cuts for corr tracks
 
   TH2I * hMEvents; //event histrogam
   TH2I * hTrackCent; //event histrogam
 
-  //AliAnaConvCorrBase * fPhotonCorr; //photon
-  //AliAnaConvCorrPion * fPionCorr; //poin
+  AliAnaConvCorrBase * fPhotonCorr; //photon
+  AliAnaConvCorrPion * fPionCorr; //poin
 
   TString fDeltaAODBranchName; //comment
 
@@ -119,28 +94,17 @@ private:
   TAxis fAxisdEta; //comment
   TAxis fAxisTrigEta; //comment
   TAxis fAxisAssEta; //comment
-  TAxis fAxisdPhi; //comment
+  TAxis fAxisPhi; //comment
   TAxis fAxisCent; //comment
   TAxis fAxisZ; //comment
   TAxis fAxisPiM; //comment
-  TAxis fAxisTrackFilters; //comment
-  TAxis fAxisV0Filters; //comment
-  TAxis fAxisMesonFilters; //comment
-  Bool_t fkTrackAxis; // on or off
-  Bool_t fkV0Axis; // on or off
-  Bool_t fkPionAxis; // on or off
-
-  TList fAxesList; //dphi axes list
-  TList fTrigAxesList; // Trigger axes list
-  TList fTrackAxesList; //Trackociated particles axes list
-  TList fMassAxesList; // Mass vs pt sparse
 
   Bool_t fDoPhoton; // do photon analysis?
   
   AliAnalysisTaskdPhi(const AliAnalysisTaskdPhi&); // not implemented
   AliAnalysisTaskdPhi& operator=(const AliAnalysisTaskdPhi&); // not implemented
   
-  ClassDef(AliAnalysisTaskdPhi, 7); 
+  ClassDef(AliAnalysisTaskdPhi, 6); 
 };
 
 inline THnSparseF * AliAnalysisTaskdPhi::GetMEHistogram(Int_t binz, Int_t binc, TObjArray * array) {
@@ -160,17 +124,17 @@ inline THnSparseF * AliAnalysisTaskdPhi::GetMEHistogram(Int_t binz, Int_t binc,
 }
 
 
-// inline AliAnaConvCorrBase * AliAnalysisTaskdPhi::GetCorrObject(Int_t binz, Int_t binc, TObjArray * array) {
-//   ///Get correlation object
-//   if(binc < 0 || binz < 0) {
-//       AliError("We have a bad bin!!!");
-//       return NULL;
-//     }
+inline AliAnaConvCorrBase * AliAnalysisTaskdPhi::GetCorrObject(Int_t binz, Int_t binc, TObjArray * array) {
+  ///Get correlation object
+  if(binc < 0 || binz < 0) {
+         AliError("We have a bad bin!!!");
+         return NULL;
+       }
 
-//   TObjArray * arrayc = static_cast<TObjArray*>(array->At(binc));
-//   AliAnaConvCorrBase * corrmaker = static_cast<AliAnaConvCorrBase*>(arrayc->At(binz));
-//   return corrmaker;
-// }
+  TObjArray * arrayc = static_cast<TObjArray*>(array->At(binc));
+  AliAnaConvCorrBase * corrmaker = static_cast<AliAnaConvCorrBase*>(arrayc->At(binz));
+  return corrmaker;
+}
 
 inline Int_t AliAnalysisTaskdPhi::GetBin(TAxis & axis, Double_t value) {
   //Return bin - 1 if within range, else return -1