added material task
authorfbock <fbock@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Oct 2012 15:24:50 +0000 (15:24 +0000)
committerfbock <fbock@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Oct 2012 15:24:50 +0000 (15:24 +0000)
16 files changed:
PWGGA/GammaConv/AliAnalysisTaskConversionQA.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.h
PWGGA/GammaConv/AliAnalysisTaskMaterial.cxx [new file with mode: 0644]
PWGGA/GammaConv/AliAnalysisTaskMaterial.h [new file with mode: 0644]
PWGGA/GammaConv/AliAnalysisTaskPi0v2.cxx
PWGGA/GammaConv/AliAnalysisTaskPi0v2.h
PWGGA/GammaConv/AliConversionCuts.cxx
PWGGA/GammaConv/AliConversionCuts.h
PWGGA/GammaConv/AliConversionMesonCuts.cxx
PWGGA/GammaConv/AliConversionMesonCuts.h
PWGGA/GammaConv/AliConversionSelection.cxx
PWGGA/GammaConv/AliConversionSelection.h
PWGGA/GammaConv/macros/AddTask_GammaConvV1.C
PWGGA/GammaConv/macros/AddTask_Material.C [new file with mode: 0644]

index 4eec977..3bf6c82 100644 (file)
@@ -125,7 +125,7 @@ void AliAnalysisTaskConversionQA::ProcessQA(){
       daughterProp(2) = posTrack->GetTPCsignal();
       daughterProp(9) = negTrack->GetTPCsignal();
       daughterProp(3) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
-      daughterProp(10) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
+      daughterProp(10) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
       if((posTrack->GetStatus() & AliESDtrack::kTOFpid) && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
          daughterProp(4) = posTrack->GetTOFsignal();
          daughterProp(5) = pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron);
index f78ea3d..cd42f1e 100644 (file)
@@ -296,12 +296,12 @@ void AliAnalysisTaskGammaConvDalitzV1::InitBack(){
       sESDMotherBackInvMassPtZM[iCut]->Sumw2();
       fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
 
-      if(((AliConversionCuts*)fCutGammaArray->At(iCut))->UseTrackMultiplicity()){
-         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,6,((AliConversionCuts*)fCutGammaArray->At(iCut))->NumberOfRotationEvents());
+      if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseTrackMultiplicity()){
+         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,6,((AliConversionMesonCuts*)fCutGammaArray->At(iCut))->NumberOfBGEvents());
          fBGHandler[iCut]->Initialize(zBinLimitsArray, multiplicityBinLimitsArrayTracks);
       }
       else{
-         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,5,((AliConversionCuts*)fCutGammaArray->At(iCut))->NumberOfRotationEvents());
+         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,5,((AliConversionMesonCuts*)fCutGammaArray->At(iCut))->NumberOfBGEvents());
          fBGHandler[iCut]->Initialize(zBinLimitsArray, multiplicityBinLimitsArrayV0s);
       }
    }
@@ -849,7 +849,7 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
               // }
                Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
                Int_t mbin = 0;
-               if(((AliConversionCuts*)fCutGammaArray->At(fiCut))->UseTrackMultiplicity()){
+               if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseTrackMultiplicity()){
                   mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
                } else {
                   mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
index d709597..a6c7734 100644 (file)
@@ -42,6 +42,7 @@
 #include "AliKFVertex.h"
 #include "AliV0ReaderV1.h"
 #include "AliGammaConversionAODBGHandler.h"
+#include "AliGenCocktailEventHeader.h"
 
 ClassImp(AliAnalysisTaskGammaConvV1)
 
@@ -55,13 +56,17 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fCutFolder(NULL),
    fESDList(NULL),
    fBackList(NULL),
+   fMotherList(NULL),
    fTrueList(NULL),
    fMCList(NULL),
+   fHeaderNameList(NULL),
    fOutputContainer(0),
    fReaderGammas(NULL),
    fGoodGammas(NULL),
    fCutArray(NULL),
    fConversionCuts(NULL),
+   fMesonCutArray(NULL),
+   fMesonCuts(NULL),
    hESDConvGammaPt(NULL),
    hESDMotherInvMassPt(NULL),
    sESDMotherInvMassPtZM(NULL),
@@ -69,57 +74,39 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    sESDMotherBackInvMassPtZM(NULL),
    hESDMotherInvMassEalpha(NULL),
    hMCAllGammaPt(NULL),
-   hMCAllGammaPtAddedSig(NULL),
    hMCDecayGammaPi0Pt(NULL),
-   hMCDecayGammaPi0PtAddedSig(NULL),
    hMCDecayGammaRhoPt(NULL),
-   hMCDecayGammaRhoPtAddedSig(NULL),
    hMCDecayGammaEtaPt(NULL),
-   hMCDecayGammaEtaPtAddedSig(NULL),
    hMCDecayGammaOmegaPt(NULL),
-   hMCDecayGammaOmegaPtAddedSig(NULL),
    hMCDecayGammaEtapPt(NULL),
-   hMCDecayGammaEtapPtAddedSig(NULL),
    hMCDecayGammaPhiPt(NULL),
-   hMCDecayGammaPhiPtAddedSig(NULL),
    hMCConvGammaPt(NULL),
-   hMCConvGammaPtAddedSig(NULL),
+   hMCConvGammaR(NULL),
+   hMCConvGammaEta(NULL),
    hMCPi0Pt(NULL),
    hMCEtaPt(NULL),
    hMCPi0InAccPt(NULL),
    hMCEtaInAccPt(NULL),
-   hMCPi0PtAddedSig(NULL),
-   hMCEtaPtAddedSig(NULL),
-   hMCPi0InAccPtAddedSig(NULL),
-   hMCEtaInAccPtAddedSig(NULL),
    hESDTrueMotherInvMassPt(NULL),
-   hESDTrueMotherInvMassPtAddedSig(NULL),
    hESDTruePrimaryMotherInvMassMCPt(NULL),
-   hESDTruePrimaryMotherInvMassMCPtAddedSig(NULL),
    hESDTruePrimaryPi0ESDPtMCPt(NULL),
-   hESDTruePrimaryPi0ESDPtMCPtAddedSig(NULL),
    hESDTrueSecondaryMotherInvMassPt(NULL),
-   hESDTrueSecondaryMotherInvMassPtAddedSig(NULL),
    hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
-   hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig(NULL),
    hESDTrueBckGGInvMassPt(NULL),
    hESDTrueBckContInvMassPt(NULL),
    hESDTrueMotherDalitzInvMassPt(NULL),
-   hESDTrueMotherDalitzInvMassPtAddedSig(NULL),
    hESDTrueConvGammaPt(NULL),
-   hESDTrueConvGammaPtAddedSig(NULL),
-   hESDTrueElecCombPt(NULL),
-   hESDTruePionCombPt(NULL),
+   hESDTrueTwoElecCombPt(NULL),
+   hESDTrueTwoPionCombPt(NULL),
+   hESDTrueElecPionCombPt(NULL),
+   hESDTrueCombPt(NULL),
    hESDTruePrimaryConvGammaPt(NULL),
-   hESDTruePrimaryConvGammaPtAddedSig(NULL),
+   hESDTruePrimaryConvGammaR(NULL),
+   hESDTruePrimaryConvGammaEta(NULL),
    hESDTruePrimaryConvGammaESDPtMCPt(NULL),
-   hESDTruePrimaryConvGammaESDPtMCPtAddedSig(NULL),
    hESDTrueSecondaryConvGammaPt(NULL),
-   hESDTrueSecondaryConvGammaPtAddedSig(NULL),
    hESDTrueSecondaryConvGammaFromK0sPt(NULL),
-   hESDTrueSecondaryConvGammaFromK0sPtAddedSig(NULL),
    hESDTrueSecondaryConvGammaFromXFromK0sPt(NULL),
-   hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig(NULL),
    hNEvents(NULL),
    hNGoodESDTracks(NULL),
    hNV0Tracks(NULL),
@@ -148,13 +135,17 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fCutFolder(NULL),
    fESDList(NULL),
    fBackList(NULL),
+   fMotherList(NULL),
    fTrueList(NULL),
    fMCList(NULL),
+   fHeaderNameList(NULL),
    fOutputContainer(0),
    fReaderGammas(NULL),
    fGoodGammas(NULL),
    fCutArray(NULL),
    fConversionCuts(NULL),
+   fMesonCutArray(NULL),
+   fMesonCuts(NULL),
    hESDConvGammaPt(NULL),
    hESDMotherInvMassPt(NULL),
    sESDMotherInvMassPtZM(NULL),
@@ -162,57 +153,39 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    sESDMotherBackInvMassPtZM(NULL),
    hESDMotherInvMassEalpha(NULL),
    hMCAllGammaPt(NULL),
-   hMCAllGammaPtAddedSig(NULL),
    hMCDecayGammaPi0Pt(NULL),
-   hMCDecayGammaPi0PtAddedSig(NULL),
    hMCDecayGammaRhoPt(NULL),
-   hMCDecayGammaRhoPtAddedSig(NULL),
    hMCDecayGammaEtaPt(NULL),
-   hMCDecayGammaEtaPtAddedSig(NULL),
    hMCDecayGammaOmegaPt(NULL),
-   hMCDecayGammaOmegaPtAddedSig(NULL),
    hMCDecayGammaEtapPt(NULL),
-   hMCDecayGammaEtapPtAddedSig(NULL),
    hMCDecayGammaPhiPt(NULL),
-   hMCDecayGammaPhiPtAddedSig(NULL),
    hMCConvGammaPt(NULL),
-   hMCConvGammaPtAddedSig(NULL),
+   hMCConvGammaR(NULL),
+   hMCConvGammaEta(NULL),
    hMCPi0Pt(NULL),
    hMCEtaPt(NULL),
    hMCPi0InAccPt(NULL),
    hMCEtaInAccPt(NULL),
-   hMCPi0PtAddedSig(NULL),
-   hMCEtaPtAddedSig(NULL),
-   hMCPi0InAccPtAddedSig(NULL),
-   hMCEtaInAccPtAddedSig(NULL),
    hESDTrueMotherInvMassPt(NULL),
-   hESDTrueMotherInvMassPtAddedSig(NULL),
    hESDTruePrimaryMotherInvMassMCPt(NULL),
-   hESDTruePrimaryMotherInvMassMCPtAddedSig(NULL),
    hESDTruePrimaryPi0ESDPtMCPt(NULL),
-   hESDTruePrimaryPi0ESDPtMCPtAddedSig(NULL),
    hESDTrueSecondaryMotherInvMassPt(NULL),
-   hESDTrueSecondaryMotherInvMassPtAddedSig(NULL),
    hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
-   hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig(NULL),
    hESDTrueBckGGInvMassPt(NULL),
    hESDTrueBckContInvMassPt(NULL),
    hESDTrueMotherDalitzInvMassPt(NULL),
-   hESDTrueMotherDalitzInvMassPtAddedSig(NULL),
    hESDTrueConvGammaPt(NULL),
-   hESDTrueConvGammaPtAddedSig(NULL),
-   hESDTrueElecCombPt(NULL),
-   hESDTruePionCombPt(NULL),
+   hESDTrueTwoElecCombPt(NULL),
+   hESDTrueTwoPionCombPt(NULL),
+   hESDTrueElecPionCombPt(NULL),
+   hESDTrueCombPt(NULL),
    hESDTruePrimaryConvGammaPt(NULL),
-   hESDTruePrimaryConvGammaPtAddedSig(NULL),
+   hESDTruePrimaryConvGammaR(NULL),
+   hESDTruePrimaryConvGammaEta(NULL),
    hESDTruePrimaryConvGammaESDPtMCPt(NULL),
-   hESDTruePrimaryConvGammaESDPtMCPtAddedSig(NULL),
    hESDTrueSecondaryConvGammaPt(NULL),
-   hESDTrueSecondaryConvGammaPtAddedSig(NULL),
    hESDTrueSecondaryConvGammaFromK0sPt(NULL),
-   hESDTrueSecondaryConvGammaFromK0sPtAddedSig(NULL),
    hESDTrueSecondaryConvGammaFromXFromK0sPt(NULL),
-   hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig(NULL),
    hNEvents(NULL),
    hNGoodESDTracks(NULL),
    hNV0Tracks(NULL),
@@ -296,25 +269,31 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
    fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
       TString cutstring = ((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber();
-
+               TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
       fBackList[iCut] = new TList();
-      fBackList[iCut]->SetName(Form("%s Back histograms",cutstring.Data()));
+      fBackList[iCut]->SetName(Form("%s_%s Back histograms",cutstring.Data(),cutstringMeson.Data()));
       fBackList[iCut]->SetOwner(kTRUE);
       fCutFolder[iCut]->Add(fBackList[iCut]);
 
-      sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-      sESDMotherInvMassPtZM[iCut]->Sumw2();
-      fBackList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
       sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
       sESDMotherBackInvMassPtZM[iCut]->Sumw2();
       fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
+      
+      fMotherList[iCut] = new TList();
+      fMotherList[iCut]->SetName(Form("%s_%s Mother histograms",cutstring.Data(),cutstringMeson.Data()));
+      fMotherList[iCut]->SetOwner(kTRUE);
+      fCutFolder[iCut]->Add(fMotherList[iCut]);
 
-      if(((AliConversionCuts*)fCutArray->At(iCut))->UseTrackMultiplicity()){
-         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,6,((AliConversionCuts*)fCutArray->At(iCut))->NumberOfRotationEvents());
+      sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
+      sESDMotherInvMassPtZM[iCut]->Sumw2();
+      fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
+
+      if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity()){
+         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,6,((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->NumberOfBGEvents());
          fBGHandler[iCut]->Initialize(zBinLimitsArray, multiplicityBinLimitsArrayTracks);
       }
       else{
-         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,5,((AliConversionCuts*)fCutArray->At(iCut))->NumberOfRotationEvents());
+         fBGHandler[iCut] = new AliGammaConversionAODBGHandler(9,5,((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->NumberOfBGEvents());
          fBGHandler[iCut]->Initialize(zBinLimitsArray, multiplicityBinLimitsArrayV0s);
       }
    }
@@ -339,11 +318,12 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
    fCutFolder = new TList*[fnCuts];
    fESDList = new TList*[fnCuts];
    fBackList = new TList*[fnCuts];
+   fMotherList = new TList*[fnCuts];
    hESDConvGammaPt = new TH1F*[fnCuts];
    hNEvents = new TH1I*[fnCuts];
    hNGoodESDTracks = new TH1I*[fnCuts];
-       hNV0Tracks = new TH1I*[fnCuts];
-       
+   hNV0Tracks = new TH1I*[fnCuts];
+
    if(fDoMesonAnalysis){
       hESDMotherInvMassPt = new TH2F*[fnCuts];
       hESDMotherBackInvMassPt = new TH2F*[fnCuts];
@@ -352,13 +332,14 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
 
       TString cutstring = ((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber();
-
+               TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
+               
       fCutFolder[iCut] = new TList();
-      fCutFolder[iCut]->SetName(Form("Cut Number %s",cutstring.Data()));
+      fCutFolder[iCut]->SetName(Form("Cut Number %s_%s",cutstring.Data(),cutstringMeson.Data()));
       fCutFolder[iCut]->SetOwner(kTRUE);
       fOutputContainer->Add(fCutFolder[iCut]);
       fESDList[iCut] = new TList();
-      fESDList[iCut]->SetName(Form("%s ESD histograms",cutstring.Data()));
+      fESDList[iCut]->SetName(Form("%s_%s ESD histograms",cutstring.Data(),cutstringMeson.Data()));
       fESDList[iCut]->SetOwner(kTRUE);
 
       hNEvents[iCut] = new TH1I("NEvents","NEvents",7,-0.5,6.5);
@@ -366,10 +347,10 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       if(fIsHeavyIon) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
       else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
       fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
-               if(fIsHeavyIon) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",25000,0,25000);
+      if(fIsHeavyIon) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",25000,0,25000);
       else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
       fESDList[iCut]->Add(hNV0Tracks[iCut]);
-   
+
       hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
       fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
 
@@ -394,103 +375,77 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       fMCList = new TList*[fnCuts];
       // True Histogramms
       fTrueList = new TList*[fnCuts];
+      // Selected Header List
+      fHeaderNameList = new TList*[fnCuts];
 
       hMCAllGammaPt = new TH1F*[fnCuts];
-               hMCAllGammaPtAddedSig = new TH1F*[fnCuts];
       hMCDecayGammaPi0Pt = new TH1F*[fnCuts];
-               hMCDecayGammaPi0PtAddedSig = new TH1F*[fnCuts];
       hMCDecayGammaRhoPt = new TH1F*[fnCuts];
-      hMCDecayGammaRhoPtAddedSig = new TH1F*[fnCuts];
-               hMCDecayGammaEtaPt = new TH1F*[fnCuts];
-               hMCDecayGammaEtaPtAddedSig = new TH1F*[fnCuts];
+      hMCDecayGammaEtaPt = new TH1F*[fnCuts];
       hMCDecayGammaOmegaPt = new TH1F*[fnCuts];
-               hMCDecayGammaOmegaPtAddedSig = new TH1F*[fnCuts];
       hMCDecayGammaEtapPt = new TH1F*[fnCuts];
-               hMCDecayGammaEtapPtAddedSig = new TH1F*[fnCuts];
       hMCDecayGammaPhiPt = new TH1F*[fnCuts];
-               hMCDecayGammaPhiPtAddedSig = new TH1F*[fnCuts];
       hMCConvGammaPt = new TH1F*[fnCuts];
-               hMCConvGammaPtAddedSig = new TH1F*[fnCuts];
+      hMCConvGammaR = new TH1F*[fnCuts];
+      hMCConvGammaEta = new TH1F*[fnCuts];
       hESDTrueConvGammaPt = new TH1F*[fnCuts];
-               hESDTrueConvGammaPtAddedSig = new TH1F*[fnCuts];
-      hESDTrueElecCombPt = new TH1F*[fnCuts];
-          hESDTruePionCombPt = new TH1F*[fnCuts];
-          hESDTruePrimaryConvGammaPt = new TH1F*[fnCuts];
-               hESDTruePrimaryConvGammaPtAddedSig = new TH1F*[fnCuts];
+      hESDTrueTwoElecCombPt = new TH1F*[fnCuts];
+      hESDTrueTwoPionCombPt = new TH1F*[fnCuts];
+      hESDTrueElecPionCombPt = new TH1F*[fnCuts];
+      hESDTrueCombPt = new TH1F*[fnCuts];
+      hESDTruePrimaryConvGammaPt = new TH1F*[fnCuts];
+      hESDTruePrimaryConvGammaR = new TH1F*[fnCuts];
+      hESDTruePrimaryConvGammaEta = new TH1F*[fnCuts];
       hESDTruePrimaryConvGammaESDPtMCPt = new TH2F*[fnCuts];
-               hESDTruePrimaryConvGammaESDPtMCPtAddedSig = new TH2F*[fnCuts];
       hESDTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
-               hESDTrueSecondaryConvGammaPtAddedSig = new TH1F*[fnCuts];
       hESDTrueSecondaryConvGammaFromK0sPt = new TH1F*[fnCuts];
-               hESDTrueSecondaryConvGammaFromK0sPtAddedSig = new TH1F*[fnCuts];
       hESDTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
-               hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig = new TH1F*[fnCuts];
-               
+
       if(fDoMesonAnalysis){
          hMCPi0Pt = new TH1F*[fnCuts];
          hMCEtaPt = new TH1F*[fnCuts];
          hMCPi0InAccPt = new TH1F*[fnCuts];
          hMCEtaInAccPt = new TH1F*[fnCuts];
-                       hMCPi0PtAddedSig = new TH1F*[fnCuts];
-         hMCEtaPtAddedSig = new TH1F*[fnCuts];
-         hMCPi0InAccPtAddedSig = new TH1F*[fnCuts];
-         hMCEtaInAccPtAddedSig = new TH1F*[fnCuts];
 
          hESDTrueMotherInvMassPt = new TH2F*[fnCuts];
-                       hESDTrueMotherInvMassPtAddedSig = new TH2F*[fnCuts];
          hESDTruePrimaryPi0ESDPtMCPt = new TH2F*[fnCuts];
-                       hESDTruePrimaryPi0ESDPtMCPtAddedSig = new TH2F*[fnCuts];
          hESDTruePrimaryMotherInvMassMCPt = new TH2F*[fnCuts];
-                       hESDTruePrimaryMotherInvMassMCPtAddedSig = new TH2F*[fnCuts];
          hESDTrueSecondaryMotherInvMassPt = new TH2F*[fnCuts];
-                       hESDTrueSecondaryMotherInvMassPtAddedSig = new TH2F*[fnCuts];
          hESDTrueSecondaryMotherFromK0sInvMassPt = new TH2F*[fnCuts];
-                       hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig = new TH2F*[fnCuts];
          hESDTrueBckGGInvMassPt = new TH2F*[fnCuts];
          hESDTrueBckContInvMassPt = new TH2F*[fnCuts];
          hESDTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
-                       hESDTrueMotherDalitzInvMassPtAddedSig = new TH2F*[fnCuts];
       }
 
       for(Int_t iCut = 0; iCut<fnCuts;iCut++){
          TString cutstring = ((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber();
-         fMCList[iCut] = new TList();
-         fMCList[iCut]->SetName(Form("%s MC histograms",cutstring.Data()));
+                       TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
+         
+                       fMCList[iCut] = new TList();
+         fMCList[iCut]->SetName(Form("%s_%s MC histograms",cutstring.Data(),cutstringMeson.Data()));
          fMCList[iCut]->SetOwner(kTRUE);
          fCutFolder[iCut]->Add(fMCList[iCut]);
 
          hMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
          fMCList[iCut]->Add(hMCAllGammaPt[iCut]);
-                       hMCAllGammaPtAddedSig[iCut] = new TH1F("MC_AllGamma_Pt_AddedSig","MC_AllGamma_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCAllGammaPtAddedSig[iCut]);
          hMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
          fMCList[iCut]->Add(hMCDecayGammaPi0Pt[iCut]);
-         hMCDecayGammaPi0PtAddedSig[iCut] = new TH1F("MC_DecayGammaPi0_Pt_AddedSig","MC_DecayGammaPi0_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCDecayGammaPi0PtAddedSig[iCut]);
          hMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
          fMCList[iCut]->Add(hMCDecayGammaRhoPt[iCut]);
-         hMCDecayGammaRhoPtAddedSig[iCut] = new TH1F("MC_DecayGammaRho_Pt_AddedSig","MC_DecayGammaRho_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCDecayGammaRhoPtAddedSig[iCut]);
          hMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
          fMCList[iCut]->Add(hMCDecayGammaEtaPt[iCut]);
-         hMCDecayGammaEtaPtAddedSig[iCut] = new TH1F("MC_DecayGammaEta_Pt_AddedSig","MC_DecayGammaEta_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCDecayGammaEtaPtAddedSig[iCut]);
          hMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
          fMCList[iCut]->Add(hMCDecayGammaOmegaPt[iCut]);
-         hMCDecayGammaOmegaPtAddedSig[iCut] = new TH1F("MC_DecayGammaOmega_Pt_AddedSig","MC_DecayGammaOmmega_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCDecayGammaOmegaPtAddedSig[iCut]);
          hMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
          fMCList[iCut]->Add(hMCDecayGammaEtapPt[iCut]);
-         hMCDecayGammaEtapPtAddedSig[iCut] = new TH1F("MC_DecayGammaEtap_Pt_AddedSig","MC_DecayGammaEtap_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCDecayGammaEtapPtAddedSig[iCut]);
          hMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
          fMCList[iCut]->Add(hMCDecayGammaPhiPt[iCut]);
-         hMCDecayGammaPhiPtAddedSig[iCut] = new TH1F("MC_DecayGammaPhi_Pt_AddedSig","MC_DecayGammaPhi_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCDecayGammaPhiPtAddedSig[iCut]);
          hMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
          fMCList[iCut]->Add(hMCConvGammaPt[iCut]);
-         hMCConvGammaPtAddedSig[iCut] = new TH1F("MC_ConvGamma_Pt_AddedSig","MC_ConvGamma_Pt_AddedSig",250,0,25);
-         fMCList[iCut]->Add(hMCConvGammaPtAddedSig[iCut]);
+         hMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",1000,0,250);
+         fMCList[iCut]->Add(hMCConvGammaR[iCut]);
+         hMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",100,-4,4);
+         fMCList[iCut]->Add(hMCConvGammaEta[iCut]);
          if(fDoMesonAnalysis){
             hMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
             fMCList[iCut]->Add(hMCPi0Pt[iCut]);
@@ -500,79 +455,65 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
             fMCList[iCut]->Add(hMCPi0InAccPt[iCut]);
             hMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
             fMCList[iCut]->Add(hMCEtaInAccPt[iCut]);
-                               hMCPi0PtAddedSig[iCut] = new TH1F("MC_Pi0_Pt_AddedSig","MC_Pi0_Pt_AddedSig",250,0,25);
-            fMCList[iCut]->Add(hMCPi0PtAddedSig[iCut]);
-            hMCEtaPtAddedSig[iCut] = new TH1F("MC_Eta_Pt_AddedSig","MC_Eta_Pt_AddedSig",250,0,25);
-            fMCList[iCut]->Add(hMCEtaPtAddedSig[iCut]);
-            hMCPi0InAccPtAddedSig[iCut] = new TH1F("MC_Pi0InAcc_Pt_AddedSig","MC_Pi0InAcc_Pt_AddedSig",250,0,25);
-            fMCList[iCut]->Add(hMCPi0InAccPtAddedSig[iCut]);
-            hMCEtaInAccPtAddedSig[iCut] = new TH1F("MC_EtaInAcc_Pt_AddedSig","MC_EtaInAcc_Pt_AddedSig",250,0,25);
-            fMCList[iCut]->Add(hMCEtaInAccPtAddedSig[iCut]);
          }
          fTrueList[iCut] = new TList();
-         fTrueList[iCut]->SetName(Form("%s True histograms",cutstring.Data()));
+         fTrueList[iCut]->SetName(Form("%s_%s True histograms",cutstring.Data(),cutstringMeson.Data()));
          fTrueList[iCut]->SetOwner(kTRUE);
          fCutFolder[iCut]->Add(fTrueList[iCut]);
 
          hESDTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueConvGammaPt[iCut]);
-                       hESDTrueConvGammaPtAddedSig[iCut] = new TH1F("ESD_TrueConvGamma_Pt_AddedSig","ESD_TrueConvGamma_Pt_AddedSig",250,0,25);
-         fTrueList[iCut]->Add(hESDTrueConvGammaPtAddedSig[iCut]);
-         hESDTrueElecCombPt[iCut] = new TH1F("ESD_TrueElecComb_Pt","ESD_TrueElecComb_Pt",250,0,25);
-         fTrueList[iCut]->Add(hESDTrueElecCombPt[iCut]);
-         hESDTruePionCombPt[iCut] = new TH1F("ESD_TruePionComb_Pt","ESD_TruePionComb_Pt",250,0,25);
-         fTrueList[iCut]->Add(hESDTruePionCombPt[iCut]);
+         hESDTrueTwoElecCombPt[iCut] = new TH1F("ESD_TrueTwoElecComb_Pt","ESD_TrueTwoElecComb_Pt",250,0,25);
+         fTrueList[iCut]->Add(hESDTrueTwoElecCombPt[iCut]);
+         hESDTrueTwoPionCombPt[iCut] = new TH1F("ESD_TrueTwoPionComb_Pt","ESD_TrueTwoPionComb_Pt",250,0,25);
+         fTrueList[iCut]->Add(hESDTrueTwoPionCombPt[iCut]);
+         hESDTrueElecPionCombPt[iCut] = new TH1F("ESD_TrueElecPionComb_Pt","ESD_TrueElecPionComb_Pt",250,0,25);
+         fTrueList[iCut]->Add(hESDTrueElecPionCombPt[iCut]);
+         hESDTrueCombPt[iCut] = new TH1F("ESD_TrueComb_Pt","ESD_TrueComb_Pt",250,0,25);
+         fTrueList[iCut]->Add(hESDTrueCombPt[iCut]);
          hESDTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTruePrimaryConvGammaPt[iCut]);
-         hESDTruePrimaryConvGammaPtAddedSig[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt_AddedSig","ESD_TruePrimaryConvGamma_Pt_AddedSig",250,0,25);
-         fTrueList[iCut]->Add(hESDTruePrimaryConvGammaPtAddedSig[iCut]);
+         hESDTruePrimaryConvGammaR[iCut] = new TH1F("ESD_TruePrimaryConvGamma_R","ESD_TruePrimaryConvGamma_R",1000,0,250);
+         fTrueList[iCut]->Add(hESDTruePrimaryConvGammaR[iCut]);
+         hESDTruePrimaryConvGammaEta[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Eta","ESD_TruePrimaryConvGamma_Eta",100,-4,4);
+         fTrueList[iCut]->Add(hESDTruePrimaryConvGammaEta[iCut]);
          hESDTrueSecondaryConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaPt[iCut]);
-         hESDTrueSecondaryConvGammaPtAddedSig[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt_AddedSig", "ESD_TrueSecondaryConvGamma_Pt_AddedSig",250,0,25);
-         fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaPtAddedSig[iCut]);
          hESDTrueSecondaryConvGammaFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromK0s_Pt","ESD_TrueSecondaryConvGammaFromK0s_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromK0sPt[iCut]);
-         hESDTrueSecondaryConvGammaFromK0sPtAddedSig[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromK0s_Pt_AddedSig", "ESD_TrueSecondaryConvGammaFromK0s_Pt_AddedSig",250,0,25);
-         fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromK0sPtAddedSig[iCut]);
          hESDTrueSecondaryConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
-         hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt_AddedSig", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt_AddedSig",250,0,25);
-         fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig[iCut]);
          hESDTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
          fTrueList[iCut]->Add(hESDTruePrimaryConvGammaESDPtMCPt[iCut]);
-                       hESDTruePrimaryConvGammaESDPtMCPtAddedSig[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt_AddedSig", "ESD_TruePrimaryConvGammaESD_PtMCPt_AddedSig",250,0,25,250,0,25);
-         fTrueList[iCut]->Add(hESDTruePrimaryConvGammaESDPtMCPtAddedSig[iCut]);
 
          if(fDoMesonAnalysis){
             hESDTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTrueMotherInvMassPt[iCut]);
-                               hESDTrueMotherInvMassPtAddedSig[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt_AddedSig", "ESD_TrueMother_InvMass_Pt_AddedSig", 1000,0,1,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueMotherInvMassPtAddedSig[iCut]);
             hESDTruePrimaryPi0ESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryPi0_ESDPt_MCPt","ESD_TruePrimaryPi0_ESDPt_MCPt",250,0,25,250,0,25);
             fTrueList[iCut]->Add(hESDTruePrimaryPi0ESDPtMCPt[iCut]);
-            hESDTruePrimaryPi0ESDPtMCPtAddedSig[iCut] = new TH2F("ESD_TruePrimaryPi0_ESDPt_MCPt_AddedSig", "ESD_TruePrimaryPi0_ESDPt_MCPt_AddedSig", 250,0,25,250,0,25);
-            fTrueList[iCut]->Add(hESDTruePrimaryPi0ESDPtMCPtAddedSig[iCut]);
             hESDTruePrimaryMotherInvMassMCPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_MCPt", "ESD_TruePrimaryMother_InvMass_MCPt", 1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassMCPt[iCut]);
-            hESDTruePrimaryMotherInvMassMCPtAddedSig[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_MCPt_AddedSig", "ESD_TruePrimaryMother_InvMass_MCPt_AddedSig", 1000,0,1,250,0,25);
-            fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassMCPtAddedSig[iCut]);
             hESDTrueSecondaryMotherInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMother_InvMass_Pt", "ESD_TrueSecondaryMother_InvMass_Pt", 1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTrueSecondaryMotherInvMassPt[iCut]);
             hESDTrueSecondaryMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromK0s_InvMass_Pt","ESD_TrueSecondaryMotherFromK0s_InvMass_Pt",1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromK0sInvMassPt[iCut]);
-            hESDTrueSecondaryMotherInvMassPtAddedSig[iCut] = new TH2F("ESD_TrueSecondaryMother_InvMass_Pt_AddedSig","ESD_TrueSecondaryMother_InvMass_Pt_AddedSig",1000,0,1,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueSecondaryMotherInvMassPtAddedSig[iCut]);
-            hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig[iCut] = new TH2F("ESD_TrueSecondaryMotherFromK0s_InvMass_Pt_AddedSig","ESD_TrueSecondaryMotherFromK0s_InvMass_Pt_AddedSig",1000,0,1,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig[iCut]);
-                               hESDTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",1000,0,1,250,0,25);
+            hESDTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTrueBckGGInvMassPt[iCut]);
-                hESDTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",1000,0,1,250,0,25);
+            hESDTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTrueBckContInvMassPt[iCut]);
             hESDTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueDalitz_InvMass_Pt","ESD_TrueDalitz_InvMass_Pt",1000,0,1,250,0,25);
             fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPt[iCut]);
-            hESDTrueMotherDalitzInvMassPtAddedSig[iCut] = new TH2F("ESD_TrueDalitz_InvMass_Pt_AddedSig", "ESD_TrueDalitz_InvMass_Pt_AddedSig", 1000,0,1,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPtAddedSig[iCut]);
-
+         }
+         
+         if(((AliConversionCuts*)fCutArray->At(iCut))->GetSignalRejection() == 2){
+            fHeaderNameList[iCut] = new TList();
+            TString HeaderNames = "Header";
+            for(Int_t i = 0;i<(((AliConversionCuts*)fCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
+               HeaderNames = HeaderNames+"_"+ ((TObjString*)((TList*) ( (AliConversionCuts*)fCutArray->At(iCut)) ->GetAcceptedHeader())->At(i))->GetString();
+            }
+            fHeaderNameList[iCut]->SetName(HeaderNames);
+            fHeaderNameList[iCut]->SetOwner(kTRUE);
+            fCutFolder[iCut]->Add(fHeaderNameList[iCut]);
          }
       }
    }
@@ -611,16 +552,21 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
       hNEvents[iCut]->Fill(eventQuality);
 
       hNGoodESDTracks[iCut]->Fill(fNumberOfESDTracks);
-               hNV0Tracks[iCut]->Fill(fESDEvent->GetVZEROData()->GetMTotV0A()+fESDEvent->GetVZEROData()->GetMTotV0C());
+      hNV0Tracks[iCut]->Fill(fESDEvent->GetVZEROData()->GetMTotV0A()+fESDEvent->GetVZEROData()->GetMTotV0C());
       if(fMCEvent){ // Process MC Particle
          fMCStack = fMCEvent->Stack();
+         if(((AliConversionCuts*)fCutArray->At(iCut))->GetSignalRejection() != 0){
+            ((AliConversionCuts*)fCutArray->At(iCut))->GetNotRejectedParticles(((AliConversionCuts*)fCutArray->At(iCut))->GetSignalRejection(),
+                                                                               ((AliConversionCuts*)fCutArray->At(iCut))->GetAcceptedHeader(),
+                                                                               fMCEvent);
+         }
          ProcessMCParticles();
       }
-
+      
       ProcessPhotonCandidates(); // Process this cuts gammas
 
       if(fDoMesonAnalysis){ // Meson Analysis
-         if(((AliConversionCuts*)fCutArray->At(iCut))->UseMCPSmearing() && fMCEvent){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fMCEvent){
             fUnsmearedPx = new Double_t[fGoodGammas->GetEntries()]; // Store unsmeared Momenta
             fUnsmearedPy = new Double_t[fGoodGammas->GetEntries()];
             fUnsmearedPz = new Double_t[fGoodGammas->GetEntries()];
@@ -631,14 +577,15 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
                fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Py();
                fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Pz();
                fUnsmearedE[gamma] =  ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->E();
-               ((AliConversionCuts*)fCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(gamma)));
+               ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(gamma)));
             }
          }
+
          CalculatePi0Candidates(); // Combine Gammas
          CalculateBackground(); // Combinatorial Background
          UpdateEventByEventData(); // Store Event for mixed Events
 
-         if(((AliConversionCuts*)fCutArray->At(iCut))->UseMCPSmearing() && fMCEvent){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fMCEvent){
             for(Int_t gamma=0;gamma<fGoodGammas->GetEntries();gamma++){ // Smear the AODPhotons in MC
                ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
                ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPy(fUnsmearedPy[gamma]);
@@ -652,8 +599,9 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
          }
       }
       fGoodGammas->Clear(); // delete this cuts good gammas
-   }
 
+   }
+   
    PostData(1, fOutputContainer);
 }
 //________________________________________________________________________
@@ -666,9 +614,15 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
    for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
       AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
       if(!PhotonCandidate) continue;
+
+      if(fMCEvent && ((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 0){
+         if(!((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack)) continue;
+         if(!((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack)) continue;
+      }
+
       if(!((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fESDEvent)) continue;
-      
-      if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut() && 
+
+      if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
          !((AliConversionCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // if no post reader loop is required add to events good gammas
          fGoodGammas->Add(PhotonCandidate);
          hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
@@ -681,7 +635,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
          nV0++;
          GoodGammasStepOne->Add(PhotonCandidate);
       }
-      else if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut() && 
+      else if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
               ((AliConversionCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
          GoodGammasStepTwo->Add(PhotonCandidate);
       }
@@ -691,7 +645,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
          AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GoodGammasStepOne->At(i);
          if(!PhotonCandidate) continue;
          if(!((AliConversionCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GoodGammasStepOne->GetEntries())) continue;
-         if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed 
+         if(!((AliConversionCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
             fGoodGammas->Add(PhotonCandidate);
             hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
             if(fMCEvent){
@@ -731,9 +685,24 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
    if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
    if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){  // Not Same Mother == Combinatorial Bck
       if(TMath::Abs(posDaughter->GetPdgCode())==11 && TMath::Abs(negDaughter->GetPdgCode())==11)
-         hESDTrueElecCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //Electron Combinatorial
-      if(TMath::Abs(posDaughter->GetPdgCode())==211 || TMath::Abs(negDaughter->GetPdgCode())==211)
-         hESDTruePionCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
+         hESDTrueTwoElecCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //Electron Combinatorial
+      else if(TMath::Abs(posDaughter->GetPdgCode())==211 && TMath::Abs(negDaughter->GetPdgCode())==211)
+         hESDTrueTwoPionCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
+      else if( (TMath::Abs(posDaughter->GetPdgCode())==11 && TMath::Abs(negDaughter->GetPdgCode())==211) ||
+               (TMath::Abs(posDaughter->GetPdgCode())==211 && TMath::Abs(negDaughter->GetPdgCode())==11) )
+         hESDTrueElecPionCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
+      else hESDTrueCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
+      return;
+   }
+   else if(posDaughter->GetMother(0) == -1){
+      if(TMath::Abs(posDaughter->GetPdgCode())==11 && TMath::Abs(negDaughter->GetPdgCode())==11)
+         hESDTrueTwoElecCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //Electron Combinatorial
+      else if(TMath::Abs(posDaughter->GetPdgCode())==211 && TMath::Abs(negDaughter->GetPdgCode())==211)
+         hESDTrueTwoPionCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
+      else if( (TMath::Abs(posDaughter->GetPdgCode())==11 && TMath::Abs(negDaughter->GetPdgCode())==211) ||
+               (TMath::Abs(posDaughter->GetPdgCode())==211 && TMath::Abs(negDaughter->GetPdgCode())==11) )
+         hESDTrueElecPionCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
+      else hESDTrueCombPt[fiCut]->Fill(TruePhotonCandidate->Pt()); //At least on Pion Combinatorial
       return;
    }
    if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11) return; //One Particle is not electron
@@ -743,45 +712,26 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
    TParticle *Photon = TruePhotonCandidate->GetMCParticle(MCStack);
    if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
 
-       if (!fMCEvent->IsFromBGEvent(TruePhotonCandidate->GetMCParticleLabel(fMCStack)) && fIsHeavyIon){
-      // True Photon
-               hESDTrueConvGammaPtAddedSig[fiCut]->Fill(TruePhotonCandidate->Pt());
-
-               if(posDaughter->GetMother(0) <= MCStack->GetNprimary()){
-                       // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
-                       hESDTruePrimaryConvGammaPtAddedSig[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       hESDTruePrimaryConvGammaESDPtMCPtAddedSig[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt());
-               }
-               else{
-                       hESDTrueSecondaryConvGammaPtAddedSig[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       if(MCStack->Particle(Photon->GetMother(0))->GetPdgCode() == 310){
-                               hESDTrueSecondaryConvGammaFromK0sPtAddedSig[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       }
-                       if(MCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
-                               MCStack->Particle(MCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
-                               hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       }
-               }
-       } else {
-      // True Photon
-               hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-
-               if(posDaughter->GetMother(0) <= MCStack->GetNprimary()){
-                       // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
-                       hESDTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       hESDTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt());
-               }
-               else{
-                       hESDTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       if(MCStack->Particle(Photon->GetMother(0))->GetPdgCode() == 310){
-                               hESDTrueSecondaryConvGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       }
-                       if(MCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
-                               MCStack->Particle(MCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
-                               hESDTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-                       }
-               }               
-       }
+   // True Photon
+   hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+
+   if(posDaughter->GetMother(0) <= MCStack->GetNprimary()){
+      // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
+      hESDTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+      hESDTruePrimaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
+      hESDTruePrimaryConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
+      hESDTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt());
+   }
+   else{
+      hESDTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+      if(MCStack->Particle(Photon->GetMother(0))->GetPdgCode() == 310){
+         hESDTrueSecondaryConvGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+      }
+      if(MCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
+         MCStack->Particle(MCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
+         hESDTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+      }
+   }
 }
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
@@ -792,97 +742,56 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
       TParticle* particle = (TParticle *)fMCStack->Particle(i);
       if (!particle) continue;
 
-               if (!fMCEvent->IsFromBGEvent(i) && fIsHeavyIon){
-                       if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
-                               hMCAllGammaPtAddedSig[fiCut]->Fill(particle->Pt()); // All MC Gamma
-                               if(particle->GetMother(0) >-1){ // Meson Decay Gamma
-                                       switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
-                                       case 111: // Pi0
-                                               hMCDecayGammaPi0PtAddedSig[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 113: // Rho0
-                                               hMCDecayGammaRhoPtAddedSig[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 221: // Eta
-                                               hMCDecayGammaEtaPtAddedSig[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 223: // Omega
-                                               hMCDecayGammaOmegaPtAddedSig[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 331: // Eta'
-                                               hMCDecayGammaEtapPtAddedSig[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 333: // Phi
-                                               hMCDecayGammaPhiPtAddedSig[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       }
-                               }
-                       }
-                       if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
-                               hMCConvGammaPtAddedSig[fiCut]->Fill(particle->Pt());
-                       } // Converted MC Gamma
-                       if(fDoMesonAnalysis){
-                               if(((AliConversionCuts*)fCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,kFALSE)){
-                                       if(particle->GetPdgCode() == 111)hMCPi0PtAddedSig[fiCut]->Fill(particle->Pt()); // All MC Pi0
-                                       if(particle->GetPdgCode() == 221)hMCEtaPtAddedSig[fiCut]->Fill(particle->Pt()); // All MC Eta
-                                       // Check the acceptance for both gammas
-                                       if(particle->GetNDaughters() == 2){
-                                               TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
-                                               TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
-                                               if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
-                                                       ((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) ){
-                                                       if(particle->GetPdgCode() == 111)hMCPi0InAccPtAddedSig[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
-                                                       if(particle->GetPdgCode() == 221)hMCEtaInAccPtAddedSig[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
-                                               }
-                                       }
-                               }
-                       }
-               } else {
-                       if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
-                               hMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
-                               if(particle->GetMother(0) >-1){ // Meson Decay Gamma
-                                       switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
-                                       case 111: // Pi0
-                                               hMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 113: // Rho0
-                                               hMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 221: // Eta
-                                               hMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 223: // Omega
-                                               hMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 331: // Eta'
-                                               hMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       case 333: // Phi
-                                               hMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
-                                               break;
-                                       }
-                               }
-                       }
-                       if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
-                               hMCConvGammaPt[fiCut]->Fill(particle->Pt());
-                       } // Converted MC Gamma
-                       if(fDoMesonAnalysis){
-                               if(((AliConversionCuts*)fCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,kFALSE)){
-                                       if(particle->GetPdgCode() == 111)hMCPi0Pt[fiCut]->Fill(particle->Pt()); // All MC Pi0
-                                       if(particle->GetPdgCode() == 221)hMCEtaPt[fiCut]->Fill(particle->Pt()); // All MC Eta
-                                       // Check the acceptance for both gammas
-                                       if(particle->GetNDaughters() == 2){
-                                               TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
-                                               TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
-                                               if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
-                                                       ((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) ){
-                                                       if(particle->GetPdgCode() == 111)hMCPi0InAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
-                                                       if(particle->GetPdgCode() == 221)hMCEtaInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
-                                               }
-                                       }
-                               }
-                       }
-               }
+      if(((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 0){
+         if(!((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack)) continue;
+      }
+
+      if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
+         hMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
+         if(particle->GetMother(0) >-1){ // Meson Decay Gamma
+            switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
+            case 111: // Pi0
+               hMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
+               break;
+            case 113: // Rho0
+               hMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
+               break;
+            case 221: // Eta
+               hMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
+               break;
+            case 223: // Omega
+               hMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
+               break;
+            case 331: // Eta'
+               hMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
+               break;
+            case 333: // Phi
+               hMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
+               break;
+            }
+         }
+      }
+      if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
+         hMCConvGammaPt[fiCut]->Fill(particle->Pt());
+         hMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
+         hMCConvGammaEta[fiCut]->Fill(particle->Eta());
+      } // Converted MC Gamma
+      if(fDoMesonAnalysis){
+         if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,kFALSE)){
+            if(particle->GetPdgCode() == 111)hMCPi0Pt[fiCut]->Fill(particle->Pt()); // All MC Pi0
+            if(particle->GetPdgCode() == 221)hMCEtaPt[fiCut]->Fill(particle->Pt()); // All MC Eta
+            // Check the acceptance for both gammas
+            if(particle->GetNDaughters() == 2){
+               TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
+               TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
+               if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
+                  ((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) ){
+                  if(particle->GetPdgCode() == 111)hMCPi0InAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
+                  if(particle->GetPdgCode() == 221)hMCEtaInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
+               }
+            }
+         }
+      }
    }
 }
 //________________________________________________________________________
@@ -903,14 +812,14 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
             AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
             pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
 
-            if((((AliConversionCuts*)fCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE))){
+            if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE))){
                hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
                if(pi0cand->GetAlpha()<0.1){
                   hESDMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
                }
                Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
                Int_t mbin = 0;
-               if(((AliConversionCuts*)fCutArray->At(fiCut))->UseTrackMultiplicity()){
+               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
                   mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
                } else {
                   mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
@@ -988,39 +897,21 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
             }
          }
          if(isTruePi0 || isTrueEta){ // True Pion or Eta
-                               if (!fMCEvent->IsFromBGEvent(gamma1MotherLabel) && fIsHeavyIon){
-                                       hESDTrueMotherInvMassPtAddedSig[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                       if(gamma0MotherLabel > MCStack->GetNprimary()){ // Secondary Meson
-                                               hESDTrueSecondaryMotherInvMassPtAddedSig[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                               if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0) >-1){
-                                                       if(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->GetPdgCode()==kK0Short){
-                                                               hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                                       }
-                                               }
-                                       }                       
-                                       if(gamma0MotherLabel <= MCStack->GetNprimary()){ // Only primary pi0 for efficiency calculation
-                                               hESDTruePrimaryMotherInvMassMCPtAddedSig[fiCut]->Fill(Pi0Candidate->M(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt());
-                                               if(isTruePi0){ // Only primaries for unfolding
-                                                       hESDTruePrimaryPi0ESDPtMCPtAddedSig[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt());
-                                               }
-                                       }
-                               } else {
-                                       hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                       if(gamma0MotherLabel > MCStack->GetNprimary()){ // Secondary Meson
-                                               hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                               if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0) >-1){
-                                                       if(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->GetPdgCode()==kK0Short){
-                                                               hESDTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                                       }
-                                               }
-                                       }
-                                       if(gamma0MotherLabel <= MCStack->GetNprimary()){ // Only primary pi0 for efficiency calculation
-                                               hESDTruePrimaryMotherInvMassMCPt[fiCut]->Fill(Pi0Candidate->M(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt());
-                                               if(isTruePi0){ // Only primaries for unfolding
-                                                       hESDTruePrimaryPi0ESDPtMCPt[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt());
-                                               }
-                                       }
-                               }
+            hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+            if(gamma0MotherLabel > MCStack->GetNprimary()){ // Secondary Meson
+               hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+               if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0) >-1){
+                  if(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->GetPdgCode()==kK0Short){
+                     hESDTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                  }
+               }
+            }
+            if(gamma0MotherLabel <= MCStack->GetNprimary()){ // Only primary pi0 for efficiency calculation
+               hESDTruePrimaryMotherInvMassMCPt[fiCut]->Fill(Pi0Candidate->M(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt());
+               if(isTruePi0){ // Only primaries for unfolding
+                  hESDTruePrimaryPi0ESDPtMCPt[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt());
+               }
+            }
          }
          if(!isTruePi0 && !isTrueEta){ // Background
             if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
@@ -1028,11 +919,8 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
             } else { // No photon or without mother
                hESDTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
             }
-            if((gamma0MotherLabel==-111 || gamma1MotherLabel==-111 || gamma0MotherLabel==-221 || gamma1MotherLabel==-221) && (!fMCEvent->IsFromBGEvent(gamma1MotherLabel) || !fMCEvent->IsFromBGEvent(gamma0MotherLabel)) && fIsHeavyIon){
+            if((gamma0MotherLabel==-111 || gamma1MotherLabel==-111 || gamma0MotherLabel==-221 || gamma1MotherLabel==-221) ){
                // Dalitz
-               hESDTrueMotherDalitzInvMassPtAddedSig[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-            } else if (gamma0MotherLabel==-111 || gamma1MotherLabel==-111 || gamma0MotherLabel==-221 || gamma1MotherLabel==-221){
-                                       // Dalitz
                hESDTrueMotherDalitzInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
             }
          }
@@ -1046,21 +934,21 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
    Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
    Int_t mbin = 0;
 
-   if(((AliConversionCuts*)fCutArray->At(fiCut))->UseTrackMultiplicity()){
+   if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
       mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
    } else {
       mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
    }
 
-   if(((AliConversionCuts*)fCutArray->At(fiCut))->UseRotationMethod()){
+   if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseRotationMethod()){
 
       for(Int_t iCurrent=0;iCurrent<fGoodGammas->GetEntries();iCurrent++){
          AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodGammas->At(iCurrent));
          for(Int_t iCurrent2=iCurrent+1;iCurrent2<fGoodGammas->GetEntries();iCurrent2++){
-            for(Int_t nRandom=0;nRandom<((AliConversionCuts*)fCutArray->At(fiCut))->NumberOfRotationEvents();nRandom++){
+            for(Int_t nRandom=0;nRandom<((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NumberOfBGEvents();nRandom++){
                AliAODConversionPhoton currentEventGoodV02 = *(AliAODConversionPhoton*)(fGoodGammas->At(iCurrent2));
 
-               if(((AliConversionCuts*)fV0Reader->GetConversionCuts())->DoBGProbability()){
+               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGProbability()){
                   AliAODConversionMother *backgroundCandidateProb = new AliAODConversionMother(&currentEventGoodV0,&currentEventGoodV02);
                   Double_t massBGprob = backgroundCandidateProb->M();
                   if(massBGprob>0.1 && massBGprob<0.14){
@@ -1075,7 +963,7 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
 
                RotateParticle(&currentEventGoodV02);
                AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&currentEventGoodV02);
-               if((((AliConversionCuts*)fCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
+               if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
                   hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                   Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),zbin,mbin};
                   sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1085,11 +973,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
             }
          }
       }
-   }
-   else{
+   }else{
       AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
 
-      if(((AliConversionCuts*)fCutArray->At(fiCut))->UseTrackMultiplicity()){
+      if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
          for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
             AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
             if(fMoveParticleAccordingToVertex == kTRUE){
@@ -1105,7 +992,7 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                   }
 
                   AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
-                  if((((AliConversionCuts*)fCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
+                  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
                      hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                      Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),zbin,mbin};
                      sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1135,7 +1022,7 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
 
                      AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
 
-                     if((((AliConversionCuts*)fCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
+                     if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE))){
                         hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                         Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),zbin,mbin};
                         sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
@@ -1149,9 +1036,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
       }
    }
 }
+
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::RotateParticle(AliAODConversionPhoton *gamma){
-   Int_t fNDegreesPMBackground= ((AliConversionCuts*)fV0Reader->GetConversionCuts())->NDegreesRotation();
+   Int_t fNDegreesPMBackground= ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NDegreesRotation();
    Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
    Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
    gamma->RotateZ(rotationValue);
@@ -1171,7 +1059,7 @@ void AliAnalysisTaskGammaConvV1::MoveParticleAccordingToVertex(AliAODConversionP
 void AliAnalysisTaskGammaConvV1::UpdateEventByEventData(){
    //see header file for documentation
    if(fGoodGammas->GetEntries() >0 ){
-      if(((AliConversionCuts*)fCutArray->At(fiCut))->UseTrackMultiplicity()){
+      if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
          fBGHandler[fiCut]->AddEvent(fGoodGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfESDTracks);
       }
       else{ // means we use #V0s for multiplicity
@@ -1211,7 +1099,9 @@ void AliAnalysisTaskGammaConvV1::Terminate(const Option_t *)
       if(((AliConversionCuts*)fCutArray->At(iCut))->GetCutHistograms()){
          fCutFolder[iCut]->Add(((AliConversionCuts*)fCutArray->At(iCut))->GetCutHistograms());
       }
+      if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
+         fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
+      }
    }
    fOutputContainer->Print();
 }
-
index a57e381..a4af0c5 100644 (file)
 #include "AliV0ReaderV1.h"
 #include "AliKFConversionPhoton.h"
 #include "AliGammaConversionAODBGHandler.h"
+#include "AliConversionMesonCuts.h"
 #include "TH3.h"
 
 
 class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
-public:
+ public:
 
-    AliAnalysisTaskGammaConvV1();
-    AliAnalysisTaskGammaConvV1(const char *name);
-    virtual ~AliAnalysisTaskGammaConvV1();
+   AliAnalysisTaskGammaConvV1();
+   AliAnalysisTaskGammaConvV1(const char *name);
+   virtual ~AliAnalysisTaskGammaConvV1();
 
-    virtual void   UserCreateOutputObjects();
-    virtual void   UserExec(Option_t *);
-    virtual void   Terminate(const Option_t*);
-    void InitBack();
+   virtual void   UserCreateOutputObjects();
+   virtual void   UserExec(Option_t *);
+   virtual void   Terminate(const Option_t*);
+   void InitBack();
 
-    void SetIsHeavyIon(Bool_t flag){fIsHeavyIon = flag;}
-    void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
-    void ProcessPhotonCandidates();
-    void CalculatePi0Candidates();
-    void CalculateBackground();
-    void ProcessMCParticles();
-    void ProcessTruePhotonCandidates( AliAODConversionPhoton* TruePhotonCandidate);
-    void ProcessTrueMesonCandidates( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);   
-    void RotateParticle(AliAODConversionPhoton *gamma);
-    void SetConversionCutList(Int_t nCuts, TList *CutArray){
-       fnCuts = nCuts;
-       fCutArray = CutArray;
-    }
-    
-    // BG HandlerSettings
-    void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
-    void CountESDTracks();
-    void MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
-    void UpdateEventByEventData();
+   void SetIsHeavyIon(Bool_t flag){fIsHeavyIon = flag;}
+   void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
+   void ProcessPhotonCandidates();
+   void CalculatePi0Candidates();
+   void CalculateBackground();
+   void ProcessMCParticles();
+   void ProcessTruePhotonCandidates( AliAODConversionPhoton* TruePhotonCandidate);
+   void ProcessTrueMesonCandidates( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
+   void RotateParticle(AliAODConversionPhoton *gamma);
+   void SetConversionCutList(Int_t nCuts, TList *CutArray){
+      fnCuts = nCuts;
+      fCutArray = CutArray;
+   }
+   void SetMesonCutList(Int_t nCuts, TList *CutArray){
+      fnCuts = nCuts;
+      fMesonCutArray = CutArray;
+   }
 
-protected:
-    AliV0ReaderV1 *fV0Reader;
-    AliGammaConversionAODBGHandler **fBGHandler;
-    AliESDEvent *fESDEvent;
-    AliMCEvent *fMCEvent;
-    AliStack *fMCStack;
-    TList **fCutFolder;
-    TList **fESDList;
-    TList **fBackList;
-    TList **fTrueList;
-    TList **fMCList;
-    TList *fOutputContainer;
-    TClonesArray *fReaderGammas;
-    TList *fGoodGammas;
-    TList *fCutArray;
-    AliConversionCuts *fConversionCuts;
-    TH1F **hESDConvGammaPt;
-    TH2F **hESDMotherInvMassPt;
-    THnSparseF **sESDMotherInvMassPtZM;
-    TH2F **hESDMotherBackInvMassPt;
-    THnSparseF **sESDMotherBackInvMassPtZM;
-    TH2F **hESDMotherInvMassEalpha;
-    TH1F **hMCAllGammaPt;
-        TH1F **hMCAllGammaPtAddedSig;
-    TH1F **hMCDecayGammaPi0Pt;
-        TH1F **hMCDecayGammaPi0PtAddedSig;
-    TH1F **hMCDecayGammaRhoPt;
-        TH1F **hMCDecayGammaRhoPtAddedSig;
-    TH1F **hMCDecayGammaEtaPt;
-        TH1F **hMCDecayGammaEtaPtAddedSig;
-    TH1F **hMCDecayGammaOmegaPt;
-        TH1F **hMCDecayGammaOmegaPtAddedSig;
-    TH1F **hMCDecayGammaEtapPt;
-        TH1F **hMCDecayGammaEtapPtAddedSig;
-    TH1F **hMCDecayGammaPhiPt;
-        TH1F **hMCDecayGammaPhiPtAddedSig;
-    TH1F **hMCConvGammaPt;
-        TH1F **hMCConvGammaPtAddedSig;
-    TH1F **hMCPi0Pt;
-    TH1F **hMCEtaPt;
-    TH1F **hMCPi0InAccPt;
-    TH1F **hMCEtaInAccPt;
-        TH1F **hMCPi0PtAddedSig;
-    TH1F **hMCEtaPtAddedSig;
-    TH1F **hMCPi0InAccPtAddedSig;
-    TH1F **hMCEtaInAccPtAddedSig;
-    TH2F **hESDTrueMotherInvMassPt;
-        TH2F **hESDTrueMotherInvMassPtAddedSig;
-    TH2F **hESDTruePrimaryMotherInvMassMCPt;
-        TH2F **hESDTruePrimaryMotherInvMassMCPtAddedSig;
-    TH2F **hESDTruePrimaryPi0ESDPtMCPt;
-        TH2F **hESDTruePrimaryPi0ESDPtMCPtAddedSig;
-    TH2F **hESDTrueSecondaryMotherInvMassPt;
-        TH2F **hESDTrueSecondaryMotherInvMassPtAddedSig;
-    TH2F **hESDTrueSecondaryMotherFromK0sInvMassPt;
-        TH2F **hESDTrueSecondaryMotherFromK0sInvMassPtAddedSig;
-    TH2F **hESDTrueBckGGInvMassPt;
-    TH2F **hESDTrueBckContInvMassPt;
-    TH2F **hESDTrueMotherDalitzInvMassPt;
-        TH2F **hESDTrueMotherDalitzInvMassPtAddedSig;
-    TH1F **hESDTrueConvGammaPt;
-        TH1F **hESDTrueConvGammaPtAddedSig;
-    TH1F **hESDTrueElecCombPt;
-    TH1F **hESDTruePionCombPt;
-    TH1F **hESDTruePrimaryConvGammaPt;
-        TH1F **hESDTruePrimaryConvGammaPtAddedSig;
-    TH2F **hESDTruePrimaryConvGammaESDPtMCPt;
-        TH2F **hESDTruePrimaryConvGammaESDPtMCPtAddedSig;
-    TH1F **hESDTrueSecondaryConvGammaPt;
-        TH1F **hESDTrueSecondaryConvGammaPtAddedSig;
-    TH1F **hESDTrueSecondaryConvGammaFromK0sPt;
-        TH1F **hESDTrueSecondaryConvGammaFromK0sPtAddedSig;
-    TH1F **hESDTrueSecondaryConvGammaFromXFromK0sPt;
-        TH1F **hESDTrueSecondaryConvGammaFromXFromK0sPtAddedSig;
-    TH1I **hNEvents;
-    TH1I **hNGoodESDTracks;
-        TH1I **hNV0Tracks;
-        
-    TRandom3 fRandom;
-    Double_t *fUnsmearedPx;
-    Double_t *fUnsmearedPy;
-    Double_t *fUnsmearedPz;
-    Double_t *fUnsmearedE;
-    Int_t fnCuts;
-    Int_t fiCut;
-    Int_t fNumberOfESDTracks;
-    Bool_t fMoveParticleAccordingToVertex;
-    Bool_t fIsHeavyIon;
-    Bool_t fDoMesonAnalysis;
-    
-    ClassDef(AliAnalysisTaskGammaConvV1, 2);
+   // BG HandlerSettings
+   void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
+   void CountESDTracks();
+   void MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex);
+   void UpdateEventByEventData();
+
+ protected:
+   AliV0ReaderV1 *fV0Reader;
+   AliGammaConversionAODBGHandler **fBGHandler;
+   AliESDEvent *fESDEvent;
+   AliMCEvent *fMCEvent;
+   AliStack *fMCStack;
+   TList **fCutFolder;
+   TList **fESDList;
+   TList **fBackList;
+   TList **fMotherList;
+   TList **fTrueList;
+   TList **fMCList;
+   TList **fHeaderNameList;
+   TList *fOutputContainer;
+   TClonesArray *fReaderGammas;
+   TList *fGoodGammas;
+   TList *fCutArray;
+   AliConversionCuts *fConversionCuts;
+       TList *fMesonCutArray;
+       AliConversionMesonCuts *fMesonCuts;
+   TH1F **hESDConvGammaPt;
+   TH2F **hESDMotherInvMassPt;
+   THnSparseF **sESDMotherInvMassPtZM;
+   TH2F **hESDMotherBackInvMassPt;
+   THnSparseF **sESDMotherBackInvMassPtZM;
+   TH2F **hESDMotherInvMassEalpha;
+   TH1F **hMCAllGammaPt;
+   TH1F **hMCDecayGammaPi0Pt;
+   TH1F **hMCDecayGammaRhoPt;
+   TH1F **hMCDecayGammaEtaPt;
+   TH1F **hMCDecayGammaOmegaPt;
+   TH1F **hMCDecayGammaEtapPt;
+   TH1F **hMCDecayGammaPhiPt;
+   TH1F **hMCConvGammaPt;
+   TH1F **hMCConvGammaR;
+   TH1F **hMCConvGammaEta;
+   TH1F **hMCPi0Pt;
+   TH1F **hMCEtaPt;
+   TH1F **hMCPi0InAccPt;
+   TH1F **hMCEtaInAccPt;
+   TH2F **hESDTrueMotherInvMassPt;
+   TH2F **hESDTruePrimaryMotherInvMassMCPt;
+   TH2F **hESDTruePrimaryPi0ESDPtMCPt;
+   TH2F **hESDTrueSecondaryMotherInvMassPt;
+   TH2F **hESDTrueSecondaryMotherFromK0sInvMassPt;
+   TH2F **hESDTrueBckGGInvMassPt;
+   TH2F **hESDTrueBckContInvMassPt;
+   TH2F **hESDTrueMotherDalitzInvMassPt;
+   TH1F **hESDTrueConvGammaPt;
+   TH1F **hESDTrueTwoElecCombPt;
+   TH1F **hESDTrueTwoPionCombPt;
+   TH1F **hESDTrueElecPionCombPt;
+   TH1F **hESDTrueCombPt;
+   TH1F **hESDTruePrimaryConvGammaPt;
+   TH1F **hESDTruePrimaryConvGammaR;
+   TH1F **hESDTruePrimaryConvGammaEta;
+   TH2F **hESDTruePrimaryConvGammaESDPtMCPt;
+   TH1F **hESDTrueSecondaryConvGammaPt;
+   TH1F **hESDTrueSecondaryConvGammaFromK0sPt;
+   TH1F **hESDTrueSecondaryConvGammaFromXFromK0sPt;
+   TH1I **hNEvents;
+   TH1I **hNGoodESDTracks;
+   TH1I **hNV0Tracks;
+
+   TRandom3 fRandom;
+   Double_t *fUnsmearedPx;
+   Double_t *fUnsmearedPy;
+   Double_t *fUnsmearedPz;
+   Double_t *fUnsmearedE;
+   Int_t fnCuts;
+   Int_t fiCut;
+   Int_t fNumberOfESDTracks;
+   Int_t fNumberOfHijingPythiaParticles;
+   Bool_t fMoveParticleAccordingToVertex;
+   Bool_t fIsHeavyIon;
+   Bool_t fDoMesonAnalysis;
+
+   ClassDef(AliAnalysisTaskGammaConvV1, 2);
 };
 
 #endif
diff --git a/PWGGA/GammaConv/AliAnalysisTaskMaterial.cxx b/PWGGA/GammaConv/AliAnalysisTaskMaterial.cxx
new file mode 100644 (file)
index 0000000..6032504
--- /dev/null
@@ -0,0 +1,352 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                                                                                                                                             *
+ * Authors: Friederike Bock                                                                                                                    *
+ * Version 1.0                                                                                                                                                         *
+ *                                                                                                                                                                                             *
+ * Permission to use, copy, modify and distribute this software and its         *
+ * documentation strictly for non-commercial purposes is hereby granted         *
+ * without fee, provided that the above copyright notice appears in all         *
+ * copies and that both the copyright notice and this permission notice         *
+ * appear in the supporting documentation. The authors make no claims   *
+ * about the suitability of this software for any purpose. It is                       *
+ * provided "as is" without express or implied warranty.                                               *
+ **************************************************************************/
+
+////////////////////////////////////////////////
+//---------------------------------------------
+// QA Task for V0 Reader V1
+//---------------------------------------------
+////////////////////////////////////////////////
+
+#include "AliAnalysisTaskMaterial.h"
+#include "TChain.h"
+#include "AliAnalysisManager.h"
+#include "TParticle.h"
+#include "TVectorF.h"
+#include "AliPIDResponse.h"
+#include "AliESDtrackCuts.h"
+#include "TFile.h"
+
+class iostream;
+
+using namespace std;
+
+ClassImp(AliAnalysisTaskMaterial)
+
+//________________________________________________________________________
+AliAnalysisTaskMaterial::AliAnalysisTaskMaterial(const char *name) : AliAnalysisTaskSE(name),
+   fConversionGammas(NULL),
+   fConversionCuts(NULL),
+   fStreamMaterial(NULL),
+   fStreamResolution(NULL),
+   fIsHeavyIon(kFALSE),
+   fOutputList(NULL),
+   fESDEvent(NULL),
+   fMCEvent(NULL)
+{
+   // Default constructor
+
+   DefineInput(0, TChain::Class());
+   DefineOutput(1, TList::Class());
+}
+
+//________________________________________________________________________
+AliAnalysisTaskMaterial::~AliAnalysisTaskMaterial()
+{
+   // default deconstructor
+   if(fStreamMaterial){
+      delete fStreamMaterial;
+      fStreamMaterial = 0x0;
+   }
+   if(fStreamResolution){
+      delete fStreamResolution;
+      fStreamResolution = 0x0;
+   }
+}
+//________________________________________________________________________
+void AliAnalysisTaskMaterial::UserCreateOutputObjects()
+{
+   // Create User Output Objects
+
+   if(fOutputList != NULL){
+      delete fOutputList;
+      fOutputList = NULL;
+   }
+   if(fOutputList == NULL){
+      fOutputList = new TList();
+      fOutputList->SetOwner(kTRUE);
+   }
+
+   // V0 Reader Cuts
+   TString cutnumber = fConversionCuts->GetCutNumber();
+
+   fStreamMaterial = new TTreeSRedirector(Form("GammaConvV1_Material_%s.root",cutnumber.Data()));
+       fStreamResolution = new TTreeSRedirector(Form("GammaConvV1_Resolution_%s.root",cutnumber.Data()));
+   PostData(1, fOutputList);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskMaterial::UserExec(Option_t *){
+
+   fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
+
+   Int_t eventQuality = ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetEventQuality();
+   if(eventQuality != 0){// Event Not Accepted
+      return;
+   }
+   fESDEvent = (AliESDEvent*) InputEvent();
+   if(fIsHeavyIon && !fConversionCuts->IsCentralitySelected(fESDEvent)) return;
+       Int_t nESDtracks = CountESDTracks(); // Estimate Event Multiplicity
+       Int_t nContrVtx;
+       if(fESDEvent){
+               if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
+                       nContrVtx = fESDEvent->GetPrimaryVertexTracks()->GetNContributors();
+               } else if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
+                       if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
+                               nContrVtx = fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
+
+                       } else if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
+                               nContrVtx = 0;
+                       }
+               }
+   }
+       Int_t primVtxZ = fESDEvent->GetPrimaryVertex()->GetZ();
+       
+       if (fStreamMaterial){
+               (*fStreamMaterial)<<"Event"
+                                               << "primVtxZ=" << primVtxZ
+                                               << "nContrVtx=" << nContrVtx
+                                               << "nGoodTracks=" << nESDtracks
+                                               << "\n";
+       }
+       
+   fConversionGammas=fV0Reader->GetReconstructedGammas();
+       if(MCEvent()){
+               fMCEvent = MCEvent();
+       }
+   ProcessPhotons();
+       if(MCEvent()){
+               ProcessMCPhotons();
+       }
+   PostData(1, fOutputList);
+}
+
+
+///________________________________________________________________________
+void AliAnalysisTaskMaterial::ProcessMCPhotons(){
+       // Loop over all primary MC particle
+       AliStack *ffMCStack = fMCEvent->Stack();
+       for(Int_t i = 0; i < ffMCStack->GetNprimary(); i++) {
+               TParticle* particle = (TParticle *)ffMCStack->Particle(i);
+               if (!particle) continue;                
+               if(fConversionCuts->PhotonIsSelectedMC(particle,ffMCStack,kFALSE)){
+                       Float_t gammaPt = particle->Pt();
+                       Float_t gammaP = particle->P();
+                       Float_t gammaEta = particle->Eta();
+                       if (fStreamMaterial){
+                               (*fStreamMaterial)<<"AllGamma"
+                                                               << "pt=" << gammaPt
+                                                               << "p=" << gammaP
+                                                               << "eta=" << gammaEta
+                                                               << "\n";
+                       }       
+               }
+               if(fConversionCuts->PhotonIsSelectedMC(particle,ffMCStack,kTRUE)){
+                       Float_t gammaPt = particle->Pt();
+                       Float_t gammaP = particle->P();
+                       Float_t gammaEta = particle->Eta();
+                       TParticle* daughter = (TParticle *)ffMCStack->Particle(particle->GetFirstDaughter());
+                       Float_t gammaX = daughter->Vx();
+                       Float_t gammaY =  daughter->Vy();
+                       Float_t gammaZ = daughter->Vz();
+                       Float_t gammaR = daughter->R();
+                       Float_t gammaPhi = particle->Phi();
+                       
+                       if (fStreamMaterial){
+                               (*fStreamMaterial)<<"ConvGammaMC"
+                                                               << "pt=" << gammaPt
+                                                               << "p=" << gammaP
+                                                               << "eta=" << gammaEta
+                                                               << "X=" << gammaX
+                                                               << "Y=" << gammaY
+                                                               << "Z=" << gammaZ
+                                                               << "R=" << gammaR
+                                                               << "Phi=" << gammaPhi
+                                                               << "\n";
+                       }
+               } // Converted MC Gamma
+       }       
+}
+
+///________________________________________________________________________
+void AliAnalysisTaskMaterial::ProcessPhotons(){
+
+       // Fill Histograms for QA and MC
+   for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
+      AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
+      if(!fConversionCuts->PhotonIsSelected(gamma,fESDEvent)) continue;
+//             cout << "i=  " <<firstGammaIndex << " of "<< fConversionGammas->GetEntriesFast() << endl;
+      Float_t gammaPt = gamma->GetPhotonPt();
+               Float_t gammaP = gamma->GetPhotonP();
+               Float_t gammaEta = gamma->GetPhotonEta();
+               Float_t gammaChi2NDF = gamma->GetChi2perNDF();
+               Float_t gammaX = gamma->GetConversionX();
+               Float_t gammaY = gamma->GetConversionY();
+               Float_t gammaZ = gamma->GetConversionZ();
+      Float_t gammaR = gamma->GetConversionRadius();
+               Float_t gammaPhi = gamma->GetPhotonPhi();
+               UInt_t kind = 9;
+               if(fMCEvent){
+//                     cout << "generating MC stack"<< endl;
+                       AliStack *fMCStack = fMCEvent->Stack();
+                       if (!fMCStack) continue;
+                       TParticle *posDaughter = gamma->GetPositiveMCDaughter(fMCStack);
+                       TParticle *negDaughter = gamma->GetNegativeMCDaughter(fMCStack);
+//                     cout << "generate Daughters: "<<posDaughter << "\t" << negDaughter << endl;
+                       
+                       if(posDaughter == NULL || negDaughter == NULL){ 
+                               kind = 9; // garbage
+//                             cout << "one of the daughters not available" << endl;
+                       } else if(posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)){ 
+                               // Not Same Mother == Combinatorial Bck
+                               kind = 1;
+//                             cout << "not the same mother" << endl;
+                               Int_t pdgCodePos; 
+                               if (posDaughter->GetPdgCode()) pdgCodePos = posDaughter->GetPdgCode(); else continue;
+                               Int_t pdgCodeNeg; 
+                               if (negDaughter->GetPdgCode()) pdgCodeNeg = negDaughter->GetPdgCode(); else continue;
+//                             cout << "PDG codes daughters: " << pdgCodePos << "\t" << pdgCodeNeg << endl;
+                               if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11)
+                                       kind = 10; //Electron Combinatorial
+                               if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11 && (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1))
+                                       kind = 15; //direct Electron Combinatorial
+                               
+                               if(TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==211)
+                                       kind = 11; //Pion Combinatorial
+                               if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==2212) ||
+                                       (TMath::Abs(pdgCodePos)==2212 && TMath::Abs(pdgCodeNeg)==211))
+                                       kind = 12; //Pion, Proton Combinatorics
+                               if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==11) ||
+                                       (TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==211))
+                                       kind = 13; //Pion, Electron Combinatorics
+                               if (TMath::Abs(pdgCodePos)==321 || TMath::Abs(pdgCodeNeg)==321) 
+                                       kind = 14; //Kaon combinatorics
+
+                       } else {
+//                             cout << "same mother" << endl;
+                               Int_t pdgCodePos; 
+                               if (posDaughter->GetPdgCode()) pdgCodePos = posDaughter->GetPdgCode(); else continue;
+                               Int_t pdgCodeNeg; 
+                               if (negDaughter->GetPdgCode()) pdgCodeNeg = negDaughter->GetPdgCode(); else continue;
+//                             cout << "PDG codes daughters: " << pdgCodePos << "\t" << pdgCodeNeg << endl;
+                               Int_t pdgCode; 
+                               if (gamma->GetMCParticle(fMCStack)->GetPdgCode()) pdgCode = gamma->GetMCParticle(fMCStack)->GetPdgCode(); else continue;
+//                             cout << "PDG code: " << pdgCode << endl;
+                               if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11)
+                                       kind = 2; // combinatorics from hadronic decays
+                               else if ( !(pdgCodeNeg==pdgCodePos)){
+                                       TParticle *truePhotonCanditate = gamma->GetMCParticle(fMCStack);
+                                       if(pdgCode == 111) 
+                                               kind = 3; // pi0 Dalitz
+                                       else if (pdgCode == 221) 
+                                               kind = 4; // eta Dalitz
+                                       else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
+                                               if(pdgCode == 22 && negDaughter->GetMother(0) <= fMCStack->GetNprimary()){
+                                                       kind = 0; // primary photons
+                                               } else if (pdgCode == 22){
+                                                       kind = 5; //secondary photons
+                                               }
+                                               if(pdgCode == 22){
+                                                       Float_t mcPt   = truePhotonCanditate->Pt();
+                                                       Float_t mcR = gamma->GetNegativeMCDaughter(fMCStack)->R();
+                                                       Float_t mcZ = gamma->GetNegativeMCDaughter(fMCStack)->Vz();
+                                                       Float_t mcPhi = gamma->GetNegativeMCDaughter(fMCStack)->Phi();
+                                                       Float_t mcEta = gamma->GetNegativeMCDaughter(fMCStack)->Eta();
+                                                       if (fStreamResolution){
+                                                               (*fStreamResolution)<<"Resolution"
+                                                               << "ESDpt=" << gammaPt
+                                                               << "ESDphi=" << gammaPhi
+                                                               << "ESDeta=" << gammaEta
+                                                               << "ESDr="<< gammaR
+                                                               << "ESDz="<< gammaZ
+                                                               << "MCpt=" << mcPt
+                                                               << "MCphi=" << mcPhi
+                                                               << "MCeta=" << mcEta
+                                                               << "MCr="<< mcR
+                                                               << "MCz="<< mcZ
+                                                               << "chi2ndf=" << gammaChi2NDF
+                                                               << "\n";
+                                                       }
+                                               }               
+                                       } else  kind = 9; //garbage
+                               } else kind = 9; //garbage
+                       }
+//                     cout << gammaPt << "\t" << gammaP<< "\t" << gammaEta<<  "\t" <<gammaChi2NDF << "\t" << gammaX<<  "\t" <<gammaY << "\t" << gammaZ<< "\t" << gammaR<<  "\t" <<  gammaPhi<< "\t" <<kind << endl;
+               
+                       if (fStreamMaterial){
+                               (*fStreamMaterial)<<"ConvPointRec"
+                                                               << "pt=" << gammaPt
+                                                               << "p=" << gammaP
+                                                               << "eta=" << gammaEta
+                                                               << "chi2ndf=" << gammaChi2NDF
+                                                               << "kind=" << kind
+                                                               << "X=" << gammaX
+                                                               << "Y=" << gammaY
+                                                               << "Z=" << gammaZ
+                                                               << "R=" << gammaR
+                                                               << "Phi=" << gammaPhi
+                                                               << "\n";
+                       }               
+               } else {
+                               if (fStreamMaterial){
+                               (*fStreamMaterial)<<"ConvPointRec"
+                                                               << "pt=" << gammaPt
+                                                               << "p=" << gammaP
+                                                               << "eta=" << gammaEta
+                                                               << "chi2ndf=" << gammaChi2NDF
+                                                               << "X=" << gammaX
+                                                               << "Y=" << gammaY
+                                                               << "Z=" << gammaZ
+                                                               << "R=" << gammaR
+                                                               << "Phi=" << gammaPhi
+                                                               << "\n";
+                       }
+               }
+       }
+}
+
+//________________________________________________________________________
+Int_t AliAnalysisTaskMaterial::CountESDTracks(){
+
+   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
+   // Using standard function for setting Cuts
+   Bool_t selectPrimaries=kTRUE;
+   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+   EsdTrackCuts->SetMaxDCAToVertexZ(2);
+   EsdTrackCuts->SetEtaRange(-0.8, 0.8);
+   EsdTrackCuts->SetPtRange(0.15);
+
+   Int_t fNumberOfESDTracks = 0;
+   for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
+      AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
+      if(!curTrack) continue;
+      if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTracks++;
+   }
+   delete EsdTrackCuts;
+   EsdTrackCuts=0x0;
+
+   return fNumberOfESDTracks;
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskMaterial::Terminate(Option_t *)
+{
+   if (fStreamMaterial){
+      fStreamMaterial->GetFile()->Write();
+   }
+   if (fStreamResolution){
+      fStreamResolution->GetFile()->Write();
+   }
+}
diff --git a/PWGGA/GammaConv/AliAnalysisTaskMaterial.h b/PWGGA/GammaConv/AliAnalysisTaskMaterial.h
new file mode 100644 (file)
index 0000000..d5f121d
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef AliAnalysisTaskMaterial_cxx
+#define AliAnalysisTaskMaterial_cxx
+
+#include "AliAnalysisTaskSE.h"
+#include "AliConversionPhotonBase.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TTreeStream.h"
+#include "AliLog.h"
+#include <vector>
+#include "AliV0ReaderV1.h"
+#include "AliConversionCuts.h"
+#include "TList.h"
+#include "AliStack.h"
+#include "TClonesArray.h"
+
+
+using namespace std;
+
+
+class AliAnalysisTaskMaterial : public AliAnalysisTaskSE{
+
+public:
+
+    AliAnalysisTaskMaterial(const char *name);
+    virtual ~AliAnalysisTaskMaterial();
+
+    virtual void   UserCreateOutputObjects();
+    virtual void   UserExec(Option_t *option);
+    virtual void   Terminate(Option_t *);
+
+    void SetV0Reader(AliV0ReaderV1 *v0Reader){fV0Reader=v0Reader;}
+    void SetConversionCuts(AliConversionCuts* conversionCuts,Bool_t IsHeavyIon ){
+       fConversionCuts=conversionCuts;
+       fIsHeavyIon = IsHeavyIon;
+    }
+    
+private:
+
+    void ProcessPhotons();
+        void ProcessMCPhotons();
+        Int_t CountESDTracks();
+        
+    AliV0ReaderV1 *fV0Reader;
+    TClonesArray *fConversionGammas; //Reconstructed Photons;
+    AliConversionCuts *fConversionCuts; // Cuts used by the V0Reader
+    TTreeSRedirector *fStreamMaterial;
+        TTreeSRedirector *fStreamResolution;
+    Bool_t fIsHeavyIon;
+    TList *fOutputList;
+        AliESDEvent *fESDEvent;
+        AliMCEvent *fMCEvent;
+       
+    ClassDef(AliAnalysisTaskMaterial, 0);
+};
+
+#endif
+
index 7848988..c0c4db5 100644 (file)
@@ -30,11 +30,8 @@ ClassImp(AliAnalysisTaskPi0v2)
     fCentralityBins(NULL),
     fCentrality(-1),
     fCentralityBin(0),
-    fNRadialBins(1),
-    fRadialBins(NULL),
     fNBinsPhi(6),
     fEP(NULL),
-    fWeightMultiplicity(kTRUE),
     fEtaMax(0.75),
     fEtaGap(1),
     fRPTPCEtaA(0),
@@ -44,6 +41,8 @@ ClassImp(AliAnalysisTaskPi0v2)
     fNCuts(0),
     fCutList(NULL),
     fConversionCuts(NULL),
+    fMesonCutList(NULL),
+    fMesonCuts(NULL),
     fRandomizer(NULL),
     fOutputList(NULL),
     fMesonPDGCode(kPi0),
@@ -70,6 +69,21 @@ ClassImp(AliAnalysisTaskPi0v2)
     hRPTPCEtaC(NULL),
     hRPTPCEtaAC(NULL),
     hCos2TPCEta(NULL),
+    hCos2TPCWeightedPhoton(NULL),
+    hCos2TPCEtaWeightedPhoton(NULL),
+    hCos2V0ATPCWeightedPhoton(NULL),
+    hCos2V0CTPCWeightedPhoton(NULL),
+    hCos2V0ACWeightedPhoton(NULL),
+    hCos2TPCWeightedCharged(NULL),
+    hCos2TPCEtaWeightedCharged(NULL),
+    hCos2V0ATPCWeightedCharged(NULL),
+    hCos2V0CTPCWeightedCharged(NULL),
+    hCos2V0ACWeightedCharged(NULL),
+    hCos2TPCWeightedV0Mult(NULL),
+    hCos2TPCEtaWeightedV0Mult(NULL),
+    hCos2V0ATPCWeightedV0Mult(NULL),
+    hCos2V0CTPCWeightedV0Mult(NULL),
+    hCos2V0ACWeightedV0Mult(NULL),
     hGammaMultCent(NULL),
     hGammaPhi(NULL),
     hMultChargedvsNGamma(NULL),
@@ -83,13 +97,15 @@ ClassImp(AliAnalysisTaskPi0v2)
     hGammaMultdPhi(NULL),
     hGammaMult(NULL),
     hGamma(NULL),
+    hGammaFull(NULL),
     hCharged(NULL),
     hPi0(NULL),
     hPi0BG(NULL),
 
     fMultV0(0x0),
     fV0Cpol(0.),
-    fV0Apol(0.)
+    fV0Apol(0.),
+    hEPVertex(NULL)
 
 {
     fInvMassRange=new Double_t[2];
@@ -119,14 +135,15 @@ AliAnalysisTaskPi0v2::~AliAnalysisTaskPi0v2(){
        delete fInvMassRange;
         fInvMassRange=NULL;
     }
-    if(fRadialBins){
-       delete fRadialBins;
-       fRadialBins=NULL;
-    }
     if(fCutList){
        delete fCutList;
        fCutList=NULL;
     }
+    if(fMesonCutList){
+        delete fMesonCutList;
+        fMesonCutList=NULL;
+    }
+
     if(fConversionSelection){
        delete fConversionSelection;
        fConversionSelection=NULL;
@@ -174,10 +191,10 @@ void AliAnalysisTaskPi0v2::UserCreateOutputObjects()
     Double_t maxpi0[knbinsPi0]={kGClastYBinSpectra,kGClastXBinSpectra,TMath::Pi()/2,fNCentralityBins-0.5,fNEPMethods-0.5};
     const char *binpi0[knbinsPi0]={"pt","mass","dPhi","centr","EPm"};
 
-    Int_t nbinsg[knbinsGamma]={kGCnYBinsSpectra,fNRadialBins,6,fNCentralityBins,fNEPMethods};
-    Double_t ming[knbinsGamma]={kGCfirstYBinSpectra,-0.5,0,-0.5,-0.5};
-    Double_t maxg[knbinsGamma]={kGClastYBinSpectra,fNRadialBins-0.5,TMath::Pi()/2,fNCentralityBins-0.5,fNEPMethods-0.5};
-    const char *bingamma[knbinsGamma]={"pt","R","dPhi","centr","EPm"};
+    Int_t nbinsg[knbinsGamma]={kGCnYBinsSpectra,6,fNCentralityBins,fNEPMethods};
+    Double_t ming[knbinsGamma]={kGCfirstYBinSpectra,0,-0.5,-0.5};
+    Double_t maxg[knbinsGamma]={kGClastYBinSpectra,TMath::Pi()/2,fNCentralityBins-0.5,fNEPMethods-0.5};
+    const char *bingamma[knbinsGamma]={"pt","dPhi","centr","EPm"};
 
     // Define Binning
 
@@ -278,6 +295,64 @@ void AliAnalysisTaskPi0v2::UserCreateOutputObjects()
        hCos2V0AC=new TH2F("Cos2_V0AC" ,"Cos2_V0AC" ,fNCentralityBins,fCentralityBins,100,-1,1);
        hCos2V0AC->Sumw2();
        fRPList->Add(hCos2V0AC);
+
+       hCos2TPCWeightedPhoton=new TH2F("Cos2_TPCAC_WeightedPhoton" ,"Cos2_TPCAC_WeightedPhoton" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2TPCWeightedPhoton->Sumw2();
+       fRPList->Add(hCos2TPCWeightedPhoton);
+       hCos2TPCEtaWeightedPhoton=new TH2F("Cos2_TPCEtaAC_WeightedPhoton" ,"Cos2_TPCEtaAC_WeightedPhoton" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2TPCEtaWeightedPhoton->Sumw2();
+       fRPList->Add(hCos2TPCEtaWeightedPhoton);
+       hCos2V0ATPCWeightedPhoton=new TH2F("Cos2_V0ATPC_WeightedPhoton" ,"Cos2_V0ATPC_WeightedPhoton" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0ATPCWeightedPhoton->Sumw2();
+       fRPList->Add(hCos2V0ATPCWeightedPhoton);
+       hCos2V0CTPCWeightedPhoton=new TH2F("Cos2_V0CTPC_WeightedPhoton" ,"Cos2_V0CTPC_WeightedPhoton" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0CTPCWeightedPhoton->Sumw2();
+       fRPList->Add(hCos2V0CTPCWeightedPhoton);
+       hCos2V0ACWeightedPhoton=new TH2F("Cos2_V0AC_WeightedPhoton" ,"Cos2_V0AC_WeightedPhoton" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0ACWeightedPhoton->Sumw2();
+       fRPList->Add(hCos2V0ACWeightedPhoton);
+
+       hCos2TPCWeightedCharged=new TH2F("Cos2_TPCAC_WeightedCharged" ,"Cos2_TPCAC_WeightedCharged" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2TPCWeightedCharged->Sumw2();
+       fRPList->Add(hCos2TPCWeightedCharged);
+       hCos2TPCEtaWeightedCharged=new TH2F("Cos2_TPCEtaAC_WeightedCharged" ,"Cos2_TPCEtaAC_WeightedCharged" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2TPCEtaWeightedCharged->Sumw2();
+       fRPList->Add(hCos2TPCEtaWeightedCharged);
+       hCos2V0ATPCWeightedCharged=new TH2F("Cos2_V0ATPC_WeightedCharged" ,"Cos2_V0ATPC_WeightedCharged" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0ATPCWeightedCharged->Sumw2();
+       fRPList->Add(hCos2V0ATPCWeightedCharged);
+       hCos2V0CTPCWeightedCharged=new TH2F("Cos2_V0CTPC_WeightedCharged" ,"Cos2_V0CTPC_WeightedCharged" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0CTPCWeightedCharged->Sumw2();
+       fRPList->Add(hCos2V0CTPCWeightedCharged);
+       hCos2V0ACWeightedCharged=new TH2F("Cos2_V0AC_WeightedCharged" ,"Cos2_V0AC_WeightedCharged" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0ACWeightedCharged->Sumw2();
+       fRPList->Add(hCos2V0ACWeightedCharged);
+
+       hCos2TPCWeightedV0Mult=new TH2F("Cos2_TPCAC_WeightedV0Mult" ,"Cos2_TPCAC_WeightedV0Mult" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2TPCWeightedV0Mult->Sumw2();
+       fRPList->Add(hCos2TPCWeightedV0Mult);
+       hCos2TPCEtaWeightedV0Mult=new TH2F("Cos2_TPCEtaAC_WeightedV0Mult" ,"Cos2_TPCEtaAC_WeightedV0Mult" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2TPCEtaWeightedV0Mult->Sumw2();
+       fRPList->Add(hCos2TPCEtaWeightedV0Mult);
+       hCos2V0ATPCWeightedV0Mult=new TH2F("Cos2_V0ATPC_WeightedV0Mult" ,"Cos2_V0ATPC_WeightedV0Mult" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0ATPCWeightedV0Mult->Sumw2();
+       fRPList->Add(hCos2V0ATPCWeightedV0Mult);
+       hCos2V0CTPCWeightedV0Mult=new TH2F("Cos2_V0CTPC_WeightedV0Mult" ,"Cos2_V0CTPC_WeightedV0Mult" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0CTPCWeightedV0Mult->Sumw2();
+       fRPList->Add(hCos2V0CTPCWeightedV0Mult);
+       hCos2V0ACWeightedV0Mult=new TH2F("Cos2_V0AC_WeightedV0Mult" ,"Cos2_V0AC_WeightedV0Mult" ,fNCentralityBins,fCentralityBins,100,-1,1);
+       hCos2V0ACWeightedV0Mult->Sumw2();
+       fRPList->Add(hCos2V0ACWeightedV0Mult);
+
+        const Int_t nepbins=4;
+       Int_t nbinsep[nepbins]={30,30,40,180};
+       Double_t minep[nepbins]={-0.015,0.17,-10,0};
+       Double_t maxep[nepbins]={0.015,0.20,10,TMath::Pi()};
+
+       hEPVertex=new THnSparseF("EP_Vertex","EP_Vertex",nepbins,nbinsep,minep,maxep);
+       fRPList->Add(hEPVertex);
+
+       
     }
 
     TList *fPhotonQAList=new TList();
@@ -287,9 +362,9 @@ void AliAnalysisTaskPi0v2::UserCreateOutputObjects()
 
     if(fFillQA){
        // Gamma QA
-       hGammaPhi=new TH3F*[fNCentralityBins];
+       hGammaPhi=new TH2F*[fNCentralityBins];
        for(Int_t m=0;m<fNCentralityBins;m++){
-           hGammaPhi[m]=new TH3F(Form("%d_GammaPhi",m),"GammaPhi",kGCnYBinsSpectra,kGCfirstYBinSpectra,kGClastYBinSpectra,fNRadialBins,-0.5,fNRadialBins-0.5,360,0,2*TMath::Pi());
+           hGammaPhi[m]=new TH2F(Form("%d_GammaPhi",m),"GammaPhi",kGCnYBinsSpectra,kGCfirstYBinSpectra,kGClastYBinSpectra,360,0,2*TMath::Pi());
            hGammaPhi[m]->Sumw2();
            fPhotonQAList->Add(hGammaPhi[m]);
        }
@@ -308,11 +383,11 @@ void AliAnalysisTaskPi0v2::UserCreateOutputObjects()
        hMultChargedvsNGamma->Sumw2();
        fPhotonQAList->Add(hMultChargedvsNGamma);
 
-       Int_t nbinsgmult[knbinsGammaMult]={kGCnYBinsSpectra,fNRadialBins,400,fNCentralityBins};
-       Double_t mingmult[knbinsGammaMult]={kGCfirstYBinSpectra,-0.5,0,-0.5};
-       Double_t maxgmult[knbinsGammaMult]={kGClastYBinSpectra,fNRadialBins-0.5,8000,fNCentralityBins-0.5};
-       Double_t maxgmultdPhi[knbinsGammaMult]={kGClastYBinSpectra,fNRadialBins-0.5,2000,fNCentralityBins-0.5};
-       const char *bingammamult[knbinsGammaMult]={"pt","R","gmult","centr"};
+       Int_t nbinsgmult[knbinsGammaMult]={kGCnYBinsSpectra,400,fNCentralityBins};
+       Double_t mingmult[knbinsGammaMult]={kGCfirstYBinSpectra,0,-0.5};
+       Double_t maxgmult[knbinsGammaMult]={kGClastYBinSpectra,8000,fNCentralityBins-0.5};
+       Double_t maxgmultdPhi[knbinsGammaMult]={kGClastYBinSpectra,2000,fNCentralityBins-0.5};
+       const char *bingammamult[knbinsGammaMult]={"pt","gmult","centr"};
 
        if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()){
 
@@ -367,6 +442,15 @@ void AliAnalysisTaskPi0v2::UserCreateOutputObjects()
        hCharged->GetAxis(2)->SetName("EPm");
        hCharged->Sumw2();
        fPhotonQAList->Add(hCharged);
+
+       Int_t nbinsgfull[knbinsGamma]={kGCnYBinsSpectra,24,fNCentralityBins,fNEPMethods};
+       Double_t mingfull[knbinsGamma]={kGCfirstYBinSpectra,0,-0.5,-0.5};
+       Double_t maxgfull[knbinsGamma]={kGClastYBinSpectra,2*TMath::Pi(),fNCentralityBins-0.5,fNEPMethods-0.5};
+       hGammaFull=new THnSparseF("Gamma_Sparse_Full","Gamma_Sparse_Full",knbinsGamma,nbinsgfull,mingfull,maxgfull);
+       for(Int_t i=0;i<knbinsGamma;i++) hGammaFull->GetAxis(i)->SetName(bingamma[i]);
+       hGammaFull->Sumw2();
+       fPhotonQAList->Add(hGammaFull);
+
     }
     hNEvents=new TH1F("NEvents","NEvents",fNCentralityBins,fCentralityBins);
     fPhotonQAList->Add(hNEvents);
@@ -388,7 +472,8 @@ void AliAnalysisTaskPi0v2::InitConversionSelection(){
     for(Int_t iCut=0;iCut<fNCuts;iCut++){
        AliConversionCuts *fPhotonv2Cuts=(AliConversionCuts*)fCutList->At(iCut);
        if(iCut==0)fEtaMax=fPhotonv2Cuts->GetEtaCut();
-       fConversionSelection[iCut]=new AliConversionSelection(fPhotonv2Cuts);
+        AliConversionMesonCuts *fMesonv2Cuts=(AliConversionMesonCuts*)fMesonCutList->At(iCut);
+       fConversionSelection[iCut]=new AliConversionSelection(fPhotonv2Cuts,fMesonv2Cuts);
        fConversionSelection[iCut]->SetInvMassRange(fInvMassRange);
     }
 }
@@ -473,10 +558,7 @@ void AliAnalysisTaskPi0v2::ProcessPi0s(Int_t iCut,EEventPlaneMethod iEP){
     if(photonMultiplicity==0)return;
 
     // Process Pi0s
-    Float_t weight=1; // Weight for Multiplicity
-    if(fWeightMultiplicity){
-       weight*=1/Float_t(photonMultiplicity);
-    }
+    Float_t weight=1/Float_t(photonMultiplicity);
 
     for(Int_t ii=0;ii<fConversionSelection[iCut]->GetNumberOfPi0s();ii++){
 
@@ -485,14 +567,13 @@ void AliAnalysisTaskPi0v2::ProcessPi0s(Int_t iCut,EEventPlaneMethod iEP){
        if(!pi0cand)continue;
 
        Double_t val[knbinsPi0];
-       val[0]=pi0cand->Pt();
-       val[1]=pi0cand->M();
-       val[2]=GetPi0PhiwrtRP(pi0cand,iEP);
-       val[3]=fCentralityBin;
-       val[4]=Int_t(iEP);
+       val[kPi0Pt]=pi0cand->Pt();
+       val[kPi0Mass]=pi0cand->M();
+       val[kPi0dPhi]=GetPi0PhiwrtRP(pi0cand,iEP);
+       val[kPi0Cent]=fCentralityBin;
+       val[kPi0EPM]=Int_t(iEP);
 
        hPi0[iCut]->Fill(val,weight);
-
     }
 
     // Pi0 BG
@@ -503,11 +584,11 @@ void AliAnalysisTaskPi0v2::ProcessPi0s(Int_t iCut,EEventPlaneMethod iEP){
        if(!pi0cand)continue;
 
        Double_t val[knbinsPi0];
-       val[0]=pi0cand->Pt();
-       val[1]=pi0cand->M();
-       val[2]=GetPi0PhiwrtRP(pi0cand,iEP);
-       val[3]=fCentralityBin;
-       val[4]=Int_t(iEP);
+       val[kPi0Pt]=pi0cand->Pt();
+       val[kPi0Mass]=pi0cand->M();
+       val[kPi0dPhi]=GetPi0PhiwrtRP(pi0cand,iEP);
+       val[kPi0Cent]=fCentralityBin;
+       val[kPi0EPM]=Int_t(iEP);
 
        hPi0BG[iCut]->Fill(val,pi0cand->GetWeight()*weight);
     }
@@ -521,25 +602,30 @@ void AliAnalysisTaskPi0v2::ProcessGammas(Int_t iCut,EEventPlaneMethod iEP){
     Int_t photonMultiplicity=fConversionSelection[iCut]->GetMultiplicity(fInputEvent);
     if(photonMultiplicity==0)return;
 
-    Float_t weight=1; // Weight for Multiplicity
-    if(fWeightMultiplicity){
-       weight*=1/Float_t(photonMultiplicity);
-    }
+    Float_t weight=1/Float_t(photonMultiplicity);
 
     for(Int_t ii=0;ii<fConversionSelection[iCut]->GetNumberOfPhotons();ii++){
 
        AliAODConversionPhoton *gamma=fConversionSelection[iCut]->GetPhoton(ii);
 
        Double_t val[knbinsGamma];
-       val[0]=gamma->Pt();
-       val[1]=GetRadialBin(gamma->GetConversionRadius());
-       val[2]=GetPhotonPhiwrtRP(gamma,iEP);
-       val[3]=fCentralityBin;
-       val[4]=Int_t(iEP);
+       val[kGammaPt]=gamma->Pt();
+       val[kGammadPhi]=GetPhotonPhiwrtRP(gamma,iEP);
+       val[kGammaCent]=fCentralityBin;
+       val[kGammaEPM]=Int_t(iEP);
 
        hGamma[iCut]->Fill(val,weight);
 
-       if(iCut==0&&fFillQA)hGammadNdPhi->Fill(val);
+       if(iCut==0&&fFillQA){
+           hGammadNdPhi->Fill(val);
+
+           Double_t EPAngle=GetEventPlaneAngle(iEP,gamma->Eta(),gamma,NULL);
+           Double_t dPhi=gamma->Phi()-EPAngle;
+           if(dPhi>=(2*TMath::Pi()))dPhi-=2*TMath::Pi();
+           if(dPhi<0)dPhi+=2*TMath::Pi();
+           val[kGammadPhi]=dPhi;
+           hGammaFull->Fill(val);
+       }
     }
 }
 
@@ -562,10 +648,7 @@ void AliAnalysisTaskPi0v2::ProcessQA(){
     // Efficiency Purity
 
     Int_t photonMultiplicity=fConversionSelection[0]->GetMultiplicity(fInputEvent);
-    Float_t weight=1; // Weight for Multiplicity
-    if(fWeightMultiplicity){
-       weight*=1/Float_t(photonMultiplicity);
-    }
+    Float_t weight=1/Float_t(photonMultiplicity);
 
     Double_t valdPhi[knbinsGammaMult];
     Double_t val[knbinsGammaMult];
@@ -580,20 +663,18 @@ void AliAnalysisTaskPi0v2::ProcessQA(){
        for(Int_t ii=0;ii<fConversionSelection[0]->GetNumberOfPhotons();ii++){
            AliAODConversionPhoton *gamma=fConversionSelection[0]->GetPhoton(ii);
             val[0]=gamma->Pt();
-           val[1]=GetRadialBin(gamma->GetConversionRadius());
-           val[2]=ncharged;
-           val[3]=fCentralityBin;
+           val[1]=ncharged;
+           val[2]=fCentralityBin;
 
            valdPhi[0]=gamma->Pt();
-           valdPhi[1]=GetRadialBin(gamma->GetConversionRadius());
-           valdPhi[2]=dNdPhi[GetPhotonPhiBin(gamma,iEP)];
-           valdPhi[3]=fCentralityBin;
+           valdPhi[1]=dNdPhi[GetPhotonPhiBin(gamma,iEP)];
+           valdPhi[2]=fCentralityBin;
        
            hGammaMult[iEP]->Fill(val,weight);
            hGammaMultdPhi[iEP]->Fill(valdPhi,weight);
 
            // Gamma Phi
-           hGammaPhi[fCentralityBin]->Fill(gamma->Pt(),GetRadialBin(gamma->GetConversionRadius()),gamma->Phi());
+           hGammaPhi[fCentralityBin]->Fill(gamma->Pt(),gamma->Phi());
            hGammaMultCent->Fill(fCentrality,Float_t(fConversionSelection[0]->GetNumberOfPhotons()));
 
            if(fMCStack){
@@ -613,14 +694,12 @@ void AliAnalysisTaskPi0v2::ProcessQA(){
                    TParticle *daughter=(TParticle *)fMCStack->Particle(particle->GetDaughter(0));
                    if(daughter){
                        val[0]=particle->Pt();
-                       val[1]=GetRadialBin(daughter->R());
-                       val[2]=ncharged;
-                       val[3]=fCentralityBin;
+                       val[1]=ncharged;
+                       val[2]=fCentralityBin;
        
                        valdPhi[0]=particle->Pt();
-                       valdPhi[1]=GetRadialBin(daughter->R());
-                       valdPhi[2]=dNdPhi[GetPhiBin(GetMCPhotonPhiwrtRP(particle,EEventPlaneMethod(iEP)))];
-                       valdPhi[3]=fCentralityBin;
+                       valdPhi[1]=dNdPhi[GetPhiBin(GetMCPhotonPhiwrtRP(particle,EEventPlaneMethod(iEP)))];
+                       valdPhi[2]=fCentralityBin;
        
                        hGammaMultTRUE->Fill(val,weight);
                        hGammaMultdPhiTRUE->Fill(valdPhi,weight);
@@ -727,25 +806,29 @@ void AliAnalysisTaskPi0v2::Terminate(Option_t *)
 //________________________________________________________________________
 void AliAnalysisTaskPi0v2::ProcessEventPlane()
 {
-
     if(!fMCEvent&&fConversionCuts->IsHeavyIon()){
 
+        Double_t val[4];
+       val[0]=fInputEvent->GetPrimaryVertex()->GetX();
+         val[1]=fInputEvent->GetPrimaryVertex()->GetY();
+         val[2]=fInputEvent->GetPrimaryVertex()->GetZ();
+        val[3]=GetEventPlaneAngle(kTPC);
+         hEPVertex->Fill(val);
+
        // TPC EP
        Double_t PsiRP1=fEP->GetQsub1()->Phi()/2;
        Double_t PsiRP2=fEP->GetQsub2()->Phi()/2;
-       Double_t dPsi=fEP->GetQsubRes();
        Double_t EPTPC=GetEventPlaneAngle(kTPC);
 
        hRPTPC->Fill(fCentrality,EPTPC);
        hRPTPCAC->Fill(PsiRP1,PsiRP2);
-       hCos2TPC->Fill(fCentrality,TMath::Cos(2.*dPsi));
+       hCos2TPC->Fill(fCentrality,TMath::Cos(2*(PsiRP1-PsiRP2)));
 
        // TPC Eta Gap
        hRPTPCEtaA->Fill(fCentrality,fRPTPCEtaA);
         hRPTPCEtaC->Fill(fCentrality,fRPTPCEtaC);
        hRPTPCEtaAC->Fill(fRPTPCEtaA,fRPTPCEtaC);
-       dPsi=fRPTPCEtaA-fRPTPCEtaC;
-       hCos2TPCEta->Fill(fCentrality,TMath::Cos(2.*dPsi));
+       hCos2TPCEta->Fill(fCentrality,TMath::Cos(2.*(fRPTPCEtaA-fRPTPCEtaC)));
 
        // V0
        hCos2V0ATPC->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0A)));
@@ -758,6 +841,36 @@ void AliAnalysisTaskPi0v2::ProcessEventPlane()
        hRPV0ATPC->Fill(fRPV0A,EPTPC);
        hRPV0CTPC->Fill(fRPV0C,EPTPC);
        hRPV0AC->Fill(fRPV0A,fRPV0C);
+
+        // Weight with Photon Mult
+       Float_t weightphoton=Float_t(fConversionSelection[0]->GetNumberOfPhotons());
+
+       hCos2TPCWeightedPhoton->Fill(fCentrality,TMath::Cos(2*(PsiRP1-PsiRP2)),weightphoton);
+       hCos2TPCEtaWeightedPhoton->Fill(fCentrality,TMath::Cos(2.*(fRPTPCEtaA-fRPTPCEtaC)),weightphoton);
+       hCos2V0ATPCWeightedPhoton->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0A)),weightphoton);
+       hCos2V0CTPCWeightedPhoton->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0C)),weightphoton);
+       hCos2V0ACWeightedPhoton->Fill(fCentrality,TMath::Cos(2*(fRPV0C-fRPV0A)),weightphoton);
+
+       // Weight with charged Track Mult
+
+       Float_t weightcharged=Float_t(fConversionSelection[0]->GetNumberOfChargedTracks(fInputEvent));
+
+        hCos2TPCWeightedCharged->Fill(fCentrality,TMath::Cos(2*(PsiRP1-PsiRP2)),weightcharged);
+       hCos2TPCEtaWeightedCharged->Fill(fCentrality,TMath::Cos(2.*(fRPTPCEtaA-fRPTPCEtaC)),weightcharged);
+       hCos2V0ATPCWeightedCharged->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0A)),weightcharged);
+       hCos2V0CTPCWeightedCharged->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0C)),weightcharged);
+       hCos2V0ACWeightedCharged->Fill(fCentrality,TMath::Cos(2*(fRPV0C-fRPV0A)),weightcharged);
+
+       // Weight with V0 mult
+
+       Float_t weightv0Mult=Float_t(fConversionSelection[0]->GetVZEROMult(fInputEvent));
+
+        hCos2TPCWeightedV0Mult->Fill(fCentrality,TMath::Cos(2*(PsiRP1-PsiRP2)),weightv0Mult);
+       hCos2TPCEtaWeightedV0Mult->Fill(fCentrality,TMath::Cos(2.*(fRPTPCEtaA-fRPTPCEtaC)),weightv0Mult);
+       hCos2V0ATPCWeightedV0Mult->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0A)),weightv0Mult);
+       hCos2V0CTPCWeightedV0Mult->Fill(fCentrality,TMath::Cos(2*(EPTPC-fRPV0C)),weightv0Mult);
+       hCos2V0ACWeightedV0Mult->Fill(fCentrality,TMath::Cos(2*(fRPV0C-fRPV0A)),weightv0Mult);
+
     }
 }
 
@@ -779,7 +892,7 @@ Double_t AliAnalysisTaskPi0v2::GetCorrectedTPCEPAngle(AliAODConversionPhoton *ga
     if(gamma0)q0-=GetEPContribution(gamma0);
     if(gamma1)q0-=GetEPContribution(gamma1);
     Double_t EPangle=q0.Phi()/2;
-    EPangle=ApplyFlatteningTPC(EPangle,fCentrality);
+    //EPangle=ApplyFlatteningTPC(EPangle,fCentrality);
 
     return EPangle;
 }
@@ -890,37 +1003,6 @@ void AliAnalysisTaskPi0v2::SetCuts(TString *cutarray,Int_t ncuts){
     }
 }
 
-//________________________________________________________________________
-Int_t AliAnalysisTaskPi0v2::GetRadialBin(Double_t radius){
-    if(fNRadialBins<=1)return 0;
-    for(Int_t ii=0;ii<fNRadialBins;ii++){
-       if(radius>fRadialBins[ii]){
-           if(radius<fRadialBins[ii+1]){return ii;}
-       }
-    }
-    return -1;
-}
-
-
-
-//________________________________________________________________________
-void AliAnalysisTaskPi0v2::SetRadialBins(Float_t *bins,Int_t nbins)
-{
-    // Set Centrality bins for analysis
-
-    fNRadialBins=nbins;
-
-    if(fRadialBins){
-       delete[] fRadialBins;
-       fRadialBins=NULL;
-    }
-
-    fRadialBins=new Double_t[fNRadialBins+1];
-    for(Int_t ii=0;ii<=fNRadialBins;ii++){
-       fRadialBins[ii]=bins[ii];
-    }
-}
-
 //___________________________________________________________________________
 Int_t AliAnalysisTaskPi0v2::GetRunIndex(Int_t run){
 
index beae1cf..981bb59 100644 (file)
@@ -7,6 +7,7 @@
 #include "TH3.h"
 #include "AliLog.h"
 #include "AliConversionSelection.h"
+#include "AliConversionMesonCuts.h"
 #include "AliV0ReaderV1.h"
 #include "AliEventplane.h"
 #include "TVector2.h"
@@ -41,7 +42,6 @@ public:
     virtual void   Terminate(Option_t *);
 
     void SetCentralityBins(Double_t *bins,Int_t nbins);
-    void SetRadialBins(Float_t *bins,Int_t nbins);
 
     void SetMeson(EPDGCode meson){fMesonPDGCode=meson;}
 
@@ -52,10 +52,12 @@ public:
 
     void SetMesonCuts(const TString cut);
     void SetCuts(TString *cutarray,Int_t ncuts);
+    void SetMesonCutList(Int_t nCuts, TList *cutArray){
+      fMesonCutList = cutArray;
+    }
 
-    void SetFillQA(Bool_t fill){fFillQA=fill;}
 
-    void SetWeightMultiplicity(Bool_t b){fWeightMultiplicity=b;}
+    void SetFillQA(Bool_t fill){fFillQA=fill;}
 
 private:
     Bool_t InitEvent();
@@ -94,10 +96,25 @@ private:
 
     // Constants
 
-    static const Int_t knbinsGamma=5;
-    static const Int_t knbinsGammaMult=4;
-    static const Int_t knbinsPi0=5;
+    enum Ebinsgamma{
+       kGammaPt=0,
+       kGammadPhi,
+       kGammaCent,
+       kGammaEPM,
+       knbinsGamma
+    };
+
+    enum Ebinspi0{
+       kPi0Pt=0,
+       kPi0Mass,
+       kPi0dPhi,
+       kPi0Cent,
+       kPi0EPM,
+       knbinsPi0
+    };
 
+    static const Int_t knbinsGammaMult=3;
+  
     static const Int_t kGCnYBinsSpectra = 80;
     static const Double_t kGCfirstYBinSpectra = 0.;
     static const Double_t kGClastYBinSpectra = 8.;
@@ -111,8 +128,6 @@ private:
     Double_t *fCentralityBins; // CentralityBins for Analysis
     Float_t fCentrality; //Event Centrality
     Int_t fCentralityBin; // Event Centrality Bin
-    Int_t fNRadialBins; // Number of Radial Bins for Photon Conversion Point
-    Double_t *fRadialBins; // Radial Bins for Photons Conversion Point
     Int_t fNBinsPhi; // Number of Phi wrt RP bins
     AliEventplane *fEP; // Event Plane Pointer
     Bool_t fWeightMultiplicity; // Use Multiplicity Weight
@@ -125,6 +140,8 @@ private:
     Int_t fNCuts; // NUmber of Photon Cuts for v2 analysis
     TList *fCutList; // Cuts for Photon v2 analysis
     AliConversionCuts *fConversionCuts; // Cuts used by the V0Reader
+   TList *fMesonCutList; // Cuts for Photon v2 analysis
+    AliConversionMesonCuts *fMesonCuts; // Cuts used by the V0Reader
     TRandom3 *fRandomizer; // Randomizer for Event Plane Randomisation
     TList *fOutputList; // List for Output (Histograms etc.)
     EPDGCode fMesonPDGCode; // PDG Code of the processed Meson (for MC truth)
@@ -156,10 +173,28 @@ private:
     TH2F *hRPTPCEtaAC;
     TH2F *hCos2TPCEta;
 
+    TH2F *hCos2TPCWeightedPhoton;
+    TH2F *hCos2TPCEtaWeightedPhoton;
+    TH2F *hCos2V0ATPCWeightedPhoton;
+    TH2F *hCos2V0CTPCWeightedPhoton;
+    TH2F *hCos2V0ACWeightedPhoton;
+
+    TH2F *hCos2TPCWeightedCharged;
+    TH2F *hCos2TPCEtaWeightedCharged;
+    TH2F *hCos2V0ATPCWeightedCharged;
+    TH2F *hCos2V0CTPCWeightedCharged;
+    TH2F *hCos2V0ACWeightedCharged;
+
+    TH2F *hCos2TPCWeightedV0Mult;
+    TH2F *hCos2TPCEtaWeightedV0Mult;
+    TH2F *hCos2V0ATPCWeightedV0Mult;
+    TH2F *hCos2V0CTPCWeightedV0Mult;
+    TH2F *hCos2V0ACWeightedV0Mult;
+
 
     // Gamma
     TH2F *hGammaMultCent;
-    TH3F **hGammaPhi;
+    TH2F **hGammaPhi;
     TH2F *hMultChargedvsNGamma;
     TH2F *hMultChargedvsVZERO;
     TH2F *hMultChargedvsSPD;
@@ -173,6 +208,7 @@ private:
     THnSparseF **hGammaMult;
 
     THnSparseF **hGamma;
+    THnSparseF *hGammaFull;
 
     THnSparseF *hCharged;
 
@@ -188,6 +224,8 @@ private:
     Float_t fMeanQ[nCentrBinV0][2][2];    // and recentering
     Float_t fWidthQ[nCentrBinV0][2][2];   // ...
 
+    //Event Plane
+    THnSparse *hEPVertex;
 
     AliAnalysisTaskPi0v2(const AliAnalysisTaskPi0v2&); // not implemented
     AliAnalysisTaskPi0v2& operator=(const AliAnalysisTaskPi0v2&); // not implemented
index a9b872d..2a1073f 100644 (file)
@@ -40,6 +40,7 @@
 #include "AliCentrality.h"
 #include "TList.h"
 #include "AliLog.h"
+#include "AliGenCocktailEventHeader.h"
 
 class iostream;
 
@@ -49,36 +50,28 @@ ClassImp(AliConversionCuts)
 
 
 const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
-"GoodId",
+"HeavyIon",
+"CentralityMin",
+"CentralityMax",
+"SelectV0AND",
+"MultiplicityMethod",
+"RemovePileUp",
+"RejectExtraSignals",
 "V0FinderType",
-"eProbCut",
+"EtaCut",
+"MinRCut",
+"SinglePtCut",
+"ClsTPCCut",
 "ededxSigmaCut",
 "pidedxSigmaCut",
 "piMomdedxSigmaCut",
-"Chi2GammaCut",
-"SinglePtCut",
-"ClsTPCCut",
-"EtaCut",
-"Chi2MesonCut",
-"LowPRejectionSigmaCut",
-"QtMaxCut",
 "piMaxMomdedxSigmaCut",
-"AlphaMesonCut",
-"MinRCut",
-"RapidityMesonCut",
-"BackgroundScheme",
-"DegreesForRotationMethod",
-"NumberOfRotations",
-"RemovePileUp",
-"SelectV0AND",
-"MultiplicityMethod",
-"HeavyIon",
-"CentralityMin",
-"CentralityMax",
+"LowPRejectionSigmaCut",
 "TOFelectronPID",
-"UseMCPSmearing",
-"DoPhotonAsymmetryCut",
+"QtMaxCut",
+"Chi2GammaCut",
 "PsiPair",
+"DoPhotonAsymmetryCut",
 "CosinePointingAngle",
 "SharedElectronCuts",
 "RejectToCloseV0s",
@@ -104,17 +97,16 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) : AliAn
     fLineCutZRSlopeMin(0.),
     fLineCutZValueMin(0),
     fChi2CutConversion(1000),
-    fChi2CutMeson(1000),
     fPIDProbabilityCutNegativeParticle(0),
     fPIDProbabilityCutPositiveParticle(0),
     fDodEdxSigmaCut(kTRUE),
-    fDoTOFsigmaCut(kFALSE), // RRnewTOF
+    fDoTOFsigmaCut(kFALSE), 
     fPIDTRDEfficiency(1),
     fDoTRDPID(kFALSE),
     fPIDnSigmaAboveElectronLine(100),
     fPIDnSigmaBelowElectronLine(-100),
-    fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF
-    fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF
+    fTofPIDnSigmaAboveElectronLine(100), 
+    fTofPIDnSigmaBelowElectronLine(-100), 
     fPIDnSigmaAbovePionLine(0),
     fPIDnSigmaAbovePionLineHighPt(-100),
     fPIDMinPnSigmaAbovePionLine(0),
@@ -150,19 +142,6 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) : AliAn
     fCentralityMax(0),
     fUseCorrectedTPCClsInfo(kFALSE),
     fUseTOFpid(kFALSE),
-    fAlphaMinCutMeson(0),
-    fAlphaCutMeson(1),
-    fRapidityCutMeson(1),
-    fUseRotationMethodInBG(kFALSE),
-    fdoBGProbability(kFALSE),
-    fUseTrackMultiplicityForBG(kFALSE),
-    fnDegreeRotationPMForBG(0),
-    fnumberOfRotationEventsForBG(0),
-    fUseMCPSmearing(kFALSE),
-    fPBremSmearing(0),
-    fPSigSmearing(0),
-    fPSigSmearingCte(0),
-    fBrem(NULL),
     fMultiplicityMethod(0),
     fSelectV0AND(kFALSE),
     fRemovePileUp(kFALSE),
@@ -170,11 +149,15 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) : AliAn
     fPsiPairCut(10000),
     fCosPAngleCut(10000),
     fDoToCloseV0sCut(kFALSE),
+    fRejectExtraSignals(0),
     fminV0Dist(200.),
     fDoSharedElecCut(kFALSE),
     fOfflineTriggerMask(0),
     fRandom(0),
     fElectronLabelArray(NULL),
+    fNotRejectedStart(NULL),
+    fNotRejectedEnd(NULL),
+    fGeneratorNames(NULL),
     fCutString(NULL),
     hdEdxCuts(NULL),
     hTPCdEdxbefore(NULL),
@@ -192,22 +175,14 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) : AliAn
     hV0EventCuts(NULL),
     hCentrality(NULL),
     hVertexZ(NULL),
-    hTriggerClass(NULL),
-    hMesonCuts(NULL),
-    hMesonBGCuts(NULL)
+    hTriggerClass(NULL)
 {
     InitPIDResponse();
     for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
     fCutString=new TObjString((GetCutNumber()).Data());
 
-    if (fBrem == NULL){
-       fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
-       // tests done with 1.0e-14
-       fBrem->SetParameter(0,fPBremSmearing);
-       fBrem->SetNpx(100000);
-    }
-
     fElectronLabelArray = new Int_t[500];
+
 }
 
 //________________________________________________________________________
@@ -221,15 +196,22 @@ AliConversionCuts::~AliConversionCuts() {
       delete fCutString;
       fCutString = NULL;
    }
-   if(fBrem){
-      delete fBrem;
-      fBrem = NULL;
-   }
    if(fElectronLabelArray){
       delete fElectronLabelArray;
       fElectronLabelArray = NULL;
    }
-
+   if(fNotRejectedStart){
+      delete[] fNotRejectedStart;
+      fNotRejectedStart = NULL;
+   }
+   if(fNotRejectedEnd){
+      delete[] fNotRejectedEnd;
+      fNotRejectedEnd = NULL;
+   }
+   if(fGeneratorNames){
+      delete[] fGeneratorNames;
+      fGeneratorNames = NULL;
+   }
 }
 
 //________________________________________________________________________
@@ -372,34 +354,15 @@ void AliConversionCuts::InitCutHistograms(TString name, Bool_t preCut){
        hVertexZ=new TH1F(Form("VertexZ %s",GetCutNumber().Data()),"VertexZ",1000,-50,50);
        fHistograms->Add(hVertexZ);
        
-       hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",4,-0.5,3.5);
+       hTriggerClass= new TH1F(Form("OfflineTrigger %s",GetCutNumber().Data()),"OfflineTrigger",4,-0.5,5.5);
        hTriggerClass->GetXaxis()->SetBinLabel(1,"kAny");
        hTriggerClass->GetXaxis()->SetBinLabel(2,"kMB");
        hTriggerClass->GetXaxis()->SetBinLabel(3,"kCentral");
        hTriggerClass->GetXaxis()->SetBinLabel(4,"kSemiCentral");
+                hTriggerClass->GetXaxis()->SetBinLabel(4,"kCINT5");
+                hTriggerClass->GetXaxis()->SetBinLabel(5,"kINT7");
        fHistograms->Add(hTriggerClass);
     }
-    
-    // Meson Cuts
-    hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",10,-0.5,9.5);
-    hMesonCuts->GetXaxis()->SetBinLabel(1,"in");
-    hMesonCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
-    hMesonCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
-    hMesonCuts->GetXaxis()->SetBinLabel(4,"opening angle");
-    hMesonCuts->GetXaxis()->SetBinLabel(5,"alpha max");
-    hMesonCuts->GetXaxis()->SetBinLabel(6,"alpha min");
-    hMesonCuts->GetXaxis()->SetBinLabel(7,"out");
-    fHistograms->Add(hMesonCuts);
-
-    hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",10,-0.5,9.5);
-    hMesonBGCuts->GetXaxis()->SetBinLabel(1,"in");
-    hMesonBGCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
-    hMesonBGCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
-    hMesonBGCuts->GetXaxis()->SetBinLabel(4,"opening angle");
-    hMesonBGCuts->GetXaxis()->SetBinLabel(5,"alpha max");
-    hMesonBGCuts->GetXaxis()->SetBinLabel(6,"alpha min");
-    hMesonBGCuts->GetXaxis()->SetBinLabel(7,"out");
-    fHistograms->Add(hMesonBGCuts);
 }
 
 //________________________________________________________________________
@@ -414,6 +377,7 @@ Bool_t AliConversionCuts::InitPIDResponse(){
     
   }
   
+
   return kFALSE;
 }
 ///________________________________________________________________________
@@ -580,46 +544,6 @@ Bool_t AliConversionCuts::PhotonIsSelectedMC(TParticle *particle,AliStack *fMCSt
 }
 
 
-//________________________________________________________________________
-Bool_t AliConversionCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack,Bool_t bMCDaughtersInAcceptance){
-    // Returns true for all pions within acceptance cuts for decay into 2 photons
-    // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
-
-    if(!fMCStack)return kFALSE;
-    
-    if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
-       
-       if(fMCMother->R()>fMaxR)        return kFALSE; // cuts on distance from collision point
-
-       Double_t rapidity = 10.;
-       if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
-          rapidity=8.;
-       }
-       else{
-          rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())));
-       }       
-       
-       // Rapidity Cut
-       if(TMath::Abs(rapidity)>fRapidityCutMeson)return kFALSE;
-
-       // Select only -> 2y decay channel
-       if(fMCMother->GetNDaughters()!=2)return kFALSE;
-
-       for(Int_t i=0;i<2;i++){
-           TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
-
-           // Is Daughter a Photon?
-           if(MDaughter->GetPdgCode()!=22)return kFALSE;
-            // Is Photon in Acceptance?
-           if(bMCDaughtersInAcceptance){
-               if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
-           }
-       }
-       return kTRUE;
-    }
-    return kFALSE;
-}
-
 ///________________________________________________________________________
 Bool_t AliConversionCuts::PhotonCuts(AliConversionPhotonBase *photon,AliVEvent *event)
 {   // Specific Photon Cuts
@@ -778,66 +702,6 @@ Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliV
 }
 
 ///________________________________________________________________________
-Bool_t AliConversionCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal)
-{
-    // Selection of reconstructed Meson candidates
-    // Use flag IsSignal in order to fill Fill different
-    // histograms for Signal and Background
-    TH1 *hist=0x0;
-
-    if(IsSignal){hist=hMesonCuts;
-    }
-    else{hist=hMesonBGCuts;}
-
-    Int_t cutIndex=0;
-    if(hist)hist->Fill(cutIndex);
-    cutIndex++;
-
-    // Undefined Rapidity -> Floating Point exception
-    if((pi0->E()+pi0->Pz())/(pi0->E()-pi0->Pz())<=0){
-        if(hist)hist->Fill(cutIndex);
-       cutIndex++;
-       return kFALSE;
-    }
-    else{
-               // PseudoRapidity Cut --> But we cut on Rapidity !!!
-        cutIndex++;
-        if(TMath::Abs(pi0->Rapidity())>fRapidityCutMeson){
-        //if(TMath::Abs(pi0->PseudoRapidity())>fRapidityCutMeson){
-           if(hist)hist->Fill(cutIndex);
-           return kFALSE;
-       }
-    }
-    cutIndex++;
-
-    // Opening Angle Cut
-    //fOpeningAngle=2*TMath::ATan(0.134/pi0->P());// physical minimum opening angle
-    if(pi0->GetOpeningAngle()<fOpeningAngle){
-       if(hist)hist->Fill(cutIndex);
-       return kFALSE;
-    }
-    cutIndex++;
-
-    // Alpha Max Cut
-    if(pi0->GetAlpha()>fAlphaCutMeson){
-       if(hist)hist->Fill(cutIndex);
-       return kFALSE;
-    }
-    cutIndex++;
-
-    // Alpha Min Cut
-    if(pi0->GetAlpha()<fAlphaMinCutMeson){
-       if(hist)hist->Fill(cutIndex);
-       return kFALSE;
-    }
-    cutIndex++;
-
-    if(hist)hist->Fill(cutIndex);
-    return kTRUE;
-}
-
-
-///________________________________________________________________________
 Bool_t AliConversionCuts::ArmenterosQtCut(AliConversionPhotonBase *photon)
 {   // Armenteros Qt Cut
 
@@ -1293,7 +1157,7 @@ Bool_t AliConversionCuts::UpdateCutString(cutIds cutID, Int_t value) {
 Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
    // Initialize Cuts from a given Cut string
 
-    AliInfo(Form("Set Cut Number: %s",analysisCutSelection.Data()));
+    AliInfo(Form("Set Photoncut Number: %s",analysisCutSelection.Data()));
   if(analysisCutSelection.Length()!=kNCuts) {
        AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
        return kFALSE;
@@ -1309,13 +1173,6 @@ Bool_t AliConversionCuts::InitializeCutsFromCutString(const TString analysisCutS
       ASSIGNARRAY(ii);
   }
 
-  // TestFlag
-  if(fCuts[0] !=9){
-    AliError("Analysis Cut Selection does not start with 9");
-       PrintCuts();
-    return kFALSE;
-  }
-
   // Set Individual Cuts
   for(Int_t ii=0;ii<kNCuts;ii++){
       if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
@@ -1336,15 +1193,7 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
 
 
   switch (cutID) {
-  case kgoodId:
-       fCuts[kgoodId] = value;
-       if(value != 9) {
-         AliError("First value of cut string is wrong, aborting!!");
-         return kFALSE;
-       } else {
-         return kTRUE;
-       }
-
   case kv0FinderType:
        if( SetV0Finder(value)) {
          fCuts[kv0FinderType] = value;
@@ -1352,13 +1201,6 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
          return kTRUE;
        } else return kFALSE;
 
-  case keProbCut:
-       if( SetElectronProbCut(value)) {
-         fCuts[keProbCut] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
   case kededxSigmaCut:
        if( SetTPCdEdxCutElectronLine(value)) {
          fCuts[kededxSigmaCut] = value;
@@ -1408,13 +1250,6 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
          return kTRUE;
        } else return kFALSE;
 
-  case kchi2MesonCut:
-       if( SetChi2MesonCut(value)) {
-         fCuts[kchi2MesonCut] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
   case kLowPRejectionSigmaCut:
        if( SetLowPRejectionCuts(value)) {
          fCuts[kLowPRejectionSigmaCut] = value;
@@ -1436,44 +1271,9 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
          return kTRUE;
        } else return kFALSE;
 
-  case kalphaMesonCut:
-       if( SetAlphaMesonCut(value)) {
-         fCuts[kalphaMesonCut] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
-  case kminRCut:
+  case kRCut:
        if( SetRCut(value)) {
-         fCuts[kminRCut] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
-  case kRapidityMesonCut:
-       if( SetRapidityMesonCut(value)) {
-         fCuts[kRapidityMesonCut] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
-  case kBackgroundScheme:
-       if( SetBackgroundScheme(value)) {
-         fCuts[kBackgroundScheme] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
-  case kDegreesForRotationMethod:
-       if( SetNDegreesForRotationMethod(value)) {
-         fCuts[kDegreesForRotationMethod] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
-  case kNumberOfRotations:
-       if( SetNumberOfRotations(value)) {
-         fCuts[kNumberOfRotations] = value;
+         fCuts[kRCut] = value;
          UpdateCutString(cutID, value);
          return kTRUE;
        } else return kFALSE;
@@ -1527,13 +1327,6 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
          return kTRUE;
        } else return kFALSE;
 
-  case kuseMCPSmearing:
-       if( SetMCPSmearing(value)) {
-         fCuts[kuseMCPSmearing] = value;
-         UpdateCutString(cutID, value);
-         return kTRUE;
-       } else return kFALSE;
-
   case kdoPhotonAsymmetryCut:
        if( SetPhotonAsymmetryCut(value)) {
          fCuts[kdoPhotonAsymmetryCut] = value;
@@ -1571,6 +1364,14 @@ Bool_t AliConversionCuts::SetCut(cutIds cutID, const Int_t value) {
          return kTRUE;
        } else return kFALSE;
 
+ case kExtraSignals:
+       if( SetRejectExtraSignalsCut(value)) {
+         fCuts[kExtraSignals] = value;
+         UpdateCutString(cutID, value);
+         return kTRUE;
+       } else return kFALSE;
+
+
   case kNCuts:
       AliError("Cut id out of range");
        return kFALSE;
@@ -1628,77 +1429,6 @@ Bool_t AliConversionCuts::SetMultiplicityMethod(Int_t multiplicityMethod)
     return kTRUE;
 }
 
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetMCPSmearing(Int_t useMCPSmearing)
-{// Set Cut
-    switch(useMCPSmearing){
-    case 0:
-       fUseMCPSmearing=0;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.;
-       fPSigSmearingCte=0.;
-       break;
-    case 1:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.0e-14;
-       fPSigSmearing=0.;
-       fPSigSmearingCte=0.;
-       break;
-    case 2:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.0e-15;
-       fPSigSmearing=0.0;
-       fPSigSmearingCte=0.;
-       break;
-    case 3:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.003;
-       fPSigSmearingCte=0.002;
-       break;
-    case 4:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.003;
-       fPSigSmearingCte=0.007;
-       break;
-    case 5:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.003;
-       fPSigSmearingCte=0.016;
-       break;
-    case 6:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.007;
-       fPSigSmearingCte=0.016;
-       break;
-    case 7:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.0e-16;
-       fPSigSmearing=0.0;
-       fPSigSmearingCte=0.;
-       break;
-    case 8:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.007;
-       fPSigSmearingCte=0.014;
-       break;
-    case 9:
-       fUseMCPSmearing=1;
-       fPBremSmearing=1.;
-       fPSigSmearing=0.007;
-       fPSigSmearingCte=0.011;
-       break;
-
-    default:
-       AliError("Warning: UseMCPSmearing not defined");
-       return kFALSE;
-    }
-    return kTRUE;
-}
 
 ///________________________________________________________________________
 void AliConversionCuts::PrintCuts() {
@@ -1952,33 +1682,6 @@ Bool_t AliConversionCuts::SetV0Finder(Int_t v0FinderType)
     return kTRUE;
 }
 
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetElectronProbCut(Int_t eProbCut)
-{   // Set Cut
-
-    switch(eProbCut){
-    case 0:
-       fPIDProbabilityCutNegativeParticle=0;
-       fPIDProbabilityCutPositiveParticle=0;
-       break;
-    case 1:
-       fPIDProbabilityCutNegativeParticle=0.1;
-       fPIDProbabilityCutPositiveParticle=0.1;
-       break;
-    case 2:
-       fPIDProbabilityCutNegativeParticle=0.5;
-       fPIDProbabilityCutPositiveParticle=0.5;
-       break;
-    case 3:
-       fPIDProbabilityCutNegativeParticle=0.7;
-       fPIDProbabilityCutPositiveParticle=0.7;
-       break;
-    default:
-       AliError(Form("Warning: eProbCut not defined %d",eProbCut));
-       return kFALSE;
-    }
-    return kTRUE;
-}
 
 ///________________________________________________________________________
 Bool_t AliConversionCuts::SetSinglePtCut(Int_t singlePtCut)
@@ -2126,35 +1829,6 @@ Bool_t AliConversionCuts::SetEtaCut(Int_t etaCut)
 }
 
 ///________________________________________________________________________
-Bool_t AliConversionCuts::SetChi2MesonCut(Int_t chi2MesonCut)
-{   // Set Cut
-    switch(chi2MesonCut){
-    case 0:  // 100.
-       fChi2CutMeson = 100.;
-       break;
-    case 1:  // 50.
-       fChi2CutMeson = 50.;
-       break;
-    case 2:  // 30.
-       fChi2CutMeson = 30.;
-       break;
-    case 3:
-       fChi2CutMeson = 200.;
-       break;
-    case 4:
-       fChi2CutMeson = 500.;
-       break;
-    case 5:
-       fChi2CutMeson = 1000.;
-       break;
-    default:
-       AliError(Form("Chi2MesonCut not defined %d",chi2MesonCut));
-       return kFALSE;
-    }
-    return kTRUE;
-}
-
-///________________________________________________________________________
 Bool_t AliConversionCuts::SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut)
 {   // Set Cut
     switch(piMaxMomdedxSigmaCut){
@@ -2212,73 +1886,6 @@ Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
    return kTRUE;
 }
 
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
-{   // Set Cut
-    switch(alphaMesonCut){
-    case 0:    // 0- 0.7
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.7;
-       break;
-    case 1:    // 0-0.5
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.5;
-       break;
-    case 2:    // 0.5-1
-       fAlphaMinCutMeson        = 0.5;
-       fAlphaCutMeson   = 1.;
-       break;
-    case 3:    // 0.0-1
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 1.;
-       break;
-    case 4:    // 0-0.65
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.65;
-       break;
-    case 5:    // 0-0.75
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.75;
-       break;
-    case 6:    // 0-0.8
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.8;
-       break;
-    case 7:    // 0.0-0.85
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.85;
-       break;
-    case 8:    // 0.0-0.6
-       fAlphaMinCutMeson        = 0.0;
-       fAlphaCutMeson   = 0.6;
-       break;
-    default:
-        AliError(Form("AlphaMesonCut not defined %d",alphaMesonCut));
-       return kFALSE;
-    }
-    return kTRUE;
-}
-
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetRapidityMesonCut(Int_t RapidityMesonCut)
-{   // Set Cut
-    switch(RapidityMesonCut){
-    case 0:  //
-       fRapidityCutMeson   = 0.9;
-       break;
-    case 1:  //
-       fRapidityCutMeson   = 0.8;
-       break;
-    case 2:  //
-       fRapidityCutMeson   = 0.7;
-       break;
-
-    default:
-        AliError(Form("RapidityMesonCut not defined %d",RapidityMesonCut));
-       return kFALSE;
-    }
-    return kTRUE;
-}
 
 ///________________________________________________________________________
 Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
@@ -2329,7 +1936,7 @@ Bool_t AliConversionCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
 ///________________________________________________________________________
 Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
     // Set Cut
-    switch(TOFelectronPID){ // RRnewTOF start //////////////////////////////////////////////////////////////////////////
+    switch(TOFelectronPID){ 
     case 0: // no cut
        fUseTOFpid = kFALSE;
        fTofPIDnSigmaBelowElectronLine=-100;
@@ -2358,7 +1965,7 @@ Bool_t AliConversionCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
     default:
         AliError(Form("TOFElectronCut not defined %d",TOFelectronPID));
        return kFALSE;
-    } //////////////////////// RRnewTOF end //////////////////////////////////////////////////////////////////////////
+    } 
     return kTRUE;
 }
 
@@ -2559,93 +2166,6 @@ Bool_t AliConversionCuts::SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut){
     return kTRUE;
 }
 
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetBackgroundScheme(Int_t BackgroundScheme){
-    // Set Cut
-    switch(BackgroundScheme){
-    case 0: //Rotation
-       fUseRotationMethodInBG=kTRUE;
-       fdoBGProbability=kFALSE;
-       break;
-    case 1: // mixed event with V0 multiplicity
-       fUseRotationMethodInBG=kFALSE;
-       fUseTrackMultiplicityForBG=kFALSE;
-       fdoBGProbability=kFALSE;
-       break;
-    case 2: // mixed event with track multiplicity
-       fUseRotationMethodInBG=kFALSE;
-       fUseTrackMultiplicityForBG=kTRUE;
-       fdoBGProbability=kFALSE;
-       break;
-    case 3: //Rotation
-       fUseRotationMethodInBG=kTRUE;
-       fdoBGProbability=kTRUE;
-       break;
-    default:
-       AliError(Form("BackgroundScheme not defined %d",BackgroundScheme));
-       return kFALSE;
-    }
-    return kTRUE;
-}
-
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod){
-    // Set Cut
-    switch(DegreesForRotationMethod){
-    case 0:
-       fnDegreeRotationPMForBG = 5;
-       break;
-    case 1:
-       fnDegreeRotationPMForBG = 10;
-       break;
-    case 2:
-       fnDegreeRotationPMForBG = 15;
-       break;
-    case 3:
-       fnDegreeRotationPMForBG = 20;
-       break;
-    default:
-       AliError(Form("DegreesForRotationMethod not defined %d",DegreesForRotationMethod));
-       return kFALSE;
-    }
-    fCuts[kDegreesForRotationMethod]=DegreesForRotationMethod;
-    return kTRUE;
-}
-
-///________________________________________________________________________
-Bool_t AliConversionCuts::SetNumberOfRotations(Int_t NumberOfRotations)
-{   // Set Cut
-    switch(NumberOfRotations){
-    case 0:
-       fnumberOfRotationEventsForBG = 5;
-       break;
-    case 1:
-       fnumberOfRotationEventsForBG = 10;
-       break;
-    case 2:
-       fnumberOfRotationEventsForBG = 15;
-       break;
-    case 3:
-       fnumberOfRotationEventsForBG = 20;
-       break;
-    case 4:
-       fnumberOfRotationEventsForBG = 2;
-       break;
-    case 5:
-       fnumberOfRotationEventsForBG = 50;
-       break;
-    case 6:
-       fnumberOfRotationEventsForBG = 80;
-       break;
-    case 7:
-       fnumberOfRotationEventsForBG = 100;
-       break;
-    default:
-       AliError(Form("NumberOfRotations not defined %d",NumberOfRotations));
-       return kFALSE;
-    }
-    return kTRUE;
-}
 
 ///________________________________________________________________________
 Bool_t AliConversionCuts::SetPsiPairCut(Int_t psiCut) {
@@ -2768,8 +2288,25 @@ Bool_t AliConversionCuts::SetToCloseV0sCut(Int_t toClose) {
    }
    return kTRUE;
 }
+///________________________________________________________________________
+Bool_t AliConversionCuts::SetRejectExtraSignalsCut(Int_t extraSignal) {
 
-
+   switch(extraSignal){
+   case 0:
+      fRejectExtraSignals = 0;
+      break; // No Rejection
+   case 1:
+      fRejectExtraSignals = 1;
+      break; // MinBias Header
+   case 2:
+      fRejectExtraSignals = 2;
+      break; // User String Array
+   default:
+      AliError(Form("Extra Signal Rejection not defined %d",extraSignal));
+      return kFALSE;
+   }
+   return kTRUE;
+}
 
 ///________________________________________________________________________
 
@@ -2833,10 +2370,12 @@ Bool_t AliConversionCuts::IsTriggerSelected()
 
     // Fill Histogram
     if(hTriggerClass){
-       if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(0);
-       if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(1);
-       if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(2);
-       if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(3);
+               if (fInputHandler->IsEventSelected() & AliVEvent::kAny)hTriggerClass->Fill(0);
+               if (fInputHandler->IsEventSelected() & AliVEvent::kMB)hTriggerClass->Fill(1);
+               if (fInputHandler->IsEventSelected() & AliVEvent::kCentral)hTriggerClass->Fill(2);
+               if (fInputHandler->IsEventSelected() & AliVEvent::kSemiCentral)hTriggerClass->Fill(3);
+               if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(4);
+               if (fInputHandler->IsEventSelected() & AliVEvent::kCINT5)hTriggerClass->Fill(5);
     }
 
     
@@ -2930,38 +2469,6 @@ TString AliConversionCuts::GetCutNumber(){
 }
 
 ///________________________________________________________________________
-void AliConversionCuts::SmearParticle(AliAODConversionPhoton* photon)
-{
-   Double_t facPBrem = 1.;
-   Double_t facPSig = 0.;
-
-   Double_t phi=0.;
-   Double_t theta=0.;
-   Double_t P=0.;
-
-   
-   P=photon->P();
-   phi=photon->Phi();
-   if( photon->P()!=0){
-      theta=acos( photon->Pz()/ photon->P());
-   }
-
-   if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){ 
-      facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
-   }
-       
-   if( fPBremSmearing != 1.){
-      if(fBrem!=NULL){
-         facPBrem = fBrem->GetRandom();
-      }
-   }
-
-   photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
-   photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
-   photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
-   photon->SetE(photon->P());
-}
-///________________________________________________________________________
 void AliConversionCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
    
    Int_t posLabel = photon->GetTrackLabelPositive();
@@ -3013,3 +2520,103 @@ Bool_t AliConversionCuts::RejectToCloseV0s(AliAODConversionPhoton* photon, TList
    }
    return kTRUE;
 }
+///________________________________________________________________________
+void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliMCEvent *MCEvent){
+   
+   if(fNotRejectedStart){
+      delete[] fNotRejectedStart;
+      fNotRejectedStart = NULL;
+   }
+   if(fNotRejectedEnd){
+      delete[] fNotRejectedEnd;
+      fNotRejectedEnd = NULL;
+   }
+   if(fGeneratorNames){
+      delete[] fGeneratorNames;
+      fGeneratorNames = NULL;
+   }
+   
+   if(rejection == 0) return; // No Rejection
+   AliGenCocktailEventHeader *cHeader = dynamic_cast<AliGenCocktailEventHeader*>(MCEvent->GenEventHeader());
+   if(cHeader){
+      TList *genHeaders = cHeader->GetHeaders();
+      AliGenEventHeader* gh = 0;
+      fnHeaders = 0;
+      if(rejection == 1) fnHeaders = 1; // MinBiasHeader
+      if(rejection == 2){ // TList of Headers Names
+         for(Int_t i = 0; i<genHeaders->GetEntries();i++){
+            gh = (AliGenEventHeader*)genHeaders->At(i);
+            TString GeneratorName = gh->GetName();
+            for(Int_t j = 0; j<HeaderList->GetEntries();j++){
+               TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
+               if(GeneratorName.CompareTo(GeneratorInList) == 0){
+                  fnHeaders++;
+                  continue;
+               }
+            }
+         }
+      }
+
+      fNotRejectedStart = new Int_t[fnHeaders];
+      fNotRejectedEnd = new Int_t[fnHeaders];
+      fGeneratorNames = new TString[fnHeaders];
+
+      if(rejection == 1){
+         fNotRejectedStart[0] = 0;
+         fNotRejectedEnd[0] = ((AliGenEventHeader*)genHeaders->At(0))->NProduced();
+         fGeneratorNames[0] = ((AliGenEventHeader*)genHeaders->At(0))->GetName();
+
+         return;
+      }
+      
+      Int_t firstindex = 0;
+      Int_t lastindex = -1;
+      Int_t nummer = 0;
+      for(Int_t i = 0; i<genHeaders->GetEntries();i++){
+         gh = (AliGenEventHeader*)genHeaders->At(i);
+         TString GeneratorName = gh->GetName();
+         lastindex = lastindex + gh->NProduced();
+         for(Int_t j = 0; j<HeaderList->GetEntries();j++){
+            TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
+            if(GeneratorName.CompareTo(GeneratorInList) == 0){
+               fNotRejectedStart[nummer] = firstindex;
+               fNotRejectedEnd[nummer] = lastindex;
+               fGeneratorNames[nummer] = GeneratorName;
+               nummer++;
+               continue;
+            }
+         }
+         firstindex = firstindex + gh->NProduced();
+      }
+   }
+   else{
+      fNotRejectedStart = new Int_t[1];
+      fNotRejectedEnd = new Int_t[1];
+      fGeneratorNames = new TString[1];
+      if(rejection == 1 || rejection == 0){  fnHeaders = 1; } else {fnHeaders = 0;}
+      fNotRejectedStart[0] = 0;
+      fNotRejectedEnd[0] = MCEvent->Stack()->GetNprimary();
+      fGeneratorNames[0] = "NoGenerator";
+      //cout << "rejection: " << rejection << " start: " << fNotRejectedStart[0] << " end: " << fNotRejectedEnd[0] << endl;
+   }
+   
+}
+//_________________________________________________________________________
+Bool_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack){
+   
+   if(index < 0) return kFALSE; // No Particle
+   
+   Bool_t accepted = kFALSE; 
+   if( index >= MCStack->GetNprimary()){ // Secondary Particle
+      if( ((TParticle*)MCStack->Particle(index))->GetMother(0) < 0) return kTRUE; // Secondary Particle without Mother??
+      //cout<<"Secondary "<<index<<"   "<<((TParticle*)MCStack->Particle(index))->GetPdgCode()<<"  "<<((TParticle*)MCStack->Particle(index))->GetMother(0)<<endl;
+      return IsParticleFromBGEvent(((TParticle*)MCStack->Particle(index))->GetMother(0),MCStack);
+   }
+//   cout<<index<<"   "<<((TParticle*)MCStack->Particle(index))->GetPdgCode()<<"  "<<fNotRejectedStart[0]<<"  "<<fNotRejectedEnd[0]<<"  "<<MCStack->GetNprimary()<<endl;
+   for(Int_t i = 0;i<fnHeaders;i++){
+      if(index >= fNotRejectedStart[i] && index <= fNotRejectedEnd[i])
+         accepted = kTRUE;
+   }
+   
+   return accepted;
+}
index 1578651..5b22c63 100644 (file)
@@ -36,46 +36,31 @@ class AliConversionCuts : public AliAnalysisCuts {
 
 
   enum cutIds {
-       kgoodId=0, 
+       kisHeavyIon,                  
+       kCentralityMin,               
+       kCentralityMax,               
+       kselectV0AND,                 
+       kmultiplicityMethod,             
+       kremovePileUp,                
+       kExtraSignals,  
        kv0FinderType,                
-       keProbCut,                    
-       kededxSigmaCut,               
-       kpidedxSigmaCut,              
-       kpiMomdedxSigmaCut,           
-       kchi2GammaCut,                
+       ketaCut,                                     
+       kRCut,                     
        ksinglePtCut,                 
        kclsTPCCut,                   
-       ketaCut,                      
-       kchi2MesonCut,
-       kLowPRejectionSigmaCut,       
-       kQtMaxCut,                    
+       kededxSigmaCut,               
+       kpidedxSigmaCut,              
+       kpiMomdedxSigmaCut,        
        kpiMaxMomdedxSigmaCut,        
-       kalphaMesonCut,               
-       kminRCut,                     
-       kRapidityMesonCut,            
-       kBackgroundScheme,            
-       kDegreesForRotationMethod,    
-       kNumberOfRotations,           
-       kremovePileUp,                
-       kselectV0AND,                 
-       kmultiplicityMethod,             
-       kisHeavyIon,                  
-       kCentralityMin,               
-       kCentralityMax,               
+       kLowPRejectionSigmaCut,       
        kTOFelectronPID,              
-       kuseMCPSmearing,              
-       kdoPhotonAsymmetryCut,
+       kQtMaxCut,                    
+       kchi2GammaCut,                
        kPsiPair, 
+       kdoPhotonAsymmetryCut,
        kCosPAngle,
-        kElecShare,
-        kToCloseV0s,
-     //   kHBTmultiplicityBin,
-     //   kprimaryCutNumber,
-     //   kuseBayesPID,
-     //   kdalitzelectronsPID,
-     //   kpsiCutNumber,
-     //   kdalitzBackgroundType,
-     //   keleclsTPCCut,
+       kElecShare,
+       kToCloseV0s,
        kNCuts
   };
 
@@ -105,7 +90,8 @@ class AliConversionCuts : public AliAnalysisCuts {
   Bool_t InitializeCutsFromCutString(const TString analysisCutSelection);
   void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB) {fOfflineTriggerMask = offlineTriggerMask;}
   void FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0);
-   
+  void SetAcceptedHeader(TList *HeaderList){fHeaderList = HeaderList;}   
+
   Int_t GetEventQuality(){return fEventQuality;}
 
   AliConversionCuts(const char *name="V0Cuts", const char * title="V0 Cuts");
@@ -142,8 +128,6 @@ class AliConversionCuts : public AliAnalysisCuts {
 
   static AliVTrack * GetTrack(AliVEvent * event, Int_t label);
 
-  void SmearParticle(AliAODConversionPhoton * photon);
-
   ///Cut functions
   Bool_t SpecificTrackCuts(AliAODTrack * negTrack, AliAODTrack * posTrack,Int_t &cutIndex);
   Bool_t SpecificTrackCuts(AliESDtrack * negTrack, AliESDtrack * posTrack,Int_t &cutIndex);
@@ -163,6 +147,9 @@ class AliConversionCuts : public AliAnalysisCuts {
   Bool_t CosinePAngleCut(const AliConversionPhotonBase * photon, AliVEvent * event) const;
   Bool_t RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s);
   Bool_t RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0);
+  Bool_t IsParticleFromBGEvent(Int_t index, AliStack *MCStack);
+  void GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliMCEvent *MCEvent);
+
   // Event Cuts
   Bool_t IsCentralitySelected(AliVEvent *fInputEvent);
   Double_t GetCentrality(AliVEvent *event);
@@ -173,56 +160,46 @@ class AliConversionCuts : public AliAnalysisCuts {
   // Set Individual Cuts
   Bool_t SetRCut(Int_t RCut);
   Bool_t SetV0Finder(Int_t v0FinderType);
-  Bool_t SetElectronProbCut(Int_t eProbCut);
   Bool_t SetChi2GammaCut(Int_t chi2GammaCut);
   Bool_t SetTPCdEdxCutPionLine(Int_t pidedxSigmaCut);
   Bool_t SetTPCdEdxCutElectronLine(Int_t ededxSigmaCut);
   Bool_t SetSinglePtCut(Int_t singlePtCut);
   Bool_t SetTPCClusterCut(Int_t clsTPCCut);
   Bool_t SetEtaCut(Int_t etaCut);
-  Bool_t SetChi2MesonCut(Int_t chi2MesonCut);
   Bool_t SetMinMomPiondEdxCut(Int_t piMinMomdedxSigmaCut);
   Bool_t SetMaxMomPiondEdxCut(Int_t piMaxMomdedxSigmaCut);
   Bool_t SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut);
   Bool_t SetQtMaxCut(Int_t QtMaxCut);
-  Bool_t SetAlphaMesonCut(Int_t alphaMesonCut);
   Bool_t SetTOFElectronPIDCut(Int_t TOFelectronPID);
   Bool_t SetTRDElectronCut(Int_t TRDElectronCut);
-  Bool_t SetRapidityMesonCut(Int_t RapidityMesonCut);
   Bool_t SetCentralityMin(Int_t useCentrality);
   Bool_t SetIsHeavyIon(Int_t isHeavyIon);
   Bool_t SetCentralityMax(Int_t centralityBin);
   Bool_t SetPhotonAsymmetryCut(Int_t doPhotonAsymmetryCut);
-  Bool_t SetRemovePileUp(Int_t removePileUp);
-  Bool_t SetBackgroundScheme(Int_t BackgroundScheme);
-  Bool_t SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod);
-  Bool_t SetNumberOfRotations(Int_t NumberOfRotations);
-  Bool_t SetMCPSmearing(Int_t useMCPSmearing);
+  Bool_t SetRemovePileUp(Int_t removePileUp);  
   Bool_t SetMultiplicityMethod(Int_t multiplicityMethod);
   Bool_t SetSelectV0AND(Int_t selectV0AND);
   Bool_t SetCosPAngleCut(Int_t cosCut);
   Bool_t SetPsiPairCut(Int_t psiCut);
   Bool_t SetSharedElectronCut(Int_t sharedElec);
   Bool_t SetToCloseV0sCut(Int_t toClose);
-
+  Bool_t SetRejectExtraSignalsCut(Int_t extraSignal);
 
   // Request Flags
 
-  Bool_t UseRotationMethod(){return fUseRotationMethodInBG;}
-  Int_t NumberOfRotationEvents(){return fnumberOfRotationEventsForBG;}
-  Int_t NDegreesRotation(){return fnDegreeRotationPMForBG;}
   Bool_t IsHeavyIon(){return fIsHeavyIon;}
-  Bool_t UseTrackMultiplicity(){return fUseTrackMultiplicityForBG;}
-  Bool_t DoBGProbability(){return fdoBGProbability;}
   Int_t GetFirstTPCRow(Double_t radius);
-  Bool_t UseMCPSmearing(){return fUseMCPSmearing;}
+
   Bool_t UseElecSharingCut(){return fDoSharedElecCut;}
   Bool_t UseToCloseV0sCut(){return fDoToCloseV0sCut;}
   Int_t GetMultiplicityMethod(){return fMultiplicityMethod;}
   Double_t GetEtaCut(){return fEtaCut;}
+  Int_t GetSignalRejection(){return fRejectExtraSignals;}
+  TList* GetAcceptedHeader(){return fHeaderList;}
 
   protected:
   TList *fHistograms;
+  TList *fHeaderList;
   AliPIDResponse *fPIDResponse;
 
 
@@ -242,7 +219,6 @@ class AliConversionCuts : public AliAnalysisCuts {
   Double_t fLineCutZRSlopeMin; //linecut
   Double_t fLineCutZValueMin; //linecut
   Double_t fChi2CutConversion; //chi2cut
-  Double_t fChi2CutMeson; //chicut meson
   Double_t fPIDProbabilityCutNegativeParticle;
   Double_t fPIDProbabilityCutPositiveParticle;
   Bool_t   fDodEdxSigmaCut; // flag to use the dEdxCut based on sigmas
@@ -288,19 +264,6 @@ class AliConversionCuts : public AliAnalysisCuts {
   Int_t fCentralityMax; // centrality selection upper bin value
   Bool_t fUseCorrectedTPCClsInfo; // flag to use corrected tpc cl info
   Bool_t fUseTOFpid; // flag to use tof pid
-  Double_t fAlphaMinCutMeson; // min value for meson alpha cut
-  Double_t fAlphaCutMeson; // max value for meson alpha cut
-  Double_t fRapidityCutMeson; // max value for meson rapidity
-  Bool_t fUseRotationMethodInBG; // flag to apply rotation method for meson bg estimation
-  Bool_t fdoBGProbability; // flag to use probability method for meson bg estimation
-  Bool_t fUseTrackMultiplicityForBG; // flag to use track multiplicity for meson bg estimation (else V0 mult)
-  Int_t fnDegreeRotationPMForBG; //
-  Int_t fnumberOfRotationEventsForBG; //
-  Bool_t fUseMCPSmearing; // flag
-  Double_t fPBremSmearing;//
-  Double_t fPSigSmearing; //
-  Double_t fPSigSmearingCte; //
-  TF1 *fBrem; //
   Int_t fMultiplicityMethod; // selected multiplicity method
   Bool_t fSelectV0AND; // flag
   Bool_t fRemovePileUp; //flag
@@ -308,6 +271,7 @@ class AliConversionCuts : public AliAnalysisCuts {
   Float_t fPsiPairCut;
   Float_t fCosPAngleCut;
   Bool_t fDoToCloseV0sCut; //
+  Int_t fRejectExtraSignals;//
   Double_t fminV0Dist; //
   Bool_t fDoSharedElecCut; //
   UInt_t fOfflineTriggerMask;   //  Task processes collision candidates only
@@ -316,6 +280,11 @@ class AliConversionCuts : public AliAnalysisCuts {
   Float_t fConversionPointXArray; // Array with conversion Point x
   Float_t fConversionPointYArray; // Array with conversion Point y
   Float_t fConversionPointZArray; // Array with conversion Point z
+  Int_t *fNotRejectedStart;
+  Int_t *fNotRejectedEnd;
+  TString *fGeneratorNames;
+  Int_t fnHeaders;
+
 
   // Histograms
   TObjString *fCutString; // cut number used for analysis
@@ -336,8 +305,6 @@ class AliConversionCuts : public AliAnalysisCuts {
   TH1F *hCentrality; // centrality distribution for selected events
   TH1F *hVertexZ; // vertex z distribution for selected events
   TH1F *hTriggerClass; //fired offline trigger class
-  TH1F *hMesonCuts; // bookkeeping for meson cuts
-  TH1F *hMesonBGCuts; // bookkeeping for meson bg cuts
 
 
 private:
index 7d4bcd8..d1a2c2b 100644 (file)
@@ -48,15 +48,16 @@ ClassImp(AliConversionMesonCuts)
 
 const char* AliConversionMesonCuts::fgkCutNames[AliConversionMesonCuts::kNCuts] = {
 "MesonKind",
-"Chi2MesonCut",
-"AlphaMesonCut",
-"RapidityMesonCut",
-"rCut",
 "BackgroundScheme",
+"NumberOfBGEvents",
 "DegreesForRotationMethod",
-"NumberOfRotations",
+"RapidityMesonCut",
+"RCut",
+"AlphaMesonCut",
+"Chi2MesonCut",
 "SharedElectronCuts",
 "RejectToCloseV0s",
+"UseMCPSmearing",
 };
 
 
@@ -72,11 +73,16 @@ AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *titl
     fdoBGProbability(kFALSE),
     fUseTrackMultiplicityForBG(kFALSE),
     fnDegreeRotationPMForBG(0),
-    fnumberOfRotationEventsForBG(0),
+    fNumberOfBGEvents(0),
     fOpeningAngle(0.005),
     fDoToCloseV0sCut(kFALSE),
     fminV0Dist(200.),
     fDoSharedElecCut(kFALSE),
+    fUseMCPSmearing(kFALSE),
+    fPBremSmearing(0),
+    fPSigSmearing(0),
+    fPSigSmearingCte(0),
+    fBrem(NULL),
     fRandom(0),
     fElectronLabelArray(NULL),
     fCutString(NULL),
@@ -86,6 +92,13 @@ AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *titl
        for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
        fCutString=new TObjString((GetCutNumber()).Data());
        fElectronLabelArray = new Int_t[500];
+       if (fBrem == NULL){
+               fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
+               // tests done with 1.0e-14
+               fBrem->SetParameter(0,fPBremSmearing);
+               fBrem->SetNpx(100000);
+       }
+
 }
 
 //________________________________________________________________________
@@ -121,8 +134,6 @@ void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t preCut){
                else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
     }
 
-   
-   
     // Meson Cuts
     hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",10,-0.5,9.5);
     hMesonCuts->GetXaxis()->SetBinLabel(1,"in");
@@ -151,39 +162,36 @@ Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *
     // Returns true for all pions within acceptance cuts for decay into 2 photons
     // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
 
-    if(!fMCStack)return kFALSE;
-    
-    if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
-       
-       if(fMCMother->R()>fMaxR)        return kFALSE; // cuts on distance from collision point
-
-       Double_t rapidity = 10.;
-       if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
-          rapidity=8.;
-       }
-       else{
-          rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())));
-       }       
-       
-       // Rapidity Cut
-       if(TMath::Abs(rapidity)>fRapidityCutMeson)return kFALSE;
-
-       // Select only -> 2y decay channel
-       if(fMCMother->GetNDaughters()!=2)return kFALSE;
+       if(!fMCStack)return kFALSE;
+       
+       if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){                       
+               if(fMCMother->R()>fMaxR)        return kFALSE; // cuts on distance from collision point
 
-       for(Int_t i=0;i<2;i++){
-           TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
+               Double_t rapidity = 10.;
+               if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
+                       rapidity=8.;
+               } else{
+                       rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())));
+               }       
+               
+               // Rapidity Cut
+               if(TMath::Abs(rapidity)>fRapidityCutMeson)return kFALSE;
 
-           // Is Daughter a Photon?
-           if(MDaughter->GetPdgCode()!=22)return kFALSE;
-            // Is Photon in Acceptance?
-//         if(bMCDaughtersInAcceptance){
-//             if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
-//         }
+               // Select only -> 2y decay channel
+               if(fMCMother->GetNDaughters()!=2)return kFALSE;
+
+               for(Int_t i=0;i<2;i++){
+                       TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
+                       // Is Daughter a Photon?
+                       if(MDaughter->GetPdgCode()!=22)return kFALSE;
+                                       // Is Photon in Acceptance?
+       //          if(bMCDaughtersInAcceptance){
+       //              if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
+       //          }
+               }
+               return kTRUE;
        }
-       return kTRUE;
-    }
-    return kFALSE;
+       return kFALSE;
 }
 
 //________________________________________________________________________
@@ -307,20 +315,20 @@ Bool_t AliConversionMesonCuts::UpdateCutString(cutIds cutID, Int_t value) {
 ///Update the cut string (if it has been created yet)
 
   if(fCutString && fCutString->GetString().Length() == kNCuts) {
-        cout << "Updating cut id in spot number " << cutID << " to " << value << endl;
+//         cout << "Updating cut id in spot number " << cutID << " to " << value << endl;
        fCutString->SetString(GetCutNumber());
   } else {
-        cout << "fCutString not yet initialized, will not be updated" << endl;
+//         cout << "fCutString not yet initialized, will not be updated" << endl;
        return kFALSE;
   }
-  cout << fCutString->GetString().Data() << endl;
+//   cout << fCutString->GetString().Data() << endl;
   return kTRUE;
 }
 
 ///________________________________________________________________________
 Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
        // Initialize Cuts from a given Cut string
-       cout<<"Set Cut Number: "<<analysisCutSelection.Data()<<endl;
+       AliInfo(Form("Set Meson Cutnumber: %s",analysisCutSelection.Data()));
        if(analysisCutSelection.Length()!=kNCuts) {
                AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
                return kFALSE;
@@ -400,13 +408,22 @@ Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
                return kTRUE;
                } else return kFALSE;
 
-       case kNumberOfRotations:
-               if( SetNumberOfRotations(value)) {
-               fCuts[kNumberOfRotations] = value;
+       case kNumberOfBGEvents:
+               if( SetNumberOfBGEvents(value)) {
+               fCuts[kNumberOfBGEvents] = value;
                UpdateCutString(cutID, value);
                return kTRUE;
                } else return kFALSE;
 
+       case kuseMCPSmearing:
+               if( SetMCPSmearing(value)) {
+               fCuts[kuseMCPSmearing] = value;
+               UpdateCutString(cutID, value);
+               return kTRUE;
+               } else return kFALSE;
+
+       
+               
        case kElecShare:
                if( SetSharedElectronCut(value)) {
                fCuts[kElecShare] = value;
@@ -580,6 +597,12 @@ Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
                case 2:  //
                fRapidityCutMeson   = 0.7;
                break;
+               case 3:  //
+               fRapidityCutMeson   = 0.6;
+               break;
+               case 4:  //
+               fRapidityCutMeson   = 0.5;
+               break;
 
                default:
                        cout<<"Warning: RapidityMesonCut not defined "<<RapidityMesonCut<<endl;
@@ -618,6 +641,7 @@ Bool_t AliConversionMesonCuts::SetBackgroundScheme(Int_t BackgroundScheme){
        return kTRUE;
 }
 
+
 ///________________________________________________________________________
 Bool_t AliConversionMesonCuts::SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod){
     // Set Cut
@@ -643,35 +667,35 @@ Bool_t AliConversionMesonCuts::SetNDegreesForRotationMethod(Int_t DegreesForRota
 }
 
 ///________________________________________________________________________
-Bool_t AliConversionMesonCuts::SetNumberOfRotations(Int_t NumberOfRotations){
+Bool_t AliConversionMesonCuts::SetNumberOfBGEvents(Int_t NumberOfBGEvents){
        // Set Cut
-       switch(NumberOfRotations){
+       switch(NumberOfBGEvents){
                case 0:
-               fnumberOfRotationEventsForBG = 5;
+               fNumberOfBGEvents = 5;
                break;
                case 1:
-               fnumberOfRotationEventsForBG = 10;
+               fNumberOfBGEvents = 10;
                break;
                case 2:
-               fnumberOfRotationEventsForBG = 15;
+               fNumberOfBGEvents = 15;
                break;
                case 3:
-               fnumberOfRotationEventsForBG = 20;
+               fNumberOfBGEvents = 20;
                break;
                case 4:
-               fnumberOfRotationEventsForBG = 2;
+               fNumberOfBGEvents = 2;
                break;
                case 5:
-               fnumberOfRotationEventsForBG = 50;
+               fNumberOfBGEvents = 50;
                break;
                case 6:
-               fnumberOfRotationEventsForBG = 80;
+               fNumberOfBGEvents = 80;
                break;
                case 7:
-               fnumberOfRotationEventsForBG = 100;
+               fNumberOfBGEvents = 100;
                break;
                default:
-                       cout<<"Warning: NumberOfRotations not defined "<<NumberOfRotations<<endl;
+                       cout<<"Warning: NumberOfBGEvents not defined "<<NumberOfBGEvents<<endl;
        return kFALSE;
        }
        return kTRUE;
@@ -762,6 +786,78 @@ Bool_t AliConversionMesonCuts::SetToCloseV0sCut(Int_t toClose) {
        return kTRUE;
 }
 
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
+{// Set Cut
+    switch(useMCPSmearing){
+    case 0:
+       fUseMCPSmearing=0;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.;
+       fPSigSmearingCte=0.;
+       break;
+    case 1:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.0e-14;
+       fPSigSmearing=0.;
+       fPSigSmearingCte=0.;
+       break;
+    case 2:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.0e-15;
+       fPSigSmearing=0.0;
+       fPSigSmearingCte=0.;
+       break;
+    case 3:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.003;
+       fPSigSmearingCte=0.002;
+       break;
+    case 4:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.003;
+       fPSigSmearingCte=0.007;
+       break;
+    case 5:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.003;
+       fPSigSmearingCte=0.016;
+       break;
+    case 6:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.007;
+       fPSigSmearingCte=0.016;
+       break;
+    case 7:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.0e-16;
+       fPSigSmearing=0.0;
+       fPSigSmearingCte=0.;
+       break;
+    case 8:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.007;
+       fPSigSmearingCte=0.014;
+       break;
+    case 9:
+       fUseMCPSmearing=1;
+       fPBremSmearing=1.;
+       fPSigSmearing=0.007;
+       fPSigSmearingCte=0.011;
+       break;
+
+    default:
+       AliError("Warning: UseMCPSmearing not defined");
+       return kFALSE;
+    }
+    return kTRUE;
+}
+
 // Bool_t AliConversionMesonCuts::PsiPairCut(const AliConversionPhotonBase * photon) const {
 // 
 //     if(photon->GetPsiPair() > fPsiPairCut){
@@ -831,3 +927,36 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
        }
        return kTRUE;
 }
+
+///________________________________________________________________________
+void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
+{
+   Double_t facPBrem = 1.;
+   Double_t facPSig = 0.;
+
+   Double_t phi=0.;
+   Double_t theta=0.;
+   Double_t P=0.;
+
+   
+   P=photon->P();
+   phi=photon->Phi();
+   if( photon->P()!=0){
+      theta=acos( photon->Pz()/ photon->P());
+   }
+
+   if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){ 
+      facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
+   }
+       
+   if( fPBremSmearing != 1.){
+      if(fBrem!=NULL){
+         facPBrem = fBrem->GetRandom();
+      }
+   }
+
+   photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
+   photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
+   photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
+   photon->SetE(photon->P());
+}
index fc1c28b..aba3af0 100644 (file)
@@ -37,15 +37,16 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
 
   enum cutIds {
        kMesonKind,
-       kchi2MesonCut,
-       kalphaMesonCut,               
-       kRapidityMesonCut,    
-       kRCut,
        kBackgroundScheme,            
+       kNumberOfBGEvents,           
        kDegreesForRotationMethod,    
-       kNumberOfRotations,           
+       kRapidityMesonCut,    
+       kRCut,
+       kalphaMesonCut,               
+       kchi2MesonCut,
        kElecShare,
        kToCloseV0s,
+       kuseMCPSmearing,              
        kNCuts
   };
 
@@ -76,7 +77,8 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
   void InitCutHistograms(TString name="",Bool_t preCut = kTRUE);
   void SetFillCutHistograms(TString name="",Bool_t preCut = kTRUE){if(!fHistograms){InitCutHistograms(name,preCut);};}
   TList *GetCutHistograms(){return fHistograms;}
-
+  void SmearParticle(AliAODConversionPhoton * photon);
+  
   ///Cut functions
   Bool_t RejectSharedElectronV0s(AliAODConversionPhoton* photon, Int_t nV0, Int_t nV0s);
   Bool_t RejectToCloseV0s(AliAODConversionPhoton* photon, TList *photons, Int_t nV0);
@@ -88,19 +90,22 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
   Bool_t SetRapidityMesonCut(Int_t RapidityMesonCut);
   Bool_t SetBackgroundScheme(Int_t BackgroundScheme);
   Bool_t SetNDegreesForRotationMethod(Int_t DegreesForRotationMethod);
-  Bool_t SetNumberOfRotations(Int_t NumberOfRotations);
+  Bool_t SetNumberOfBGEvents(Int_t NumberOfBGEvents);
+  Bool_t SetMCPSmearing(Int_t useMCPSmearing);
   Bool_t SetSharedElectronCut(Int_t sharedElec);
   Bool_t SetToCloseV0sCut(Int_t toClose);
 
 
   // Request Flags
   Bool_t UseRotationMethod(){return fUseRotationMethodInBG;}
-  Int_t NumberOfRotationEvents(){return fnumberOfRotationEventsForBG;}
+  Bool_t UseTrackMultiplicity(){return fUseTrackMultiplicityForBG;}
+  Int_t NumberOfBGEvents(){return fNumberOfBGEvents;}
   Int_t NDegreesRotation(){return fnDegreeRotationPMForBG;}
   Bool_t DoBGProbability(){return fdoBGProbability;}
   Bool_t UseElecSharingCut(){return fDoSharedElecCut;}
   Bool_t UseToCloseV0sCut(){return fDoToCloseV0sCut;}
-
+  Bool_t UseMCPSmearing(){return fUseMCPSmearing;}
+  
   protected:
   TList *fHistograms;
   //cuts
@@ -114,11 +119,16 @@ class AliConversionMesonCuts : public AliAnalysisCuts {
   Bool_t fdoBGProbability; // flag to use probability method for meson bg estimation
   Bool_t fUseTrackMultiplicityForBG; // flag to use track multiplicity for meson bg estimation (else V0 mult)
   Int_t fnDegreeRotationPMForBG; //
-  Int_t fnumberOfRotationEventsForBG; //
+  Int_t fNumberOfBGEvents; //
   Float_t fOpeningAngle; // min opening angle for meson
   Bool_t fDoToCloseV0sCut; //
   Double_t fminV0Dist; //
   Bool_t fDoSharedElecCut; //
+  Bool_t fUseMCPSmearing; // flag
+  Double_t fPBremSmearing;//
+  Double_t fPSigSmearing; //
+  Double_t fPSigSmearingCte; //
+  TF1 *fBrem; //
   TRandom3 fRandom; //
   Int_t *fElectronLabelArray; // Array with elec/pos v0 label
   
index 8ddc459..53c5015 100644 (file)
@@ -13,10 +13,11 @@ ClassImp(AliConversionSelection)
 
 
 //________________________________________________________________________
-AliConversionSelection::AliConversionSelection(AliConversionCuts *convCut) : TObject(),
+AliConversionSelection::AliConversionSelection(AliConversionCuts *convCut, AliConversionMesonCuts *mesonCut) : TObject(),
     fInputEvent(NULL),
     fMCEvent(NULL),
     fConversionCut(convCut),
+    fMesonCut(mesonCut),
     fESDTrackCuts(NULL),
     fGoodGammas(NULL),
     fPi0Candidates(NULL),
@@ -28,7 +29,7 @@ AliConversionSelection::AliConversionSelection(AliConversionCuts *convCut) : TOb
     fUnsmearedPy(NULL),
     fUnsmearedPz(NULL),
     fUnsmearedE(NULL),
-    fCurrentEventNumber(0)
+    fCurrentEventNumber(-1)
 {
     // Default Values
     fInvMassRange=new Double_t[2];
@@ -109,7 +110,7 @@ Bool_t AliConversionSelection::ProcessEvent(TClonesArray *photons,AliVEvent *inp
     }
 
     // Do MC Smearing
-    if(fConversionCut->UseMCPSmearing() && fMCEvent){
+    if(fMesonCut->UseMCPSmearing() && fMCEvent){
        fUnsmearedPx = new Double_t[fGoodGammas->GetEntries()]; // Store unsmeared Momenta
        fUnsmearedPy = new Double_t[fGoodGammas->GetEntries()];
        fUnsmearedPz = new Double_t[fGoodGammas->GetEntries()];
@@ -120,7 +121,7 @@ Bool_t AliConversionSelection::ProcessEvent(TClonesArray *photons,AliVEvent *inp
            fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Py();
            fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Pz();
            fUnsmearedE[gamma] =  ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->E();
-           fConversionCut->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(gamma)));
+           fMesonCut->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(gamma)));
        }
     }
 
@@ -130,7 +131,7 @@ Bool_t AliConversionSelection::ProcessEvent(TClonesArray *photons,AliVEvent *inp
     if(fBGHandler)fBGHandler->AddEvent(fGoodGammas,fInputEvent);
 
     // Undo MC Smearing
-    if(fConversionCut->UseMCPSmearing() && fMCEvent){
+    if(fMesonCut->UseMCPSmearing() && fMCEvent){
        for(Int_t gamma=0;gamma<fGoodGammas->GetEntries();gamma++){ // Smear the AODPhotons in MC
            ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
            ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPy(fUnsmearedPy[gamma]);
@@ -213,7 +214,7 @@ void AliConversionSelection::CalculatePi0Candidates(){
                    }
                }
 
-               if((fConversionCut->MesonIsSelected(&pi0cand))){
+               if((fMesonCut->MesonIsSelected(&pi0cand))){
                    if(MesonInMassWindow(&pi0cand)){
 
                        // Add Pi0 to Stack
@@ -251,11 +252,11 @@ void AliConversionSelection::RotateParticle(AliAODConversionPhoton *gamma,Int_t
 void AliConversionSelection::CalculateBackground(){
 
     //Rotation Method
-    if(fConversionCut->UseRotationMethod()){
+    if(fMesonCut->UseRotationMethod()){
 
        // Correct for the number of rotations
        // BG is for rotation the same, except for factor NRotations
-       Double_t weight=1./Double_t(fConversionCut->NumberOfRotationEvents());
+       Double_t weight=1./Double_t(fMesonCut->NumberOfBGEvents());
 
        for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodGammas->GetEntriesFast();firstGammaIndex++){
 
@@ -264,13 +265,13 @@ void AliConversionSelection::CalculateBackground(){
            for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGoodGammas->GetEntriesFast();secondGammaIndex++){
                AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(secondGammaIndex));
                if(!fConversionCut->PhotonIsSelected(gamma1,fInputEvent))continue;
-               for(Int_t nRandom=0;nRandom<fConversionCut->NumberOfRotationEvents();nRandom++){
+               for(Int_t nRandom=0;nRandom<fMesonCut->NumberOfBGEvents();nRandom++){
 
-                   RotateParticle(gamma1,fConversionCut->NDegreesRotation());
+                   RotateParticle(gamma1,fMesonCut->NDegreesRotation());
 
                    AliAODConversionMother BGcandidate(gamma0,gamma1);
 
-                   if(fConversionCut->MesonIsSelected(&BGcandidate,kFALSE)){
+                   if(fMesonCut->MesonIsSelected(&BGcandidate,kFALSE)){
                        if(MesonInMassWindow(&BGcandidate)){
 
                            new((*fBGPi0s)[fBGPi0s->GetEntriesFast()]) AliAODConversionMother(BGcandidate);
@@ -287,7 +288,7 @@ void AliConversionSelection::CalculateBackground(){
        // Do Event Mixing
 
        if(fBGHandler==NULL){
-           fBGHandler=new AliConversionAODBGHandlerRP(fConversionCut->IsHeavyIon(),fConversionCut->UseTrackMultiplicity());
+           fBGHandler=new AliConversionAODBGHandlerRP(fConversionCut->IsHeavyIon(),fMesonCut->UseTrackMultiplicity());
        }
 
        for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler->GetNBGEvents(fGoodGammas,fInputEvent);nEventsInBG++){
@@ -314,7 +315,7 @@ void AliConversionSelection::CalculateBackground(){
 
                        AliAODConversionMother BGcandidate(gamma0,gamma1);
 
-                       if(fConversionCut->MesonIsSelected(&BGcandidate,kFALSE)){
+                       if(fMesonCut->MesonIsSelected(&BGcandidate,kFALSE)){
                            if(MesonInMassWindow(&BGcandidate)){
 
                                new((*fBGPi0s)[fBGPi0s->GetEntriesFast()]) AliAODConversionMother(BGcandidate);
index 327b320..3cb3889 100644 (file)
@@ -6,6 +6,7 @@
 #include "AliAODConversionPhoton.h"
 #include "AliConversionAODBGHandlerRP.h"
 #include "AliConversionCuts.h"
+#include "AliConversionMesonCuts.h"
 #include "TRandom3.h"
 #include "AliVEvent.h"
 #include "AliMCEvent.h"
@@ -16,7 +17,7 @@ class AliConversionSelection : public TObject{
 
 public:
 
-    AliConversionSelection(AliConversionCuts *convCut);
+    AliConversionSelection(AliConversionCuts *convCut, AliConversionMesonCuts *mesonCut);
     virtual ~AliConversionSelection();
 
     // Main Functions
@@ -64,6 +65,7 @@ protected:
     AliVEvent *fInputEvent;
     AliMCEvent *fMCEvent;
     AliConversionCuts *fConversionCut;
+        AliConversionMesonCuts *fMesonCut;
     AliESDtrackCuts *fESDTrackCuts;
     TObjArray *fGoodGammas; // Pointer to selected photons
     TClonesArray *fPi0Candidates;
index e366792..6724ef6 100644 (file)
@@ -10,8 +10,12 @@ AliAnalysisTask *AddTask_GammaConvV1(TString collisionSystem = "pp"){
    Bool_t IsHeavyIon=collisionSystem.Contains("PbPb");
 
    TString cutnumber = "";
-   if(IsHeavyIon) cutnumber = "900400508050113211200001080000000";
-   else cutnumber = "900400508050113211360000000000000"; 
+       TString cutnumberMeson = "";
+   if(IsHeavyIon){ 
+               cutnumber = "1080000002084001001500000";cutnumberMeson = "01021035000"; 
+       } else{
+               cutnumber = "0000000002084001001500000";cutnumberMeson = "01631035000"; 
+       }
        
    //========= Add PID Reponse to ANALYSIS manager ====
    if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
@@ -26,7 +30,7 @@ AliAnalysisTask *AddTask_GammaConvV1(TString collisionSystem = "pp"){
   
    AliLog::SetGlobalLogLevel(AliLog::kInfo);
 
-   //================================================
+      //================================================
    //              data containers
    //================================================
    //            find input container
@@ -47,350 +51,345 @@ AliAnalysisTask *AddTask_GammaConvV1(TString collisionSystem = "pp"){
    // Cut Numbers to use in Analysis
    
    Int_t numberOfCuts = 1;
-   if(IsHeavyIon) numberOfCuts = 8;
-   else numberOfCuts = 1;
-
+   if(trainConfig.Contains("PbPb")) numberOfCuts = 21;
+   else if(trainConfig.Contains("pPb")) numberOfCuts = 1;
+       else numberOfCuts = 9;
+       
    TString *cutarray = new TString[numberOfCuts];
-   if(IsHeavyIon){
+       TString *mesonCutArray = new TString[numberOfCuts];
+   if(trainConfig.Contains("PbPb")){
                // Standard Cuts 
-                       cutarray[0] = "900297209450304221200003012002000"; //standard cut Pi0 PbPb 00-05
-                       cutarray[1] = "900297209450304221200003122002000"; //standard cut Pi0 PbPb 05-10
-                       cutarray[2] = "900297209450304221200001012002000"; //standard cut Pi0 PbPb 00-10
-                       cutarray[3] = "900297209450304221200001122002000"; //standard cut Pi0 PbPb 10-20
-                       cutarray[4] = "900297209450304221200001022002000"; //standard cut Pi0 PbPb 00-20
-                       cutarray[5] = "900297209450304221200001242002000"; //standard cut Pi0 PbPb 20-40     
-                       cutarray[6] = "900297209450306221200001462002000"; //standard cut Pi0 PbPb 40-60
-                       cutarray[7] = "900297209450306221200001682002000"; //standard cut Pi0 PbPb 60-80      
-
-       //      CutStudies more BG events 20 events
-//                     cutarray[0] = "900297209450304221230003012002000"; 
-//                     cutarray[1] = "900297209450304221230003122002000"; 
-//                     cutarray[2] = "900297209450304221230001012002000"; 
-//                     cutarray[3] = "900297209450304221230001122002000"; 
-//                     cutarray[4] = "900297209450304221230001022002000"; 
-//                     cutarray[5] = "900297209450304221230001242002000"; 
-//                     cutarray[6] = "900297209450306221230001462002000"; 
-//                     cutarray[7] = "900297209450306221230001682002000"; 
+//       cutarray[0] = "1000000042092970023220000"; mesonCutArray[0] = "01022045000";  //standard cut Pi0 PbPb 00-100
+//                     cutarray[0] = "1000001042092970023220000"; mesonCutArray[0] = "01022045000";  //standard cut Pi0 PbPb 00-100
+//       cutarray[2] = "1000002042092970023220000"; mesonCutArray[2] = "01022045000";  //standard cut Pi0 PbPb 00-100
+//                     cutarray[0] = "3010001042092970023220000"; mesonCutArray[0] = "01022045000";  //standard cut Pi0 PbPb 00-05
+//                     cutarray[1] = "3120001042092970023220000"; mesonCutArray[1] = "01022045000";  //standard cut Pi0 PbPb 05-10
+//                     cutarray[2] = "1010001042092970023220000"; mesonCutArray[2] = "01022045000";  //standard cut Pi0 PbPb 00-10
+//                     cutarray[3] = "1120001042092970023220000"; mesonCutArray[3] = "01022045000";  //standard cut Pi0 PbPb 10-20
+// //                  cutarray[4] = "1020001042092970023220000"; mesonCutArray[4] = "01022045000";  //standard cut Pi0 PbPb 00-20
+//                     cutarray[4] = "1240001042092970023220000"; mesonCutArray[4] = "01022045000";  //standard cut Pi0 PbPb 20-40     
+//                     cutarray[5] = "1460001042092970023220000"; mesonCutArray[5] = "01022065000";  //standard cut Pi0 PbPb 40-60
+//                     cutarray[6] = "1680001042092970023220000"; mesonCutArray[6] = "01022065000";  //standard cut Pi0 PbPb 60-80      
+// 
+//     //      CutStudies more BG events 20 events
+//                     cutarray[7] = "3010001042092970023220000"; mesonCutArray[7] = "01322045000";  
+//                     cutarray[8] = "3120001042092970023220000"; mesonCutArray[8] = "01322045000"; 
+//                     cutarray[9] = "1010001042092970023220000"; mesonCutArray[9] = "01322045000"; 
+//                     cutarray[10] = "1120001042092970023220000"; mesonCutArray[10] = "01322045000"; 
+// //                  cutarray[12] = "1020001042092970023220000"; mesonCutArray[12] = "01322045000"; 
+//                     cutarray[11] = "1240001042092970023220000"; mesonCutArray[11] = "01322045000"; 
+//                     cutarray[12] = "1460001042092970023220000"; mesonCutArray[12] = "01322065000";
+//                     cutarray[13] = "1680001042092970023220000"; mesonCutArray[13] = "01322065000"; 
 
        //      CutStudies more BG events 50 events
-//                     cutarray[0] = "900297209450304221250003012002000"; 
-//                     cutarray[1] = "900297209450304221250003122002000"; 
-//                     cutarray[2] = "900297209450304221250001012002000"; 
-//                     cutarray[3] = "900297209450304221250001122002000"; 
-//                     cutarray[4] = "900297209450304221250001022002000"; 
-//                     cutarray[5] = "900297209450304221250001242002000"; 
-//                     cutarray[6] = "900297209450306221250001462002000"; 
-//                     cutarray[7] = "900297209450306221250001682002000"; 
+//                     cutarray[0] = "3010001042092970023220000"; mesonCutArray[0] = "01522045000"; 
+//                     cutarray[1] = "3120001042092970023220000"; mesonCutArray[1] = "01522045000"; 
+//                     cutarray[2] = "1010001042092970023220000"; mesonCutArray[2] = "01522045000"; 
+//                     cutarray[3] = "1120001042092970023220000"; mesonCutArray[3] = "01522045000"; 
+// //                  cutarray[4] = "1020001042092970023220000"; mesonCutArray[4] = "01522045000"; 
+//                     cutarray[4] = "1240001042092970023220000"; mesonCutArray[4] = "01522045000"; 
+//                     cutarray[5] = "1460001042092970023220000"; mesonCutArray[5] = "01522065000"; 
+//                     cutarray[6] = "1680001042092970023220000"; mesonCutArray[6] = "01522065000"; 
 
                // Cutstudies 0-5% dEdx
-//                     cutarray[0] = "900397209450304221200003012002000"; 
-//                     cutarray[1] = "900697209450304221200003012002000"; 
-//                     cutarray[2] = "900247209450304221200003012002000"; 
-//                     cutarray[3] = "900277209450304221200003012002000"; 
-//                     cutarray[4] = "900295209450304221200003012002000"; 
-               // Cutstudies 5-10% dEdx
-//                     cutarray[0] = "900397209450304221200003122002000"; 
-//                     cutarray[1] = "900697209450304221200003122002000"; 
-//                     cutarray[2] = "900247209450304221200003122002000"; 
-//                     cutarray[3] = "900277209450304221200003122002000"; 
-//                     cutarray[4] = "900295209450304221200003122002000"; 
-               // Cutstudies 0-10% dEdx
-//                     cutarray[0] = "900397209450304221200001012002000"; 
-//                     cutarray[1] = "900697209450304221200001012002000"; 
-//                     cutarray[2] = "900247209450304221200001012002000"; 
-//                     cutarray[3] = "900277209450304221200001012002000"; 
-//                     cutarray[4] = "900295209450304221200001012002000"; 
+               //      cutarray[7] = "3010001042093970023220000"; mesonCutArray[7] = "01022045000"; 
+               //      cutarray[8] = "3010001042096970023220000"; mesonCutArray[8] = "01022045000"; 
+               //      cutarray[9] = "3010001042092470023220000"; mesonCutArray[9] = "01022045000"; 
+               //      cutarray[10] = "3010001042092770023220000"; mesonCutArray[10] = "01022045000"; 
+               //      cutarray[11] = "3010001042092950023220000"; mesonCutArray[11] = "01022045000"; 
+               // // Cutstudies 5-10% dEdx
+               //      cutarray[12] = "3120001042093970023220000"; mesonCutArray[12] = "01022045000"; 
+               //      cutarray[13] = "3120001042096970023220000"; mesonCutArray[13] = "01022045000"; 
+//                     cutarray[7] = "3120001042092470023220000"; mesonCutArray[7] = "01022045000"; 
+//                     cutarray[8] = "3120001042092770023220000"; mesonCutArray[8] = "01022045000"; 
+//                     cutarray[9] = "3120001042092950023220000"; mesonCutArray[9] = "01022045000"; 
+//             // Cutstudies 0-10% dEdx
+//                     cutarray[10] = "1010001042093970023220000"; mesonCutArray[10] = "01022045000"; 
+//                     cutarray[11] = "1010001042096970023220000"; mesonCutArray[11] = "01022045000"; 
+//                     cutarray[12] = "1010001042092470023220000"; mesonCutArray[12] = "01022045000"; 
+//                     cutarray[13] = "1010001042092770023220000"; mesonCutArray[13] = "01022045000"; 
+                       cutarray[0] = "1010001042092950023220000"; mesonCutArray[0] = "01022045000"; 
                // Cutstudies 10-20% dEdx
-//                     cutarray[0] = "900397209450304221200001122002000"; 
-//                     cutarray[1] = "900697209450304221200001122002000"; 
-//                     cutarray[2] = "900247209450304221200001122002000"; 
-//                     cutarray[3] = "900277209450304221200001122002000"; 
-//                     cutarray[4] = "900295209450304221200001122002000"; 
-               // Cutstudies 40-60% dEdx
-//                     cutarray[0] = "900397209450306221200001462002000"; 
-//                     cutarray[1] = "900697209450306221200001462002000"; 
-//                     cutarray[2] = "900247209450306221200001462002000"; 
-//                     cutarray[3] = "900277209450306221200001462002000"; 
-//                     cutarray[4] = "900295209450306221200001462002000"; 
+                       cutarray[1] = "1120001042093970023220000"; mesonCutArray[1] = "01022045000"; 
+                       cutarray[2] = "1120001042096970023220000"; mesonCutArray[2] = "01022045000";
+                       cutarray[3] = "1120001042092470023220000"; mesonCutArray[3] = "01022045000"; 
+                       cutarray[4] = "1120001042092770023220000"; mesonCutArray[4] = "01022045000"; 
+                       cutarray[5] = "1120001042092950023220000"; mesonCutArray[5] = "01022045000"; 
+//             Cutstudies 40-60% dEdx
+                       cutarray[6] = "1460001042093970023220000"; mesonCutArray[6] = "01022065000"; 
+                       cutarray[7] = "1460001042096970023220000"; mesonCutArray[7] = "01022065000"; 
+                       cutarray[8] = "1460001042092470023220000"; mesonCutArray[8] = "01022065000"; 
+                       cutarray[9] = "1460001042092770023220000"; mesonCutArray[9] = "01022065000"; 
+                       cutarray[10] = "1460001042092950023220000"; mesonCutArray[10] = "01022065000"; 
                // Cutstudies 60-80% dEdx
-//                     cutarray[0] = "900397209450306221200001682002000"; 
-//                     cutarray[1] = "900697209450306221200001682002000"; 
-//                     cutarray[2] = "900247209450306221200001682002000"; 
-//                     cutarray[3] = "900277209450306221200001682002000"; 
-//                     cutarray[4] = "900295209450306221200001682002000"; 
+                       cutarray[11] = "1680001042093970023220000"; mesonCutArray[11] = "01022065000"; 
+                       cutarray[12] = "1680001042096970023220000"; mesonCutArray[12] = "01022065000"; 
+                       cutarray[13] = "1680001042092470023220000"; mesonCutArray[13] = "01022065000";
+                       cutarray[14] = "1680001042092770023220000"; mesonCutArray[14] = "01022065000"; 
+                       cutarray[15] = "1680001042092950023220000"; mesonCutArray[15] = "01022065000"; 
+               // Cutstudies 20-40% dEdx
+                       cutarray[16] = "1240001042093970023220000"; mesonCutArray[16] = "01022045000"; 
+                       cutarray[17] = "1240001042096970023220000"; mesonCutArray[17] = "01022045000";
+                       cutarray[18] = "1240001042092470023220000"; mesonCutArray[18] = "01022045000"; 
+                       cutarray[19] = "1240001042092770023220000"; mesonCutArray[19] = "01022045000"; 
+                       cutarray[20] = "1240001042092950023220000"; mesonCutArray[20] = "01022045000"; 
 
                // Cutstudies 0-5% TOF
-//                     cutarray[0] = "900297209450304221200003013002000"; 
-//                     cutarray[1] = "900297209450304221200003014002000"; 
+//                     cutarray[5] = "3010001042092970033220000"; mesonCutArray[5] = "01022045000"; 
+//                     cutarray[6] = "3010001042092970043220000"; mesonCutArray[6] = "01022045000"; 
                // Cutstudies 5-10% TOF
-//                     cutarray[0] = "900297209450304221200003123002000"; 
-//                     cutarray[1] = "900297209450304221200003124002000"; 
+//                     cutarray[7] = "3120001042092970033220000"; mesonCutArray[7] = "01022045000"; 
+//                     cutarray[8] = "3120001042092970043220000"; mesonCutArray[8] = "01022045000"; 
                // Cutstudies 0-10% TOF
-//                     cutarray[0] = "900297209450304221200001013002000"; 
-//                     cutarray[1] = "900297209450304221200001014002000"; 
+//                     cutarray[9] = "1010001042092970033220000"; mesonCutArray[9] = "01022045000"; 
+//                     cutarray[10] = "1010001042092970043220000"; mesonCutArray[10] = "01022045000"; 
                // Cutstudies 10-20% TOF
-//                     cutarray[0] = "900297209450304221200001123002000"; 
-//                     cutarray[1] = "900297209450304221200001124002000"; 
+//                     cutarray[11] = "1120001042092970033220000"; mesonCutArray[11] = "01022045000"; 
+//                     cutarray[12] = "1120001042092970043220000"; mesonCutArray[12] = "01022045000"; 
                // Cutstudies 20-40% TOF
-//                     cutarray[0] = "900297209450304221200001243002000"; 
-//                     cutarray[1] = "900297209450304221200001244002000"; 
+//                     cutarray[13] = "1240001042092970033220000"; mesonCutArray[13] = "01022045000"; 
+//                     cutarray[14] = "1240001042092970043220000"; mesonCutArray[14] = "01022045000"; 
                // Cutstudies 40-60% TOF
-//                     cutarray[0] = "900297209450306221200001463002000"; 
-//                     cutarray[1] = "900297209450306221200001464002000"; 
+//                     cutarray[15] = "1460001042092970033220000"; mesonCutArray[15] = "01022065000"; 
+//                     cutarray[16] = "1460001042092970043220000"; mesonCutArray[16] = "01022065000"; 
                // Cutstudies 60-80% TOF
-//                     cutarray[0] = "900297209450306221200001683002000"; 
-//                     cutarray[1] = "900297209450306221200001684002000"; 
+//                     cutarray[17] = "1680001042092970033220000"; mesonCutArray[17] = "01022065000"; 
+//                     cutarray[18] = "1680001042092970043220000"; mesonCutArray[18] = "01022065000"; 
 
                // Cutstudies 0-5% Alpha
-//                     cutarray[0] = "900297209450308221200003012002000"; 
-//                     cutarray[1] = "900297209450300221200003012002000"; 
+//                     cutarray[0] = "3010001042092970023220000"; mesonCutArray[0] = "01022085000"; 
+//                     cutarray[1] = "3010001042092970023220000"; mesonCutArray[1] = "01022005000"; 
                // Cutstudies 5-10% Alpha
-//                     cutarray[0] = "900297209450308221200003122002000"; 
-//                     cutarray[1] = "900297209450300221200003122002000"; 
+//                     cutarray[2] = "3120001042092970023220000"; mesonCutArray[2] = "01022085000"; 
+//                     cutarray[3] = "3120001042092970023220000"; mesonCutArray[3] = "01022005000"; 
                // Cutstudies 0-10% Alpha
-//                     cutarray[0] = "900297209450308221200001012002000"; 
-//                     cutarray[1] = "900297209450300221200001012002000"; 
+//                     cutarray[4] = "1010001042092970023220000"; mesonCutArray[4] = "01022085000"; 
+//                     cutarray[5] = "1010001042092970023220000"; mesonCutArray[5] = "01022005000"; 
                // Cutstudies 10-20% Alpha
-//                     cutarray[0] = "900297209450308221200001122002000"; 
-//                     cutarray[1] = "900297209450300221200001122002000"; 
+//                     cutarray[6] = "1120001042092970023220000"; mesonCutArray[6] = "01022085000"; 
+//                     cutarray[7] = "1120001042092970023220000"; mesonCutArray[7] = "01022005000"; 
                // Cutstudies 20-40% Alpha
-//       cutarray[0] = "900297209450308221200001242002000";
-//       cutarray[1] = "900297209450300221200001242002000";
-               // Cutstudies 40-60% Alpha
-//       cutarray[0] = "900297209450307221200001682002000";
-//       cutarray[1] = "900297209450305221200001682002000";
+//       cutarray[8] = "1240001042092970023220000"; mesonCutArray[8] = "01022085000";
+//       cutarray[9] = "1240001042092970023220000"; mesonCutArray[9] = "01022005000"; 
                // Cutstudies 60-80% Alpha
-//       cutarray[8] = "900297209450307221200001462002000";
-//       cutarray[9] = "900297209450305221200001462002000";
+//       cutarray[10] = "1680001042092970023220000"; mesonCutArray[10] = "01022075000"; 
+//       cutarray[11] = "1680001042092970023220000"; mesonCutArray[11] = "01022055000"; 
+               // Cutstudies 40-60% Alpha
+//       cutarray[12] = "1460001042092970023220000"; mesonCutArray[12] = "01022075000"; 
+//       cutarray[13] = "1460001042092970023220000"; mesonCutArray[13] = "01022055000"; 
 
                // Cutstudies 0-5% Qt
-//                     cutarray[0] = "900297209450404221200003012002000"; 
-//                     cutarray[1] = "900297209450204221200003012002000"; 
+//                     cutarray[14] = "3010001042092970024220000"; mesonCutArray[14] = "01022045000"; 
+//                     cutarray[15] = "3010001042092970022220000"; mesonCutArray[15] = "01022045000"; 
                // Cutstudies 5-10% Qt
-//                     cutarray[0] = "900297209450404221200003122002000"; 
-//                     cutarray[1] = "900297209450204221200003122002000"; 
+//                     cutarray[16] = "3120001042092970024220000"; mesonCutArray[16] = "01022045000"; 
+//                     cutarray[17] = "3120001042092970022220000"; mesonCutArray[17] = "01022045000"; 
                // Cutstudies 0-10% Qt
-//                     cutarray[0] = "900297209450404221200001012002000"; 
-//                     cutarray[1] = "900297209450204221200001012002000"; 
+//                     cutarray[0] = "1010001042092970024220000"; mesonCutArray[0] = "01022045000"; 
+//                     cutarray[1] = "1010001042092970022220000"; mesonCutArray[1] = "01022045000"; 
                // Cutstudies 10-20% Qt
-//                     cutarray[0] = "900297209450404221200001122002000"; 
-//                     cutarray[1] = "900297209450204221200001122002000"; 
+//                     cutarray[2] = "1120001042092970024220000"; mesonCutArray[2] = "01022045000"; 
+//                     cutarray[3] = "1120001042092970022220000"; mesonCutArray[3] = "01022045000"; 
                // Cutstudies 20-40% Qt
-//                     cutarray[0] = "900297209450404221200001242002000"; 
-//                     cutarray[1] = "900297209450204221200001242002000"; 
+//                     cutarray[4] = "1240001042092970024220000"; mesonCutArray[4] = "01022045000"; 
+//                     cutarray[5] = "1240001042092970022220000"; mesonCutArray[5] = "01022045000"; 
                // Cutstudies 40-60% Qt
-//                     cutarray[0] = "900297209450406221200001462002000"; 
-//                     cutarray[1] = "900297209450206221200001462002000"; 
+//                     cutarray[6] = "1460001042092970024220000"; mesonCutArray[6] = "01022065000"; 
+//                     cutarray[7] = "1460001042092970022220000"; mesonCutArray[7] = "01022065000"; 
                // Cutstudies 60-80% Qt
-//                     cutarray[0] = "900297209450406221200001682002000"; 
-//                     cutarray[1] = "900297209450206221200001682002000"; 
+//                     cutarray[8] = "1680001042092970024220000"; mesonCutArray[8] = "01022065000"; 
+//                     cutarray[9] = "1680001042092970022220000"; mesonCutArray[9] = "01022065000"; 
 
                // Cutstudies 0-5% Single Pt
-//                     cutarray[0] = "900297249450304221200003012002000"; 
-//                     cutarray[1] = "900297219450304221200003012002000"; 
+//                     cutarray[10] = "3010001042492970023220000"; mesonCutArray[10] = "01022045000";
+//                     cutarray[11] = "3010001042192970023220000"; mesonCutArray[11] = "01022045000";
                // Cutstudies 5-10% Single Pt
-//                     cutarray[0] = "900297249450304221200003122002000"; 
-//                     cutarray[1] = "900297219450304221200003122002000"; 
+//                     cutarray[12] = "3120001042492970023220000"; mesonCutArray[12] = "01022045000"; 
+//                     cutarray[13] = "3120001042192970023220000"; mesonCutArray[13] = "01022045000"; 
                // Cutstudies 0-10% Single Pt
-//                     cutarray[0] = "900297249450304221200001012002000"; 
-//                     cutarray[1] = "900297219450304221200001012002000"; 
+//                     cutarray[14] = "1010001042492970023220000"; mesonCutArray[14] = "01022045000"; 
+//                     cutarray[15] = "1010001042192970023220000"; mesonCutArray[15] = "01022045000"; 
                // Cutstudies 10-20% Single Pt
-//                     cutarray[0] = "900297249450304221200001122002000"; 
-//                     cutarray[1] = "900297219450304221200001122002000"; 
+//                     cutarray[16] = "1120001042492970023220000"; mesonCutArray[16] = "01022045000"; 
+//                     cutarray[17] = "1120001042192970023220000"; mesonCutArray[17] = "01022045000"; 
                // Cutstudies 20-40% Single Pt
-//                     cutarray[0] = "900297249450304221200001242002000"; 
-//                     cutarray[1] = "900297219450304221200001242002000"; 
+//                     cutarray[0] = "1240001042492970023220000"; mesonCutArray[0] = "01022045000"; 
+//                     cutarray[1] = "1240001042192970023220000"; mesonCutArray[1] = "01022045000"; 
                // Cutstudies 40-60% Single Pt
-//                     cutarray[0] = "900297249450306221200001462002000"; 
-//                     cutarray[1] = "900297219450306221200001462002000"; 
+//                     cutarray[2] = "1460001042492970023220000"; mesonCutArray[2] = "01022065000"; 
+//                     cutarray[3] = "1460001042192970023220000"; mesonCutArray[3] = "01022065000"; 
                // Cutstudies 60-80% Single Pt
-//                     cutarray[0] = "900297249450306221200001682002000"; 
-//                     cutarray[1] = "900297219450306221200001682002000"; 
+//                     cutarray[4] = "1680001042492970023220000"; mesonCutArray[4] = "01022065000"; 
+//                     cutarray[5] = "1680001042192970023220000"; mesonCutArray[5] = "01022065000"; 
 
                // Cutstudies 0-5% Chi2 Gamma
-//                     cutarray[0] = "900297109450304221200003012002000"; 
-//                     cutarray[1] = "900297809450304221200004012002000"; 
+//                     cutarray[6] = "3010001042092970023120000"; mesonCutArray[6] = "01022045000"; 
+//                     cutarray[7] = "3010001042092970023820000"; mesonCutArray[7] = "01022045000"; 
                // Cutstudies 5-10% Chi2 Gamma
-//                     cutarray[0] = "900297109450304221200003122002000"; 
-//                     cutarray[1] = "900297809450304221200003122002000"; 
+//                     cutarray[8] = "3120001042092970023120000"; mesonCutArray[8] = "01022045000"; 
+//                     cutarray[9] = "3120001042092970023820000"; mesonCutArray[9] = "01022045000"; 
                // Cutstudies 0-10% Chi2 Gamma
-//                     cutarray[0] = "900297109450304221200001012002000"; 
-//                     cutarray[1] = "900297809450304221200001012002000"; 
+//                     cutarray[10] = "1010001042092970023120000"; mesonCutArray[10] = "01022045000"; 
+//                     cutarray[11] = "1010001042092970023820000"; mesonCutArray[11] = "01022045000"; 
                // Cutstudies 10-20% Chi2 Gamma
-//                     cutarray[0] = "900297109450304221200001122002000"; 
-//                     cutarray[1] = "900297809450304221200001122002000"; 
+//                     cutarray[12] = "1120001042092970023120000"; mesonCutArray[12] = "01022045000"; 
+//                     cutarray[13] = "1120001042092970023820000"; mesonCutArray[13] = "01022045000"; 
                // Cutstudies 20-40% Chi2 Gamma
-//                     cutarray[0] = "900297109450304221200001242002000"; 
-//                     cutarray[1] = "900297809450304221200001242002000"; 
+//                     cutarray[14] = "1240001042092970023120000"; mesonCutArray[14] = "01022045000"; 
+//                     cutarray[15] = "1240001042092970023820000"; mesonCutArray[15] = "01022045000"; 
                // Cutstudies 40-60% Chi2 Gamma
-//                     cutarray[0] = "900297109450306221200001462002000"; 
-//                     cutarray[1] = "900297809450306221200001462002000"; 
+//                     cutarray[16] = "1460001042092970023120000"; mesonCutArray[16] = "01022065000"; 
+//                     cutarray[17] = "1460001042092970023820000"; mesonCutArray[17] = "01022065000"; 
                // Cutstudies 60-80% Chi2 Gamma
-//                     cutarray[0] = "900297109450306221200001682002000"; 
-//                     cutarray[1] = "900297809450306221200001682002000"; 
+//                     cutarray[18] = "1680001042092970023120000"; mesonCutArray[18] = "01022065000"; 
+//                     cutarray[19] = "1680001042092970023820000"; mesonCutArray[19] = "01022065000"; 
 
                // Cutstudies 0-5% TPC Cluster
-//                     cutarray[0] = "900297206450304221200003012002000"; 
-//                     cutarray[1] = "900297208450304221200003012002000"; 
+//                     cutarray[0] = "3010001042062970023220000"; mesonCutArray[0] = "01022045000"; 
+//                     cutarray[1] = "3010001042082970023220000"; mesonCutArray[1] = "01022045000";
                // Cutstudies 5-10% TPC Cluster
-//                     cutarray[0] = "900297206450304221200003122002000"; 
-//                     cutarray[1] = "900297208450304221200003122002000"; 
+//                     cutarray[2] = "3120001042062970023220000"; mesonCutArray[2] = "01022045000"; 
+//                     cutarray[3] = "3120001042082970023220000"; mesonCutArray[3] = "01022045000"; 
                // Cutstudies 0-10% TPC Cluster
-//                     cutarray[0] = "900297206450304221200001012002000"; 
-//                     cutarray[1] = "900297208450304221200001012002000"; 
+//                     cutarray[4] = "1010001042062970023220000"; mesonCutArray[4] = "01022045000"; 
+//                     cutarray[5] = "1010001042082970023220000"; mesonCutArray[5] = "01022045000"; 
                // Cutstudies 10-20% TPC Cluster
-//                     cutarray[0] = "900297206450304221200001122002000"; 
-//                     cutarray[1] = "900297208450304221200001122002000"; 
+//                     cutarray[6] = "1120001042062970023220000"; mesonCutArray[6] = "01022045000"; 
+//                     cutarray[7] = "1120001042082970023220000"; mesonCutArray[7] = "01022045000"; 
                // Cutstudies 20-40% TPC Cluster
-//                     cutarray[0] = "900297206450304221200001242002000"; 
-//                     cutarray[1] = "900297208450304221200001242002000"; 
+//                     cutarray[8] = "1240001042062970023220000"; mesonCutArray[8] = "01022045000"; 
+//                     cutarray[9] = "1240001042082970023220000"; mesonCutArray[9] = "01022045000"; 
                // Cutstudies 40-60% TPC Cluster
-//                     cutarray[0] = "900297206450306221200001462002000"; 
-//                     cutarray[1] = "900297208450306221200001462002000"; 
+//                     cutarray[10] = "1460001042062970023220000"; mesonCutArray[10] = "01022065000"; 
+//                     cutarray[11] = "1460001042082970023220000"; mesonCutArray[11] = "01022065000"; 
                // Cutstudies 60-80% TPC Cluster
-//                     cutarray[0] = "900297206450306221200001682002000"; 
-//                     cutarray[1] = "900297208450306221200001682002000"; 
+//                     cutarray[12] = "1680001042062970023220000"; mesonCutArray[12] = "01022065000"; 
+//                     cutarray[13] = "1680001042082970023220000"; mesonCutArray[13] = "01022065000"; 
 
                // Cutstudies 0-5% Psi Pair
-//                     cutarray[0] = "900297209450304221200003012001000"; 
-//                     cutarray[1] = "900297209450304221200003012003000"; 
+//                     cutarray[14] = "3010001042092970023210000"; mesonCutArray[14] = "01022045000"; 
+//                     cutarray[15] = "3010001042092970023230000"; mesonCutArray[15] = "01022045000"; 
                // Cutstudies 5-10% Psi Pair
-//                     cutarray[0] = "900297209450304221200003122001000"; 
-//                     cutarray[1] = "900297209450304221200003122003000"; 
+//                     cutarray[16] = "3120001042092970023210000"; mesonCutArray[16] = "01022045000"; 
+//                     cutarray[17] = "3120001042092970023230000"; mesonCutArray[17] = "01022045000"; 
                // Cutstudies 0-10% Psi Pair
-//                     cutarray[0] = "900297209450304221200001012001000"; 
-//                     cutarray[1] = "900297209450304221200001012003000"; 
+//                     cutarray[0] = "1010001042092970023210000"; mesonCutArray[0] = "01022045000"; 
+//                     cutarray[1] = "1010001042092970023230000"; mesonCutArray[1] = "01022045000"; 
                // Cutstudies 10-20% Psi Pair
-//                     cutarray[0] = "900297209450304221200001122001000"; 
-//                     cutarray[1] = "900297209450304221200001122003000"; 
+//                     cutarray[2] = "1120001042092970023210000"; mesonCutArray[2] = "01022045000"; 
+//                     cutarray[3] = "1120001042092970023230000"; mesonCutArray[3] = "01022045000";
                // Cutstudies 20-40% Psi Pair
-//                     cutarray[0] = "900297209450304221200001242001000"; 
-//                     cutarray[1] = "900297209450304221200001242003000"; 
+//                     cutarray[4] = "1240001042092970023210000"; mesonCutArray[4] = "01022045000"; 
+//                     cutarray[5] = "1240001042092970023230000"; mesonCutArray[5] = "01022045000"; 
                // Cutstudies 40-60% Psi Pair
-//                     cutarray[0] = "900297209450306221200001462001000"; 
-//                     cutarray[1] = "900297209450306221200001462003000"; 
+//                     cutarray[6] = "1460001042092970023210000"; mesonCutArray[6] = "01022065000"; 
+//                     cutarray[7] = "1460001042092970023230000"; mesonCutArray[7] = "01022065000"; 
                // Cutstudies 60-80% Psi Pair
-//                     cutarray[0] = "900297209450306221200001682001000"; 
-//                     cutarray[1] = "900297209450306221200001682003000"; 
+//                     cutarray[8] = "1680001042092970023210000"; mesonCutArray[8] = "01022065000"; 
+//                     cutarray[9] = "1680001042092970023230000"; mesonCutArray[9] = "01022065000"; 
 
                // Cutstudies 0-5% R Cut
-//                     cutarray[0] = "900297209450304121200003012002000"; 
-//                     cutarray[1] = "900297209450304421200003012002000"; 
+//                     cutarray[10] = "3010001041092970023220000"; mesonCutArray[10] = "01022045000"; 
+//                     cutarray[11] = "3010001044092970023220000"; mesonCutArray[11] = "01022045000"; 
                // Cutstudies 5-10% R Cut
-//                     cutarray[0] = "900297209450304121200003122002000"; 
-//                     cutarray[1] = "900297209450304421200003122002000"; 
+//                     cutarray[12] = "3120001041092970023220000"; mesonCutArray[12] = "01022045000"; 
+//                     cutarray[13] = "3120001044092970023220000"; mesonCutArray[13] = "01022045000";
                // Cutstudies 0-10% R Cut
-//                     cutarray[0] = "900297209450304121200001012002000"; 
-//                     cutarray[1] = "900297209450304421200001012002000"; 
+//                     cutarray[14] = "1010001041092970023220000"; mesonCutArray[14] = "01022045000"; 
+//                     cutarray[15] = "1010001044092970023220000"; mesonCutArray[15] = "01022045000"; 
                // Cutstudies 10-20% R Cut
-//                     cutarray[0] = "900297209450304121200001122002000"; 
-//                     cutarray[1] = "900297209450304421200001122002000"; 
+//                     cutarray[16] = "1120001041092970023220000"; mesonCutArray[16] = "01022045000"; 
+//                     cutarray[17] = "1120001044092970023220000"; mesonCutArray[17] = "01022045000"; 
                // Cutstudies 20-40% R Cut
-//                     cutarray[0] = "900297209450304121200001242002000"; 
-//                     cutarray[1] = "900297209450304421200001242002000"; 
+//                     cutarray[0] = "1240001041092970023220000"; mesonCutArray[0] = "01022045000"; 
+//                     cutarray[1] = "1240001044092970023220000"; mesonCutArray[1] = "01022045000"; 
                // Cutstudies 40-60% R Cut
-//                     cutarray[0] = "900297209450306121200001462002000"; 
-//                     cutarray[1] = "900297209450306421200001462002000"; 
+//                     cutarray[2] = "1460001041092970023220000"; mesonCutArray[2] = "01022065000"; 
+//                     cutarray[3] = "1460001044092970023220000"; mesonCutArray[3] = "01022065000"; 
                // Cutstudies 60-80% R Cut
-//                     cutarray[0] = "900297209450306121200001682002000"; 
-//                     cutarray[1] = "900297209450306421200001682002000"; 
-
+//                     cutarray[4] = "1680001041092970023220000"; mesonCutArray[4] = "01022065000"; 
+//                     cutarray[5] = "1680001044092970023220000"; mesonCutArray[5] = "01022065000"; 
+       } else if(trainConfig.Contains("pPb")){ //pA needs thighter rapidity cut y < 0.5
+                cutarray[0] = "1000000042092172023220000"; mesonCutArray[0] = "01024045000";  //standard cut Pi0 PbPb 00-100
    } else {
-       cutarray[0] = "900366809010333211361000000900000"; //Standard Cut Pi0 with PileUp Rejection
-//       cutarray[1] = "900226609010303211361000004900000"; //Standard Cut Gamma with PileUp Rejection
-//             // V0 finder      
-//             cutarray[2] = "910366809010333211361000000900000"; //Standard Cut Pi0 with PileUp Rejection V0 offline
+//        cutarray[0] = "0000010002093663003800000"; mesonCutArray[0] = "01631031009"; //Standard Cut Pi0 with PileUp Rejection
+//             // V0 finder      
+// //           cutarray[1] = "0000010102093663003800000"; mesonCutArray[1] = "01631031009"; //Standard Cut Pi0 with PileUp Rejection
+//        cutarray[1] = "0000011002093663003800000"; mesonCutArray[1] = "01631031009"; //Standard Cut only MinBias in MC
+//              cutarray[2] = "0000012002093663003800000"; mesonCutArray[2] = "01631031009"; //Standard Cut only added Signals in MC            
+// //       cutarray[1] = "0000010002093260043800000"; mesonCutArray[0] = "01631031009";  //Standard Cut Gamma with PileUp Rejection
+// 
 //             // dEdx e-line
-//       cutarray[2] = "900166809010333211361000000900000"; 
-//       cutarray[3] = "900266809010333211361000000900000"; 
+//       cutarray[3] = "0000011002091663003800000"; mesonCutArray[3] = "01631031009"; 
+//       cutarray[4] = "0000011002092663003800000"; mesonCutArray[4] = "01631031009";
 //             // dEdx pi-line
-//             cutarray[4] = "900386809010333211361000000900000";
-//             cutarray[5] = "900355809010333211361000000900000";
-//             cutarray[6] = "900310809010303211361000000900000";
-//             cutarray[7] = "900367809010343211361000000900000";
+//             cutarray[5] = "0000011002093863003800000"; mesonCutArray[5] = "01631031009"; 
+//             cutarray[6] = "0000011002093553003800000"; mesonCutArray[6] = "01631031009"; 
+//             cutarray[7] = "0000011002093100003800000"; mesonCutArray[7] = "01631031009"; 
+//             cutarray[8] = "0000011002093674003800000"; mesonCutArray[8] = "01631031009"; 
 //             // Alpha 
-//             cutarray[8] = "900366809010330211361000000900000";
+//             cutarray[9] = "0000011002093663003800000"; mesonCutArray[9] = "01631001009"; 
 //             // chi2 gamma
-//       cutarray[9] = "900366909010333211361000000900000";
-//       cutarray[10] = "900366209010333211361000000900000";
+//       cutarray[10] = "0000011002093663003900000"; mesonCutArray[10] = "01631031009"; 
+//       cutarray[11] = "0000011002093663003200000"; mesonCutArray[11] = "01631031009"; 
 //             // pt single e+/e-
-//       cutarray[11] = "900366849010333211361000000900000";
-//       cutarray[12] = "900366819010333211361000000900000";
-//             // findable cluster TPC
-//             cutarray[0] = "900366800010333211361000000900000";
-//             cutarray[1] = "900366808010333211361000000900000";
-//             // qt variation
-//             cutarray[2] = "900366809010433211361000000900000";
-//             cutarray[3] = "900366809010233211361000000900000";
-//             // TOF
-//             cutarray[4] = "900366809010333211361000002900000";
-//             cutarray[5] = "900366809010333211361000003900000";
-//             cutarray[6] = "900366809010333211361000004900000";
-//             // track sharing
-//             cutarray[7] = "900366809010333211361000000900013";
-//             cutarray[8] = "900366809010333211361000000900012";
-
-      // cutarray[1] = "9006266090103032113600000049000";
-      // cutarray[2] = "9007266090103032113600000049000";
-      // cutarray[3] = "9006267090103032113600000049000";
-      // cutarray[4] = "9006268090103032113600000049000";
-      // cutarray[5] = "9006265090103032113600000049000";
-      // cutarray[6] = "9006265090103032113600000049010";
-      // cutarray[7] = "9006265090103032113600000049020";
-      // cutarray[8] = "9006265090103032113600000049030";
-      // cutarray[9] = "9003662080100332113600000009000";
-      // cutarray[0] = "9006166090103032113600000049000";
-      // cutarray[1] = "9006266090103032113600000049000";
-      // cutarray[2] = "9006366090103032113600000049000";
-      // cutarray[3] = "9006206090103032113600000049000";
-      // cutarray[4] = "9006666090103032113600000049000";
-      // cutarray[5] = "9006566090103032113600000049000";
-      // cutarray[6] = "9006266090104032113600000049000";
-      // cutarray[7] = "9006266090102032113600000049000";
-      // cutarray[8] = "9006266090103032113600000049020";
-      // cutarray[9] = "9003662080100332113600000009000";
-      // cutarray[0] = "9006266090103032113600000049000";
-      // cutarray[1] = "9006267090103032113600000049000";
-      // cutarray[2] = "9006268090103032113600000049000";
-      // cutarray[3] = "9006266190103032113600000049000";
-      // cutarray[4] = "9006266290103032113600000049000";
-      // cutarray[5] = "9006266080103032113600000049000";
-      // cutarray[6] = "9006266091103032113600000049000";
-      // cutarray[7] = "9006266091403032113600000049000";
-      // cutarray[8] = "9002265090103032113600000049000";
-      // cutarray[9] = "9003662080100332113600000009000";
-      
-      // cutarray[1] = "9003662080100332113600000009000";
-      // cutarray[2] = "9006266090103031113600000049000";
-      // cutarray[3] = "9006266090103035113600000049000";
-      // cutarray[4] = "9006266090103032113600000029000";
-      // cutarray[5] = "9006266090103032113600000039000";
-      // cutarray[6] = "9002266090103032113600000049000";
-      // cutarray[7] = "9003266090103032113600000049000";
-      // cutarray[8] = "9002267090103032113600000049000";
-      // cutarray[9] = "9002268090103032113600000049000";
-   }
+//       cutarray[12] = "0000011002493663003800000"; mesonCutArray[12] = "01631031009"; 
+//       cutarray[13] = "0000011002193663003800000"; mesonCutArray[13] = "01631031009"; 
+               // findable cluster TPC
+               cutarray[0] = "0000010002003663003800000"; mesonCutArray[0] = "01631031009"; 
+               cutarray[1] = "0000010002083663003800000"; mesonCutArray[1] = "01631031009"; 
+               // qt variation
+               cutarray[2] = "0000010002093663004800000"; mesonCutArray[2] = "01631031009"; 
+               cutarray[3] = "0000010002093663002800000"; mesonCutArray[3] = "01631031009"; 
+               // TOF
+               cutarray[4] = "0000010002093663023800000"; mesonCutArray[4] = "01631031009"; 
+               cutarray[5] = "0000010002093663033800000"; mesonCutArray[5] = "01631031009"; 
+               cutarray[6] = "0000010002093663043800000"; mesonCutArray[6] = "01631031009"; 
+               // track sharing
+               cutarray[7] = "0000010002093663003800013"; mesonCutArray[7] = "01631031009"; 
+               cutarray[8] = "0000010002093663003800012"; mesonCutArray[8] = "01631031009"; 
+  }
   
    TList *ConvCutList = new TList();
+       TList *MesonCutList = new TList();
+
+   TList *HeaderList = new TList();
+   TObjString *Header1 = new TObjString("PARAM");
+   HeaderList->Add(Header1);
+   TObjString *Header2 = new TObjString("BOX");
+   HeaderList->Add(Header2);
+   TObjString *Header3 = new TObjString("Pythia");
+   HeaderList->Add(Header3);
+   
    ConvCutList->SetOwner(kTRUE);
    AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
+       MesonCutList->SetOwner(kTRUE);
+   AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
+
    for(Int_t i = 0; i<numberOfCuts; i++){
       analysisCuts[i] = new AliConversionCuts();
       analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
+               if (trainConfig.Contains("pPb")) analysisCuts[i]->SelectCollisionCandidates(AliVEvent::kCINT5);
       ConvCutList->Add(analysisCuts[i]);
+               
       analysisCuts[i]->SetFillCutHistograms("",kFALSE);
-//      if(i == 0 ){ //|| i == 1
-//       if(!IsHeavyIon){
-//          AddQATaskV1(analysisCuts[i],IsHeavyIon);
-//          TString addoutput=gSystem->Getenv("ADD_OUTPUT_FILES");
-//          if (addoutput.Length()) addoutput+=",";
-//          addoutput+=Form("GammaConvV1_QA_%s.root",((analysisCuts[i])->GetCutNumber()).Data());
-//          gSystem->Setenv("ADD_OUTPUT_FILES",addoutput.Data());
-//          cout<<"Adding addoutput.Data()"<<endl;
- //      }
-//             }
+//      if(i == 2 ){
+ //        analysisCuts[i]->SetAcceptedHeader(HeaderList);
+//      }
+      analysisMesonCuts[i] = new AliConversionMesonCuts();
+      analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
+      MesonCutList->Add(analysisMesonCuts[i]);
+               analysisMesonCuts[i]->SetFillCutHistograms("",kFALSE);
+               if (i < 7 && trainConfig.Contains("PbPb")){
+                       AddQATaskV1(analysisCuts[i],IsHeavyIon);
+                       TString addoutput=gSystem->Getenv("ADD_OUTPUT_FILES");
+                       if (addoutput.Length()) addoutput+=",";
+                       addoutput+=Form("GammaConvV1_QA_%s.root",((analysisCuts[i])->GetCutNumber()).Data());
+                       gSystem->Setenv("ADD_OUTPUT_FILES",addoutput.Data());
+       }
    }
    task->SetConversionCutList(numberOfCuts,ConvCutList);
+       task->SetMesonCutList(numberOfCuts,MesonCutList);
    task->SetMoveParticleAccordingToVertex(kTRUE);
    task->SetDoMesonAnalysis(kTRUE);
    mgr->AddTask(task);
@@ -400,14 +399,15 @@ AliAnalysisTask *AddTask_GammaConvV1(TString collisionSystem = "pp"){
       mgr->CreateContainer("GammaConvV1", TList::Class(),
                            AliAnalysisManager::kOutputContainer,"GammaConvV1.root");
    AliAnalysisDataContainer *coutput0 =
-      mgr->CreateContainer("gammaConv_tree",
+      mgr->CreateContainer("kkoch_tree",
                            TTree::Class(),
                            AliAnalysisManager::kExchangeContainer,
-                           "gammaConv_default");
+                           "kkoch_default");
    mgr->ConnectInput  (task,  0, cinput );
    mgr->ConnectOutput (task,  0, coutput0);
    mgr->ConnectOutput (task,  1, coutput1);
    return task;
+
 }
 
 void ConfigV0ReaderV1(AliV0ReaderV1 *fV0ReaderV1,TString analysiscut="",Bool_t IsHeavyIon=kFALSE){
diff --git a/PWGGA/GammaConv/macros/AddTask_Material.C b/PWGGA/GammaConv/macros/AddTask_Material.C
new file mode 100644 (file)
index 0000000..f1eaf6c
--- /dev/null
@@ -0,0 +1,122 @@
+AliAnalysisTask *AddTask_Material(){
+                       
+   //get the current analysis manager
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   if (!mgr) {
+      Error("AddTask_Material", "No analysis manager found.");
+      return 0;
+   }
+   
+   TString trainConfig=gSystem->Getenv("CONFIG_FILE");
+       cout << trainConfig.Data() << endl;
+   Bool_t IsHeavyIon=trainConfig.Contains("PbPb");
+
+   TString cutnumber = "";
+   if(IsHeavyIon) cutnumber = "1080000020084001001500000";
+   else cutnumber = "0000000020084001001500000"; 
+       
+   //========= Add PID Reponse to ANALYSIS manager ====
+   if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
+      gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+      AddTaskPIDResponse();
+   }
+   
+   //========= Add V0 Reader to  ANALYSIS manager =====
+   AliV0ReaderV1 *fV0ReaderV1=new AliV0ReaderV1("V0ReaderV1");
+   ConfigV0ReaderV1(fV0ReaderV1,cutnumber,IsHeavyIon);
+   mgr->AddTask(fV0ReaderV1);
+  
+   AliLog::SetGlobalLogLevel(AliLog::kInfo);
+
+   //================================================
+   //              data containers
+   //================================================
+   //            find input container
+   //below the trunk version
+   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
+   //connect input V0Reader
+   mgr->ConnectInput (fV0ReaderV1,0,cinput);
+   
+//   TString cutarray = "0000010020093663003800000"; //Standard Cut Pi0 with PileUp Rejection
+//   TString cutarray = "0000010020092663003800000"; //Standard Cut Pi0 with PileUp Rejection
+    TString cutarray = "0000010020092663043800000"; //Standard Cut Pi0 with PileUp Rejection
+
+   TList *ConvCutList = new TList();
+   ConvCutList->SetOwner(kTRUE);
+   AliConversionCuts *analysisCuts = new AliConversionCuts();
+       analysisCuts->InitializeCutsFromCutString(cutarray.Data());
+       ConvCutList->Add(analysisCuts);
+       analysisCuts->SetFillCutHistograms("",kFALSE);
+       AliAnalysisTaskMaterial *fMaterial= new AliAnalysisTaskMaterial(Form("%s_Material",(analysisCuts->GetCutNumber()).Data()));
+       fMaterial->SetConversionCuts(analysisCuts,IsHeavyIon);
+       TString addoutput=gSystem->Getenv("ADD_OUTPUT_FILES");
+       if (addoutput.Length()) addoutput+=",";
+       addoutput+=Form("GammaConvV1_Material_%s.root",(analysisCuts->GetCutNumber()).Data());
+       if (trainConfig.Contains("MC"){
+               if (addoutput.Length()) addoutput+=",";
+               addoutput+=Form("GammaConvV1_Resolution_%s.root",(analysisCuts->GetCutNumber()).Data());
+       }
+       AddQATaskV1(analysisCuts,IsHeavyIon);
+       if (addoutput.Length()) addoutput+=",";
+       addoutput+=Form("GammaConvV1_QA_%s.root",(analysisCuts->GetCutNumber()).Data());
+       gSystem->Setenv("ADD_OUTPUT_FILES",addoutput.Data());
+       
+       cout<<"Adding addoutput.Data()"<<endl; 
+
+       mgr->AddTask(fMaterial);
+       mgr->ConnectInput(fMaterial,  0, cinput );
+       
+   //connect containers
+   return fMaterial;
+}
+
+void ConfigV0ReaderV1(AliV0ReaderV1 *fV0ReaderV1,TString analysiscut="",Bool_t IsHeavyIon=kFALSE){
+
+   fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
+   fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
+   fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
+
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   if (!mgr) {
+      Error("AddTask_V0ReaderV1", "No analysis manager found.");
+      return;
+   }
+   AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
+   
+   if(inputHandler->IsA()==AliESDInputHandler::Class()){
+      // ESD mode
+   }
+   
+   if(inputHandler->IsA()==AliAODInputHandler::Class()){
+      // AOD mode
+      //   task->SetUseSatelliteAODs(kTRUE);
+   }
+
+   // Set AnalysisCut Number
+   AliConversionCuts *fCuts=NULL;
+   if(analysiscut!=""){
+      fCuts= new AliConversionCuts(analysiscut.Data(),analysiscut.Data());
+      if(fCuts->InitializeCutsFromCutString(analysiscut.Data())){
+         fV0ReaderV1->SetConversionCuts(fCuts);
+         fCuts->SetFillCutHistograms("",kTRUE);
+      }
+   }
+   fV0ReaderV1->Init();
+   
+}
+
+void AddQATaskV1(AliConversionCuts *ConversionCuts, Bool_t IsHeavyIon){
+   
+   //get the current analysis manager
+    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+    if (!mgr) {
+       Error("AddTask_V0ReaderV1QA", "No analysis manager found.");
+       return 0;
+    }
+    AliAnalysisTaskConversionQA *fQA = new AliAnalysisTaskConversionQA(Form("%s_QA",(ConversionCuts->GetCutNumber()).Data()));
+    fQA->SetConversionCuts(ConversionCuts,IsHeavyIon);
+    mgr->AddTask(fQA);
+    
+    AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
+    mgr->ConnectInput (fQA,0,cinput);
+}