]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Simplify AliAnaPhoton, move conversion utilities to other analysis class
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 31 Oct 2011 18:31:02 +0000 (18:31 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 31 Oct 2011 18:31:02 +0000 (18:31 +0000)
PWG4/CMakelibPWG4PartCorrDep.pkg
PWG4/PWG4PartCorrDepLinkDef.h
PWG4/PartCorrDep/AliAnaPhoton.cxx
PWG4/PartCorrDep/AliAnaPhoton.h
PWG4/PartCorrDep/AliAnaPhotonConvInCalo.cxx [new file with mode: 0755]
PWG4/PartCorrDep/AliAnaPhotonConvInCalo.h [new file with mode: 0755]

index d180410a9f253840266342dfa7944d4a7419a853..9e51667e05231e287dfcd7b9b2d7fc11f6f64fa8 100644 (file)
@@ -43,6 +43,7 @@ set ( SRCS
     PartCorrDep/AliAnaShowerParameter.cxx 
     PartCorrDep/AliAnalysisTaskTaggedPhotons.cxx 
     PartCorrDep/AliAnaOmegaToPi0Gamma.cxx 
+    PartCorrDep/AliAnaPhotonConvInCalo.cxx 
     )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
index 66ba13b43a613e86650694bd35924f3fd76aa35d..3b8ce04146d03637bd70ca55e76aefb2bcb26b0b 100644 (file)
@@ -20,5 +20,6 @@
 #pragma link C++ class AliAnaShowerParameter+;
 #pragma link C++ class AliAnalysisTaskTaggedPhotons+;
 #pragma link C++ class AliAnaOmegaToPi0Gamma+;
+#pragma link C++ class AliAnaPhotonConvInCalo+;
 
 #endif
index bd0f4e2010e35b3ee0309da05cd98b129771d048..2fc81bf9563d4279eb8c3b9357b4799e3591b7e2 100755 (executable)
@@ -31,7 +31,6 @@
 #include <TH3D.h>
 #include <TClonesArray.h>
 #include <TObjString.h>
-//#include <Riostream.h>
 #include "TParticle.h"
 #include "TDatabasePDG.h"
 
 
 ClassImp(AliAnaPhoton)
   
-//____________________________________________________________________________
+//____________________________
 AliAnaPhoton::AliAnaPhoton() : 
     AliAnaPartCorrBaseClass(),    fCalorimeter(""), 
     fMinDist(0.),                 fMinDist2(0.),                fMinDist3(0.), 
     fRejectTrackMatch(0),         fTimeCutMin(-1),              fTimeCutMax(999999),         
     fNCellsCut(0),                fFillSSHistograms(kFALSE),    
     fNOriginHistograms(8),        fNPrimaryHistograms(4),
-    fCheckConversion(kFALSE),     fRemoveConvertedPair(kFALSE), 
-    fAddConvertedPairsToAOD(kFALSE), 
-    fMassCut(0),                  fConvAsymCut(1.),             fConvDEtaCut(2.),
-    fConvDPhiMinCut(-1.),         fConvDPhiMaxCut(7.), 
 
     // Histograms
     fhNCellsE(0),                 fhMaxCellDiffClusterE(0),
@@ -67,15 +62,6 @@ AliAnaPhoton::AliAnaPhoton() :
     fhPhiPhoton(0),               fhEtaPhoton(0), 
     fhEtaPhiPhoton(0),            fhEtaPhi05Photon(0),
 
-    // Conversion histograms
-    fhPtPhotonConv(0),            fhEtaPhiPhotonConv(0),        fhEtaPhi05PhotonConv(0),
-    fhConvDeltaEta(0),            fhConvDeltaPhi(0),            fhConvDeltaEtaPhi(0), 
-    fhConvAsym(0),                fhConvPt(0),
-    fhConvDistEta(0),             fhConvDistEn(0),              fhConvDistMass(0),     
-    fhConvDistEtaCutEta(0),       fhConvDistEnCutEta(0),        fhConvDistMassCutEta(0),
-    fhConvDistEtaCutMass(0),      fhConvDistEnCutMass(0), 
-    fhConvDistEtaCutAsy(0),       fhConvDistEnCutAsy(0),
-
     // Shower shape histograms
     fhDispE(0),                   fhLam0E(0),                   fhLam1E(0), 
     fhDispETRD(0),                fhLam0ETRD(0),                fhLam1ETRD(0),
@@ -90,29 +76,7 @@ AliAnaPhoton::AliAnaPhoton() :
     fhDispLam1LowE(0),            fhDispLam1HighE(0),
 
     // MC histograms
-    // Conversion MC histograms
-    fhPtConversionTagged(0),           fhPtAntiNeutronTagged(0),       
-    fhPtAntiProtonTagged(0),           fhPtUnknownTagged(0),
-    fhEtaPhiConversion(0),             fhEtaPhi05Conversion(0),
-
-    fhConvDeltaEtaMCConversion(0),     fhConvDeltaPhiMCConversion(0),  fhConvDeltaEtaPhiMCConversion(0),
-    fhConvAsymMCConversion(0),         fhConvPtMCConversion(0),           
-    fhConvDispersionMCConversion(0),   fhConvM02MCConversion(0),
-
-    fhConvDeltaEtaMCAntiNeutron(0),    fhConvDeltaPhiMCAntiNeutron(0), fhConvDeltaEtaPhiMCAntiNeutron(0), 
-    fhConvAsymMCAntiNeutron(0),        fhConvPtMCAntiNeutron(0), 
-    fhConvDispersionMCAntiNeutron(0),  fhConvM02MCAntiNeutron(0),
-    fhConvDeltaEtaMCAntiProton(0),     fhConvDeltaPhiMCAntiProton(0),  fhConvDeltaEtaPhiMCAntiProton(0),  
-    fhConvAsymMCAntiProton(0),         fhConvPtMCAntiProton(0),  
-    fhConvDispersionMCAntiProton(0),   fhConvM02MCAntiProton(0),
-    fhConvDeltaEtaMCString(0),         fhConvDeltaPhiMCString(0),      fhConvDeltaEtaPhiMCString(0),      
-    fhConvAsymMCString(0),             fhConvPtMCString(0),      
-    fhConvDispersionMCString(0),       fhConvM02MCString(0),
-    fhConvDistMCConversion(0),         fhConvDistMCConversionCuts(0),
-
-    // Photon SS MC histograms
-    fhMCPhotonELambda0NoOverlap(0),    fhMCPhotonELambda0TwoOverlap(0),  fhMCPhotonELambda0NOverlap(0),
-
+    fhMCPhotonELambda0NoOverlap(0),     fhMCPhotonELambda0TwoOverlap(0),      fhMCPhotonELambda0NOverlap(0),
     //Embedding
     fhEmbeddedSignalFractionEnergy(0),     
     fhEmbedPhotonELambda0FullSignal(0), fhEmbedPhotonELambda0MostlySignal(0),  
@@ -163,14 +127,9 @@ AliAnaPhoton::AliAnaPhoton() :
   //Initialize parameters
   InitParameters();
 
-}//____________________________________________________________________________
-AliAnaPhoton::~AliAnaPhoton() 
-{
-  //dtor
-
 }
 
-//__________________________________________________________________
+//__________________________________________________________________________
 Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom) 
 {
   //Select clusters if they pass different cuts
@@ -959,9 +918,6 @@ TObjString *  AliAnaPhoton::GetAnalysisCuts()
   parList+=onePar ;
   snprintf(onePar,buffersize,"fRejectTrackMatch: %d\n",fRejectTrackMatch) ;
   parList+=onePar ;  
-  snprintf(onePar,buffersize,"Conversion Selection: fConvAsymCut %1.2f, fConvDEtaCut %1.2f fConvDPhiCut (%1.2f,%1.2f)\n",
-           fConvAsymCut, fConvDEtaCut, fConvDPhiMinCut, fConvDPhiMaxCut) ;
-  parList+=onePar ; 
   
   //Get parameters set in base class.
   parList += GetBaseParametersList() ;
@@ -1035,133 +991,6 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
     outputContainer->Add(fhEtaPhi05Photon) ;
   }
   
-  //Conversion
-  if(fCheckConversion){
-    
-    fhEtaPhiConversion  = new TH2F
-    ("hEtaPhiConversion","#eta vs #phi for converted clusters",netabins,etamin,etamax,nphibins,phimin,phimax); 
-    fhEtaPhiConversion->SetYTitle("#phi (rad)");
-    fhEtaPhiConversion->SetXTitle("#eta");
-    outputContainer->Add(fhEtaPhiConversion) ;
-    if(GetMinPt() < 0.5){
-      fhEtaPhi05Conversion  = new TH2F
-      ("hEtaPhi05Conversion","#eta vs #phi, E > 0.5, for converted clusters",netabins,etamin,etamax,nphibins,phimin,phimax); 
-      fhEtaPhi05Conversion->SetYTitle("#phi (rad)");
-      fhEtaPhi05Conversion->SetXTitle("#eta");
-      outputContainer->Add(fhEtaPhi05Conversion) ;
-    }    
-    
-    fhPtPhotonConv  = new TH1F("hPtPhotonConv","Number of #gamma over calorimeter, conversion",nptbins,ptmin,ptmax); 
-    fhPtPhotonConv->SetYTitle("N");
-    fhPtPhotonConv->SetXTitle("p_{T #gamma}(GeV/c)");
-    outputContainer->Add(fhPtPhotonConv) ; 
-    
-    fhEtaPhiPhotonConv  = new TH2F
-    ("hEtaPhiPhotonConv","#eta vs #phi",netabins,etamin,etamax,nphibins,phimin,phimax); 
-    fhEtaPhiPhotonConv->SetYTitle("#phi (rad)");
-    fhEtaPhiPhotonConv->SetXTitle("#eta");
-    outputContainer->Add(fhEtaPhiPhotonConv) ;
-    if(GetMinPt() < 0.5){
-      fhEtaPhi05PhotonConv  = new TH2F
-      ("hEtaPhi05PhotonConv","#eta vs #phi, E > 0.5",netabins,etamin,etamax,nphibins,phimin,phimax); 
-      fhEtaPhi05PhotonConv->SetYTitle("#phi (rad)");
-      fhEtaPhi05PhotonConv->SetXTitle("#eta");
-      outputContainer->Add(fhEtaPhi05PhotonConv) ;
-    }
-    
-    fhConvDeltaEta  = new TH2F
-    ("hConvDeltaEta","#Delta #eta of selected conversion pairs",100,0,fMassCut,netabins*2,-0.5,0.5); 
-    fhConvDeltaEta->SetYTitle("#Delta #eta");
-    fhConvDeltaEta->SetXTitle("Pair Mass (GeV/c^2)");
-    outputContainer->Add(fhConvDeltaEta) ;
-    
-    fhConvDeltaPhi  = new TH2F
-    ("hConvDeltaPhi","#Delta #phi of selected conversion pairs",100,0,fMassCut,nphibins*2,-0.5,0.5); 
-    fhConvDeltaPhi->SetYTitle("#Delta #phi");
-    fhConvDeltaPhi->SetXTitle("Pair Mass (GeV/c^2)");
-    outputContainer->Add(fhConvDeltaPhi) ;
-    
-    fhConvDeltaEtaPhi  = new TH2F
-    ("hConvDeltaEtaPhi","#Delta #eta vs #Delta #phi of selected conversion pairs",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
-    fhConvDeltaEtaPhi->SetYTitle("#Delta #phi");
-    fhConvDeltaEtaPhi->SetXTitle("#Delta #eta");
-    outputContainer->Add(fhConvDeltaEtaPhi) ;
-    
-    fhConvAsym  = new TH2F
-    ("hConvAsym","Asymmetry of selected conversion pairs",100,0,fMassCut,100,0,1); 
-    fhConvAsym->SetYTitle("Asymmetry");
-    fhConvAsym->SetXTitle("Pair Mass (GeV/c^2)");
-    outputContainer->Add(fhConvAsym) ;  
-    
-    fhConvPt  = new TH2F
-    ("hConvPt","p_{T} of selected conversion pairs",100,0,fMassCut,100,0.,10.); 
-    fhConvPt->SetYTitle("Pair p_{T} (GeV/c)");
-    fhConvPt->SetXTitle("Pair Mass (GeV/c^2)");
-    outputContainer->Add(fhConvPt) ;
-    
-    fhConvDistEta  = new TH2F
-    ("hConvDistEta","distance to conversion vertex",100,-0.7,0.7,100,0.,5.); 
-    fhConvDistEta->SetXTitle("#eta");
-    fhConvDistEta->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEta) ;
-    
-    fhConvDistEn  = new TH2F
-    ("hConvDistEn","distance to conversion vertex",nptbins,ptmin,ptmax,100,0.,5.); 
-    fhConvDistEn->SetXTitle("E (GeV)");
-    fhConvDistEn->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEn) ;
-
-    fhConvDistMass  = new TH2F
-    ("hConvDistMass","distance to conversion vertex",100,0,fMassCut,100,0.,5.); 
-    fhConvDistMass->SetXTitle("m (GeV/c^2)");
-    fhConvDistMass->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistMass) ;
-    
-    fhConvDistEtaCutEta  = new TH2F
-    ("hConvDistEtaCutEta","distance to conversion vertex, dEta < 0.05",100,-0.7,0.7,100,0.,5.); 
-    fhConvDistEtaCutEta->SetXTitle("#eta");
-    fhConvDistEtaCutEta->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEtaCutEta) ;
-    
-    fhConvDistEnCutEta  = new TH2F
-    ("hConvDistEnCutEta","distance to conversion vertex, dEta < 0.05",nptbins,ptmin,ptmax,100,0.,5.); 
-    fhConvDistEnCutEta->SetXTitle("E (GeV)");
-    fhConvDistEnCutEta->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEnCutEta) ;
-    
-    fhConvDistMassCutEta  = new TH2F
-    ("hConvDistMassCutEta","distance to conversion vertex, dEta < 0.05",100,0,fMassCut,100,0.,5.); 
-    fhConvDistMassCutEta->SetXTitle("m (GeV/c^2)");
-    fhConvDistMassCutEta->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistMassCutEta) ;
-    
-    fhConvDistEtaCutMass  = new TH2F
-    ("hConvDistEtaCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",100,-0.7,0.7,100,0.,5.); 
-    fhConvDistEtaCutMass->SetXTitle("#eta");
-    fhConvDistEtaCutMass->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEtaCutMass) ;
-    
-    fhConvDistEnCutMass  = new TH2F
-    ("hConvDistEnCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",nptbins,ptmin,ptmax,100,0.,5.); 
-    fhConvDistEnCutMass->SetXTitle("E (GeV)");
-    fhConvDistEnCutMass->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEnCutMass) ;
-
-    fhConvDistEtaCutAsy  = new TH2F
-    ("hConvDistEtaCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",100,-0.7,0.7,100,0.,5.); 
-    fhConvDistEtaCutAsy->SetXTitle("#eta");
-    fhConvDistEtaCutAsy->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEtaCutAsy) ;
-    
-    fhConvDistEnCutAsy  = new TH2F
-    ("hConvDistEnCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",nptbins,ptmin,ptmax,100,0.,5.); 
-    fhConvDistEnCutAsy->SetXTitle("E (GeV)");
-    fhConvDistEnCutAsy->SetYTitle(" distance (m)");
-    outputContainer->Add(fhConvDistEnCutAsy) ;
-    
-  } // check conversion
-  
-  
   //Shower shape
   if(fFillSSHistograms){
     
@@ -1410,209 +1239,6 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
       
     }
                
-    if(fCheckConversion){  
-      fhPtConversionTagged  = new TH1F("hPtMCConversionTagged","Number of converted #gamma over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
-      fhPtConversionTagged->SetYTitle("N");
-      fhPtConversionTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-      outputContainer->Add(fhPtConversionTagged) ; 
-      
-      
-      fhPtAntiNeutronTagged  = new TH1F("hPtMCAntiNeutronTagged","Number of AntiNeutron id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
-      fhPtAntiNeutronTagged->SetYTitle("N");
-      fhPtAntiNeutronTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-      outputContainer->Add(fhPtAntiNeutronTagged) ; 
-      
-      fhPtAntiProtonTagged  = new TH1F("hPtMCAntiProtonTagged","Number of AntiProton id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
-      fhPtAntiProtonTagged->SetYTitle("N");
-      fhPtAntiProtonTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-      outputContainer->Add(fhPtAntiProtonTagged) ; 
-      
-      fhPtUnknownTagged  = new TH1F("hPtMCUnknownTagged","Number of Unknown id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
-      fhPtUnknownTagged->SetYTitle("N");
-      fhPtUnknownTagged->SetXTitle("p_{T #gamma}(GeV/c)");
-      outputContainer->Add(fhPtUnknownTagged) ;     
-      
-      fhConvDeltaEtaMCConversion  = new TH2F
-      ("hConvDeltaEtaMCConversion","#Delta #eta of selected conversion pairs from real conversions",100,0,fMassCut,netabins,-0.5,0.5); 
-      fhConvDeltaEtaMCConversion->SetYTitle("#Delta #eta");
-      fhConvDeltaEtaMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaEtaMCConversion) ;
-      
-      fhConvDeltaPhiMCConversion  = new TH2F
-      ("hConvDeltaPhiMCConversion","#Delta #phi of selected conversion pairs from real conversions",100,0,fMassCut,nphibins,-0.5,0.5); 
-      fhConvDeltaPhiMCConversion->SetYTitle("#Delta #phi");
-      fhConvDeltaPhiMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaPhiMCConversion) ;
-      
-      fhConvDeltaEtaPhiMCConversion  = new TH2F
-      ("hConvDeltaEtaPhiMCConversion","#Delta #eta vs #Delta #phi of selected conversion pairs, from real conversions",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
-      fhConvDeltaEtaPhiMCConversion->SetYTitle("#Delta #phi");
-      fhConvDeltaEtaPhiMCConversion->SetXTitle("#Delta #eta");
-      outputContainer->Add(fhConvDeltaEtaPhiMCConversion) ;
-      
-      fhConvAsymMCConversion  = new TH2F
-      ("hConvAsymMCConversion","Asymmetry of selected conversion pairs from real conversions",100,0,fMassCut,100,0,1); 
-      fhConvAsymMCConversion->SetYTitle("Asymmetry");
-      fhConvAsymMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvAsymMCConversion) ;
-      
-      fhConvPtMCConversion  = new TH2F
-      ("hConvPtMCConversion","p_{T} of selected conversion pairs from real conversions",100,0,fMassCut,100,0.,10.); 
-      fhConvPtMCConversion->SetYTitle("Pair p_{T} (GeV/c)");
-      fhConvPtMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvPtMCConversion) ;    
-      
-      fhConvDispersionMCConversion  = new TH2F
-      ("hConvDispersionMCConversion","p_{T} of selected conversion pairs from real conversions",100,0.,1.,100,0.,1.); 
-      fhConvDispersionMCConversion->SetYTitle("Dispersion cluster 1");
-      fhConvDispersionMCConversion->SetXTitle("Dispersion cluster 2");
-      outputContainer->Add(fhConvDispersionMCConversion) ;   
-      
-      fhConvM02MCConversion  = new TH2F
-      ("hConvM02MCConversion","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
-      fhConvM02MCConversion->SetYTitle("M02 cluster 1");
-      fhConvM02MCConversion->SetXTitle("M02 cluster 2");
-      outputContainer->Add(fhConvM02MCConversion) ;           
-      
-      fhConvDeltaEtaMCAntiNeutron  = new TH2F
-      ("hConvDeltaEtaMCAntiNeutron","#Delta #eta of selected conversion pairs from anti-neutrons",100,0,fMassCut,netabins,-0.5,0.5); 
-      fhConvDeltaEtaMCAntiNeutron->SetYTitle("#Delta #eta");
-      fhConvDeltaEtaMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaEtaMCAntiNeutron) ;
-      
-      fhConvDeltaPhiMCAntiNeutron  = new TH2F
-      ("hConvDeltaPhiMCAntiNeutron","#Delta #phi of selected conversion pairs from anti-neutrons",100,0,fMassCut,nphibins,-0.5,0.5); 
-      fhConvDeltaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
-      fhConvDeltaPhiMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaPhiMCAntiNeutron) ;
-      
-      fhConvDeltaEtaPhiMCAntiNeutron  = new TH2F
-      ("hConvDeltaEtaPhiMCAntiNeutron","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-neutrons",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
-      fhConvDeltaEtaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
-      fhConvDeltaEtaPhiMCAntiNeutron->SetXTitle("#Delta #eta");
-      outputContainer->Add(fhConvDeltaEtaPhiMCAntiNeutron) ;    
-      
-      fhConvAsymMCAntiNeutron  = new TH2F
-      ("hConvAsymMCAntiNeutron","Asymmetry of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0,1); 
-      fhConvAsymMCAntiNeutron->SetYTitle("Asymmetry");
-      fhConvAsymMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvAsymMCAntiNeutron) ;
-      
-      fhConvPtMCAntiNeutron  = new TH2F
-      ("hConvPtMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0.,10.); 
-      fhConvPtMCAntiNeutron->SetYTitle("Pair p_{T} (GeV/c)");
-      fhConvPtMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvPtMCAntiNeutron) ;    
-      
-      fhConvDispersionMCAntiNeutron  = new TH2F
-      ("hConvDispersionMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0.,1.,100,0.,1.); 
-      fhConvDispersionMCAntiNeutron->SetYTitle("Dispersion cluster 1");
-      fhConvDispersionMCAntiNeutron->SetXTitle("Dispersion cluster 2");
-      outputContainer->Add(fhConvDispersionMCAntiNeutron) ;       
-      
-      fhConvM02MCAntiNeutron  = new TH2F
-      ("hConvM02MCAntiNeutron","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
-      fhConvM02MCAntiNeutron->SetYTitle("M02 cluster 1");
-      fhConvM02MCAntiNeutron->SetXTitle("M02 cluster 2");
-      outputContainer->Add(fhConvM02MCAntiNeutron) ;  
-      
-      fhConvDeltaEtaMCAntiProton  = new TH2F
-      ("hConvDeltaEtaMCAntiProton","#Delta #eta of selected conversion pairs from anti-protons",100,0,fMassCut,netabins,-0.5,0.5); 
-      fhConvDeltaEtaMCAntiProton->SetYTitle("#Delta #eta");
-      fhConvDeltaEtaMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaEtaMCAntiProton) ;
-      
-      fhConvDeltaPhiMCAntiProton  = new TH2F
-      ("hConvDeltaPhiMCAntiProton","#Delta #phi of selected conversion pairs from anti-protons",100,0,fMassCut,nphibins,-0.5,0.5); 
-      fhConvDeltaPhiMCAntiProton->SetYTitle("#Delta #phi");
-      fhConvDeltaPhiMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaPhiMCAntiProton) ;
-      
-      fhConvDeltaEtaPhiMCAntiProton  = new TH2F
-      ("hConvDeltaEtaPhiMCAntiProton","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-protons",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
-      fhConvDeltaEtaPhiMCAntiProton->SetYTitle("#Delta #phi");
-      fhConvDeltaEtaPhiMCAntiProton->SetXTitle("#Delta #eta");
-      outputContainer->Add(fhConvDeltaEtaPhiMCAntiProton) ;    
-      
-      fhConvAsymMCAntiProton  = new TH2F
-      ("hConvAsymMCAntiProton","Asymmetry of selected conversion pairs from anti-protons",100,0,fMassCut,100,0,1); 
-      fhConvAsymMCAntiProton->SetYTitle("Asymmetry");
-      fhConvAsymMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvAsymMCAntiProton) ;
-      
-      fhConvPtMCAntiProton  = new TH2F
-      ("hConvPtMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0,fMassCut,100,0.,10.); 
-      fhConvPtMCAntiProton->SetYTitle("Pair p_{T} (GeV/c)");
-      fhConvPtMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvPtMCAntiProton) ;
-      
-      fhConvDispersionMCAntiProton  = new TH2F
-      ("hConvDispersionMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0.,1.,100,0.,1.); 
-      fhConvDispersionMCAntiProton->SetYTitle("Dispersion cluster 1");
-      fhConvDispersionMCAntiProton->SetXTitle("Dispersion cluster 2");
-      outputContainer->Add(fhConvDispersionMCAntiProton) ;       
-      
-      fhConvM02MCAntiProton  = new TH2F
-      ("hConvM02MCAntiProton","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
-      fhConvM02MCAntiProton->SetYTitle("M02 cluster 1");
-      fhConvM02MCAntiProton->SetXTitle("M02 cluster 2");
-      outputContainer->Add(fhConvM02MCAntiProton) ;       
-      
-      fhConvDeltaEtaMCString  = new TH2F
-      ("hConvDeltaEtaMCString","#Delta #eta of selected conversion pairs from string",100,0,fMassCut,netabins,-0.5,0.5); 
-      fhConvDeltaEtaMCString->SetYTitle("#Delta #eta");
-      fhConvDeltaEtaMCString->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaEtaMCString) ;
-      
-      fhConvDeltaPhiMCString  = new TH2F
-      ("hConvDeltaPhiMCString","#Delta #phi of selected conversion pairs from string",100,0,fMassCut,nphibins,-0.5,0.5); 
-      fhConvDeltaPhiMCString->SetYTitle("#Delta #phi");
-      fhConvDeltaPhiMCString->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvDeltaPhiMCString) ;
-      
-      fhConvDeltaEtaPhiMCString  = new TH2F
-      ("hConvDeltaEtaPhiMCString","#Delta #eta vs #Delta #phi of selected conversion pairs from string",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
-      fhConvDeltaEtaPhiMCString->SetYTitle("#Delta #phi");
-      fhConvDeltaEtaPhiMCString->SetXTitle("#Delta #eta");
-      outputContainer->Add(fhConvDeltaEtaPhiMCString) ;    
-      
-      fhConvAsymMCString  = new TH2F
-      ("hConvAsymMCString","Asymmetry of selected conversion pairs from string",100,0,fMassCut,100,0,1); 
-      fhConvAsymMCString->SetYTitle("Asymmetry");
-      fhConvAsymMCString->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvAsymMCString) ;
-      
-      fhConvPtMCString  = new TH2F
-      ("hConvPtMCString","p_{T} of selected conversion pairs from string",100,0,fMassCut,100,0.,10.); 
-      fhConvPtMCString->SetYTitle("Pair p_{T} (GeV/c)");
-      fhConvPtMCString->SetXTitle("Pair Mass (GeV/c^2)");
-      outputContainer->Add(fhConvPtMCString) ;
-      
-      fhConvDispersionMCString  = new TH2F
-      ("hConvDispersionMCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
-      fhConvDispersionMCString->SetYTitle("Dispersion cluster 1");
-      fhConvDispersionMCString->SetXTitle("Dispersion cluster 2");
-      outputContainer->Add(fhConvDispersionMCString) ;       
-      
-      fhConvM02MCString  = new TH2F
-      ("hConvM02MCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
-      fhConvM02MCString->SetYTitle("M02 cluster 1");
-      fhConvM02MCString->SetXTitle("M02 cluster 2");
-      outputContainer->Add(fhConvM02MCString) ; 
-      
-      fhConvDistMCConversion  = new TH2F
-      ("hConvDistMCConversion","calculated conversion distance vs real vertes for MC conversion",100,0.,5.,100,0.,5.); 
-      fhConvDistMCConversion->SetYTitle("distance");
-      fhConvDistMCConversion->SetXTitle("vertex R");
-      outputContainer->Add(fhConvDistMCConversion) ; 
-      
-      fhConvDistMCConversionCuts  = new TH2F
-      ("hConvDistMCConversionCuts","calculated conversion distance vs real vertes for MC conversion, deta < 0.05, m < 10 MeV, asym < 0.1",100,0.,5.,100,0.,5.); 
-      fhConvDistMCConversionCuts->SetYTitle("distance");
-      fhConvDistMCConversionCuts->SetXTitle("vertex R");
-      outputContainer->Add(fhConvDistMCConversionCuts) ; 
-    }
-    
     if(fFillSSHistograms){
       
       TString ptypess[] = { "#gamma","hadron?","#pi^{0}","#eta","#gamma->e^{#pm}","e^{#pm}"} ; 
@@ -1840,16 +1466,12 @@ void AliAnaPhoton::InitParameters()
   fMinDist     = 2.;
   fMinDist2    = 4.;
   fMinDist3    = 5.;
-  fMassCut     = 0.03; //30 MeV
        
   fTimeCutMin  = -1;
   fTimeCutMax  = 9999999;
   fNCellsCut   = 0;
        
   fRejectTrackMatch       = kTRUE ;
-  fCheckConversion        = kFALSE;
-  fRemoveConvertedPair    = kFALSE;
-  fAddConvertedPairsToAOD = kFALSE;
        
 }
 
@@ -1877,13 +1499,6 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
   //Init arrays, variables, get number of clusters
   TLorentzVector mom, mom2 ;
   Int_t nCaloClusters = pl->GetEntriesFast();
-  //List to be used in conversion analysis, to tag the cluster as candidate for conversion
-  Bool_t * indexConverted = 0x0;
-  if(fCheckConversion){
-    indexConverted = new Bool_t[nCaloClusters];
-    for (Int_t i = 0; i < nCaloClusters; i++) 
-      indexConverted[i] = kFALSE;
-       }
   
   if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillAOD() - input %s cluster entries %d\n", fCalorimeter.Data(), nCaloClusters);
   
@@ -1993,275 +1608,12 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
     }
     
     if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetIdentifiedParticleType());
-    
-    
-    //--------------------------------------------------------------------------------------
-    // Conversions pairs analysis
-    // Check if cluster comes from a conversion in the material in front of the calorimeter
-    // Do invariant mass of all pairs, if mass is close to 0, then it is conversion.
-    //--------------------------------------------------------------------------------------
-    
-    // Do analysis only if there are more than one cluster
-    if( nCaloClusters > 1 && fCheckConversion){
-      Bool_t bConverted = kFALSE;
-      Int_t id2 = -1;
-                 
-      //Check if set previously as converted couple, if so skip its use.
-      if (indexConverted[icalo]) continue;
-                 
-      // Second cluster loop
-      for(Int_t jcalo = icalo + 1 ; jcalo < nCaloClusters ; jcalo++) {
-        //Check if set previously as converted couple, if so skip its use.
-        if (indexConverted[jcalo]) continue;
-        //printf("Check Conversion indeces %d and %d\n",icalo,jcalo);
-        AliVCluster * calo2 =  (AliVCluster*) (pl->At(jcalo));  //Get cluster kinematics
-        
-        
-        //Mixed event, get index of event
-        Int_t evtIndex2 = 0 ; 
-        if (GetMixedEvent()) {
-          evtIndex2=GetMixedEvent()->EventIndexForCaloCluster(calo2->GetID()) ; 
-          
-        }      
-        
-        //Get kinematics of second cluster
-        if(GetReader()->GetDataType() != AliCaloTrackReader::kMC){
-          calo2->GetMomentum(mom2,GetVertex(evtIndex2)) ;}//Assume that come from vertex in straight line
-        else{
-          Double_t vertex[]={0,0,0};
-          calo2->GetMomentum(mom2,vertex) ;
-        }
-        
-        //--------------------------------------
-        // Cluster selection
-        //--------------------------------------
-        
-        if(!ClusterSelected(calo2,mom2)) continue;  
-        
-        //................................................
-        // Get TOF of each cluster in pair, calculate difference if small, 
-        // take this pair. Way to reject clusters from hadrons (or pileup?)
-        Double_t t12diff = calo2->GetTOF()-calo->GetTOF()*1e9;
-        if(TMath::Abs(t12diff) > GetPairTimeCut()) continue;
-        
-        //................................................
-        //Get mass of pair, if small, take this pair.
-        Float_t pairM     = (mom+mom2).M();
-        //printf("\t both in calo, mass %f, cut %f\n",pairM,fMassCut);
-        if(pairM < fMassCut){  
-          aodph.SetTagged(kFALSE);
-          id2 = calo2->GetID();
-          indexConverted[icalo]=kTRUE;
-          indexConverted[jcalo]=kTRUE; 
-          Float_t asymmetry = TMath::Abs(mom.E()-mom2.E())/(mom.E()+mom2.E());
-          Float_t dPhi      = mom.Phi()-mom2.Phi();
-          Float_t dEta      = mom.Eta()-mom2.Eta();  
-          
-          //...............................................
-          //Fill few histograms with kinematics of the pair
-          //FIXME, move all this to MakeAnalysisFillHistograms ...
-          
-          fhConvDeltaEta   ->Fill( pairM, dPhi      );
-          fhConvDeltaPhi   ->Fill( pairM, dEta      );
-          fhConvAsym       ->Fill( pairM, asymmetry );
-          fhConvDeltaEtaPhi->Fill( dEta , dPhi      );
-          fhConvPt         ->Fill( pairM, (mom+mom2).Pt());          
-          
-          //Estimate conversion distance, T. Awes, M. Ivanov
-          //Under the assumption that the pair has zero mass, and that each electron 
-          //of the pair has the same momentum, they will each have the same bend radius 
-          //given by R=p/(qB) = p / (300 B) with p in [MeV/c], B in [Tesla] and R in [m]. 
-          //With nominal ALICE magnet current of 30kA B=0.5T, and so with E_cluster=p,  
-          //R = E/1.5 [cm].  Under these assumptions, the distance from the conversion 
-          //point to the MCEal can be related to the separation distance, L=2y, on the MCEal 
-          //as d = sqrt(R^2 -(R-y)^2) = sqrt(2Ry - y^2). And since R>>y we can write as 
-          //d = sqrt(E*L/1.5) where E is the cluster energy and L is the distance in cm between 
-          //the clusters.
-          Float_t pos1[3];
-          calo->GetPosition(pos1); 
-          Float_t pos2[3];
-          calo2->GetPosition(pos2); 
-          Float_t clustDist = TMath::Sqrt((pos1[0]-pos2[0])*(pos1[0]-pos2[0])+
-                                          (pos1[1]-pos2[1])*(pos1[1]-pos2[1])+
-                                          (pos1[2]-pos2[2])*(pos1[2]-pos2[2]));
-          
-          Float_t convDist  = TMath::Sqrt(mom.E() *clustDist*0.01/0.15);
-          Float_t convDist2 = TMath::Sqrt(mom2.E()*clustDist*0.01/0.15);
-          //printf("l = %f, e1 = %f, d1=%f, e2 = %f, d2=%f\n",clustDist,mom.E(),convDist,mom2.E(),convDist2);
-          if(GetDebug() > 2)
-            printf("AliAnaPhoton::MakeAnalysisFillAOD(): Pair with mass %2.3f < %2.3f, %1.2f < dPhi %2.2f < %2.2f, dEta %f < %2.2f, asymmetry %2.2f< %2.2f; \n    cluster1 id %d, e %2.3f  SM %d, eta %2.3f, phi %2.3f ; \n    cluster2 id %d, e %2.3f, SM %d,eta %2.3f, phi %2.3f\n",
-                   pairM,fMassCut,fConvDPhiMinCut, dPhi, fConvDPhiMaxCut, dEta, fConvDEtaCut, asymmetry, fConvAsymCut,
-                   calo->GetID(),calo->E(),GetCaloUtils()->GetModuleNumber(calo), mom.Eta(), mom.Phi(),
-                   id2, calo2->E(), GetCaloUtils()->GetModuleNumber(calo2),mom2.Eta(), mom2.Phi());
-          
-          fhConvDistEta ->Fill(mom .Eta(), convDist );
-          fhConvDistEta ->Fill(mom2.Eta(), convDist2);
-          fhConvDistEn  ->Fill(mom .E(),   convDist );
-          fhConvDistEn  ->Fill(mom2.E(),   convDist2);        
-          fhConvDistMass->Fill((mom+mom2).M(), convDist );
-          //dEta cut
-          if(dEta<0.05){
-            fhConvDistEtaCutEta ->Fill(mom .Eta(), convDist );
-            fhConvDistEtaCutEta ->Fill(mom2.Eta(), convDist2);
-            fhConvDistEnCutEta  ->Fill(mom .E(),   convDist );
-            fhConvDistEnCutEta  ->Fill(mom2.E(),   convDist2);        
-            fhConvDistMassCutEta->Fill((mom+mom2).M(), convDist );
-            //mass cut
-            if(pairM<0.01){//10 MeV
-              fhConvDistEtaCutMass ->Fill(mom .Eta(), convDist );
-              fhConvDistEtaCutMass ->Fill(mom2.Eta(), convDist2);
-              fhConvDistEnCutMass  ->Fill(mom .E(),   convDist );
-              fhConvDistEnCutMass  ->Fill(mom2.E(),   convDist2);        
-              // asymmetry cut
-              if(asymmetry<0.1){
-                fhConvDistEtaCutAsy ->Fill(mom .Eta(), convDist );
-                fhConvDistEtaCutAsy ->Fill(mom2.Eta(), convDist2);
-                fhConvDistEnCutAsy  ->Fill(mom .E(),   convDist );
-                fhConvDistEnCutAsy  ->Fill(mom2.E(),   convDist2); 
-              }//asymmetry cut
-            }//mass cut            
-          }//dEta cut
-          
-          //...............................................
-          //Select pairs in a eta-phi window
-          if(TMath::Abs(dEta) < fConvDEtaCut    && 
-             TMath::Abs(dPhi) < fConvDPhiMaxCut &&
-             TMath::Abs(dPhi) > fConvDPhiMinCut && 
-             asymmetry        < fConvAsymCut       ){
-            bConverted = kTRUE;          
-          }
-          //printf("Accepted? %d\n",bConverted);
-          //...........................................
-          //Fill more histograms, simulated data
-          //FIXME, move all this to MakeAnalysisFillHistograms ...
-          if(IsDataMC()){
-            
-            //Check the origin of the pair, look for conversion, antinucleons or jet correlations (strings)
-            Int_t ancPDG    = 0;
-            Int_t ancStatus = 0;
-            TLorentzVector momentum;
-            TVector3 prodVertex;
-            Int_t ancLabel  = GetMCAnalysisUtils()->CheckCommonAncestor(calo->GetLabel(), calo2->GetLabel(), 
-                                                                        GetReader(), ancPDG, ancStatus, momentum, prodVertex);
-            
-            // printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Common ancestor label %d, pdg %d, name %s, status %d; \n",
-            //                          ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
-            
-            Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(calo2->GetLabels(),calo2->GetNLabels(),GetReader(), 0);
-            if(GetMCAnalysisUtils()->CheckTagBit(aodph.GetTag(),AliMCAnalysisUtils::kMCConversion)){
-              if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCConversion) && (ancPDG==22 || TMath::Abs(ancPDG)==11) && ancLabel > -1){
-                fhConvDeltaEtaMCConversion   ->Fill( pairM, dEta      );
-                fhConvDeltaPhiMCConversion   ->Fill( pairM, dPhi      );
-                fhConvAsymMCConversion       ->Fill( pairM, asymmetry );
-                fhConvDeltaEtaPhiMCConversion->Fill( dEta , dPhi      );
-                fhConvPtMCConversion         ->Fill( pairM, (mom+mom2).Pt());
-                fhConvDispersionMCConversion ->Fill( calo->GetDispersion(), calo2->GetDispersion());
-                fhConvM02MCConversion        ->Fill( calo->GetM02(), calo2->GetM02());
-                fhConvDistMCConversion       ->Fill( convDist , prodVertex.Mag() );
-                fhConvDistMCConversion       ->Fill( convDist2, prodVertex.Mag() );
-                
-                if(dEta<0.05 && pairM<0.01 && asymmetry<0.1){
-                  fhConvDistMCConversionCuts->Fill( convDist , prodVertex.Mag() );
-                  fhConvDistMCConversionCuts->Fill( convDist2, prodVertex.Mag() );
-                }
-                
-              }              
-            }
-            else if(GetMCAnalysisUtils()->CheckTagBit(aodph.GetTag(),AliMCAnalysisUtils::kMCAntiNeutron)){
-              if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiNeutron) && ancPDG==-2112 && ancLabel > -1){
-                fhConvDeltaEtaMCAntiNeutron    ->Fill( pairM, dEta      );
-                fhConvDeltaPhiMCAntiNeutron    ->Fill( pairM, dPhi      );
-                fhConvAsymMCAntiNeutron        ->Fill( pairM, asymmetry );
-                fhConvDeltaEtaPhiMCAntiNeutron ->Fill( dEta , dPhi      );
-                fhConvPtMCAntiNeutron          ->Fill( pairM, (mom+mom2).Pt());
-                fhConvDispersionMCAntiNeutron  ->Fill( calo->GetDispersion(), calo2->GetDispersion());
-                fhConvM02MCAntiNeutron         ->Fill( calo->GetM02(), calo2->GetM02());
-              }
-            }
-            else if(GetMCAnalysisUtils()->CheckTagBit(aodph.GetTag(),AliMCAnalysisUtils::kMCAntiProton)){
-              if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiProton) && ancPDG==-2212 && ancLabel > -1){
-                fhConvDeltaEtaMCAntiProton    ->Fill( pairM, dEta      );
-                fhConvDeltaPhiMCAntiProton    ->Fill( pairM, dPhi      );
-                fhConvAsymMCAntiProton        ->Fill( pairM, asymmetry );
-                fhConvDeltaEtaPhiMCAntiProton ->Fill( dEta , dPhi      );
-                fhConvPtMCAntiProton          ->Fill( pairM, (mom+mom2).Pt());
-                fhConvDispersionMCAntiProton  ->Fill( calo->GetDispersion(), calo2->GetDispersion());
-                fhConvM02MCAntiProton         ->Fill( calo->GetM02(), calo2->GetM02());
-              }
-            }
-            
-            //Pairs coming from fragmenting pairs.
-            if(ancPDG < 22 && ancLabel > 7 && (ancStatus == 11 || ancStatus == 12) ){
-              fhConvDeltaEtaMCString    ->Fill( pairM, dPhi);
-              fhConvDeltaPhiMCString    ->Fill( pairM, dPhi);
-              fhConvAsymMCString        ->Fill( pairM, TMath::Abs(mom.E()-mom2.E())/(mom.E()+mom2.E()) );
-              fhConvDeltaEtaPhiMCString ->Fill( dPhi, dPhi );
-              fhConvPtMCString          ->Fill( pairM, (mom+mom2).Pt());
-              fhConvDispersionMCString  ->Fill( calo->GetDispersion(), calo2->GetDispersion());
-              fhConvM02MCString         ->Fill( calo->GetM02(), calo2->GetM02());
-            }
-            
-          }// Data MC
-          
-          break;
-        }
-                         
-      }//Mass loop
-                 
-      //..........................................................................................................
-      //Pair selected as converted, remove both clusters or recombine them into a photon and put them in the AOD
-      if(bConverted){ 
-        //Add to AOD
-        if(fAddConvertedPairsToAOD){
-          //Create AOD of pair analysis
-          TLorentzVector mpair = mom+mom2;
-          AliAODPWG4Particle aodpair = AliAODPWG4Particle(mpair);
-          aodpair.SetLabel(aodph.GetLabel());
-          //aodpair.SetInputFileIndex(input);
-          
-          //printf("Index %d, Id %d\n",icalo, calo->GetID());
-          //Set the indeces of the original caloclusters  
-          aodpair.SetCaloLabel(calo->GetID(),id2);
-          aodpair.SetDetector(fCalorimeter);
-          aodpair.SetIdentifiedParticleType(aodph.GetIdentifiedParticleType());
-          aodpair.SetTag(aodph.GetTag());
-          aodpair.SetTagged(kTRUE);
-          //Add AOD with pair object to aod branch
-          AddAODParticle(aodpair);
-          //printf("\t \t both added pair\n");
-        }
         
-        //Do not add the current calocluster
-        if(fRemoveConvertedPair) continue;
-        else {
-          //printf("TAGGED\n");
-          //Tag this cluster as likely conversion
-          aodph.SetTagged(kTRUE);
-        }
-      }//converted pair
-    }//check conversion
-    //printf("\t \t added single cluster %d\n",icalo);
-         
-    //FIXME, this to MakeAnalysisFillHistograms ...
-    Int_t absID             = 0; 
-    Float_t maxCellFraction = 0;
-    AliVCaloCells* cells    = 0;
-    
-    if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
-    else                        cells = GetPHOSCells();
-    
-    absID = GetCaloUtils()->GetMaxEnergyCell(cells, calo,maxCellFraction);
-    
-    fhMaxCellDiffClusterE->Fill(aodph.E(),maxCellFraction);
-    fhNCellsE            ->Fill(aodph.E(),calo->GetNCells());
-
     //Add AOD with photon object to aod branch
     AddAODParticle(aodph);
     
   }//loop
-  
-  delete [] indexConverted;
-       
+       
   if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD()  End fill AODs, with %d entries \n",GetOutputAODBranch()->GetEntriesFast());  
   
 }
@@ -2338,19 +1690,34 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
     if     (ecluster > 0.5)   fhEtaPhiPhoton  ->Fill(etacluster, phicluster);
     else if(GetMinPt() < 0.5) fhEtaPhi05Photon->Fill(etacluster, phicluster);
     
-    if(fCheckConversion &&ph->IsTagged()){
-      fhPtPhotonConv->Fill(ptcluster);
-      if(ecluster > 0.5)        fhEtaPhiPhotonConv  ->Fill(etacluster, phicluster);
-      else if(GetMinPt() < 0.5) fhEtaPhi05PhotonConv->Fill(etacluster, phicluster);
+
+    //Get original cluster, to recover some information
+    Int_t absID             = 0; 
+    Float_t maxCellFraction = 0;
+    AliVCaloCells* cells    = 0;
+    TObjArray * clusters    = 0; 
+    if(fCalorimeter == "EMCAL"){
+      cells    = GetEMCALCells();
+      clusters = GetEMCALClusters();
+    }
+    else{
+      cells    = GetPHOSCells();
+      clusters = GetPHOSClusters();
     }
     
+    Int_t iclus = -1;
+    AliVCluster *cluster = FindCluster(clusters,ph->GetCaloLabel(0),iclus); 
+    absID = GetCaloUtils()->GetMaxEnergyCell(cells, cluster,maxCellFraction);
+    
+    fhMaxCellDiffClusterE->Fill(ph->E(),maxCellFraction);
+    fhNCellsE            ->Fill(ph->E(),cluster->GetNCells());
+    
     //.......................................
     //Play with the MC data if available
     if(IsDataMC()){
       
       FillAcceptanceHistograms();
       
-      
       //....................................................................
       // Access MC information in stack if requested, check that it exists.
       Int_t label =ph->GetLabel();
@@ -2426,12 +1793,6 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
           fhMC2Pt[mcConversion]    ->Fill(ptcluster, ptprim);     
           fhMCDeltaE[mcConversion] ->Fill(ecluster,eprim-ecluster);
           fhMCDeltaPt[mcConversion]->Fill(ptcluster,ptprim-ptcluster);     
-          
-          if(fCheckConversion){
-            if(ph->IsTagged()) fhPtConversionTagged ->Fill(ptcluster);
-            if(ptcluster > 0.5)fhEtaPhiConversion   ->Fill(etacluster,phicluster);
-            else               fhEtaPhi05Conversion ->Fill(etacluster,phicluster);
-          }
         }                      
         
         if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPrompt) && fhMCE[mcPrompt]){
@@ -2533,7 +1894,6 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
         fhMCPt [mcAntiNeutron] ->Fill(ptcluster);
         fhMCPhi[mcAntiNeutron] ->Fill(ecluster,phicluster);
         fhMCEta[mcAntiNeutron] ->Fill(ecluster,etacluster);
-        if(ph->IsTagged() && fCheckConversion) fhPtAntiNeutronTagged ->Fill(ptcluster);
         
         fhMC2E[mcAntiNeutron]     ->Fill(ecluster, eprim);
         fhMC2Pt[mcAntiNeutron]    ->Fill(ptcluster, ptprim);     
@@ -2547,7 +1907,6 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
         fhMCPt [mcAntiProton] ->Fill(ptcluster);
         fhMCPhi[mcAntiProton] ->Fill(ecluster,phicluster);
         fhMCEta[mcAntiProton] ->Fill(ecluster,etacluster);
-        if(ph->IsTagged() && fCheckConversion) fhPtAntiProtonTagged ->Fill(ptcluster);
         
         fhMC2E[mcAntiProton]     ->Fill(ecluster, eprim);
         fhMC2Pt[mcAntiProton]    ->Fill(ptcluster, ptprim);     
@@ -2572,14 +1931,12 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
         fhMCPt [mcOther] ->Fill(ptcluster);
         fhMCPhi[mcOther] ->Fill(ecluster,phicluster);
         fhMCEta[mcOther] ->Fill(ecluster,etacluster);
-        if(ph->IsTagged() && fCheckConversion) fhPtUnknownTagged ->Fill(ptcluster);
         
         fhMC2E[mcOther]     ->Fill(ecluster, eprim);
         fhMC2Pt[mcOther]    ->Fill(ptcluster, ptprim);     
         fhMCDeltaE[mcOther] ->Fill(ecluster,eprim-ecluster);
         fhMCDeltaPt[mcOther]->Fill(ecluster,ptprim-ptcluster);     
         
-        
         //              printf(" AliAnaPhoton::MakeAnalysisFillHistograms() - Label %d, pT %2.3f Unknown, bits set: ",
         //                                     ph->GetLabel(),ph->Pt());
         //               for(Int_t i = 0; i < 20; i++) {
@@ -2612,11 +1969,6 @@ void AliAnaPhoton::Print(const Option_t * opt) const
   printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2);
   printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3);
   printf("Reject clusters with a track matched = %d\n",fRejectTrackMatch);
-  printf("Check Pair Conversion                = %d\n",fCheckConversion);
-  printf("Add conversion pair to AOD           = %d\n",fAddConvertedPairsToAOD);
-  printf("Conversion pair mass cut             = %f\n",fMassCut);
-  printf("Conversion selection cut : A < %1.2f; %1.3f < Dphi < %1.3f; Deta < %1.3f\n",
-         fConvAsymCut,fConvDPhiMinCut, fConvDPhiMaxCut, fConvDEtaCut);
   printf("Time Cut: %3.1f < TOF  < %3.1f\n", fTimeCutMin, fTimeCutMax);
   printf("Number of cells in cluster is        > %d \n", fNCellsCut);
   printf("    \n") ;
index caee5f47bcb92603ee4006cfeecd0f7e1e4c266e..369b7f6ca6d33e11d3fb44139c82882889ed0d1b 100755 (executable)
 // --- ROOT system ---
 class TH2F ;
 class TH1F;
-class TH3D;
 class TString ;
 class TObjString;
+class TList ;
 
 // --- ANALYSIS system ---
 #include "AliAnaPartCorrBaseClass.h"
-class AliStack;
-class TParticle;
-
-class TList ;
 
 class AliAnaPhoton : public AliAnaPartCorrBaseClass {
 
  public: 
-  AliAnaPhoton() ; // default ctor
-  virtual ~AliAnaPhoton() ; //virtual dtor
+  AliAnaPhoton() ;              // default ctor
+  virtual ~AliAnaPhoton() { ; } // virtual dtor
  private:
-  AliAnaPhoton(const AliAnaPhoton & g) ; // cpy ctor
-  AliAnaPhoton & operator = (const AliAnaPhoton & g) ;//cpy assignment
+  AliAnaPhoton(const AliAnaPhoton & g) ;               // cpy ctor
+  AliAnaPhoton & operator = (const AliAnaPhoton & g) ; // cpy assignment
 
  public:
        
@@ -65,16 +61,13 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
   
   void         FillAcceptanceHistograms();
 
-  //           Fill Shower Shape histograms
   void         FillShowerShapeHistograms( AliVCluster* cluster, const Int_t mcTag) ;
   
   void         SwitchOnFillShowerShapeHistograms()    { fFillSSHistograms = kTRUE  ; }
   void         SwitchOffFillShowerShapeHistograms()   { fFillSSHistograms = kFALSE ; }  
   
   
-  //---------------------------------------
   // Analysis parameters setters getters
-  //---------------------------------------
   
   TString      GetCalorimeter()                 const { return fCalorimeter        ; }
   void         SetCalorimeter(TString  & det)         { fCalorimeter = det         ; }
@@ -95,37 +88,7 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
   Bool_t       IsTrackMatchRejectionOn()        const { return fRejectTrackMatch   ; }
   void         SwitchOnTrackMatchRejection()          { fRejectTrackMatch = kTRUE  ; }
   void         SwitchOffTrackMatchRejection()         { fRejectTrackMatch = kFALSE ; }  
-  
-  // ** Conversion pair analysis **
-  
-  Float_t      GetMassCut()                     const { return fMassCut            ; }
-  void         SetMassCut(Float_t m)                  { fMassCut    = m            ; }
-  
-  Bool_t       IsCheckConversionOn()            const { return fCheckConversion    ; }
-  void         SwitchOnConversionChecker()            { fCheckConversion = kTRUE   ; }
-  void         SwitchOffConversionChecker()           { fCheckConversion = kFALSE  ; }  
-       
-  Bool_t       AreConvertedPairsInAOD()         const { return fAddConvertedPairsToAOD   ; }
-  void         SwitchOnAdditionConvertedPairsToAOD()  { fAddConvertedPairsToAOD = kTRUE  ; 
-                                                        fCheckConversion        = kTRUE  ; }
-  void         SwitchOffAdditionConvertedPairsToAOD() { fAddConvertedPairsToAOD = kFALSE ; }  
-       
-  Bool_t       AreConvertedPairsRemoved()       const { return fRemoveConvertedPair      ; }
-  void         SwitchOnConvertedPairsRemoval()        { fRemoveConvertedPair  = kTRUE    ; 
-                                                        fCheckConversion      = kTRUE    ; }
-  void         SwitchOffConvertedPairsRemoval()       { fRemoveConvertedPair  = kFALSE   ; }    
-  
-  void         SetConvAsymCut(Float_t c)              { fConvAsymCut = c           ; }
-  Float_t      GetConvAsymCut()                 const { return fConvAsymCut        ; }
-  
-  void         SetConvDEtaCut(Float_t c)              { fConvDEtaCut = c           ; }
-  Float_t      GetConvDEtaCut()                 const { return fConvDEtaCut        ; }
-  
-  void         SetConvDPhiCut(Float_t min, Float_t max)  { fConvDPhiMinCut = min   ;  
-                                                           fConvDPhiMaxCut = max   ; }
-  Float_t      GetConvDPhiMinCut()              const { return fConvDPhiMinCut     ; }
-  Float_t      GetConvDPhiMaxCut()              const { return fConvDPhiMaxCut     ; }
-  
+         
   void         FillNOriginHistograms(Int_t n)         { fNOriginHistograms = n ; 
     if(n > 14) fNOriginHistograms = 14; }
   void         FillNPrimaryHistograms(Int_t n)        { fNPrimaryHistograms= n ;
@@ -158,16 +121,6 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
   Int_t    fNOriginHistograms;           // Fill only NOriginHistograms of the 14 defined types
   Int_t    fNPrimaryHistograms;          // Fill only NPrimaryHistograms of the 7 defined types
 
-  //Conversion pairs selection cuts
-  Bool_t   fCheckConversion;             // Combine pairs of clusters with mass close to 0
-  Bool_t   fRemoveConvertedPair;         // Remove conversion pairs
-  Bool_t   fAddConvertedPairsToAOD;      // Put Converted pairs in AOD
-  Float_t  fMassCut;                     // Mass cut for the conversion pairs selection  
-  Float_t  fConvAsymCut;                 // Select conversion pairs when asymmetry is smaller than cut
-  Float_t  fConvDEtaCut;                 // Select conversion pairs when deta of pair smaller than cut
-  Float_t  fConvDPhiMinCut;              // Select conversion pairs when dphi of pair lager than cut
-  Float_t  fConvDPhiMaxCut;              // Select conversion pairs when dphi of pair smaller than cut
-
   //Histograms 
   TH2F * fhNCellsE;                      //! number of cells in cluster vs E 
   TH2F * fhMaxCellDiffClusterE;          //! Fraction of energy carried by cell with maximum energy
@@ -179,28 +132,6 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
   TH2F * fhEtaPhiPhoton  ;               //! Pseudorapidity vs Phi of identified  photon for transerse momentum > 0.5
   TH2F * fhEtaPhi05Photon  ;             //! Pseudorapidity vs Phi of identified  photon for transerse momentum < 0.5
   
-  //Conversion pairs
-  TH1F * fhPtPhotonConv   ;              //! Number of identified photon vs transerse momentum 
-  TH2F * fhEtaPhiPhotonConv  ;           //! Pseudorapidity vs Phi of identified  photon for transerse momentum > 0.5, for converted
-  TH2F * fhEtaPhi05PhotonConv  ;         //! Pseudorapidity vs Phi of identified  photon for transerse momentum < 0.5, for converted
-  TH2F * fhConvDeltaEta;                 //! Small mass photons, correlation in eta
-  TH2F * fhConvDeltaPhi;                 //! Small mass photons, correlation in phi
-  TH2F * fhConvDeltaEtaPhi;              //! Small mass photons, correlation in phi and eta
-  TH2F * fhConvAsym;                     //! Small mass photons, correlation in energy asymmetry
-  TH2F * fhConvPt;                       //! Small mass photons, pT of pair
-  
-  //Vertex distance
-  TH2F * fhConvDistEta;                   //! Approx distance to vertex vs cluster Eta 
-  TH2F * fhConvDistEn;                    //! Approx distance to vertex vs Energy
-  TH2F * fhConvDistMass;                  //! Approx distance to vertex vs Mass
-  TH2F * fhConvDistEtaCutEta;             //! Approx distance to vertex vs cluster Eta, dEta < 0.05 
-  TH2F * fhConvDistEnCutEta;              //! Approx distance to vertex vs Energy, dEta < 0.05
-  TH2F * fhConvDistMassCutEta;            //! Approx distance to vertex vs Mass, dEta < 0.05
-  TH2F * fhConvDistEtaCutMass;            //! Approx distance to vertex vs cluster Eta, dEta < 0.05, m < 10 MeV 
-  TH2F * fhConvDistEnCutMass;             //! Approx distance to vertex vs Energy, dEta < 0.05, m < 10 MeV
-  TH2F * fhConvDistEtaCutAsy;             //! Approx distance to vertex vs cluster Eta, dEta < 0.05, m < 10 MeV, A < 0.1
-  TH2F * fhConvDistEnCutAsy;              //! Approx distance to vertex vs energy, dEta < 0.05, m < 10 MeV, A < 0.1
-
   //Shower shape
   
   TH2F * fhDispE;                         //! cluster dispersion vs E
@@ -231,78 +162,35 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
     
   //Fill MC dependent histograms, Origin of this cluster is ...
 
-  TH2F * fhMCDeltaE[14]  ;                    //! MC-Reco E distribution coming from MC particle     
-  TH2F * fhMCDeltaPt[14] ;                    //! MC-Reco pT distribution coming from MC particle
-  TH2F * fhMC2E[14]  ;                        //! E distribution, Reco vs MC coming from MC particle
-  TH2F * fhMC2Pt[14] ;                        //! pT distribution, Reco vs MC coming from MC particle
+  TH2F * fhMCDeltaE[14]  ;                      //! MC-Reco E distribution coming from MC particle     
+  TH2F * fhMCDeltaPt[14] ;                      //! MC-Reco pT distribution coming from MC particle
+  TH2F * fhMC2E[14]  ;                          //! E distribution, Reco vs MC coming from MC particle
+  TH2F * fhMC2Pt[14] ;                          //! pT distribution, Reco vs MC coming from MC particle
   
-  TH1F * fhMCE[14];                           //! Number of identified photon vs cluster energy coming from MC particle
-  TH1F * fhMCPt[14];                          //! Number of identified photon vs cluster pT     coming from MC particle
-  TH2F * fhMCPhi[14];                         //! Phi of identified photon coming from MC particle
-  TH2F * fhMCEta[14];                         //! eta of identified photon coming from MC particle
+  TH1F * fhMCE[14];                             //! Number of identified photon vs cluster energy coming from MC particle
+  TH1F * fhMCPt[14];                            //! Number of identified photon vs cluster pT     coming from MC particle
+  TH2F * fhMCPhi[14];                           //! Phi of identified photon coming from MC particle
+  TH2F * fhMCEta[14];                           //! eta of identified photon coming from MC particle
 
-  TH1F * fhEPrimMC[7];                        //! Number of generated photon vs energy
-  TH1F * fhPtPrimMC[7];                       //! Number of generated photon vs pT   
-  TH2F * fhPhiPrimMC[7];                      //! Phi of generted photon
-  TH2F * fhYPrimMC[7];                        //! Rapidity of generated photon 
-  
-  TH1F * fhEPrimMCAcc[7];                     //! Number of generated photon vs energy, in calorimeter acceptance
-  TH1F * fhPtPrimMCAcc[7];                    //! Number of generated photon vs pT, in calorimeter acceptance   
-  TH2F * fhPhiPrimMCAcc[7];                   //! Phi of generted photon, in calorimeter acceptance
-  TH2F * fhYPrimMCAcc[7];                     //! Rapidity of generated photon, in calorimeter acceptance   
+  TH1F * fhEPrimMC[7];                          //! Number of generated photon vs energy
+  TH1F * fhPtPrimMC[7];                         //! Number of generated photon vs pT   
+  TH2F * fhPhiPrimMC[7];                        //! Phi of generted photon
+  TH2F * fhYPrimMC[7];                          //! Rapidity of generated photon 
   
-  //Conversion pairs analysis histograms
-  TH1F * fhPtConversionTagged;                //! Number of identified gamma from Conversion , tagged as conversion 
-  TH1F * fhPtAntiNeutronTagged;               //! Number of identified gamma from AntiNeutrons gamma, tagged as conversion 
-  TH1F * fhPtAntiProtonTagged;                //! Number of identified gamma from AntiProtons gamma, tagged as conversion 
-  TH1F * fhPtUnknownTagged;                   //! Number of identified gamma from unknown, tagged as conversion 
+  TH1F * fhEPrimMCAcc[7];                       //! Number of generated photon vs energy, in calorimeter acceptance
+  TH1F * fhPtPrimMCAcc[7];                      //! Number of generated photon vs pT, in calorimeter acceptance   
+  TH2F * fhPhiPrimMCAcc[7];                     //! Phi of generted photon, in calorimeter acceptance
+  TH2F * fhYPrimMCAcc[7];                       //! Rapidity of generated photon, in calorimeter acceptance   
   
-  TH2F * fhEtaPhiConversion  ;                //! Pseudorapidity vs Phi for transerse momentum > 0.5, for MC converted
-  TH2F * fhEtaPhi05Conversion  ;              //! Pseudorapidity vs Phi for transerse momentum < 0.5, for MC converted
-  
-  TH2F * fhConvDeltaEtaMCConversion;          //! Small mass cluster pairs, correlation in eta, origin of both clusters is conversion
-  TH2F * fhConvDeltaPhiMCConversion;          //! Small mass cluster pairs, correlation in phi, origin of both clusters is conversion
-  TH2F * fhConvDeltaEtaPhiMCConversion;       //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is conversion
-  TH2F * fhConvAsymMCConversion;              //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is conversion
-  TH2F * fhConvPtMCConversion;                //! Small mass cluster pairs, pt of pair, origin of both clusters is conversion
-  TH2F * fhConvDispersionMCConversion;        //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2
-  TH2F * fhConvM02MCConversion;               //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2 
-
-  TH2F * fhConvDeltaEtaMCAntiNeutron;         //! Small mass cluster pairs, correlation in eta, origin of both clusters is anti neutron
-  TH2F * fhConvDeltaPhiMCAntiNeutron;         //! Small mass cluster pairs, correlation in phi, origin of both clusters is anti neutron
-  TH2F * fhConvDeltaEtaPhiMCAntiNeutron;      //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is anti neutron
-  TH2F * fhConvAsymMCAntiNeutron;             //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is anti neutron
-  TH2F * fhConvPtMCAntiNeutron;               //! Small mass cluster pairs, pt of pair, origin of both clusters is anti neutron
-  TH2F * fhConvDispersionMCAntiNeutron;       //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2, origin of both clusters is anti neutron
-  TH2F * fhConvM02MCAntiNeutron;              //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is anti neutron
-
-  TH2F * fhConvDeltaEtaMCAntiProton;          //! Small mass cluster pairs, correlation in eta, origin of both clusters is anti proton
-  TH2F * fhConvDeltaPhiMCAntiProton;          //! Small mass cluster pairs, correlation in phi, origin of both clusters is anti proton
-  TH2F * fhConvDeltaEtaPhiMCAntiProton;       //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is anti proton
-  TH2F * fhConvAsymMCAntiProton;              //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is anti proton
-  TH2F * fhConvPtMCAntiProton;                //! Small mass cluster pairs, pt of pairs, origin of both clusters is anti proton
-  TH2F * fhConvDispersionMCAntiProton;        //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2, origin of both clusters is anti proton
-  TH2F * fhConvM02MCAntiProton;               //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is anti proton
-
-  TH2F * fhConvDeltaEtaMCString;              //! Small mass cluster pairs, correlation in eta, origin of both clusters is string
-  TH2F * fhConvDeltaPhiMCString;              //! Small mass cluster pairs, correlation in phi, origin of both clusters is string
-  TH2F * fhConvDeltaEtaPhiMCString;           //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is string
-  TH2F * fhConvAsymMCString;                  //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is string
-  TH2F * fhConvPtMCString;                    //! Small mass cluster pairs, pt of pairs, origin of both clusters is string
-  TH2F * fhConvDispersionMCString;            //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2, origin of both clusters is string
-  TH2F * fhConvM02MCString;                   //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is string
-  TH2F * fhConvDistMCConversion;              //! Calculated conversion distance vs real distance to vertex       
-  TH2F * fhConvDistMCConversionCuts;          //! Calculated conversion distance vs real distance to vertex        
-
   // Shower Shape MC
 
-  TH2F * fhMCELambda0[6] ;                    //! E vs Lambda0     from MC particle
-  TH2F * fhMCELambda1[6] ;                    //! E vs Lambda1     from MC particle
-  TH2F * fhMCEDispersion[6] ;                 //! E vs Dispersion  from MC particle
+  TH2F * fhMCELambda0[6] ;                      //! E vs Lambda0     from MC particle
+  TH2F * fhMCELambda1[6] ;                      //! E vs Lambda1     from MC particle
+  TH2F * fhMCEDispersion[6] ;                   //! E vs Dispersion  from MC particle
   
-  TH2F * fhMCPhotonELambda0NoOverlap ;        //! E vs Lambda0     from MC photons, no overlap
-  TH2F * fhMCPhotonELambda0TwoOverlap ;       //! E vs Lambda0     from MC photons, 2 particles overlap
-  TH2F * fhMCPhotonELambda0NOverlap ;         //! E vs Lambda0     from MC photons, N particles overlap
+  TH2F * fhMCPhotonELambda0NoOverlap ;          //! E vs Lambda0     from MC photons, no overlap
+  TH2F * fhMCPhotonELambda0TwoOverlap ;         //! E vs Lambda0     from MC photons, 2 particles overlap
+  TH2F * fhMCPhotonELambda0NOverlap ;           //! E vs Lambda0     from MC photons, N particles overlap
   
   TH2F * fhMCLambda0vsClusterMaxCellDiffE0[6];  //! Lambda0 vs fraction of energy of max cell for E < 2 GeV
   TH2F * fhMCLambda0vsClusterMaxCellDiffE2[6];  //! Lambda0 vs fraction of energy of max cell for 2< E < 6 GeV
@@ -314,23 +202,22 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
   TH2F * fhMCMaxCellDiffClusterE[6];            //! Fraction of energy carried by cell with maximum energy
 
   //Embedding
-  TH2F * fhEmbeddedSignalFractionEnergy ;     //! Fraction of photon energy of embedded signal vs cluster energy
+  TH2F * fhEmbeddedSignalFractionEnergy ;       //! Fraction of photon energy of embedded signal vs cluster energy
   
-  TH2F * fhEmbedPhotonELambda0FullSignal ;    //!  Lambda0 vs E for embedded photons with more than 90% of the cluster energy
-  TH2F * fhEmbedPhotonELambda0MostlySignal ;  //!  Lambda0 vs E for embedded photons with 90%<fraction<50% 
-  TH2F * fhEmbedPhotonELambda0MostlyBkg ;     //!  Lambda0 vs E for embedded photons with 50%<fraction<10% 
-  TH2F * fhEmbedPhotonELambda0FullBkg ;       //!  Lambda0 vs E for embedded photons with less than 10% of the cluster energy
+  TH2F * fhEmbedPhotonELambda0FullSignal ;      //!  Lambda0 vs E for embedded photons with more than 90% of the cluster energy
+  TH2F * fhEmbedPhotonELambda0MostlySignal ;    //!  Lambda0 vs E for embedded photons with 90%<fraction<50% 
+  TH2F * fhEmbedPhotonELambda0MostlyBkg ;       //!  Lambda0 vs E for embedded photons with 50%<fraction<10% 
+  TH2F * fhEmbedPhotonELambda0FullBkg ;         //!  Lambda0 vs E for embedded photons with less than 10% of the cluster energy
   
-  TH2F * fhEmbedPi0ELambda0FullSignal ;       //!  Lambda0 vs E for embedded photons with more than 90% of the cluster energy
-  TH2F * fhEmbedPi0ELambda0MostlySignal ;     //!  Lambda0 vs E for embedded photons with 90%<fraction<50% 
-  TH2F * fhEmbedPi0ELambda0MostlyBkg ;        //!  Lambda0 vs E for embedded photons with 50%<fraction<10% 
-  TH2F * fhEmbedPi0ELambda0FullBkg ;          //!  Lambda0 vs E for embedded photons with less than 10% of the cluster energy
+  TH2F * fhEmbedPi0ELambda0FullSignal ;         //!  Lambda0 vs E for embedded photons with more than 90% of the cluster energy
+  TH2F * fhEmbedPi0ELambda0MostlySignal ;       //!  Lambda0 vs E for embedded photons with 90%<fraction<50% 
+  TH2F * fhEmbedPi0ELambda0MostlyBkg ;          //!  Lambda0 vs E for embedded photons with 50%<fraction<10% 
+  TH2F * fhEmbedPi0ELambda0FullBkg ;            //!  Lambda0 vs E for embedded photons with less than 10% of the cluster energy
   
-   ClassDef(AliAnaPhoton,17)
+   ClassDef(AliAnaPhoton,18)
 
 } ;
  
-
 #endif//ALIANAPHOTON_H
 
 
diff --git a/PWG4/PartCorrDep/AliAnaPhotonConvInCalo.cxx b/PWG4/PartCorrDep/AliAnaPhotonConvInCalo.cxx
new file mode 100755 (executable)
index 0000000..55d506e
--- /dev/null
@@ -0,0 +1,872 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes 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.                  *
+ **************************************************************************/
+
+//_________________________________________________________________________
+//
+// Conversions pairs analysis
+// Check if cluster comes from a conversion in the material in front of the calorimeter
+// Do invariant mass of all pairs, if mass is close to 0, then it is conversion.
+// Input are selected clusters with AliAnaPhoton
+//
+//
+//-- Author: Gustavo Conesa (LPSC-IN2P3-CNRS)
+//////////////////////////////////////////////////////////////////////////////
+
+
+// --- ROOT system --- 
+#include <TH2F.h>
+#include <TH3D.h>
+#include <TClonesArray.h>
+#include <TObjString.h>
+#include "TParticle.h"
+#include "TDatabasePDG.h"
+
+// --- Analysis system --- 
+#include "AliAnaPhotonConvInCalo.h" 
+#include "AliCaloTrackReader.h"
+#include "AliStack.h"
+#include "AliCaloPID.h"
+#include "AliMCAnalysisUtils.h"
+#include "AliFiducialCut.h"
+#include "AliVCluster.h"
+#include "AliAODMCParticle.h"
+
+ClassImp(AliAnaPhotonConvInCalo)
+
+//________________________________________
+AliAnaPhotonConvInCalo::AliAnaPhotonConvInCalo() : 
+AliAnaPartCorrBaseClass(),   
+fRemoveConvertedPair(kFALSE), 
+fAddConvertedPairsToAOD(kFALSE), 
+fMassCut(0),                  
+fConvAsymCut(1.),                  fConvDEtaCut(2.),
+fConvDPhiMinCut(-1.),              fConvDPhiMaxCut(7.), 
+
+// Histograms
+fhPtPhotonConv(0),                 fhEtaPhiPhotonConv(0),          fhEtaPhi05PhotonConv(0),
+fhConvDeltaEta(0),                 fhConvDeltaPhi(0),              fhConvDeltaEtaPhi(0), 
+fhConvAsym(0),                     fhConvPt(0),
+fhConvDistEta(0),                  fhConvDistEn(0),                fhConvDistMass(0),     
+fhConvDistEtaCutEta(0),            fhConvDistEnCutEta(0),          fhConvDistMassCutEta(0),
+fhConvDistEtaCutMass(0),           fhConvDistEnCutMass(0), 
+fhConvDistEtaCutAsy(0),            fhConvDistEnCutAsy(0),
+
+// MC histograms
+fhPtConversionTagged(0),           fhPtAntiNeutronTagged(0),       
+fhPtAntiProtonTagged(0),           fhPtUnknownTagged(0),
+
+fhConvDeltaEtaMCConversion(0),     fhConvDeltaPhiMCConversion(0),  fhConvDeltaEtaPhiMCConversion(0),
+fhConvAsymMCConversion(0),         fhConvPtMCConversion(0),           
+fhConvDispersionMCConversion(0),   fhConvM02MCConversion(0),
+
+fhConvDeltaEtaMCAntiNeutron(0),    fhConvDeltaPhiMCAntiNeutron(0), fhConvDeltaEtaPhiMCAntiNeutron(0), 
+fhConvAsymMCAntiNeutron(0),        fhConvPtMCAntiNeutron(0), 
+fhConvDispersionMCAntiNeutron(0),  fhConvM02MCAntiNeutron(0),
+fhConvDeltaEtaMCAntiProton(0),     fhConvDeltaPhiMCAntiProton(0),  fhConvDeltaEtaPhiMCAntiProton(0),  
+fhConvAsymMCAntiProton(0),         fhConvPtMCAntiProton(0),  
+fhConvDispersionMCAntiProton(0),   fhConvM02MCAntiProton(0),
+fhConvDeltaEtaMCString(0),         fhConvDeltaPhiMCString(0),      fhConvDeltaEtaPhiMCString(0),      
+fhConvAsymMCString(0),             fhConvPtMCString(0),      
+fhConvDispersionMCString(0),       fhConvM02MCString(0),
+fhConvDistMCConversion(0),         fhConvDistMCConversionCuts(0)
+{
+  //default ctor
+  
+  //Initialize parameters
+  InitParameters();
+  
+}
+
+//_________________________________________________
+TObjString *  AliAnaPhotonConvInCalo::GetAnalysisCuts()
+{      
+  //Save parameters used for analysis
+  TString parList ; //this will be list of parameters used for this analysis.
+  const Int_t buffersize = 255;
+  char onePar[buffersize] ;
+  
+  snprintf(onePar,buffersize,"--- AliAnaPhotonConvInCalo---\n") ;
+  parList+=onePar ;    
+  snprintf(onePar,buffersize,"Conversion Selection: fConvAsymCut %1.2f, fConvDEtaCut %1.2f fConvDPhiCut (%1.2f,%1.2f)\n",
+           fConvAsymCut, fConvDEtaCut, fConvDPhiMinCut, fConvDPhiMaxCut) ;
+  parList+=onePar ; 
+  
+  return new TObjString(parList) ;
+}
+
+//___________________________________________________
+TList *  AliAnaPhotonConvInCalo::GetCreateOutputObjects()
+{  
+  // Create histograms to be saved in output file and 
+  // store them in outputContainer
+  TList * outputContainer = new TList() ; 
+  outputContainer->SetName("PhotonConvInCaloHistos") ; 
+       
+  Int_t nptbins  = GetHistoPtBins();  Float_t ptmax  = GetHistoPtMax();  Float_t ptmin  = GetHistoPtMin(); 
+  Int_t nphibins = GetHistoPhiBins(); Float_t phimax = GetHistoPhiMax(); Float_t phimin = GetHistoPhiMin(); 
+  Int_t netabins = GetHistoEtaBins(); Float_t etamax = GetHistoEtaMax(); Float_t etamin = GetHistoEtaMin();    
+  
+  fhPtPhotonConv  = new TH1F("hPtPhotonConv","Number of #gamma over calorimeter, conversion",nptbins,ptmin,ptmax); 
+  fhPtPhotonConv->SetYTitle("N");
+  fhPtPhotonConv->SetXTitle("p_{T #gamma}(GeV/c)");
+  outputContainer->Add(fhPtPhotonConv) ; 
+  
+  fhEtaPhiPhotonConv  = new TH2F
+  ("hEtaPhiPhotonConv","#eta vs #phi",netabins,etamin,etamax,nphibins,phimin,phimax); 
+  fhEtaPhiPhotonConv->SetYTitle("#phi (rad)");
+  fhEtaPhiPhotonConv->SetXTitle("#eta");
+  outputContainer->Add(fhEtaPhiPhotonConv) ;
+  if(GetMinPt() < 0.5){
+    fhEtaPhi05PhotonConv  = new TH2F
+    ("hEtaPhi05PhotonConv","#eta vs #phi, E > 0.5",netabins,etamin,etamax,nphibins,phimin,phimax); 
+    fhEtaPhi05PhotonConv->SetYTitle("#phi (rad)");
+    fhEtaPhi05PhotonConv->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhi05PhotonConv) ;
+  }
+  
+  fhConvDeltaEta  = new TH2F
+  ("hConvDeltaEta","#Delta #eta of selected conversion pairs",100,0,fMassCut,netabins*2,-0.5,0.5); 
+  fhConvDeltaEta->SetYTitle("#Delta #eta");
+  fhConvDeltaEta->SetXTitle("Pair Mass (GeV/c^2)");
+  outputContainer->Add(fhConvDeltaEta) ;
+  
+  fhConvDeltaPhi  = new TH2F
+  ("hConvDeltaPhi","#Delta #phi of selected conversion pairs",100,0,fMassCut,nphibins*2,-0.5,0.5); 
+  fhConvDeltaPhi->SetYTitle("#Delta #phi");
+  fhConvDeltaPhi->SetXTitle("Pair Mass (GeV/c^2)");
+  outputContainer->Add(fhConvDeltaPhi) ;
+  
+  fhConvDeltaEtaPhi  = new TH2F
+  ("hConvDeltaEtaPhi","#Delta #eta vs #Delta #phi of selected conversion pairs",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+  fhConvDeltaEtaPhi->SetYTitle("#Delta #phi");
+  fhConvDeltaEtaPhi->SetXTitle("#Delta #eta");
+  outputContainer->Add(fhConvDeltaEtaPhi) ;
+  
+  fhConvAsym  = new TH2F
+  ("hConvAsym","Asymmetry of selected conversion pairs",100,0,fMassCut,100,0,1); 
+  fhConvAsym->SetYTitle("Asymmetry");
+  fhConvAsym->SetXTitle("Pair Mass (GeV/c^2)");
+  outputContainer->Add(fhConvAsym) ;  
+  
+  fhConvPt  = new TH2F
+  ("hConvPt","p_{T} of selected conversion pairs",100,0,fMassCut,100,0.,10.); 
+  fhConvPt->SetYTitle("Pair p_{T} (GeV/c)");
+  fhConvPt->SetXTitle("Pair Mass (GeV/c^2)");
+  outputContainer->Add(fhConvPt) ;
+  
+  fhConvDistEta  = new TH2F
+  ("hConvDistEta","distance to conversion vertex",100,-0.7,0.7,100,0.,5.); 
+  fhConvDistEta->SetXTitle("#eta");
+  fhConvDistEta->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEta) ;
+  
+  fhConvDistEn  = new TH2F
+  ("hConvDistEn","distance to conversion vertex",nptbins,ptmin,ptmax,100,0.,5.); 
+  fhConvDistEn->SetXTitle("E (GeV)");
+  fhConvDistEn->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEn) ;
+  
+  fhConvDistMass  = new TH2F
+  ("hConvDistMass","distance to conversion vertex",100,0,fMassCut,100,0.,5.); 
+  fhConvDistMass->SetXTitle("m (GeV/c^2)");
+  fhConvDistMass->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistMass) ;
+  
+  fhConvDistEtaCutEta  = new TH2F
+  ("hConvDistEtaCutEta","distance to conversion vertex, dEta < 0.05",100,-0.7,0.7,100,0.,5.); 
+  fhConvDistEtaCutEta->SetXTitle("#eta");
+  fhConvDistEtaCutEta->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEtaCutEta) ;
+  
+  fhConvDistEnCutEta  = new TH2F
+  ("hConvDistEnCutEta","distance to conversion vertex, dEta < 0.05",nptbins,ptmin,ptmax,100,0.,5.); 
+  fhConvDistEnCutEta->SetXTitle("E (GeV)");
+  fhConvDistEnCutEta->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEnCutEta) ;
+  
+  fhConvDistMassCutEta  = new TH2F
+  ("hConvDistMassCutEta","distance to conversion vertex, dEta < 0.05",100,0,fMassCut,100,0.,5.); 
+  fhConvDistMassCutEta->SetXTitle("m (GeV/c^2)");
+  fhConvDistMassCutEta->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistMassCutEta) ;
+  
+  fhConvDistEtaCutMass  = new TH2F
+  ("hConvDistEtaCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",100,-0.7,0.7,100,0.,5.); 
+  fhConvDistEtaCutMass->SetXTitle("#eta");
+  fhConvDistEtaCutMass->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEtaCutMass) ;
+  
+  fhConvDistEnCutMass  = new TH2F
+  ("hConvDistEnCutMass","distance to conversion vertex, dEta < 0.05, m < 10 MeV",nptbins,ptmin,ptmax,100,0.,5.); 
+  fhConvDistEnCutMass->SetXTitle("E (GeV)");
+  fhConvDistEnCutMass->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEnCutMass) ;
+  
+  fhConvDistEtaCutAsy  = new TH2F
+  ("hConvDistEtaCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",100,-0.7,0.7,100,0.,5.); 
+  fhConvDistEtaCutAsy->SetXTitle("#eta");
+  fhConvDistEtaCutAsy->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEtaCutAsy) ;
+  
+  fhConvDistEnCutAsy  = new TH2F
+  ("hConvDistEnCutAsy","distance to conversion vertex, dEta < 0.05, m < 10 MeV, A < 0.1",nptbins,ptmin,ptmax,100,0.,5.); 
+  fhConvDistEnCutAsy->SetXTitle("E (GeV)");
+  fhConvDistEnCutAsy->SetYTitle(" distance (m)");
+  outputContainer->Add(fhConvDistEnCutAsy) ;
+  
+  if(IsDataMC()){
+    
+    fhPtConversionTagged  = new TH1F("hPtMCConversionTagged","Number of converted #gamma over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtConversionTagged->SetYTitle("N");
+    fhPtConversionTagged->SetXTitle("p_{T #gamma}(GeV/c)");
+    outputContainer->Add(fhPtConversionTagged) ; 
+    
+    
+    fhPtAntiNeutronTagged  = new TH1F("hPtMCAntiNeutronTagged","Number of AntiNeutron id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtAntiNeutronTagged->SetYTitle("N");
+    fhPtAntiNeutronTagged->SetXTitle("p_{T #gamma}(GeV/c)");
+    outputContainer->Add(fhPtAntiNeutronTagged) ; 
+    
+    fhPtAntiProtonTagged  = new TH1F("hPtMCAntiProtonTagged","Number of AntiProton id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtAntiProtonTagged->SetYTitle("N");
+    fhPtAntiProtonTagged->SetXTitle("p_{T #gamma}(GeV/c)");
+    outputContainer->Add(fhPtAntiProtonTagged) ; 
+    
+    fhPtUnknownTagged  = new TH1F("hPtMCUnknownTagged","Number of Unknown id as Photon over calorimeter, tagged as converted",nptbins,ptmin,ptmax); 
+    fhPtUnknownTagged->SetYTitle("N");
+    fhPtUnknownTagged->SetXTitle("p_{T #gamma}(GeV/c)");
+    outputContainer->Add(fhPtUnknownTagged) ;     
+    
+    fhConvDeltaEtaMCConversion  = new TH2F
+    ("hConvDeltaEtaMCConversion","#Delta #eta of selected conversion pairs from real conversions",100,0,fMassCut,netabins,-0.5,0.5); 
+    fhConvDeltaEtaMCConversion->SetYTitle("#Delta #eta");
+    fhConvDeltaEtaMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaEtaMCConversion) ;
+    
+    fhConvDeltaPhiMCConversion  = new TH2F
+    ("hConvDeltaPhiMCConversion","#Delta #phi of selected conversion pairs from real conversions",100,0,fMassCut,nphibins,-0.5,0.5); 
+    fhConvDeltaPhiMCConversion->SetYTitle("#Delta #phi");
+    fhConvDeltaPhiMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaPhiMCConversion) ;
+    
+    fhConvDeltaEtaPhiMCConversion  = new TH2F
+    ("hConvDeltaEtaPhiMCConversion","#Delta #eta vs #Delta #phi of selected conversion pairs, from real conversions",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    fhConvDeltaEtaPhiMCConversion->SetYTitle("#Delta #phi");
+    fhConvDeltaEtaPhiMCConversion->SetXTitle("#Delta #eta");
+    outputContainer->Add(fhConvDeltaEtaPhiMCConversion) ;
+    
+    fhConvAsymMCConversion  = new TH2F
+    ("hConvAsymMCConversion","Asymmetry of selected conversion pairs from real conversions",100,0,fMassCut,100,0,1); 
+    fhConvAsymMCConversion->SetYTitle("Asymmetry");
+    fhConvAsymMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvAsymMCConversion) ;
+    
+    fhConvPtMCConversion  = new TH2F
+    ("hConvPtMCConversion","p_{T} of selected conversion pairs from real conversions",100,0,fMassCut,100,0.,10.); 
+    fhConvPtMCConversion->SetYTitle("Pair p_{T} (GeV/c)");
+    fhConvPtMCConversion->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvPtMCConversion) ;    
+    
+    fhConvDispersionMCConversion  = new TH2F
+    ("hConvDispersionMCConversion","p_{T} of selected conversion pairs from real conversions",100,0.,1.,100,0.,1.); 
+    fhConvDispersionMCConversion->SetYTitle("Dispersion cluster 1");
+    fhConvDispersionMCConversion->SetXTitle("Dispersion cluster 2");
+    outputContainer->Add(fhConvDispersionMCConversion) ;   
+    
+    fhConvM02MCConversion  = new TH2F
+    ("hConvM02MCConversion","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    fhConvM02MCConversion->SetYTitle("M02 cluster 1");
+    fhConvM02MCConversion->SetXTitle("M02 cluster 2");
+    outputContainer->Add(fhConvM02MCConversion) ;           
+    
+    fhConvDeltaEtaMCAntiNeutron  = new TH2F
+    ("hConvDeltaEtaMCAntiNeutron","#Delta #eta of selected conversion pairs from anti-neutrons",100,0,fMassCut,netabins,-0.5,0.5); 
+    fhConvDeltaEtaMCAntiNeutron->SetYTitle("#Delta #eta");
+    fhConvDeltaEtaMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaEtaMCAntiNeutron) ;
+    
+    fhConvDeltaPhiMCAntiNeutron  = new TH2F
+    ("hConvDeltaPhiMCAntiNeutron","#Delta #phi of selected conversion pairs from anti-neutrons",100,0,fMassCut,nphibins,-0.5,0.5); 
+    fhConvDeltaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
+    fhConvDeltaPhiMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaPhiMCAntiNeutron) ;
+    
+    fhConvDeltaEtaPhiMCAntiNeutron  = new TH2F
+    ("hConvDeltaEtaPhiMCAntiNeutron","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-neutrons",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    fhConvDeltaEtaPhiMCAntiNeutron->SetYTitle("#Delta #phi");
+    fhConvDeltaEtaPhiMCAntiNeutron->SetXTitle("#Delta #eta");
+    outputContainer->Add(fhConvDeltaEtaPhiMCAntiNeutron) ;    
+    
+    fhConvAsymMCAntiNeutron  = new TH2F
+    ("hConvAsymMCAntiNeutron","Asymmetry of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0,1); 
+    fhConvAsymMCAntiNeutron->SetYTitle("Asymmetry");
+    fhConvAsymMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvAsymMCAntiNeutron) ;
+    
+    fhConvPtMCAntiNeutron  = new TH2F
+    ("hConvPtMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0,fMassCut,100,0.,10.); 
+    fhConvPtMCAntiNeutron->SetYTitle("Pair p_{T} (GeV/c)");
+    fhConvPtMCAntiNeutron->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvPtMCAntiNeutron) ;    
+    
+    fhConvDispersionMCAntiNeutron  = new TH2F
+    ("hConvDispersionMCAntiNeutron","p_{T} of selected conversion pairs from anti-neutrons",100,0.,1.,100,0.,1.); 
+    fhConvDispersionMCAntiNeutron->SetYTitle("Dispersion cluster 1");
+    fhConvDispersionMCAntiNeutron->SetXTitle("Dispersion cluster 2");
+    outputContainer->Add(fhConvDispersionMCAntiNeutron) ;       
+    
+    fhConvM02MCAntiNeutron  = new TH2F
+    ("hConvM02MCAntiNeutron","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    fhConvM02MCAntiNeutron->SetYTitle("M02 cluster 1");
+    fhConvM02MCAntiNeutron->SetXTitle("M02 cluster 2");
+    outputContainer->Add(fhConvM02MCAntiNeutron) ;  
+    
+    fhConvDeltaEtaMCAntiProton  = new TH2F
+    ("hConvDeltaEtaMCAntiProton","#Delta #eta of selected conversion pairs from anti-protons",100,0,fMassCut,netabins,-0.5,0.5); 
+    fhConvDeltaEtaMCAntiProton->SetYTitle("#Delta #eta");
+    fhConvDeltaEtaMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaEtaMCAntiProton) ;
+    
+    fhConvDeltaPhiMCAntiProton  = new TH2F
+    ("hConvDeltaPhiMCAntiProton","#Delta #phi of selected conversion pairs from anti-protons",100,0,fMassCut,nphibins,-0.5,0.5); 
+    fhConvDeltaPhiMCAntiProton->SetYTitle("#Delta #phi");
+    fhConvDeltaPhiMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaPhiMCAntiProton) ;
+    
+    fhConvDeltaEtaPhiMCAntiProton  = new TH2F
+    ("hConvDeltaEtaPhiMCAntiProton","#Delta #eta vs #Delta #phi of selected conversion pairs from anti-protons",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    fhConvDeltaEtaPhiMCAntiProton->SetYTitle("#Delta #phi");
+    fhConvDeltaEtaPhiMCAntiProton->SetXTitle("#Delta #eta");
+    outputContainer->Add(fhConvDeltaEtaPhiMCAntiProton) ;    
+    
+    fhConvAsymMCAntiProton  = new TH2F
+    ("hConvAsymMCAntiProton","Asymmetry of selected conversion pairs from anti-protons",100,0,fMassCut,100,0,1); 
+    fhConvAsymMCAntiProton->SetYTitle("Asymmetry");
+    fhConvAsymMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvAsymMCAntiProton) ;
+    
+    fhConvPtMCAntiProton  = new TH2F
+    ("hConvPtMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0,fMassCut,100,0.,10.); 
+    fhConvPtMCAntiProton->SetYTitle("Pair p_{T} (GeV/c)");
+    fhConvPtMCAntiProton->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvPtMCAntiProton) ;
+    
+    fhConvDispersionMCAntiProton  = new TH2F
+    ("hConvDispersionMCAntiProton","p_{T} of selected conversion pairs from anti-protons",100,0.,1.,100,0.,1.); 
+    fhConvDispersionMCAntiProton->SetYTitle("Dispersion cluster 1");
+    fhConvDispersionMCAntiProton->SetXTitle("Dispersion cluster 2");
+    outputContainer->Add(fhConvDispersionMCAntiProton) ;       
+    
+    fhConvM02MCAntiProton  = new TH2F
+    ("hConvM02MCAntiProton","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    fhConvM02MCAntiProton->SetYTitle("M02 cluster 1");
+    fhConvM02MCAntiProton->SetXTitle("M02 cluster 2");
+    outputContainer->Add(fhConvM02MCAntiProton) ;       
+    
+    fhConvDeltaEtaMCString  = new TH2F
+    ("hConvDeltaEtaMCString","#Delta #eta of selected conversion pairs from string",100,0,fMassCut,netabins,-0.5,0.5); 
+    fhConvDeltaEtaMCString->SetYTitle("#Delta #eta");
+    fhConvDeltaEtaMCString->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaEtaMCString) ;
+    
+    fhConvDeltaPhiMCString  = new TH2F
+    ("hConvDeltaPhiMCString","#Delta #phi of selected conversion pairs from string",100,0,fMassCut,nphibins,-0.5,0.5); 
+    fhConvDeltaPhiMCString->SetYTitle("#Delta #phi");
+    fhConvDeltaPhiMCString->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvDeltaPhiMCString) ;
+    
+    fhConvDeltaEtaPhiMCString  = new TH2F
+    ("hConvDeltaEtaPhiMCString","#Delta #eta vs #Delta #phi of selected conversion pairs from string",netabins,-0.5,0.5,nphibins,-0.5,0.5); 
+    fhConvDeltaEtaPhiMCString->SetYTitle("#Delta #phi");
+    fhConvDeltaEtaPhiMCString->SetXTitle("#Delta #eta");
+    outputContainer->Add(fhConvDeltaEtaPhiMCString) ;    
+    
+    fhConvAsymMCString  = new TH2F
+    ("hConvAsymMCString","Asymmetry of selected conversion pairs from string",100,0,fMassCut,100,0,1); 
+    fhConvAsymMCString->SetYTitle("Asymmetry");
+    fhConvAsymMCString->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvAsymMCString) ;
+    
+    fhConvPtMCString  = new TH2F
+    ("hConvPtMCString","p_{T} of selected conversion pairs from string",100,0,fMassCut,100,0.,10.); 
+    fhConvPtMCString->SetYTitle("Pair p_{T} (GeV/c)");
+    fhConvPtMCString->SetXTitle("Pair Mass (GeV/c^2)");
+    outputContainer->Add(fhConvPtMCString) ;
+    
+    fhConvDispersionMCString  = new TH2F
+    ("hConvDispersionMCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    fhConvDispersionMCString->SetYTitle("Dispersion cluster 1");
+    fhConvDispersionMCString->SetXTitle("Dispersion cluster 2");
+    outputContainer->Add(fhConvDispersionMCString) ;       
+    
+    fhConvM02MCString  = new TH2F
+    ("hConvM02MCString","p_{T} of selected conversion pairs from string",100,0.,1.,100,0.,1.); 
+    fhConvM02MCString->SetYTitle("M02 cluster 1");
+    fhConvM02MCString->SetXTitle("M02 cluster 2");
+    outputContainer->Add(fhConvM02MCString) ; 
+    
+    fhConvDistMCConversion  = new TH2F
+    ("hConvDistMCConversion","calculated conversion distance vs real vertes for MC conversion",100,0.,5.,100,0.,5.); 
+    fhConvDistMCConversion->SetYTitle("distance");
+    fhConvDistMCConversion->SetXTitle("vertex R");
+    outputContainer->Add(fhConvDistMCConversion) ; 
+    
+    fhConvDistMCConversionCuts  = new TH2F
+    ("hConvDistMCConversionCuts","calculated conversion distance vs real vertes for MC conversion, deta < 0.05, m < 10 MeV, asym < 0.1",100,0.,5.,100,0.,5.); 
+    fhConvDistMCConversionCuts->SetYTitle("distance");
+    fhConvDistMCConversionCuts->SetXTitle("vertex R");
+    outputContainer->Add(fhConvDistMCConversionCuts) ; 
+        
+  }
+  
+  return outputContainer ;
+
+}
+
+//_______________________________________
+void AliAnaPhotonConvInCalo::InitParameters()
+{
+  
+  //Initialize the parameters of the analysis.
+  AddToHistogramsName("AnaPhotonConvInCalo_");
+  
+  fMassCut                = 0.03; //30 MeV
+  fRemoveConvertedPair    = kFALSE;
+  fAddConvertedPairsToAOD = kFALSE;
+       
+}
+
+//_____________________________________________
+void  AliAnaPhotonConvInCalo::MakeAnalysisFillAOD() 
+{
+  //Do conversion photon analysis and fill aods
+  
+  //Loop on stored AOD photons
+  Int_t naod = GetOutputAODBranch()->GetEntriesFast();
+  if(GetDebug() > 0) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillAOD() - aod branch entries %d\n", naod);
+  
+  //List to be used in conversion analysis, to tag the cluster as candidate for conversion
+  Bool_t * indexConverted = new Bool_t[naod];
+  for (Int_t i = 0; i < naod; i++) indexConverted[i] = kFALSE;
+       
+  for(Int_t iaod = 0; iaod < naod ; iaod++){
+    AliAODPWG4Particle* calo =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
+    
+    Bool_t bConverted = kFALSE;
+    Int_t id2 = -1;
+    
+    //Check if set previously as converted couple, if so skip its use.
+    if (indexConverted[iaod]) continue;
+    
+    // Second cluster loop
+    AliAODPWG4Particle* calo2 = 0;
+    for(Int_t jaod = iaod + 1 ; jaod < naod ; jaod++) {
+      //Check if set previously as converted couple, if so skip its use.
+      if (indexConverted[jaod]) continue;
+      //printf("Check Conversion indeces %d and %d\n",iaod,jaod);
+      calo2 =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(jaod));
+      
+      //................................................
+      //Get mass of pair, if small, take this pair.
+      Float_t pairM     = calo->GetPairMass(calo2);
+      //printf("\t both in calo, mass %f, cut %f\n",pairM,fMassCut);
+      if(pairM < fMassCut){  
+        calo->SetTagged(kFALSE);
+        id2 = calo2->GetCaloLabel(0);
+        Float_t asymmetry = TMath::Abs(calo->E()-calo2->E())/(calo->E()+calo2->E());
+        Float_t dPhi      = (calo->Momentum())->Phi()-(calo2->Momentum())->Phi();
+        Float_t dEta      = (calo->Momentum())->Eta()-(calo2->Momentum())->Eta();  
+        
+        //...............................................
+        //Fill few histograms with kinematics of the pair
+        //FIXME, move all this to MakeAnalysisFillHistograms ...
+        
+        fhConvDeltaEta   ->Fill( pairM, dPhi      );
+        fhConvDeltaPhi   ->Fill( pairM, dEta      );
+        fhConvAsym       ->Fill( pairM, asymmetry );
+        fhConvDeltaEtaPhi->Fill( dEta , dPhi      );
+        fhConvPt         ->Fill( pairM, (calo->Momentum())->Pt()+(calo2->Momentum())->Pt());          
+        
+        //Estimate conversion distance, T. Awes, M. Ivanov
+        //Under the assumption that the pair has zero mass, and that each electron 
+        //of the pair has the same momentum, they will each have the same bend radius 
+        //given by R=p/(qB) = p / (300 B) with p in [MeV/c], B in [Tesla] and R in [m]. 
+        //With nominal ALICE magnet current of 30kA B=0.5T, and so with E_cluster=p,  
+        //R = E/1.5 [cm].  Under these assumptions, the distance from the conversion 
+        //point to the MCEal can be related to the separation distance, L=2y, on the MCEal 
+        //as d = sqrt(R^2 -(R-y)^2) = sqrt(2Ry - y^2). And since R>>y we can write as 
+        //d = sqrt(E*L/1.5) where E is the cluster energy and L is the distance in cm between 
+        //the clusters.
+        
+        TObjArray * clusters    = 0; 
+        if(calo->GetDetector() == "EMCAL"){
+          clusters = GetEMCALClusters();
+        }
+        else{
+          clusters = GetPHOSClusters();
+        }
+        
+        Int_t iclus = -1;
+        AliVCluster *cluster1 = FindCluster(clusters,calo ->GetCaloLabel(0),iclus); 
+        AliVCluster *cluster2 = FindCluster(clusters,calo2->GetCaloLabel(0),iclus); 
+
+        Float_t pos1[3];
+        cluster1->GetPosition(pos1); 
+        Float_t pos2[3];
+        cluster2->GetPosition(pos2); 
+        Float_t clustDist = TMath::Sqrt((pos1[0]-pos2[0])*(pos1[0]-pos2[0])+
+                                        (pos1[1]-pos2[1])*(pos1[1]-pos2[1])+
+                                        (pos1[2]-pos2[2])*(pos1[2]-pos2[2]));
+        
+        Float_t convDist  = TMath::Sqrt(calo->E() *clustDist*0.01/0.15);
+        Float_t convDist2 = TMath::Sqrt(calo2->E()*clustDist*0.01/0.15);
+        //printf("l = %f, e1 = %f, d1=%f, e2 = %f, d2=%f\n",clustDist,calo->E(),convDist,calo2->E(),convDist2);
+        if(GetDebug() > 2)
+          printf("AliAnaPhotonConvInCalo::MakeAnalysisFillAOD(): Pair with mass %2.3f < %2.3f, %1.2f < dPhi %2.2f < %2.2f, dEta %f < %2.2f, asymmetry %2.2f< %2.2f; \n    cluster1 id %d, e %2.3f  SM %d, eta %2.3f, phi %2.3f ; \n    cluster2 id %d, e %2.3f, SM %d,eta %2.3f, phi %2.3f\n",
+                 pairM,fMassCut,fConvDPhiMinCut, dPhi, fConvDPhiMaxCut, dEta, fConvDEtaCut, asymmetry, fConvAsymCut,
+                 calo->GetCaloLabel(0),calo->E(),GetCaloUtils()->GetModuleNumber(calo,GetReader()->GetInputEvent()), calo->Eta(), calo->Phi(),
+                 id2, calo2->E(), GetCaloUtils()->GetModuleNumber(calo2,GetReader()->GetInputEvent()),calo2->Eta(), calo2->Phi());
+        
+        fhConvDistEta ->Fill(calo ->Eta(),convDist );
+        fhConvDistEta ->Fill(calo2->Eta(),convDist2);
+        fhConvDistEn  ->Fill(calo ->E(),  convDist );
+        fhConvDistEn  ->Fill(calo2->E(),  convDist2);        
+        fhConvDistMass->Fill(pairM, convDist );
+        //dEta cut
+        if(dEta<0.05){
+          fhConvDistEtaCutEta ->Fill(calo->Eta(), convDist );
+          fhConvDistEtaCutEta ->Fill(calo2->Eta(),convDist2);
+          fhConvDistEnCutEta  ->Fill(calo->E(),   convDist );
+          fhConvDistEnCutEta  ->Fill(calo2->E(),  convDist2);        
+          fhConvDistMassCutEta->Fill(pairM, convDist );
+          //mass cut
+          if(pairM<0.01){//10 MeV
+            fhConvDistEtaCutMass ->Fill(calo ->Eta(), convDist );
+            fhConvDistEtaCutMass ->Fill(calo2->Eta(), convDist2);
+            fhConvDistEnCutMass  ->Fill(calo ->E(),   convDist );
+            fhConvDistEnCutMass  ->Fill(calo2->E(),   convDist2);        
+            // asymmetry cut
+            if(asymmetry<0.1){
+              fhConvDistEtaCutAsy ->Fill(calo ->Eta(), convDist );
+              fhConvDistEtaCutAsy ->Fill(calo2->Eta(), convDist2);
+              fhConvDistEnCutAsy  ->Fill(calo ->E(),   convDist );
+              fhConvDistEnCutAsy  ->Fill(calo2->E(),   convDist2); 
+            }//asymmetry cut
+          }//mass cut            
+        }//dEta cut
+        
+        //...............................................
+        //Select pairs in a eta-phi window
+        if(TMath::Abs(dEta) < fConvDEtaCut    && 
+           TMath::Abs(dPhi) < fConvDPhiMaxCut &&
+           TMath::Abs(dPhi) > fConvDPhiMinCut && 
+           asymmetry        < fConvAsymCut       ){
+          indexConverted[iaod] = kTRUE;
+          indexConverted[jaod] = kTRUE; 
+          bConverted           = kTRUE;          
+        }
+        //printf("Accepted? %d\n",bConverted);
+        //...........................................
+        //Fill more histograms, simulated data
+        //FIXME, move all this to MakeAnalysisFillHistograms ...
+        if(IsDataMC()){
+          
+          //Check the origin of the pair, look for conversion, antinucleons or jet correlations (strings)
+          Int_t ancPDG    = 0;
+          Int_t ancStatus = 0;
+          TLorentzVector momentum;
+          TVector3 prodVertex;
+          Int_t ancLabel  = GetMCAnalysisUtils()->CheckCommonAncestor(cluster1->GetLabel(), cluster2->GetLabel(), 
+                                                                      GetReader(), ancPDG, ancStatus, momentum, prodVertex);
+          
+          // printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - Common ancestor label %d, pdg %d, name %s, status %d; \n",
+          //                          ancLabel,ancPDG,TDatabasePDG::Instance()->GetParticle(ancPDG)->GetName(),ancStatus);
+          
+          Int_t tag1 = calo ->GetTag();
+          Int_t tag2 = calo2->GetTag();
+          if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCConversion)){
+            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCConversion) && (ancPDG==22 || TMath::Abs(ancPDG)==11) && ancLabel > -1){
+              fhConvDeltaEtaMCConversion   ->Fill( pairM, dEta      );
+              fhConvDeltaPhiMCConversion   ->Fill( pairM, dPhi      );
+              fhConvAsymMCConversion       ->Fill( pairM, asymmetry );
+              fhConvDeltaEtaPhiMCConversion->Fill( dEta , dPhi      );
+              fhConvPtMCConversion         ->Fill( pairM, calo->Pt()+calo2->Pt());
+              fhConvDispersionMCConversion ->Fill( cluster1->GetDispersion(), cluster2->GetDispersion());
+              fhConvM02MCConversion        ->Fill( cluster1->GetM02(), cluster2->GetM02());
+              fhConvDistMCConversion       ->Fill( convDist , prodVertex.Mag() );
+              fhConvDistMCConversion       ->Fill( convDist2, prodVertex.Mag() );
+              
+              if(dEta<0.05 && pairM<0.01 && asymmetry<0.1){
+                fhConvDistMCConversionCuts->Fill( convDist , prodVertex.Mag() );
+                fhConvDistMCConversionCuts->Fill( convDist2, prodVertex.Mag() );
+              }
+              
+            }              
+          }
+          else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiNeutron)){
+            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiNeutron) && ancPDG==-2112 && ancLabel > -1){
+              fhConvDeltaEtaMCAntiNeutron    ->Fill( pairM, dEta      );
+              fhConvDeltaPhiMCAntiNeutron    ->Fill( pairM, dPhi      );
+              fhConvAsymMCAntiNeutron        ->Fill( pairM, asymmetry );
+              fhConvDeltaEtaPhiMCAntiNeutron ->Fill( dEta , dPhi      );
+              fhConvPtMCAntiNeutron          ->Fill( pairM, calo->Pt()+calo2->Pt());
+              fhConvDispersionMCAntiNeutron  ->Fill( cluster1->GetDispersion(), cluster2->GetDispersion());
+              fhConvM02MCAntiNeutron         ->Fill( cluster1->GetM02(), cluster2->GetM02());
+            }
+          }
+          else if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCAntiProton)){
+            if(GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCAntiProton) && ancPDG==-2212 && ancLabel > -1){
+              fhConvDeltaEtaMCAntiProton    ->Fill( pairM, dEta      );
+              fhConvDeltaPhiMCAntiProton    ->Fill( pairM, dPhi      );
+              fhConvAsymMCAntiProton        ->Fill( pairM, asymmetry );
+              fhConvDeltaEtaPhiMCAntiProton ->Fill( dEta , dPhi      );
+              fhConvPtMCAntiProton          ->Fill( pairM, calo->Pt()+calo2->Pt());
+              fhConvDispersionMCAntiProton  ->Fill( cluster1->GetDispersion(), cluster2->GetDispersion());
+              fhConvM02MCAntiProton         ->Fill( cluster1->GetM02(), cluster2->GetM02());
+            }
+          }
+          
+          //Pairs coming from fragmenting pairs.
+          if(ancPDG < 22 && ancLabel > 7 && (ancStatus == 11 || ancStatus == 12) ){
+            fhConvDeltaEtaMCString    ->Fill( pairM, dPhi);
+            fhConvDeltaPhiMCString    ->Fill( pairM, dPhi);
+            fhConvAsymMCString        ->Fill( pairM, TMath::Abs(calo->E()-calo2->E())/(calo->E()+calo2->E()) );
+            fhConvDeltaEtaPhiMCString ->Fill( dPhi,  dPhi);
+            fhConvPtMCString          ->Fill( pairM, calo->Pt()+calo2->Pt());
+            fhConvDispersionMCString  ->Fill( cluster1->GetDispersion(), cluster2->GetDispersion());
+            fhConvM02MCString         ->Fill( cluster1->GetM02(), cluster2->GetM02());
+          }
+          
+        }// Data MC
+        
+        break;
+      }
+      
+    }//Mass loop
+    
+    //..........................................................................................................
+    //Pair selected as converted, remove both clusters or recombine them into a photon and put them in the AOD
+    if(bConverted){ 
+      //Add to AOD
+      if(fAddConvertedPairsToAOD){
+        //Create AOD of pair analysis
+        TLorentzVector mpair = *(calo->Momentum())+*(calo2->Momentum());
+        AliAODPWG4Particle aodpair = AliAODPWG4Particle(mpair);
+        aodpair.SetLabel(calo->GetLabel());
+        
+        //printf("Index %d, Id %d\n",iaod, calo->GetID());
+        //Set the indeces of the original caloclusters  
+        aodpair.SetCaloLabel(calo->GetCaloLabel(0),id2);
+        aodpair.SetDetector(calo->GetDetector());
+        aodpair.SetIdentifiedParticleType(calo->GetIdentifiedParticleType());
+        aodpair.SetTag(calo ->GetTag());
+        aodpair.SetTagged(kTRUE);
+        //Add AOD with pair object to aod branch
+        AddAODParticle(aodpair);
+        //printf("\t \t both added pair\n");
+      }
+      
+      //Do not add the current calocluster
+      if(!fRemoveConvertedPair) 
+      {
+        //printf("TAGGED\n");
+        //Tag this cluster as likely conversion
+        calo->SetTagged(kTRUE);
+      }
+    }//converted pair
+    
+  }// main loop
+  
+  // Remove entries identified as conversion electrons
+  // Revise if this is OK
+  if(fRemoveConvertedPair || fAddConvertedPairsToAOD){
+    for(Int_t iaod = 0; iaod < naod ; iaod++)
+      if(indexConverted[iaod])GetOutputAODBranch()->RemoveAt(iaod);
+    GetOutputAODBranch()->Compress();
+  }
+  
+  delete [] indexConverted;
+       
+  if(GetDebug() > 1) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillAOD()  End fill AODs, with %d entries \n",GetOutputAODBranch()->GetEntriesFast());  
+  
+}
+
+//____________________________________________________
+void  AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() 
+{
+  //Fill histograms
+  
+  //-------------------------------------------------------------------
+  // Access MC information in stack if requested, check that it exists.        
+  AliStack         * stack       = 0x0;
+  TParticle        * primary     = 0x0;   
+  TClonesArray     * mcparticles = 0x0;
+  AliAODMCParticle * aodprimary  = 0x0; 
+  
+  if(IsDataMC()){
+    
+    if(GetReader()->ReadStack()){
+      stack =  GetMCStack() ;
+      if(!stack) {
+        printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
+        abort();
+      }
+      
+    }
+    else if(GetReader()->ReadAODMCParticles()){
+      
+      //Get the list of MC particles
+      mcparticles = GetReader()->GetAODMCParticles(0);
+      if(!mcparticles && GetDebug() > 0)       {
+        printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() -  Standard MCParticles not available!\n");
+      }        
+    }
+  }// is data and MC
+  //----------------------------------
+  //Loop on stored AOD photons
+  Int_t naod = GetOutputAODBranch()->GetEntriesFast();
+  if(GetDebug() > 0) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+  
+  for(Int_t iaod = 0; iaod < naod ; iaod++){
+    AliAODPWG4Particle* ph =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
+    //Int_t pdg = ph->GetIdentifiedParticleType();
+    
+    if(ph->IsTagged()){
+      
+      if(GetDebug() > 2) 
+        printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
+      //................................
+      //Fill photon histograms 
+      Float_t ptcluster  = ph->Pt();
+      Float_t phicluster = ph->Phi();
+      Float_t etacluster = ph->Eta();
+      Float_t ecluster   = ph->E();
+      
+      fhPtPhotonConv->Fill(ptcluster);
+      if(ecluster > 0.5)        fhEtaPhiPhotonConv  ->Fill(etacluster, phicluster);
+      else if(GetMinPt() < 0.5) fhEtaPhi05PhotonConv->Fill(etacluster, phicluster);
+      
+      
+      //.......................................
+      //Play with the MC data if available
+      if(IsDataMC()){
+        
+        
+        //....................................................................
+        // Access MC information in stack if requested, check that it exists.
+        Int_t label =ph->GetLabel();
+        if(label < 0) {
+          if(GetDebug() > 1) printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
+          continue;
+        }
+        
+        Float_t eprim   = 0;
+        Float_t ptprim  = 0;
+        if(GetReader()->ReadStack()){
+          
+          if(label >=  stack->GetNtrack()) {
+            if(GetDebug() > 2)  printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
+            continue ;
+          }
+          
+          primary = stack->Particle(label);
+          if(!primary){
+            printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
+            continue;
+          }
+          eprim   = primary->Energy();
+          ptprim  = primary->Pt();             
+          
+        }
+        else if(GetReader()->ReadAODMCParticles()){
+          //Check which is the input
+          if(ph->GetInputFileIndex() == 0){
+            if(!mcparticles) continue;
+            if(label >=  mcparticles->GetEntriesFast()) {
+              if(GetDebug() > 2)  printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", 
+                                         label, mcparticles->GetEntriesFast());
+              continue ;
+            }
+            //Get the particle
+            aodprimary = (AliAODMCParticle*) mcparticles->At(label);
+            
+          }
+          
+          if(!aodprimary){
+            printf("AliAnaPhotonConvInCalo::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
+            continue;
+          }
+          
+          eprim   = aodprimary->E();
+          ptprim  = aodprimary->Pt();
+          
+        }
+        
+        Int_t tag =ph->GetTag();
+        
+        if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton))
+        {
+          
+          if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion))
+          {
+            
+            fhPtConversionTagged ->Fill(ptcluster);
+            
+          }                    
+        }
+        else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiNeutron))
+        {
+          
+          fhPtAntiNeutronTagged ->Fill(ptcluster);
+          
+        }
+        else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiProton))
+        {
+          fhPtAntiProtonTagged ->Fill(ptcluster);
+          
+        } 
+        
+        else {
+          fhPtUnknownTagged ->Fill(ptcluster);
+          
+        }
+        
+      }//Histograms with MC
+    }// tagged by conversion
+  }// aod loop
+  
+}
+
+
+//________________________________________________________
+void AliAnaPhotonConvInCalo::Print(const Option_t * opt) const
+{
+  //Print some relevant parameters set for the analysis
+  
+  if(! opt)
+    return;
+  
+  printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
+  AliAnaPartCorrBaseClass::Print(" ");
+  
+  printf("Add conversion pair to AOD           = %d\n",fAddConvertedPairsToAOD);
+  printf("Conversion pair mass cut             = %f\n",fMassCut);
+  printf("Conversion selection cut : A < %1.2f; %1.3f < Dphi < %1.3f; Deta < %1.3f\n",
+         fConvAsymCut,fConvDPhiMinCut, fConvDPhiMaxCut, fConvDEtaCut);
+  
+  printf("    \n") ;
+       
+} 
diff --git a/PWG4/PartCorrDep/AliAnaPhotonConvInCalo.h b/PWG4/PartCorrDep/AliAnaPhotonConvInCalo.h
new file mode 100755 (executable)
index 0000000..ac02070
--- /dev/null
@@ -0,0 +1,157 @@
+#ifndef ALIANAPHOTONINCALO_H
+#define ALIANAPHOTONINCALO_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+//_________________________________________________________________________
+//
+// Conversions pairs analysis
+// Check if cluster comes from a conversion in the material in front of the calorimeter
+// Do invariant mass of all pairs, if mass is close to 0, then it is conversion.
+// Input are selected clusters with AliAnaPhoton
+//
+//-- Author: Gustavo Conesa (LPSC-IN2P3-CNRS)
+
+// --- ROOT system ---
+class TH2F;
+class TH1F;
+class TString ;
+class TObjString;
+class TList ;
+
+// --- ANALYSIS system ---
+#include "AliAnaPartCorrBaseClass.h"
+
+class AliAnaPhotonConvInCalo : public AliAnaPartCorrBaseClass {
+
+ public: 
+  AliAnaPhotonConvInCalo() ;              // default ctor
+  virtual ~AliAnaPhotonConvInCalo() { ; } // virtual dtor
+ private:
+  AliAnaPhotonConvInCalo(const AliAnaPhotonConvInCalo & g) ;               // cpy ctor
+  AliAnaPhotonConvInCalo & operator = (const AliAnaPhotonConvInCalo & g) ; // cpy assignment
+
+ public:
+       
+  //---------------------------------------
+  // General analysis frame methods
+  //---------------------------------------
+  
+  TObjString * GetAnalysisCuts();
+  
+  TList      * GetCreateOutputObjects();
+  
+  void         InitParameters();
+
+  void         MakeAnalysisFillAOD()  ;
+
+  void         MakeAnalysisFillHistograms() ; 
+  
+  void         Print(const Option_t * opt)const ;
+    
+  //---------------------------------------
+  // Analysis parameters setters getters
+  //---------------------------------------
+    
+  Float_t      GetMassCut()                     const { return fMassCut            ; }
+  void         SetMassCut(Float_t m)                  { fMassCut    = m            ; }
+       
+  Bool_t       AreConvertedPairsInAOD()         const { return fAddConvertedPairsToAOD   ; }
+  void         SwitchOnAdditionConvertedPairsToAOD()  { fAddConvertedPairsToAOD = kTRUE  ; }
+  void         SwitchOffAdditionConvertedPairsToAOD() { fAddConvertedPairsToAOD = kFALSE ; }  
+       
+  Bool_t       AreConvertedPairsRemoved()       const { return fRemoveConvertedPair      ; }
+  void         SwitchOnConvertedPairsRemoval()        { fRemoveConvertedPair  = kTRUE    ; }
+  void         SwitchOffConvertedPairsRemoval()       { fRemoveConvertedPair  = kFALSE   ; }    
+  
+  void         SetConvAsymCut(Float_t c)              { fConvAsymCut = c           ; }
+  Float_t      GetConvAsymCut()                 const { return fConvAsymCut        ; }
+  
+  void         SetConvDEtaCut(Float_t c)              { fConvDEtaCut = c           ; }
+  Float_t      GetConvDEtaCut()                 const { return fConvDEtaCut        ; }
+  
+  void         SetConvDPhiCut(Float_t min, Float_t max)  { fConvDPhiMinCut = min   ;  
+                                                           fConvDPhiMaxCut = max   ; }
+  Float_t      GetConvDPhiMinCut()              const { return fConvDPhiMinCut     ; }
+  Float_t      GetConvDPhiMaxCut()              const { return fConvDPhiMaxCut     ; }
+  
+  private:
+  Bool_t   fRemoveConvertedPair;          // Remove conversion pairs
+  Bool_t   fAddConvertedPairsToAOD;       // Put Converted pairs in AOD
+  Float_t  fMassCut;                      // Mass cut for the conversion pairs selection  
+  Float_t  fConvAsymCut;                  // Select conversion pairs when asymmetry is smaller than cut
+  Float_t  fConvDEtaCut;                  // Select conversion pairs when deta of pair smaller than cut
+  Float_t  fConvDPhiMinCut;               // Select conversion pairs when dphi of pair lager than cut
+  Float_t  fConvDPhiMaxCut;               // Select conversion pairs when dphi of pair smaller than cut
+
+  // Histograms
+  TH1F * fhPtPhotonConv   ;               //! Number of identified photon vs transerse momentum 
+  TH2F * fhEtaPhiPhotonConv  ;            //! Pseudorapidity vs Phi of identified  photon for transerse momentum > 0.5, for converted
+  TH2F * fhEtaPhi05PhotonConv  ;          //! Pseudorapidity vs Phi of identified  photon for transerse momentum < 0.5, for converted
+  TH2F * fhConvDeltaEta;                  //! Small mass photons, correlation in eta
+  TH2F * fhConvDeltaPhi;                  //! Small mass photons, correlation in phi
+  TH2F * fhConvDeltaEtaPhi;               //! Small mass photons, correlation in phi and eta
+  TH2F * fhConvAsym;                      //! Small mass photons, correlation in energy asymmetry
+  TH2F * fhConvPt;                        //! Small mass photons, pT of pair
+  
+  //Vertex distance
+  TH2F * fhConvDistEta;                   //! Approx distance to vertex vs cluster Eta 
+  TH2F * fhConvDistEn;                    //! Approx distance to vertex vs Energy
+  TH2F * fhConvDistMass;                  //! Approx distance to vertex vs Mass
+  TH2F * fhConvDistEtaCutEta;             //! Approx distance to vertex vs cluster Eta, dEta < 0.05 
+  TH2F * fhConvDistEnCutEta;              //! Approx distance to vertex vs Energy, dEta < 0.05
+  TH2F * fhConvDistMassCutEta;            //! Approx distance to vertex vs Mass, dEta < 0.05
+  TH2F * fhConvDistEtaCutMass;            //! Approx distance to vertex vs cluster Eta, dEta < 0.05, m < 10 MeV 
+  TH2F * fhConvDistEnCutMass;             //! Approx distance to vertex vs Energy, dEta < 0.05, m < 10 MeV
+  TH2F * fhConvDistEtaCutAsy;             //! Approx distance to vertex vs cluster Eta, dEta < 0.05, m < 10 MeV, A < 0.1
+  TH2F * fhConvDistEnCutAsy;              //! Approx distance to vertex vs energy, dEta < 0.05, m < 10 MeV, A < 0.1
+
+  //Conversion pairs analysis histograms
+  TH1F * fhPtConversionTagged;            //! Number of identified gamma from Conversion , tagged as conversion 
+  TH1F * fhPtAntiNeutronTagged;           //! Number of identified gamma from AntiNeutrons gamma, tagged as conversion 
+  TH1F * fhPtAntiProtonTagged;            //! Number of identified gamma from AntiProtons gamma, tagged as conversion 
+  TH1F * fhPtUnknownTagged;               //! Number of identified gamma from unknown, tagged as conversion 
+  
+  TH2F * fhConvDeltaEtaMCConversion;      //! Small mass cluster pairs, correlation in eta, origin of both clusters is conversion
+  TH2F * fhConvDeltaPhiMCConversion;      //! Small mass cluster pairs, correlation in phi, origin of both clusters is conversion
+  TH2F * fhConvDeltaEtaPhiMCConversion;   //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is conversion
+  TH2F * fhConvAsymMCConversion;          //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is conversion
+  TH2F * fhConvPtMCConversion;            //! Small mass cluster pairs, pt of pair, origin of both clusters is conversion
+  TH2F * fhConvDispersionMCConversion;    //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2
+  TH2F * fhConvM02MCConversion;           //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2 
+
+  TH2F * fhConvDeltaEtaMCAntiNeutron;     //! Small mass cluster pairs, correlation in eta, origin of both clusters is anti neutron
+  TH2F * fhConvDeltaPhiMCAntiNeutron;     //! Small mass cluster pairs, correlation in phi, origin of both clusters is anti neutron
+  TH2F * fhConvDeltaEtaPhiMCAntiNeutron;  //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is anti neutron
+  TH2F * fhConvAsymMCAntiNeutron;         //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is anti neutron
+  TH2F * fhConvPtMCAntiNeutron;           //! Small mass cluster pairs, pt of pair, origin of both clusters is anti neutron
+  TH2F * fhConvDispersionMCAntiNeutron;   //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2, origin of both clusters is anti neutron
+  TH2F * fhConvM02MCAntiNeutron;          //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is anti neutron
+
+  TH2F * fhConvDeltaEtaMCAntiProton;      //! Small mass cluster pairs, correlation in eta, origin of both clusters is anti proton
+  TH2F * fhConvDeltaPhiMCAntiProton;      //! Small mass cluster pairs, correlation in phi, origin of both clusters is anti proton
+  TH2F * fhConvDeltaEtaPhiMCAntiProton;   //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is anti proton
+  TH2F * fhConvAsymMCAntiProton;          //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is anti proton
+  TH2F * fhConvPtMCAntiProton;            //! Small mass cluster pairs, pt of pairs, origin of both clusters is anti proton
+  TH2F * fhConvDispersionMCAntiProton;    //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2, origin of both clusters is anti proton
+  TH2F * fhConvM02MCAntiProton;           //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is anti proton
+
+  TH2F * fhConvDeltaEtaMCString;          //! Small mass cluster pairs, correlation in eta, origin of both clusters is string
+  TH2F * fhConvDeltaPhiMCString;          //! Small mass cluster pairs, correlation in phi, origin of both clusters is string
+  TH2F * fhConvDeltaEtaPhiMCString;       //! Small mass cluster pairs, correlation in eta-phi, origin of both clusters is string
+  TH2F * fhConvAsymMCString;              //! Small mass cluster pairs, correlation in energy asymmetry, origin of both clusters is string
+  TH2F * fhConvPtMCString;                //! Small mass cluster pairs, pt of pairs, origin of both clusters is string
+  TH2F * fhConvDispersionMCString;        //! Small mass cluster pairs, dispersion of cluster 1 vs cluster 2, origin of both clusters is string
+  TH2F * fhConvM02MCString;               //! Small mass cluster pairs, m02 of cluster 1 vs cluster 2, origin of both clusters is string
+  TH2F * fhConvDistMCConversion;          //! Calculated conversion distance vs real distance to vertex       
+  TH2F * fhConvDistMCConversionCuts;      //! Calculated conversion distance vs real distance to vertex        
+
+   ClassDef(AliAnaPhotonConvInCalo,1)
+
+} ;
+#endif//ALIANAPHOTONINCALO_H
+
+
+