]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/GammaConv/AliAnalysisTaskGammaCalo.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaCalo.cxx
index d31d7f3628a7827ca2c1b39a63c8bbd256ffe346..b42c31c8e5a0cb1df319ec63a8c1eb56fbf166bf 100644 (file)
@@ -95,6 +95,7 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
        fHistoMotherInvMassECalib(NULL),
        fHistoMotherInvMassECalibalpha(NULL),
        fHistoClusGammaPt(NULL),
+       fHistoClusOverlapHeadersGammaPt(NULL),
        fHistoMCHeaders(NULL),
        fHistoMCAllGammaPt(NULL),
        fHistoMCDecayGammaPi0Pt(NULL),
@@ -112,6 +113,8 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
        fHistoMCEtaInAccPt(NULL),
        fHistoMCPi0PtY(NULL),
        fHistoMCEtaPtY(NULL),
+       fHistoMCPi0PtAlpha(NULL),
+       fHistoMCEtaPtAlpha(NULL),
        fHistoMCK0sPt(NULL),
        fHistoMCK0sWOWeightPt(NULL),
        fHistoMCK0sPtY(NULL),
@@ -133,6 +136,22 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
        fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
        fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
        fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
+       fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
+       fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
+       fHistoTruePi0Category1(NULL),
+       fHistoTrueEtaCategory1(NULL),
+       fHistoTruePi0Category2(NULL),
+       fHistoTrueEtaCategory2(NULL),
+       fHistoTruePi0Category3(NULL),
+       fHistoTrueEtaCategory3(NULL),
+       fHistoTruePi0Category4_6(NULL),
+       fHistoTrueEtaCategory4_6(NULL),
+       fHistoTruePi0Category5(NULL),
+       fHistoTrueEtaCategory5(NULL),
+       fHistoTruePi0Category7(NULL),
+       fHistoTrueEtaCategory7(NULL),
+       fHistoTruePi0Category8(NULL),
+       fHistoTrueEtaCategory8(NULL),
        fHistoTruePrimaryPi0InvMassPt(NULL),
        fHistoTruePrimaryEtaInvMassPt(NULL),
        fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
@@ -142,7 +161,6 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
        fHistoTruePrimaryPi0MCPtResolPt(NULL),
        fHistoTruePrimaryEtaMCPtResolPt(NULL),
        fHistoTrueSecondaryPi0InvMassPt(NULL),
-       fHistoTrueSecondaryEtaInvMassPt(NULL),
        fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
        fHistoTrueK0sWithPi0DaughterMCPt(NULL),
        fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
@@ -203,6 +221,7 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
        fDoMesonQA(0),
        fDoClusterQA(0),
        fIsFromMBHeader(kTRUE),
+       fIsOverlappingWithOtherHeader(kFALSE),
        fIsMC(kFALSE)
 {
   
@@ -246,6 +265,7 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
        fHistoMotherInvMassECalib(NULL),
        fHistoMotherInvMassECalibalpha(NULL),
        fHistoClusGammaPt(NULL),
+       fHistoClusOverlapHeadersGammaPt(NULL),
        fHistoMCHeaders(NULL),
        fHistoMCAllGammaPt(NULL),
        fHistoMCDecayGammaPi0Pt(NULL),
@@ -263,6 +283,8 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
        fHistoMCEtaInAccPt(NULL),
        fHistoMCPi0PtY(NULL),
        fHistoMCEtaPtY(NULL),
+       fHistoMCPi0PtAlpha(NULL),
+       fHistoMCEtaPtAlpha(NULL),
        fHistoMCK0sPt(NULL),
        fHistoMCK0sWOWeightPt(NULL),
        fHistoMCK0sPtY(NULL),
@@ -284,6 +306,22 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
        fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
        fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
        fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
+       fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
+       fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
+       fHistoTruePi0Category1(NULL),
+       fHistoTrueEtaCategory1(NULL),
+       fHistoTruePi0Category2(NULL),
+       fHistoTrueEtaCategory2(NULL),
+       fHistoTruePi0Category3(NULL),
+       fHistoTrueEtaCategory3(NULL),
+       fHistoTruePi0Category4_6(NULL),
+       fHistoTrueEtaCategory4_6(NULL),
+       fHistoTruePi0Category5(NULL),
+       fHistoTrueEtaCategory5(NULL),
+       fHistoTruePi0Category7(NULL),
+       fHistoTrueEtaCategory7(NULL),
+       fHistoTruePi0Category8(NULL),
+       fHistoTrueEtaCategory8(NULL),
        fHistoTruePrimaryPi0InvMassPt(NULL),
        fHistoTruePrimaryEtaInvMassPt(NULL),
        fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
@@ -293,7 +331,6 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
        fHistoTruePrimaryPi0MCPtResolPt(NULL),
        fHistoTruePrimaryEtaMCPtResolPt(NULL),
        fHistoTrueSecondaryPi0InvMassPt(NULL),
-       fHistoTrueSecondaryEtaInvMassPt(NULL),
        fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
        fHistoTrueK0sWithPi0DaughterMCPt(NULL),
        fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
@@ -354,6 +391,7 @@ AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
        fDoMesonQA(0),
        fDoClusterQA(0),
        fIsFromMBHeader(kTRUE),
+       fIsOverlappingWithOtherHeader(kFALSE),
        fIsMC(kFALSE)
 {
   // Define output slots here
@@ -375,9 +413,9 @@ AliAnalysisTaskGammaCalo::~AliAnalysisTaskGammaCalo()
 void AliAnalysisTaskGammaCalo::InitBack(){
        
        const Int_t nDim = 4;
-       Int_t nBins[nDim] = {800,250,7,4};
+       Int_t nBins[nDim] = {800,250,7,6};
        Double_t xMin[nDim] = {0,0, 0,0};
-       Double_t xMax[nDim] = {0.8,25,7,4};
+       Double_t xMax[nDim] = {0.8,25,7,6};
        
        fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
        fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
@@ -429,7 +467,8 @@ void AliAnalysisTaskGammaCalo::InitBack(){
                                fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
                                                                                                                                        collisionSystem,centMin,centMax,
                                                                                                                                        ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
-                                                                                                                                       ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
+                                                                                                                                       ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
+                                                                                                                                       4,8,7);
                        }
                }
        }
@@ -481,6 +520,7 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
        }
                
        fHistoClusGammaPt = new TH1F*[fnCuts];
+       fHistoClusOverlapHeadersGammaPt = new TH1F*[fnCuts];
        
        for(Int_t iCut = 0; iCut<fnCuts;iCut++){
                TString cutstringEvent  = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
@@ -497,11 +537,11 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                fESDList[iCut]->SetOwner(kTRUE);
                fCutFolder[iCut]->Add(fESDList[iCut]);
     
-               fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
+               fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",10,-0.5,9.5);
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
-               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
+               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){ 
                        TString TriggerNames = "Not Trigger: ";
                        TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
                        fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
@@ -513,6 +553,7 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
                fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
+               fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
                fESDList[iCut]->Add(fHistoNEvents[iCut]);
                
                if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
@@ -538,7 +579,8 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
     
                fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
                fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
-
+               fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",250,0,25);
+               fESDList[iCut]->Add(fHistoClusOverlapHeadersGammaPt[iCut]);
                
                if(fDoMesonAnalysis){
                        fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
@@ -569,10 +611,10 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
                                SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
                                fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
-                               fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
+                               fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
                                SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
                                fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
-                               fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
+                               fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
                                SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
                                fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
                        }
@@ -616,7 +658,6 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                fHistoTrueSecondaryClusGammaFromXFromEtasPt             = new TH1F*[fnCuts];
                fHistoTrueSecondaryClusConvGammaFromXFromEtasPt         = new TH1F*[fnCuts];
     
-               
                if (fDoClusterQA > 0){  
                        fHistoTrueClusUnConvGammaPt             = new TH1F*[fnCuts];
                        fHistoTrueClusUnConvGammaMCPt           = new TH1F*[fnCuts];
@@ -653,13 +694,14 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                        fProfileTruePrimaryPi0WeightsInvMassPt  = new TProfile2D*[fnCuts];
                        fProfileTruePrimaryEtaWeightsInvMassPt  = new TProfile2D*[fnCuts];
                        fHistoTrueSecondaryPi0InvMassPt                         = new TH2F*[fnCuts];
-                       fHistoTrueSecondaryEtaInvMassPt                         = new TH2F*[fnCuts];
                        fHistoTrueSecondaryPi0FromK0sInvMassPt  = new TH2F*[fnCuts];
                        fHistoTrueSecondaryPi0FromEtaInvMassPt  = new TH2F*[fnCuts];
                        fHistoTrueSecondaryPi0FromLambdaInvMassPt = new TH2F*[fnCuts];
                        if (fDoMesonQA > 0){
                                fHistoMCPi0PtY                                                          = new TH2F*[fnCuts];
                                fHistoMCEtaPtY                                                          = new TH2F*[fnCuts];
+                               fHistoMCPi0PtAlpha                                                      = new TH2F*[fnCuts];
+                               fHistoMCEtaPtAlpha                                                      = new TH2F*[fnCuts];
                                fHistoMCK0sPt                                                           = new TH1F*[fnCuts];
                                fHistoMCK0sWOWeightPt                                           = new TH1F*[fnCuts];
                                fHistoMCK0sPtY                                                          = new TH2F*[fnCuts];
@@ -679,6 +721,8 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                fHistoTrueEtaCaloMergedClusterInvMassPt         = new TH2F*[fnCuts];
                                fHistoTruePi0CaloMergedClusterPartConvInvMassPt         = new TH2F*[fnCuts];
                                fHistoTrueEtaCaloMergedClusterPartConvInvMassPt         = new TH2F*[fnCuts];
+                               fHistoTruePi0NonMergedElectronPhotonInvMassPt   = new TH2F*[fnCuts];
+                               fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt     = new TH2F*[fnCuts];
                                fHistoTruePrimaryPi0MCPtResolPt                         = new TH2F*[fnCuts];
                                fHistoTruePrimaryEtaMCPtResolPt                         = new TH2F*[fnCuts];
                                fHistoTrueK0sWithPi0DaughterMCPt                        = new TH1F*[fnCuts];
@@ -693,6 +737,22 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                fHistoTruePi0PtOpenAngle                                        = new TH2F*[fnCuts];
                                fHistoTrueEtaPtOpenAngle                                        = new TH2F*[fnCuts];
                        }
+                       if (fDoMesonQA==2){
+                               fHistoTruePi0Category1                                          = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory1                                          = new TH2F*[fnCuts];                            
+                               fHistoTruePi0Category2                                          = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory2                                          = new TH2F*[fnCuts];                            
+                               fHistoTruePi0Category3                                          = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory3                                          = new TH2F*[fnCuts];                            
+                               fHistoTruePi0Category4_6                                        = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory4_6                                        = new TH2F*[fnCuts];                            
+                               fHistoTruePi0Category5                                          = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory5                                          = new TH2F*[fnCuts];                            
+                               fHistoTruePi0Category7                                          = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory7                                          = new TH2F*[fnCuts];                            
+                               fHistoTruePi0Category8                                          = new TH2F*[fnCuts];
+                               fHistoTrueEtaCategory8                                          = new TH2F*[fnCuts];                            
+                       }       
                }
     
     
@@ -755,6 +815,13 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                        fHistoMCEtaPtY[iCut]->Sumw2();
                                        SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
                                        fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
+                                       fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",150,0.03,15.,100,0,1);
+                                       SetLogBinningXTH2(fHistoMCPi0PtAlpha[iCut]);
+                                       fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
+                                       fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",150,0.03,15.,100,0,1);
+                                       SetLogBinningXTH2(fHistoMCEtaPtAlpha[iCut]);
+                                       fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
+
                                        fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
                                        fHistoMCK0sPt[iCut]->Sumw2();
                                        fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
@@ -901,9 +968,6 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
                                fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
                                fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
-                               fHistoTrueSecondaryEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryEta_InvMass_Pt", "ESD_TrueSecondaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
-                               fHistoTrueSecondaryEtaInvMassPt[iCut]->Sumw2();
-                               fTrueList[iCut]->Add(fHistoTrueSecondaryEtaInvMassPt[iCut]);
 
                                fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,250,0,25);
                                fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->Sumw2();
@@ -943,6 +1007,10 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                        fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
                                        fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]);
 
+                                       fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt","ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]);
+                                       fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt","ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]);
                                        
                                        fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
                                        fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
@@ -983,6 +1051,37 @@ void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
                                        SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
                                        fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
                                }
+                               
+                               if (fDoMesonQA == 2){
+                                       fHistoTruePi0Category1[iCut] = new TH2F("ESD_TruePi0Category1_InvMass_Pt","ESD_TruePi0Category1_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category1[iCut]);
+                                       fHistoTrueEtaCategory1[iCut] = new TH2F("ESD_TrueEtaCategory1_InvMass_Pt","ESD_TrueEtaCategory1_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory1[iCut]);                                     
+                                       fHistoTruePi0Category2[iCut] = new TH2F("ESD_TruePi0Category2_InvMass_Pt","ESD_TruePi0Category2_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category2[iCut]);
+                                       fHistoTrueEtaCategory2[iCut] = new TH2F("ESD_TrueEtaCategory2_InvMass_Pt","ESD_TrueEtaCategory2_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory2[iCut]);                                     
+                                       fHistoTruePi0Category3[iCut] = new TH2F("ESD_TruePi0Category3_InvMass_Pt","ESD_TruePi0Category3_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category3[iCut]);
+                                       fHistoTrueEtaCategory3[iCut] = new TH2F("ESD_TrueEtaCategory3_InvMass_Pt","ESD_TrueEtaCategory3_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory3[iCut]);                                     
+                                       fHistoTruePi0Category4_6[iCut] = new TH2F("ESD_TruePi0Category4_6_InvMass_Pt","ESD_TruePi0Category4_6_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category4_6[iCut]);
+                                       fHistoTrueEtaCategory4_6[iCut] = new TH2F("ESD_TrueEtaCategory4_6_InvMass_Pt","ESD_TrueEtaCategory4_6_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory4_6[iCut]);                                   
+                                       fHistoTruePi0Category5[iCut] = new TH2F("ESD_TruePi0Category5_InvMass_Pt","ESD_TruePi0Category5_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category5[iCut]);
+                                       fHistoTrueEtaCategory5[iCut] = new TH2F("ESD_TrueEtaCategory5_InvMass_Pt","ESD_TrueEtaCategory5_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory5[iCut]);                                     
+                                       fHistoTruePi0Category7[iCut] = new TH2F("ESD_TruePi0Category7_InvMass_Pt","ESD_TruePi0Category7_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category7[iCut]);
+                                       fHistoTrueEtaCategory7[iCut] = new TH2F("ESD_TrueEtaCategory7_InvMass_Pt","ESD_TrueEtaCategory7_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory7[iCut]);                                     
+                                       fHistoTruePi0Category8[iCut] = new TH2F("ESD_TruePi0Category8_InvMass_Pt","ESD_TruePi0Category8_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTruePi0Category8[iCut]);
+                                       fHistoTrueEtaCategory8[iCut] = new TH2F("ESD_TrueEtaCategory8_InvMass_Pt","ESD_TrueEtaCategory8_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueEtaCategory8[iCut]);                                     
+                               }
                        }
                }
        }  
@@ -1075,7 +1174,11 @@ void AliAnalysisTaskGammaCalo::UserExec(Option_t *)
        for(Int_t iCut = 0; iCut<fnCuts; iCut++){
                
                fiCut = iCut;
-               Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
+               
+               Bool_t isRunningEMCALrelAna = kFALSE;
+               if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
+               
+               Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
                
                if(eventNotAccepted){
                // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
@@ -1133,11 +1236,11 @@ void AliAnalysisTaskGammaCalo::UserExec(Option_t *)
                fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries());
                fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fClusterCandidates->GetEntries());
                if(fDoMesonAnalysis){ // Meson Analysis
-
+                       
                        CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
-
                        if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
                                if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
+                                       
                                        CalculateBackground(); // Combinatorial Background
                                        UpdateEventByEventData(); // Store Event for mixed Events
                                }
@@ -1202,11 +1305,24 @@ void AliAnalysisTaskGammaCalo::ProcessClusters()
                }
                
                fIsFromMBHeader = kTRUE; 
+               fIsOverlappingWithOtherHeader = kFALSE;
                // test whether largest contribution to cluster orginates in added signals
                if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
+               if (fIsMC ){
+                       if (clus->GetNLabels()>1){
+                               Int_t* mclabelsCluster = clus->GetLabels();
+                               for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
+                                       if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCStack, fInputEvent) == 0) fIsOverlappingWithOtherHeader = kTRUE;
+                               }       
+                       }       
+               }       
                
-               if (fIsFromMBHeader)fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-               fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
+               if (fIsFromMBHeader && !fIsOverlappingWithOtherHeader){
+                       fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());  
+                       fClusterCandidates->Add(PhotonCandidate);
+               }
+               if (fIsFromMBHeader && fIsOverlappingWithOtherHeader) fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
+                // if no second loop is required add to events good gammas
                
                if(fIsMC){
                        if(fInputEvent->IsA()==AliESDEvent::Class()){
@@ -1227,7 +1343,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidates(AliAODConversionPhot
                
        TParticle *Photon = NULL;
        if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
-       fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
+       if (fDoClusterQA > 0) fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
        
        if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
                else return;
@@ -1241,7 +1357,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidates(AliAODConversionPhot
        TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
        
        // True Photon
-       if(fIsFromMBHeader){
+       if(fIsFromMBHeader && !fIsOverlappingWithOtherHeader){
                if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                        else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                if (fDoClusterQA > 0){
@@ -1325,6 +1441,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionP
 {
        AliAODMCParticle *Photon = NULL;
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (fDoClusterQA > 0) fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
        if (AODMCTrackArray){
                if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
                if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
@@ -1342,7 +1459,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionP
        TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
        
        // True Photon
-       if(fIsFromMBHeader){
+       if(fIsFromMBHeader && !fIsOverlappingWithOtherHeader){
                if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                        else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                if (fDoClusterQA > 0){
@@ -1468,7 +1585,7 @@ void AliAnalysisTaskGammaCalo::ProcessAODMCParticles()
                                }
                        }
                }
-                       // Converted MC Gamma
+               // Converted MC Gamma
                if(fDoMesonAnalysis){
                        if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
                                Double_t mesonY = 10.;
@@ -1496,26 +1613,34 @@ void AliAnalysisTaskGammaCalo::ProcessAODMCParticles()
                                if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
                                        if (particle->Pt()>0.005){
                                                weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
-                                               //                   if(particle->GetPdgCode() == 221){
-                                               //                      cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
-                                               //                   }
                                        }
                                }
+                               
                                Double_t mesonY = 10.;
                                if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
                                        mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
                                } else{
                                        mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
                                }
+                               Double_t alpha = -1;
+                               if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
+                                       alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
+                               }
                                
                                if(particle->GetPdgCode() == 111){
                                        fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
                                        fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
-                                       if (fDoMesonQA > 0) fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                       if (fDoMesonQA > 0){
+                                               fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                               fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha);
+                                       }
                                } else if(particle->GetPdgCode() == 221){
                                        fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
                                        fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
-                                       if (fDoMesonQA > 0) fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                       if (fDoMesonQA > 0){
+                                               fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                               fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha);
+                                       }
                                }
                                
                                // Check the acceptance for both gammas
@@ -1616,15 +1741,26 @@ void AliAnalysisTaskGammaCalo::ProcessMCParticles()
                                } else{
                                        mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
                                }
-                               
+       
+                               Double_t alpha = -1;
+                               if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
+                                       alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
+                               }
+       
                                if(particle->GetPdgCode() == 111){
                                        fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
                                        fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
-                                       if (fDoMesonQA > 0) fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                       if (fDoMesonQA > 0){
+                                               fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                               fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
+                                       }
                                } else if(particle->GetPdgCode() == 221){
                                        fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
                                        fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
-                                       if (fDoMesonQA > 0) fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                       if (fDoMesonQA > 0){
+                                               fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
+                                               fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
+                                       }
                                }
                                
                                // Check the acceptance for both gammas
@@ -1693,16 +1829,13 @@ void AliAnalysisTaskGammaCalo::CalculatePi0Candidates(){
                        AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
                        if (gamma0==NULL) continue;
                        
-                       for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
-                               if (firstGammaIndex == secondGammaIndex) continue;
+                       for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
                                AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
                                if (gamma1==NULL) continue;
                                
                                AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
                                pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
-                               
-                               
-                               
+                                                               
                                if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                        fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
                                        // fill new histograms
@@ -1777,8 +1910,12 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
        // Process True Mesons
        AliStack *MCStack = fMCEvent->Stack();
        
-       Bool_t isTruePi0 = kFALSE;
-       Bool_t isTrueEta = kFALSE;
+       Bool_t isTruePi0                                = kFALSE;
+       Bool_t isTrueEta                                = kFALSE;
+       Bool_t isSameConvertedGamma     = kFALSE;
+       Int_t convertedPhotonLabel0             = -1;
+       Int_t convertedPhotonLabel1             = -1;
+       
        Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0);     // get most probable MC label
        Int_t gamma0MotherLabel = -1;
 
@@ -1789,6 +1926,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
                        if (TrueGammaCandidate0->IsLargestComponentPhoton()){                                                                                                           // for photons its the direct mother 
                                gamma0MotherLabel=gammaMC0->GetMother(0);
                        } else if (TrueGammaCandidate0->IsLargestComponentElectron()){                                                                                          // for electrons its either the direct mother or for conversions the grandmother
+                               convertedPhotonLabel0 = gammaMC0->GetMother(0);
                                if (TrueGammaCandidate0->IsConversion()) gamma0MotherLabel=MCStack->Particle(gammaMC0->GetMother(0))->GetMother(0);
                                else gamma0MotherLabel=gammaMC0->GetMother(0); 
                        }
@@ -1808,6 +1946,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
                        if (TrueGammaCandidate1->IsLargestComponentPhoton()){                                                                                                           // for photons its the direct mother 
                                gamma1MotherLabel=gammaMC1->GetMother(0);
                        } else if (TrueGammaCandidate1->IsLargestComponentElectron()){                                                                                          // for electrons its either the direct mother or for conversions the grandmother
+                               convertedPhotonLabel1 = gammaMC1->GetMother(0);
                                if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
                                else gamma1MotherLabel=gammaMC1->GetMother(0); 
                        }
@@ -1823,6 +1962,10 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
                }
        }
        
+       if (convertedPhotonLabel0 > -1 && convertedPhotonLabel1 > -1){
+               if (convertedPhotonLabel0==convertedPhotonLabel1) isSameConvertedGamma = kTRUE;
+       }
+       
        if(isTruePi0 || isTrueEta){// True Pion or Eta
                if (isTruePi0)  fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                if (isTrueEta)  fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
@@ -1849,6 +1992,19 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
                                if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                                if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                        }
+                       
+                       if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
+                                (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) 
+                       ) {
+                               if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }       
+
+                       if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
+                                (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged()) 
+                       ) {
+                               if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }       
+                       
                        // at least one of the photon is merged
                        if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
                                if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
@@ -1861,6 +2017,71 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
                        }       
                }
        
+               if (fDoMesonQA == 2){
+                       // category 1: 2 real photons unmerged
+                       if (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) {
+                               if (isTruePi0) fHistoTruePi0Category1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               if (isTrueEta) fHistoTrueEtaCategory1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }
+                       // category 2, 3: 1 real photons unmerged,  1 electron (category 2 merged, category 3 unmerged )
+                       // -> photon 0 is unconverted
+                       if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())) {
+                               if (isTruePi0){
+                                       if (TrueGammaCandidate1->IsMergedPartConv())    fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate1->IsMergedPartConv()){
+                                               fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       }       
+                               }
+                               if (isTrueEta){
+                                       if (TrueGammaCandidate1->IsMergedPartConv())    fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate1->IsMergedPartConv())   fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               }       
+                       }
+                       // -> photon 1 is unconverted
+                       if ( ( TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) && (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())) {
+                               if (isTruePi0){
+                                       if (TrueGammaCandidate0->IsMergedPartConv())    fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate0->IsMergedPartConv()){
+                                               fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       }       
+                               }
+                               if (isTrueEta){
+                                       if (TrueGammaCandidate0->IsMergedPartConv())    fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate0->IsMergedPartConv())   fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               }       
+                       }
+                       
+                       // category 4 & 6, 5, 7, 8
+                       if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
+                               if (isTruePi0){
+                                       // category 4: both electrons are from same conversion 
+                                       if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv() ) fHistoTruePi0Category4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!isSameConvertedGamma ){
+                                               if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()){              // category 5: both electrons from different converted photons, electrons not merged
+                                                       fHistoTruePi0Category5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMergedPartConv()){ // category 8: both electrons from different converted photons, both electrons merged           
+                                                       fHistoTruePi0Category8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());  
+                                               } else {                                                                                                                                                // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged               
+                                                       fHistoTruePi0Category7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               }       
+                                       }       
+                               }
+                               if (isTrueEta){
+                                       // category 4: both electrons are from same conversion 
+                                       if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!isSameConvertedGamma ){
+                                               if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()){              // category 5: both electrons from different converted photons, electrons not merged
+                                                       fHistoTrueEtaCategory5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMergedPartConv()){ // category 8: both electrons from different converted photons, both electrons merged           
+                                                       fHistoTrueEtaCategory8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());  
+                                               } else {                                                                                                                                                // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged               
+                                                       fHistoTrueEtaCategory7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               }       
+                                       }       
+                               }
+                       }
+               }
+       
                if (fDoMesonQA > 0){
                        if (isTruePi0){
                                if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
@@ -1885,7 +2106,6 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother
                                //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
                        }
                        if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-                       if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                        if (secMotherLabel >-1){
                                if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310 && isTruePi0){
                                        fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
@@ -1944,13 +2164,16 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
        
        // Process True Mesons
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
-       Bool_t isTruePi0 = kFALSE;
-       Bool_t isTrueEta = kFALSE;
+       Bool_t isTruePi0                                = kFALSE;
+       Bool_t isTrueEta                                = kFALSE;
+       Bool_t isSameConvertedGamma     = kFALSE;
+       Int_t convertedPhotonLabel0             = -1;
+       Int_t convertedPhotonLabel1             = -1;
                
-       Int_t gamma0MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0);     // get most probable MC label
-       Int_t gamma0MotherLabel = -1;
-               // check if 
-
+       Int_t gamma0MCLabel                     = TrueGammaCandidate0->GetCaloPhotonMCLabel(0);         // get most probable MC label
+       Int_t gamma0MotherLabel                 = -1;
+       
+       // check if 
        if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                // Daughters Gamma 0
                AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
@@ -1960,6 +2183,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                                gamma0MotherLabel=gammaMC0->GetMother();
                        } else if (TrueGammaCandidate0->IsLargestComponentElectron()){                                                                                          // for electrons its either the direct mother or for conversions the grandmother
                                if (TrueGammaCandidate0->IsConversion()){
+                                       convertedPhotonLabel0 = gammaMC0->GetMother();
                                        AliAODMCParticle * gammaGrandMotherMC0 =  static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
                                        gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
                                } else gamma0MotherLabel=gammaMC0->GetMother(); 
@@ -1967,10 +2191,10 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                }       
        }
 
-       Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0);     // get most probable MC label
-       Int_t gamma1MotherLabel = -1;
-               // check if 
-
+       Int_t gamma1MCLabel                     = TrueGammaCandidate1->GetCaloPhotonMCLabel(0);         // get most probable MC label
+       Int_t gamma1MotherLabel                 = -1;
+       
+       // check if 
        if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                // Daughters Gamma 1
                AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
@@ -1980,6 +2204,7 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                                gamma1MotherLabel=gammaMC1->GetMother();
                        } else if (TrueGammaCandidate1->IsLargestComponentElectron()){                                                                                          // for electrons its either the direct mother or for conversions the grandmother
                                if (TrueGammaCandidate1->IsConversion()){
+                                       convertedPhotonLabel1 = gammaMC1->GetMother();
                                        AliAODMCParticle * gammaGrandMotherMC1 =  static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
                                        gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
                                } else gamma1MotherLabel=gammaMC1->GetMother(); 
@@ -1995,6 +2220,11 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                        isTrueEta=kTRUE;
                }
        }
+
+       if (convertedPhotonLabel0 > -1 && convertedPhotonLabel1 > 1){
+               if (convertedPhotonLabel0==convertedPhotonLabel1) isSameConvertedGamma = kTRUE;
+       }
+
        
        if(isTruePi0 || isTrueEta){// True Pion or Eta
                if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
@@ -2022,6 +2252,19 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                                if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                                if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                        }
+                       
+                       if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
+                                (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) 
+                       ) {
+                               if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }       
+
+                       if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
+                                (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged()) 
+                       ) {
+                               if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }       
+
                        // at least one of the photon is merged
                        if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
                                if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
@@ -2034,6 +2277,67 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                        }       
                }
 
+               if (fDoMesonQA == 2){
+                       // category 1: 2 real photons unmerged
+                       if (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) {
+                               if (isTruePi0) fHistoTruePi0Category1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               if (isTrueEta) fHistoTrueEtaCategory1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }
+                       // category 2, 3: 1 real photons unmerged,  1 electron (category 2 merged, category 3 unmerged )
+                       // -> photon 0 is unconverted
+                       if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())) {
+                               if (isTruePi0){
+                                       if (TrueGammaCandidate1->IsMergedPartConv())    fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate1->IsMergedPartConv())   fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               }
+                               if (isTrueEta){
+                                       if (TrueGammaCandidate1->IsMergedPartConv())    fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate1->IsMergedPartConv())   fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               }       
+                       }
+                       // -> photon 1 is unconverted
+                       if ( ( TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) && (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())) {
+                               if (isTruePi0){
+                                       if (TrueGammaCandidate0->IsMergedPartConv())    fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate0->IsMergedPartConv())   fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               }
+                               if (isTrueEta){
+                                       if (TrueGammaCandidate0->IsMergedPartConv())    fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!TrueGammaCandidate0->IsMergedPartConv())   fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               }       
+                       }
+                       
+                       // category 4 & 6, 5, 7, 8
+                       if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
+                               if (isTruePi0){
+                                       // category 4: both electrons are from same conversion 
+                                       if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv() ) fHistoTruePi0Category4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!isSameConvertedGamma ){
+                                               if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMerged()){              // category 5: both electrons from different converted photons, electrons not merged
+                                                       fHistoTruePi0Category5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMerged()){ // category 8: both electrons from different converted photons, both electrons merged           
+                                                       fHistoTruePi0Category8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());  
+                                               } else {                                                                                                                                                // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged               
+                                                       fHistoTruePi0Category7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               }       
+                                       }       
+                               }
+                               if (isTrueEta){
+                                       // category 4: both electrons are from same conversion 
+                                       if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if (!isSameConvertedGamma ){
+                                               if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()){              // category 5: both electrons from different converted photons, electrons not merged
+                                                       fHistoTrueEtaCategory5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMergedPartConv()){ // category 8: both electrons from different converted photons, both electrons merged           
+                                                       fHistoTrueEtaCategory8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());  
+                                               } else {                                                                                                                                                // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged               
+                                                       fHistoTrueEtaCategory7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                               }       
+                                       }       
+                               }
+                       }
+               }
+               
                if (fDoMesonQA > 0){
                        if (isTruePi0){
                                if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
@@ -2057,7 +2361,6 @@ void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMot
                                //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
                        }
                        if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-                       if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                        if (secMotherLabel >-1){
                                if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310 && isTruePi0 ){
                                        fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
@@ -2127,13 +2430,13 @@ void AliAnalysisTaskGammaCalo::CalculateBackground(){
        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
                for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
                        AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
-                       
                        for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
                                AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
                                for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
                                        AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
                                        AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
                                        backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+                               
                                        if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
                                                ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                                fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
@@ -2156,6 +2459,7 @@ void AliAnalysisTaskGammaCalo::CalculateBackground(){
                                                AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
                                                AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
                                                backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+                               
                                                if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                                        fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
                                                        Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};