]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
removed old software from directory, fixed Addtask macro for main task, applied cover...
authorfbock <fbock@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Apr 2013 08:20:06 +0000 (08:20 +0000)
committerfbock <fbock@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Apr 2013 08:20:06 +0000 (08:20 +0000)
31 files changed:
PWGGA/GammaConv/AliAnalysisTaskConversionQA.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.cxx [deleted file]
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.h [deleted file]
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitzV1.h
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.h
PWGGA/GammaConv/AliAnalysisTaskGammaConversion.cxx [deleted file]
PWGGA/GammaConv/AliAnalysisTaskGammaConversion.h [deleted file]
PWGGA/GammaConv/AliAnalysisTaskMaterial.cxx
PWGGA/GammaConv/AliAnalysisTaskPi0v2.cxx
PWGGA/GammaConv/AliAnalysisTaskPi0v2.h
PWGGA/GammaConv/AliConversionCuts.cxx
PWGGA/GammaConv/AliConversionCuts.h
PWGGA/GammaConv/AliConversionMesonCuts.cxx
PWGGA/GammaConv/AliConversionPhotonBase.h
PWGGA/GammaConv/AliConversionSelection.cxx
PWGGA/GammaConv/AliDalitzElectronCuts.cxx
PWGGA/GammaConv/AliDalitzElectronCuts.h
PWGGA/GammaConv/AliGammaConversionAODBGHandler.cxx
PWGGA/GammaConv/AliGammaConversionBGHandler.cxx [deleted file]
PWGGA/GammaConv/AliGammaConversionBGHandler.h [deleted file]
PWGGA/GammaConv/AliGammaConversionHistograms.cxx [deleted file]
PWGGA/GammaConv/AliGammaConversionHistograms.h [deleted file]
PWGGA/GammaConv/AliKFConversionPhoton.cxx
PWGGA/GammaConv/AliKFConversionPhoton.h
PWGGA/GammaConv/AliV0Reader.cxx [deleted file]
PWGGA/GammaConv/AliV0Reader.h [deleted file]
PWGGA/GammaConv/AliV0ReaderV1.cxx
PWGGA/GammaConv/AliV0ReaderV1.h
PWGGA/GammaConv/macros/AddTask_GammaConvV1.C

index 7579a79adad325529d574dc7174a682d19cae0ea..f05ba5018e07ff5c487fc110f500d2dc6ffc9f4a 100644 (file)
@@ -265,6 +265,7 @@ void AliAnalysisTaskConversionQA::UserExec(Option_t *){
 
    for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
       AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
+      if (gamma==NULL) continue;
       if(fMCEvent && fConversionCuts->GetSignalRejection() != 0){
          if(!fConversionCuts->IsParticleFromBGEvent(gamma->GetMCLabelPositive(), fMCStack))
             continue;
@@ -494,10 +495,9 @@ void AliAnalysisTaskConversionQA::ProcessTrueQA(AliAODConversionPhoton *TruePhot
 //________________________________________________________________________
 void AliAnalysisTaskConversionQA::CountESDTracks(){
 
-   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
    // Using standard function for setting Cuts
    Bool_t selectPrimaries=kTRUE;
-   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
    EsdTrackCuts->SetMaxDCAToVertexZ(2);
    EsdTrackCuts->SetEtaRange(-0.8, 0.8);
    EsdTrackCuts->SetPtRange(0.15);
diff --git a/PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.cxx b/PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.cxx
deleted file mode 100644 (file)
index 5d80cf6..0000000
+++ /dev/null
@@ -1,2755 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: Pedro González, Pedro Ladrón de Guevara, Ernesto López Torres, *
- *         Eulogio Serradilla                                             *
- * Version 2                                                           *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-// Analysis task for pi0->e+e-gamma (Dalitz decay)
-
-#include <vector>
-
-#include "TParticle.h"
-#include "TPDGCode.h"
-#include "TMCProcess.h"
-#include "TDatabasePDG.h"
-#include "TList.h"
-#include "TChain.h"
-#include "TDirectory.h"
-
-#include "AliStack.h"
-#include "AliAnalysisManager.h"
-#include "AliESDInputHandler.h"
-#include "AliESDtrack.h"
-#include "AliMCEvent.h"
-#include "AliStack.h"
-#include "AliMCEventHandler.h"
-#include "AliPID.h"
-#include "AliLog.h"
-#include "AliESDtrackCuts.h"
-#include "AliESDpidCuts.h"
-#include "AliMCEvent.h"
-#include "AliESDv0.h"
-#include "AliESDEvent.h"
-#include "AliESDpid.h"
-#include "AliKFParticle.h"
-#include "AliMCEventHandler.h"
-#include "AliGammaConversionHistograms.h"
-#include "AliV0Reader.h"
-#include "AliKFVertex.h"
-#include "AliTriggerAnalysis.h"
-#include "AliCentrality.h"
-#include "AliMultiplicity.h"
-#include "AliAnalysisTaskGammaConvDalitz.h"
-#include "TH1.h"
-
-ClassImp( AliAnalysisTaskGammaConvDalitz )
-
-//-----------------------------------------------------------------------------------------------
-AliAnalysisTaskGammaConvDalitz::AliAnalysisTaskGammaConvDalitz():
-       AliAnalysisTaskSE(),
-       fStack(0),
-       fGCMCEvent(0),
-       fESDEvent(0),
-       fEposCandidateIndex(),
-       fEnegCandidateIndex(),
-       fGammaCandidatePosIndex(),
-       fGammaCandidateNegIndex(),
-       fGammaCandidates(0),
-       fGammaPool(0),
-       fPoolMaxSize(10),
-       fGamPoolPos(0),
-       fBGEventHandler(0),
-       fOutputContainer(0),
-       fMCTruth(0),
-       fV0Reader(0),
-       fESDpid(0),
-       fESDtrackCuts(0),
-       fITSsaTrackCuts(0),
-       fESDpidCuts(0),
-       fRemovePileUp(kFALSE),
-       fSelectV0AND(kFALSE),                 // Select V0AND
-       fTriggerAnalysis(0),
-       fMultiplicity(0),
-       fUseMultiplicity(0),
-       fUseMultiplicityBin(0),
-       fUseHBTMultiplicity(0),
-       fUseHBTMultiplicityBin(0),
-       fUseCentrality(0),
-       fUseCentralityBin(0),   
-
-       fHistograms(0),
-       fStandalone(kFALSE),
-       fDoMC(kFALSE),
-       fComputeBkg(kTRUE),
-       fUseBayesPID(kFALSE),
-       fUseTrackIndexCut(kTRUE),
-       fUsePsiPairCut(kTRUE),
-       fUseMassCut(kFALSE),
-       fUseGammaCut(kFALSE),
-       fUseCorrectedTPCClsInfo(kFALSE),
-       fReadMagFieldSign(kTRUE),
-       fUseAliKF(kFALSE),
-       fBackgroundType(2),
-       fMinClsTPCToF(0.),
-       fMagFieldSign(1),
-       fkElectronMass(0.00051099891),
-       fPsiPairCut(0.45),
-       fDeltaPhiCutMin(0.),
-       fDeltaPhiCutMax(0.12),
-       fMassCutMin(0.),
-       fMassCutMax(0.1),
-       /*fNSigmaBelowElecTPCbethe(-2.),
-       fNSigmaAboveElecTPCbethe(3.),
-       fNSigmaAbovePionTPCbethe(3.),
-       fNSigmaAboveKaonTPCbethe(3.),
-       fNSigmaAboveProtonTPCbethe(3.),*/
-       fDoTOFsigmaCut(kFALSE), 
-       fPIDnSigmaAboveElectronLine(100), // sigma cut
-       fPIDnSigmaBelowElectronLine(-100), // sigma cut
-       fTofPIDnSigmaAboveElectronLine(100), // sigma cut RRnewTOF
-       fTofPIDnSigmaBelowElectronLine(-100), // sigma cut RRnewTOF 
-       fPIDnSigmaAbovePionLine(-100),     // sigma cut
-       fPIDnSigmaAbovePionLineHighPt(-100),     // sigma cut
-       fPIDMinPnSigmaAbovePionLine(100), // sigma cut
-       fPIDMaxPnSigmaAbovePionLine(100), // sigma cut
-       fDoKaonRejectionLowP(kFALSE),   // Kaon rejection at low p
-       fDoProtonRejectionLowP(kFALSE), // Proton rejection at low p
-       fDoPionRejectionLowP(kFALSE),   // Pion rejection at low p*/
-       fPIDnSigmaAtLowPAroundKaonLine(0), // sigma cut
-       fPIDnSigmaAtLowPAroundProtonLine(0), // sigma cut
-       fPIDnSigmaAtLowPAroundPionLine(0), // sigma cut
-       fPIDMinPKaonRejectionLowP(0), // Momentum limit to apply kaon rejection
-       fPIDMinPProtonRejectionLowP(0), // Momentum limit to apply proton rejection
-       fPIDMinPPionRejectionLowP(0), // Momentum limit to apply proton rejection
-       fTrkSelectionCriteria(kGlobalTrack)
-{
-//
-// Default constructor
-//
-       AdoptITSsaTrackCuts();
-       AdoptESDtrackCuts();
-       AdoptESDpidCuts();
-       
-       fGammaPool = new TClonesArray("AliKFParticle", fPoolMaxSize);
-       fGammaPool->SetOwner(kTRUE);
-}
-
-//-----------------------------------------------------------------------------------------------
-AliAnalysisTaskGammaConvDalitz::AliAnalysisTaskGammaConvDalitz( const char* name ):
-       AliAnalysisTaskSE( name ),
-       fStack(0),
-       fGCMCEvent(0),
-       fESDEvent(0),
-       fEposCandidateIndex(),
-       fEnegCandidateIndex(),
-       fGammaCandidatePosIndex(),
-       fGammaCandidateNegIndex(),
-       fGammaCandidates(0),
-       fGammaPool(0),
-       fPoolMaxSize(10),
-       fGamPoolPos(0),
-       fBGEventHandler(0),
-       fOutputContainer(0),
-       fMCTruth(0),
-       fV0Reader(0),
-       fESDpid(0),
-       fESDtrackCuts(0),
-       fITSsaTrackCuts(0),
-       fESDpidCuts(0),
-       fRemovePileUp(kFALSE),
-       fSelectV0AND(kFALSE),                 // Select V0AND
-       fTriggerAnalysis(0),
-       fMultiplicity(0),
-       fUseMultiplicity(0),
-       fUseMultiplicityBin(0),
-       fUseHBTMultiplicity(0),
-       fUseHBTMultiplicityBin(0),
-       fUseCentrality(0),
-       fUseCentralityBin(0),
-       fHistograms(0),
-       fStandalone(kFALSE),
-       fDoMC(kFALSE),
-       fComputeBkg(kTRUE),
-       fUseBayesPID(kFALSE),
-       fUseTrackIndexCut(kTRUE),
-       fUsePsiPairCut(kTRUE),
-       fUseMassCut(kFALSE),
-       fUseGammaCut(kFALSE),
-       fUseCorrectedTPCClsInfo(kFALSE),
-       fReadMagFieldSign(kTRUE),
-       fUseAliKF(kFALSE),
-       fBackgroundType(2),
-       fMinClsTPCToF(0.),
-       fMagFieldSign(1),
-       fkElectronMass(0.00051099891),
-       fPsiPairCut(0.45),
-       fDeltaPhiCutMin(0.),
-       fDeltaPhiCutMax(0.12),
-       fMassCutMin(0.),
-       fMassCutMax(0.1),
-       /*fNSigmaBelowElecTPCbethe(-2.),
-       fNSigmaAboveElecTPCbethe(3.),
-       fNSigmaAbovePionTPCbethe(3.),
-       fNSigmaAboveKaonTPCbethe(3.),
-       fNSigmaAboveProtonTPCbethe(3.),*/
-       fDoTOFsigmaCut(kFALSE), 
-       fPIDnSigmaAboveElectronLine(100), // sigma cut
-       fPIDnSigmaBelowElectronLine(-100), // sigma cut
-       fTofPIDnSigmaAboveElectronLine(100), // sigma cut RRnewTOF
-       fTofPIDnSigmaBelowElectronLine(-100), // sigma cut RRnewTOF 
-       fPIDnSigmaAbovePionLine(-100),     // sigma cut
-       fPIDnSigmaAbovePionLineHighPt(-100),     // sigma cut
-       fPIDMinPnSigmaAbovePionLine(100), // sigma cut
-       fPIDMaxPnSigmaAbovePionLine(100), // sigma cut
-       fDoKaonRejectionLowP(kFALSE),   // Kaon rejection at low p
-       fDoProtonRejectionLowP(kFALSE), // Proton rejection at low p
-       fDoPionRejectionLowP(kFALSE),   // Pion rejection at low p*/
-       fPIDnSigmaAtLowPAroundKaonLine(0), // sigma cut
-       fPIDnSigmaAtLowPAroundProtonLine(0), // sigma cut
-       fPIDnSigmaAtLowPAroundPionLine(0), // sigma cut
-       fPIDMinPKaonRejectionLowP(0), // Momentum limit to apply kaon rejection
-       fPIDMinPProtonRejectionLowP(0), // Momentum limit to apply proton rejection
-       fPIDMinPPionRejectionLowP(0), // Momentum limit to apply proton rejection
-       fTrkSelectionCriteria(kGlobalTrack)
-{
-       // Common I/O in slot 0
-       DefineInput (0, TChain::Class());
-
-       // Your private output
-       DefineOutput(1, TList::Class());
-//  DefineOutput(2, AliCFContainer::Class());  // for CF
-
-       AdoptITSsaTrackCuts();
-       AdoptESDtrackCuts();
-       AdoptESDpidCuts();
-// fkElectronMass = TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass(); //
-
-       fGammaPool = new TClonesArray("AliKFParticle", fPoolMaxSize);
-       fGammaPool->SetOwner(kTRUE);
-}
-
-//-----------------------------------------------------------------------------------------------
-AliAnalysisTaskGammaConvDalitz::~AliAnalysisTaskGammaConvDalitz()
-{
-//
-// virtual destructor
-//
-
-       if( fOutputContainer )          delete fOutputContainer;
-       if( fHistograms )               delete fHistograms;
-       if( fStandalone && fV0Reader )  delete fV0Reader;
-       if( fITSsaTrackCuts )           delete fITSsaTrackCuts;
-       if( fESDtrackCuts )             delete fESDtrackCuts;
-       if( fESDpidCuts )               delete fESDpidCuts;
-       if( fGammaCandidates)           delete fGammaCandidates;
-       if( fGammaPool )                delete fGammaPool;
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::ConnectInputData(Option_t *option)
-{
-//
-// Connect Input Data
-//
-       if( fDebug ) AliInfo("=> ConnectInputData");
-
-       AliAnalysisTaskSE::ConnectInputData(option);
-
-       if( fV0Reader == 0 )
-       {
-               AliFatal("There is not pointer to AliV0Reader object!!!");
-       }
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::UserCreateOutputObjects()
-{
-//
-// Create ouput objects
-//
-       if( fDebug ) AliInfo("=> UserCreateOutputObjects");
-
-       // Create the output container
-       if( fOutputContainer != 0 )
-       {
-               delete fOutputContainer;
-       }
-
-       fOutputContainer = new TList();
-
-       // Add the histograms to the output container
-       fHistograms->GetOutputContainer( fOutputContainer );
-       fOutputContainer->SetOwner(kTRUE);
-
-       PostData( 1, fOutputContainer );
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::UserExec(Option_t */*option*/)
-{
-//
-// Execute analysis for current event
-//        
-       if( fDebug ) AliInfo("=> UserExec");
-
-       if( fV0Reader == 0 )    {
-               AliFatal("no pointer to AliV0Reader");
-               return;
-       }
-
-       if(fTriggerAnalysis == 0){
-               fTriggerAnalysis = new AliTriggerAnalysis;
-       }
-
-       // Create list of gamma candidates in standalone mode
-       // otherwise use the created ones by AliAnalysisTaskGammaConversion
-       if( fStandalone ) {
-               AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
-               AliESDInputHandler *esdHandler=0;
-               if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){
-                       AliV0Reader::SetESDpid(esdHandler->GetESDpid());
-               } else {
-                       //load esd pid bethe bloch parameters depending on the existance of the MC handler
-                       // yes: MC parameters
-                       // no:  data parameters
-                       if (!AliV0Reader::GetESDpid()){
-                               if (MCEvent() ) {
-                                       AliV0Reader::InitESDpid();
-                               } else {
-                                       AliV0Reader::InitESDpid(1);
-                               }
-                       }
-               }
-       
-               if (MCEvent() ) {
-               // To avoid crashes due to unzip errors. Sometimes the trees are not there.
-                       AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
-
-                       if (!mcHandler){ 
-                               AliError("Could not retrive MC event handler!"); 
-                               return; 
-                       }
-
-                       if (!mcHandler->InitOk() ){
-                               return;
-                       }
-                       if (!mcHandler->TreeK() ){
-                               return;
-                       }
-                       if (!mcHandler->TreeTR() ) {
-                               return;
-                       }
-               }
-
-               fV0Reader->SetInputAndMCEvent( InputEvent(), MCEvent() );
-               fV0Reader->Initialize();
-       }
-
-       Bool_t v0A                   = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0A);
-       Bool_t v0C                   = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0C);
-       Bool_t v0AND = v0A && v0C;
-
-       if( fTriggerAnalysis ){
-               delete fTriggerAnalysis;
-               fTriggerAnalysis=0;
-       }
-
-
-       if(fSelectV0AND && !v0AND){
-               return;
-       }
-
-       if( fV0Reader->CheckForPrimaryVertex() == kFALSE )
-       {
-               if( fDebug ) AliInfo("no contributors to primary vertex");
-               return;
-       }
-
-       if( fV0Reader->CheckForPrimaryVertexZ() == kFALSE  )
-       {               
-               if( fDebug ) AliInfo("z vertex out of range");
-               return;
-       }
-
-       if(fRemovePileUp && fV0Reader->GetESDEvent()->IsPileupFromSPD()) {
-               // eventQuality=4;      
-               return;
-       }       
-
-       Int_t tTracklet=0, tITSTPC=0, tITSPure=0;
-       fV0Reader->GetESDEvent()->EstimateMultiplicity(tTracklet, tITSTPC, tITSPure, 0.8);
-       Int_t fMultiplicityITS = tITSPure;
-
-       AliESDtrackCuts* kEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE);
-
-
-       kEsdTrackCuts->SetMaxDCAToVertexZ(2);
-       kEsdTrackCuts->SetEtaRange(-0.8, 0.8);
-       kEsdTrackCuts->SetPtRange(0.15);
-
-       fMultiplicity = kEsdTrackCuts->CountAcceptedTracks(fV0Reader->GetESDEvent());
-               
-       if(  kEsdTrackCuts ) delete kEsdTrackCuts;
-
-       if( fUseHBTMultiplicity==1) {
-               fMultiplicity = fMultiplicityITS;
-       }
-
-       if(fUseMultiplicity!=0 && CalculateMultiplicityBin()!=fUseMultiplicityBin ){
-               //eventQuality=6;
-               //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               return;
-       }
-
-                       
-       if(fUseHBTMultiplicity!=0 && CalculateMultiplicityBin()!=fUseHBTMultiplicityBin ){
-               //eventQuality=6;
-               //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               return;
-       }
-
-
-       if(fV0Reader->GetIsHeavyIon()){
-               if(fUseCentrality>0){
-                       AliCentrality *esdCentrality = fV0Reader->GetESDEvent()->GetCentrality();
-                       Int_t centralityC = -1;
-
-                       if(fUseCentrality==1){
-                               centralityC = esdCentrality->GetCentralityClass10("V0M");
-                               if( centralityC != fUseCentralityBin ){
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                       }
-
-                       if(fUseCentrality==2){
-                               centralityC = esdCentrality->GetCentralityClass10("CL1");
-                               if( centralityC != fUseCentralityBin ){
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                       }
-
-                       ////////////////////////////////////// RRnew start /////////////////////////////////////////////////////
-                       if(fUseCentrality==3){
-                               centralityC = esdCentrality->GetCentralityClass10("V0M");
-                               if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
-                                               //eventQuality=7;
-                                               //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                               return;         
-                               }
-                               if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
-                                       // eventQuality=7;
-                               //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 3) && (centralityC!=0) && (centralityC!=1) ){ // 0-20%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 7) && (centralityC!=6) && (centralityC!=7) ){ // 60-80%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 8) && (centralityC>=8) ){ // 0-80%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 9) && (centralityC>=9) ){ // 0-90%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                       }
-
-                       if(fUseCentrality==4){
-                               centralityC = esdCentrality->GetCentralityClass10("CL1");
-                               if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
-                               //eventQuality=7;
-                               //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                               return;         
-                               }
-                               if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
-                                       //eventQuality=7;
-                                       //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                       return;
-                               }
-                               if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
-                                               //eventQuality=7;
-                                               //fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                                               return;
-                               }
-                       }
-               }
-       }
-
-
-       // Get Pointers
-       fBGEventHandler = fV0Reader->GetBGHandler();
-       fESDpid = fV0Reader->GetESDpid();
-       fESDEvent = fV0Reader->GetESDEvent();
-       if(fDoMC && MCEvent()){
-               fStack= MCEvent()->Stack();
-               fGCMCEvent=MCEvent();
-       }
-
-       // Read the magnetic field sign from ESD
-       if ( fReadMagFieldSign == kTRUE ){
-               fMagFieldSign = (fESDEvent->GetMagneticField() < 0) ? 1 : -1;
-       }
-
-       // Process MC information
-       if(fDoMC){
-               ProcessMCData();
-       }
-
-       if( fStandalone ){
-               while(fV0Reader->NextV0()){}; //SelectGammas
-               fV0Reader->ResetV0IndexNumber();
-       }
-
-       CreateListOfDalitzPairCandidates();
-       ProcessGammaElectronsForDalitzAnalysis();
-       
-       if ( fStandalone ){
-               fV0Reader->UpdateEventByEventData();
-       }
-
-       PostData( 1, fOutputContainer );
-}
-
-
-void AliAnalysisTaskGammaConvDalitz::Terminate(Option_t */*option*/)
-{
-//
-    if( fDebug ) AliInfo("Not to do anything in Terminate");
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::AdoptITSsaTrackCuts( AliESDtrackCuts* esdCuts )
-{
-//
-// set user ITSsa track cuts
-//
-       if( fITSsaTrackCuts ) delete fITSsaTrackCuts;
-
-       if( esdCuts ){
-               fITSsaTrackCuts = esdCuts;
-       } else {
-               // default cuts
-               fITSsaTrackCuts = new AliESDtrackCuts("Default ITSsa track cuts for Pi0 Dalitz decay"); 
-               fITSsaTrackCuts->SetEtaRange( -0.9, 0.9 );
-               fITSsaTrackCuts->SetAcceptKinkDaughters(kFALSE);
-
-               fITSsaTrackCuts->SetMinNClustersITS(2);
-               fITSsaTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
-               fITSsaTrackCuts->SetRequireITSRefit(kTRUE);
-               
-               fITSsaTrackCuts->SetRequireSigmaToVertex(kTRUE);
-               fITSsaTrackCuts->SetMaxNsigmaToVertex(3);
-               
-               fITSsaTrackCuts->SetRequireITSStandAlone(kTRUE);
-       }
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::AdoptESDtrackCuts( AliESDtrackCuts* esdCuts )
-{
-//
-// set user global track cuts
-//
-       if( fESDtrackCuts ) delete fESDtrackCuts;
-
-       if( esdCuts ){
-               fESDtrackCuts = esdCuts;
-       } else {
-               //default cuts
-               fESDtrackCuts = new AliESDtrackCuts("Default global track cuts for Pi0 Dalitz decay");
-
-               fESDtrackCuts->SetEtaRange( -0.9, 0.9 );
-               fESDtrackCuts->SetAcceptKinkDaughters(kFALSE);
-
-               fESDtrackCuts->SetMinNClustersITS(2);
-               fESDtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
-               fESDtrackCuts->SetRequireITSRefit(kTRUE);
-
-               fESDtrackCuts->SetRequireSigmaToVertex(kTRUE);
-               fESDtrackCuts->SetMaxNsigmaToVertex(3);
-
-               fESDtrackCuts->SetMinNClustersTPC(80);
-               fESDtrackCuts->SetMaxChi2PerClusterTPC(4.);
-               fESDtrackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
-               fESDtrackCuts->SetRequireTPCRefit(kTRUE);
-       }
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::AdoptESDpidCuts( AliESDpidCuts* esdPIDCuts )
-{
-//
-// set user pid cuts
-//
-       if( fESDpidCuts ) delete fESDpidCuts;
-       if( esdPIDCuts ) {
-               fESDpidCuts = esdPIDCuts;
-       } else { // default cuts
-               fESDpidCuts = new AliESDpidCuts("Electrons", "Electron PID cuts");
-       //   fESDpidCuts->SetTPCnSigmaCut(AliPID::kElectron, 3.);
-               fESDpidCuts->SetTPCnSigmaCut(AliPID::kElectron, -4., 6.);
-       }
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::ProcessMCData()
-{
-//
-// Process generation
-//
-       if( fDebug ) AliInfo("=> ProcessMCData");
-
-       fHistograms->FillTable("Table_Generation", 0);  //number of events
-
-       for ( Int_t i = 0; i < fStack->GetNprimary(); i++ ) {
-               TParticle* iParticle = fStack->Particle( i );
-               if( !iParticle ) continue;
-
-               Float_t etaMin = 0.;
-               Float_t etaMax = 0.;
-               fESDtrackCuts->GetEtaRange(etaMin,etaMax);
-               Double_t rapidity = Rapidity(iParticle);
-
-               //_____________________________________JPsi ___________________________________________________
-               if(iParticle->GetPdgCode() == 443){
-                       if(iParticle->GetNDaughters()==2){
-                               if(TMath::Abs(fStack->Particle(iParticle->GetFirstDaughter())->GetPdgCode()) == 11 &&
-                                       TMath::Abs(fStack->Particle(iParticle->GetLastDaughter())->GetPdgCode()) == 11){
-                                       if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ) {
-                                               fHistograms->FillHistogram("MC_Jpsi_EE_Pt",iParticle->Pt());    
-                                               
-                                               TParticle* daug0 = fStack->Particle(iParticle->GetFirstDaughter());
-                                               TParticle* daug1 = fStack->Particle(iParticle->GetLastDaughter());
-                                               
-                                               if( ( daug0->Eta() > etaMin && daug0->Eta() < etaMax ) && 
-                                                               ( daug1->Eta() > etaMin && daug1->Eta() < etaMax ) ){
-                                                       fHistograms->FillHistogram("MC_Jpsi_EE_Acceptance_Pt_Vs_Y",iParticle->Pt(),rapidity);
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               //_____________________________________Chic_____________________________________________________
-               if(iParticle->GetPdgCode() == 10441 || iParticle->GetPdgCode() == 20443 || iParticle->GetPdgCode() == 445){
-                       if( iParticle->GetNDaughters() == 2){
-                               TParticle* daug0 = fStack->Particle(iParticle->GetFirstDaughter());
-                               TParticle* daug1 = fStack->Particle(iParticle->GetLastDaughter());
-                                                                                               
-                               if( ( daug0->GetPdgCode() == 443 || daug0->GetPdgCode() == 22) && (daug1->GetPdgCode() == 443 || daug1->GetPdgCode() == 22) ){                          
-                                       if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ) {
-                                               if( iParticle->GetPdgCode() == 10441 ) fHistograms->FillHistogram("MC_Chic0_All_Pt",iParticle->Pt() );
-                                               if( iParticle->GetPdgCode() == 20443 ) fHistograms->FillHistogram("MC_Chic1_All_Pt",iParticle->Pt() );
-                                               if( iParticle->GetPdgCode() ==   445 ) fHistograms->FillHistogram("MC_Chic2_All_Pt",iParticle->Pt() );
-                                                       
-                                               TParticle* daugEPos;
-                                               TParticle* daugENeg;
-                                               TParticle* Gamma;
-                                               
-                                               Bool_t daugGammaEle = kFALSE;
-                                               Bool_t daugGammaPos = kFALSE;
-                                       
-                                               if( daug0->GetPdgCode() == 443){
-                                                               daugEPos = fStack->Particle(daug0->GetFirstDaughter());
-                                                               daugENeg = fStack->Particle(daug0->GetLastDaughter());
-                                                               Gamma = daug1;                          
-                                               } else if (daug1->GetPdgCode() == 443){         
-                                                               daugEPos = fStack->Particle(daug1->GetFirstDaughter());
-                                                               daugENeg = fStack->Particle(daug1->GetLastDaughter());
-                                                               Gamma = daug0;          
-                                               }
-                       
-                                               if( Gamma->GetNDaughters() >= 2 ){
-                                                       for( Int_t tIndex=Gamma->GetFirstDaughter(); tIndex<=Gamma->GetLastDaughter(); ++tIndex ){
-                                                               TParticle* tmpDaughter = fStack->Particle(tIndex);
-                                                               if( tmpDaughter->GetUniqueID() != kPPair ) continue; // check if the daughters come from a conversion
-                                                               if( tmpDaughter->GetPdgCode() == ::kElectron ){ // e+
-                                                                               // daugGammaElectronAll = kTRUE;
-                                                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && 
-                                                                                       TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                                                       daugGammaEle = kTRUE;
-                                                                                               }
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                               } else if( tmpDaughter->GetPdgCode() == ::kPositron ) {
-                                                                       //daugGammaPositronAll = kTRUE;
-                                                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                                                       daugGammaPos = kTRUE;
-                                                                                               }
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                               }
-                                                       }
-                                               }        
-
-
-                                               Bool_t gammaChicEtaCut = kTRUE;
-                                               if( TMath::Abs(Gamma->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(Gamma->Eta()) < fV0Reader->GetEtaCutMin() ) {
-                                                       gammaChicEtaCut = kFALSE;
-                                               }
-
-                                                                                       
-                                               if ( gammaChicEtaCut && Gamma->R() < fV0Reader->GetMaxRCut()  &&
-                                                       TMath::Abs( daugEPos->Eta() ) < etaMax  && TMath::Abs( daugENeg->Eta() ) < etaMax ){
-                                                       if( iParticle->GetPdgCode() == 10441 ) fHistograms->FillHistogram("MC_Chic0_Acceptance_Pt_Vs_Y", iParticle->Pt(), Rapidity(iParticle) );
-                                                       if( iParticle->GetPdgCode() == 20443 ) fHistograms->FillHistogram("MC_Chic1_Acceptance_Pt_Vs_Y", iParticle->Pt(), Rapidity(iParticle) );
-                                                       if( iParticle->GetPdgCode() ==   445 ) fHistograms->FillHistogram("MC_Chic2_Acceptance_Pt_Vs_Y", iParticle->Pt(), Rapidity(iParticle) );
-                               
-                                                       if( daugGammaEle && daugGammaPos ){
-                                                                       if( iParticle->GetPdgCode() == 10441 ) fHistograms->FillHistogram("MC_Chic0_Acceptance_ConvGammaPt_Vs_Y", iParticle->Pt(), Rapidity(iParticle) );
-                                                                       if( iParticle->GetPdgCode() == 20443 ) fHistograms->FillHistogram("MC_Chic1_Acceptance_ConvGammaPt_Vs_Y", iParticle->Pt(), Rapidity(iParticle) );
-                                                                       if( iParticle->GetPdgCode() ==   445 ) fHistograms->FillHistogram("MC_Chic2_Acceptance_ConvGammaPt_Vs_Y", iParticle->Pt(), Rapidity(iParticle) );
-                                                       }    
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               //_____________________________Pi0 or Eta______________________________________________________________
-               if ( iParticle->GetPdgCode() != ::kPi0 && iParticle->GetPdgCode() != 221) continue; 
-                                                                       
-               if( iParticle->GetNDaughters() == 2 &&
-                       fStack->Particle(iParticle->GetFirstDaughter())->GetPdgCode() == ::kGamma &&
-                       fStack->Particle(iParticle->GetLastDaughter())->GetPdgCode() == ::kGamma ) {
-
-                       if( iParticle->GetPdgCode() == ::kPi0 ){
-                               if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                                       fHistograms->FillTable("Table_Generation", 1);  // pi0 -> gg
-                               }
-                       }
-               }
-               if ( iParticle->GetNDaughters() != 3 ) continue;    // Num == 3 (e+,e-,gamma)
-       
-               // Check for Pi0 Dalitz decay
-               TParticle* eposPi0 = 0;
-               TParticle* enegPi0 = 0;
-               TParticle* gammaPi0 = 0;
-               
-               for( Int_t idxPi0 = iParticle->GetFirstDaughter(); idxPi0 <= iParticle->GetLastDaughter(); idxPi0++ ){
-                       switch(fStack->Particle(idxPi0)->GetPdgCode()) {
-                               case ::kPositron:
-                                       eposPi0 = fStack->Particle(idxPi0);
-                                       break;
-                               case ::kElectron:
-                                       enegPi0 = fStack->Particle(idxPi0);
-                                       break;
-                               case ::kGamma:
-                                       gammaPi0 = fStack->Particle(idxPi0);
-                                       break;
-                       }
-               }
-       
-               if (eposPi0==0 || enegPi0==0 || gammaPi0==0) continue;
-
-               // check for gamma conversion
-               Bool_t daugGammaElectron    = kFALSE;
-               Bool_t daugGammaPositron    = kFALSE;  // acceptance
-               Bool_t daugGammaElectronAll = kFALSE;
-               Bool_t daugGammaPositronAll = kFALSE;
-
-
-               Bool_t gammaEtaCut = kTRUE;
-               if( TMath::Abs(gammaPi0->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(gammaPi0->Eta()) < fV0Reader->GetEtaCutMin() )
-               gammaEtaCut = kFALSE;
-
-               Bool_t gammaRCut = kTRUE;
-               if( gammaPi0->R() > fV0Reader->GetMaxRCut()  ) 
-               gammaRCut = kFALSE;
-
-               // is the gamma converted? -> has 2 daughter e+e-
-               // are e+ e- from gamma in the acceptance for the V0s
-
-               if( gammaPi0->GetNDaughters() >= 2 ){
-                       for( Int_t tIndex=gammaPi0->GetFirstDaughter(); tIndex<=gammaPi0->GetLastDaughter(); ++tIndex ){
-                               TParticle* tmpDaughter = fStack->Particle(tIndex);
-                               if( tmpDaughter->GetUniqueID() != kPPair ) continue; // check if the daughters come from a conversion
-                       
-                               if( tmpDaughter->GetPdgCode() == ::kElectron ) { // e+
-                                       daugGammaElectronAll = kTRUE;
-
-                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                       daugGammaElectron = kTRUE;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                               else if( tmpDaughter->GetPdgCode() == ::kPositron ){
-                                       daugGammaPositronAll = kTRUE;
-
-                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() )) {
-                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()) {
-                                                                               daugGammaPositron = kTRUE;
-                                                               }
-                                                       } 
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-
-               if( iParticle->GetPdgCode() == ::kPi0 ) {                                       // found a Pi0 Dalitz decay
-                       if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ) {
-                               fHistograms->FillHistogram("MC_Pi0_All_Pt",iParticle->Pt());
-                               fHistograms->FillTable("Table_Generation", 2);
-                               fHistograms->FillHistogram("MC_Pi0Dalitz_P", iParticle->P());
-                               fHistograms->FillHistogram("MC_Pi0Dalitz_Pt", iParticle->Pt());
-
-                               fHistograms->FillHistogram("MC_Pi0Dalitz_Eta", iParticle->Eta());
-                               fHistograms->FillHistogram("MC_Pi0Dalitz_Pt_vs_Y", iParticle->Pt(),Rapidity(iParticle));
-                               fHistograms->FillHistogram("MC_EposDalitz_Pt", eposPi0->Pt());
-                               fHistograms->FillHistogram("MC_EposDalitz_Eta", eposPi0->Eta());
-                               fHistograms->FillHistogram("MC_EnegDalitz_Pt", enegPi0->Pt());
-                               fHistograms->FillHistogram("MC_EnegDalitz_Eta", enegPi0->Eta());
-                               fHistograms->FillHistogram("MC_GammaPi0Dalitz_Pt", gammaPi0->Pt());
-                               fHistograms->FillHistogram("MC_GammaPi0Dalitz_Eta", gammaPi0->Eta());
-                               
-                               // Angle between the gamma and the plane e+e-
-                               TVector3 ePosMom( eposPi0->Px(), eposPi0->Py(), eposPi0->Pz() );
-                               TVector3 eNegMom( enegPi0->Px(), enegPi0->Py(), enegPi0->Pz() );
-                               TVector3 gamMom( gammaPi0->Px(), gammaPi0->Py() , gammaPi0->Pz() );
-                               TVector3 planeEposEneg =  eNegMom.Cross( ePosMom );
-                               Double_t anglePlaneGamma = planeEposEneg.Angle(gamMom);
-                               
-                               fHistograms->FillHistogram("MC_EposEnegDalitz_Angle", ePosMom.Angle(eNegMom) );
-                               
-                               fHistograms->FillHistogram("MC_EposEnegDalitz_GammaPi0_Angle", anglePlaneGamma);
-                               fHistograms->FillHistogram("MC_EposEnegDalitz_GammaPi0_Angle_vs_P", anglePlaneGamma, gammaPi0->P());
-                               fHistograms->FillHistogram("MC_EposEnegDalitz_GammaPi0_Angle_vs_Pt", anglePlaneGamma, gammaPi0->Pt());
-                       
-                               if(  daugGammaElectronAll && daugGammaPositronAll ) {
-                                       TParticle* tmpDaughter = fStack->Particle( gammaPi0->GetFirstDaughter() );
-                                       fHistograms->FillHistogram("MC_GC_GammaPi0Dalitz_All_Z_vs_R",tmpDaughter->Vz(),tmpDaughter->R() );
-                               }
-
-       
-                               if ( TMath::Abs( eposPi0->Eta() ) < etaMax  && TMath::Abs( enegPi0->Eta() ) < etaMax ) {
-                                       fHistograms->FillHistogram("MC_Acceptance_EposDalitz_Pt", eposPi0->Pt());
-                                       fHistograms->FillHistogram("MC_Acceptance_EposDalitz_Eta", eposPi0->Eta());
-                                       fHistograms->FillHistogram("MC_Acceptance_EnegDalitz_Pt", enegPi0->Pt());
-                                       fHistograms->FillHistogram("MC_Acceptance_EnegDalitz_Eta", enegPi0->Eta());
-                                       fHistograms->FillHistogram("MC_Acceptance_DalitzPair_EposPt_vs_EnegPt", eposPi0->Pt(), enegPi0->Pt());
-                               }
-
-                       
-                               if ( gammaEtaCut == kTRUE && gammaRCut == kTRUE &&
-                                       TMath::Abs(  eposPi0->Eta() ) < etaMax  && TMath::Abs( enegPi0->Eta() ) < etaMax ){
-
-                                       fHistograms->FillTable("Table_Generation",3);  //
-
-                                       fHistograms->FillHistogram("MC_Acceptance_Pi0Dalitz_Pt",iParticle->Pt());
-                                       fHistograms->FillHistogram("MC_Acceptance_Pi0Dalitz_Eta",iParticle->Eta());
-                                       fHistograms->FillHistogram("MC_Acceptance_Pi0Dalitz_Radius",iParticle->R());
-                                       fHistograms->FillHistogram("MC_Acceptance_GammaPi0Dalitz_Pt",gammaPi0->Pt());
-                                       fHistograms->FillHistogram("MC_Acceptance_GammaPi0Dalitz_Eta",gammaPi0->Eta());
-                                       fHistograms->FillHistogram("MC_Acceptance_EposPi0Dalitz_Pt",eposPi0->Pt());
-                                       fHistograms->FillHistogram("MC_Acceptance_EposPi0Dalitz_Eta",eposPi0->Eta());
-                                       fHistograms->FillHistogram("MC_Acceptance_EnegPi0Dalitz_Pt",enegPi0->Pt());
-                                       fHistograms->FillHistogram("MC_Acceptance_EnegPi0Dalitz_Eta",enegPi0->Eta());
-                                       fHistograms->FillHistogram("MC_Acceptance_DalitzPair_OpeningAngle", ePosMom.Angle(eNegMom) );
-                                       fHistograms->FillHistogram("MC_Pi0_Acceptance_Pt_vs_Y",iParticle->Pt(),Rapidity(iParticle));
-
-
-                                       // Pi0 within acceptance with gamma converted
-
-                                       if ( daugGammaElectron && daugGammaPositron ){
-                                               fHistograms->FillTable("Table_Generation",4); //
-
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_Pi0Dalitz_Pt",iParticle->Pt());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_Pi0Dalitz_Eta",iParticle->Eta());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_EposPi0Dalitz_Pt",eposPi0->Pt());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_EposPi0Dalitz_Eta",eposPi0->Eta());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_EnegPi0Dalitz_Pt",enegPi0->Pt());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_EnegPi0Dalitz_Eta",enegPi0->Eta());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_GammaPi0Dalitz_Pt",gammaPi0->Pt());
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_GammaPi0Dalitz_Eta",gammaPi0->Eta());
-                                               //fHistograms->FillHistogram("MC_Acceptance_GC_Gamma_Angle",anglePlaneGamma);
-                                               //fHistograms->FillHistogram("MC_Acceptance_GC_Gamma_Angle_vs_Pt",anglePlaneGamma,gammaPi0->Pt());
-                                               TParticle* tmpDaughter = fStack->Particle( gammaPi0->GetFirstDaughter() );
-                                               fHistograms->FillHistogram("MC_Acceptance_GC_GammaPi0Dalitz_Z_vs_R",tmpDaughter->Vz(),tmpDaughter->R() );
-                                               fHistograms->FillHistogram("MC_Pi0_Acceptance_GammaConv_Pt_vs_Y",iParticle->Pt(), Rapidity(iParticle));
-                                       }
-                               }
-                       }
-               } else if( iParticle->GetPdgCode() == 221  ){ //        found Eta Dalitz decay
-
-                       if(  TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ) {
-                       fHistograms->FillHistogram("MC_Eta_All_Pt",iParticle->Pt());
-
-                               if (  gammaEtaCut && gammaRCut &&
-                                               TMath::Abs( eposPi0->Eta() ) < etaMax  && TMath::Abs( enegPi0->Eta() ) < etaMax  ){
-                                       fHistograms->FillHistogram("MC_Eta_Acceptance_Pt_vs_Y",iParticle->Pt(),rapidity);
-
-                                       if ( daugGammaElectron && daugGammaPositron ){
-                                               fHistograms->FillHistogram("MC_Eta_Acceptance_GammaConv_Pt_vs_Y",iParticle->Pt(),rapidity);
-
-                                       }
-                               }
-                       }
-               }
-       }
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::CreateListOfDalitzPairCandidates()
-{
-//
-// Dalitz pair candidates
-//
-       if( fDebug ) AliInfo("=> CreateListOfDalitzPairCandidates");
-       
-       fEposCandidateIndex.clear();
-       fEnegCandidateIndex.clear();
-
-       fHistograms->FillTable("Table_Cuts", 0);
-       
-       for( Int_t i = 0; i < fESDEvent->GetNumberOfTracks(); ++i ){
-               AliESDtrack* iTrack = fESDEvent->GetTrack(i);
-               if ( !iTrack ) continue;
-
-               Double_t p[3];
-       
-               if ( !iTrack->GetConstrainedPxPyPz(p) ) continue;
-
-               TVector3 iMom(p[0],p[1],p[2]);
-
-               //
-               // Check track cuts and find track type
-               //
-
-               Bool_t isTrackAccepted = 0;
-               Int_t trackType = -1;
-               Double_t kClsToF = 0.;
-
-               switch(fTrkSelectionCriteria){
-                       case kITSsaTrack:
-                               isTrackAccepted = fITSsaTrackCuts->AcceptTrack( iTrack );
-                               trackType = kITSsaTrack;
-                               break;
-                       
-                       case kGlobalTrack:
-                               isTrackAccepted = fESDtrackCuts->AcceptTrack( iTrack );
-                               trackType = kGlobalTrack;
-                               if( fUseCorrectedTPCClsInfo ){
-                                       if( iTrack->GetTPCNclsF()!=0){
-                                               kClsToF = (Double_t) ( iTrack->GetNcls(1)/iTrack->GetTPCNclsF() );
-                                       }
-                               } else {
-                                       kClsToF= iTrack->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
-                               }
-                                       
-                               if( kClsToF < fMinClsTPCToF ) {
-
-                                                               isTrackAccepted = kFALSE;
-                               }
-
-                               break;
-                       case kITSsaGlobalTrack:
-                               if(fITSsaTrackCuts->AcceptTrack( iTrack ) || fESDtrackCuts->AcceptTrack( iTrack ))
-                               {
-                                       isTrackAccepted = kTRUE;
-                                       if(fITSsaTrackCuts->AcceptTrack( iTrack )) trackType = kITSsaTrack;
-                                       else trackType = kGlobalTrack;
-                               }
-                               break;
-               }
-               
-               if(!isTrackAccepted) continue;
-               
-               //
-               // PID
-               //
-               
-               Int_t pid=-1;
-               Int_t pidMC=-1;
-
-               if(fUseBayesPID){
-                       pid = GetBayesPid(iTrack,trackType);
-               } else {
-                       pid = GetNSigmaPid(iTrack,trackType);
-               }
-               
-               if( fDoMC ){
-                       pidMC = GetMonteCarloPid(iTrack);
-                       // pid table
-                       Int_t iLabel = TMath::Abs(iTrack->GetLabel());
-                       TParticle* iParticle = fStack->Particle(iLabel);
-                       FillPidTable(iParticle, pid);
-               }
-               
-               // ITS standalone tracks
-               if( trackType == kITSsaTrack){
-                       Double_t mom = iTrack->GetP();
-                       Double_t signal = iTrack->GetITSsignal();
-                       
-                       fHistograms->FillHistogram( "ESD_ITSsa_dEdx_vs_P", mom, signal );
-                       
-                       if( pid == AliPID::kElectron ) {
-                               fHistograms->FillHistogram( "ESD_ITSsa_PidCut_dEdx_vs_P", mom, signal );
-                               if(fDoMC && pid == pidMC) {
-                                       fHistograms->FillHistogram( "MC_ESD_ITSsa_PidCut_dEdx_vs_P", mom, signal );
-                               }
-                       }
-                       
-                       if( fDoMC && pidMC == AliPID::kElectron){
-                               fHistograms->FillHistogram( "MC_ESD_ITSsa_Electron_dEdx_vs_P", mom, signal );
-                       }
-               }
-               
-               else { // global tracks
-                       const AliExternalTrackParam *in = iTrack->GetInnerParam();
-                       Double_t mom = in->GetP();
-                       Double_t signal = iTrack->GetTPCsignal();
-                       
-                       fHistograms->FillHistogram( "ESD_TPC_dEdx_vs_P", mom, signal );
-
-                       UInt_t statusTrack = iTrack->GetStatus(); //moved up here from below RRnewTOF
-       
-                       Double_t timesTrack[5];
-                       iTrack->GetIntegratedTimes(timesTrack);
-       
-                       Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(iTrack->GetP());
-       
-               
-                       
-                       Double_t TOFsignaTrack = iTrack->GetTOFsignal();
-                       
-
-                       Double_t dTtrack = TOFsignaTrack - t0pos - timesTrack[0];
-                       
-
-                       if( (statusTrack & AliESDtrack::kTOFpid) && !(statusTrack & AliESDtrack::kTOFmismatch) )
-                               fHistograms->FillHistogram("ESD_TOF_E_P_dT", iTrack->GetP(), dTtrack); //if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
-
-                       if( fDoMC && pidMC == AliPID::kElectron ){
-                               fHistograms->FillHistogram( "MC_ESD_TPC_Electron_dEdx_vs_P", mom, signal );
-                               if( (statusTrack & AliESDtrack::kTOFpid) && !(statusTrack & AliESDtrack::kTOFmismatch) ){
-                                       fHistograms->FillHistogram("MC_ESD_TOF_E_P_dT", iTrack->GetP(), dTtrack);
-                               }
-                       }
-                       
-                       if( pid == AliPID::kElectron ){
-                               fHistograms->FillHistogram("ESD_TPC_PidCut_dEdx_vs_P", mom, signal );
-                               if( (statusTrack & AliESDtrack::kTOFpid) && !(statusTrack & AliESDtrack::kTOFmismatch) ){
-                                       fHistograms->FillHistogram("ESD_TOF_PidCut_E_P_dT", iTrack->GetP(), dTtrack); 
-                               }
-                               if(fDoMC && pid == pidMC) {
-                                       fHistograms->FillHistogram( "MC_ESD_TPC_PidCut_dEdx_vs_P", mom, signal );
-                                       if( (statusTrack & AliESDtrack::kTOFpid) && !(statusTrack & AliESDtrack::kTOFmismatch) ){
-                                               fHistograms->FillHistogram("MC_ESD_TOF_PidCut_E_P_dT", iTrack->GetP(), dTtrack);        
-                                       }
-                               }
-                       }
-               }
-               
-               if( AliPID::kElectron != pid) continue;
-               
-               // electron track candidates from here
-               
-               if( iTrack->GetSign() > 0 ){
-                       fEposCandidateIndex.push_back(i);
-               } else {
-                       fEnegCandidateIndex.push_back(i);
-               }
-       }
-       
-       // gamma candidates
-       GetGammaCandidates(fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex);
-       
-       if(fDoMC) {
-               TClonesArray* pi0Dalitz = FindParticleDalitz(fEposCandidateIndex, fEnegCandidateIndex, fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex,1);
-               ((TH1*)fHistograms->GetValue("Table_Cuts"))->Fill(1.,(Double_t)pi0Dalitz->GetEntriesFast());
-               delete pi0Dalitz;
-       }
-       
-       if(fUseTrackIndexCut) {// remove repeated tracks
-               ESDtrackIndexCut(fEposCandidateIndex,fEnegCandidateIndex, fGammaCandidates);
-               if(fDoMC) {
-                       TClonesArray* pi0Dalitz = FindParticleDalitz(fEposCandidateIndex, fEnegCandidateIndex, fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex,1);
-                       ((TH1*)fHistograms->GetValue("Table_Cuts"))->Fill(2.,(Double_t)pi0Dalitz->GetEntriesFast());
-                       delete pi0Dalitz;
-               }
-       }
-       
-       if(fUsePsiPairCut) {// remove electrons from gamma conversions
-               PsiPairCut(fEposCandidateIndex,fEnegCandidateIndex);
-               if(fDoMC) {
-                       TClonesArray* pi0Dalitz = FindParticleDalitz(fEposCandidateIndex, fEnegCandidateIndex, fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex,1);
-                       ((TH1*)fHistograms->GetValue("Table_Cuts"))->Fill(3.,(Double_t)pi0Dalitz->GetEntriesFast());
-                       delete pi0Dalitz;
-               }
-       }
-       
-       if( fUseMassCut ) {
-               MassCut(fEposCandidateIndex, fEnegCandidateIndex);
-               if(fDoMC) {
-                       TClonesArray* pi0Dalitz = FindParticleDalitz(fEposCandidateIndex, fEnegCandidateIndex, fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex,1);
-                       ((TH1*)fHistograms->GetValue("Table_Cuts"))->Fill(4.,(Double_t)pi0Dalitz->GetEntriesFast());
-                       delete pi0Dalitz;
-               }
-       }
-       
-       if(fUseGammaCut) {
-               AngleEposEnegGammaCut(fEposCandidateIndex,fEnegCandidateIndex,fV0Reader->GetCurrentEventGoodV0s(), fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex);
-               
-               if(fDoMC) {
-                       TClonesArray* pi0Dalitz = FindParticleDalitz(fEposCandidateIndex, fEnegCandidateIndex, fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex,1);
-                       ((TH1*)fHistograms->GetValue("Table_Cuts"))->Fill(5.,(Double_t)pi0Dalitz->GetEntriesFast());
-                       delete pi0Dalitz;
-               }
-       }
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::ProcessGammaElectronsForDalitzAnalysis()
-{
-//
-// Process gamma and electrons for pi0 Dalitz decay
-//
-       if( fDebug ) AliInfo("=> ProcessGammaElectronsForDalitzAnalysis");
-       
-       fHistograms->FillTable( "Table_Reconstruction", 0); // number of events
-
-       TClonesArray* ePosCandidates = IndexToAliKFParticle(fEposCandidateIndex, ::kPositron);
-       
-       for(Int_t i=0; i < ePosCandidates->GetEntriesFast(); ++i) {
-               AliKFParticle* epos = (AliKFParticle*) ePosCandidates->At(i);
-               fHistograms->FillHistogram("ESD_EposCandidates_Pt", epos->GetPt());
-               fHistograms->FillHistogram("ESD_EposCandidates_Eta", epos->GetEta());
-               fHistograms->FillTable( "Table_Reconstruction", 1);
-       }
-       
-       TClonesArray* eNegCandidates = IndexToAliKFParticle(fEnegCandidateIndex, ::kElectron);
-       
-       for(Int_t i=0; i < eNegCandidates->GetEntriesFast(); ++i) {
-               AliKFParticle* eneg = (AliKFParticle*) eNegCandidates->At(i);
-               fHistograms->FillHistogram("ESD_EnegCandidates_Pt", eneg->GetPt());
-               fHistograms->FillHistogram("ESD_EnegCandidates_Eta", eneg->GetEta());
-               fHistograms->FillTable( "Table_Reconstruction", 2);
-       }
-       
-       TClonesArray* dalitzPairCandidates = FindDalitzPair(ePosCandidates, eNegCandidates);
-       for(Int_t i=0; i < dalitzPairCandidates->GetEntriesFast(); ++i) {
-               TLorentzVector* dalitz = (TLorentzVector*)dalitzPairCandidates->At(i);
-               fHistograms->FillHistogram("ESD_DalitzPairCandidates_Pt", dalitz->Pt());
-               fHistograms->FillHistogram("ESD_DalitzPairCandidates_InvMass", dalitz->M());
-      fHistograms->FillHistogram("ESD_DalitzPairCandidates_InvMass_vs_Pt",dalitz->M(),dalitz->Pt());
-       }
-       
-       // gamma candidates
-       for(Int_t i=0; i < fGammaCandidates->GetEntriesFast(); ++i) {
-               AliKFParticle* gamma = (AliKFParticle*) fGammaCandidates->At(i);
-               fHistograms->FillHistogram("ESD_GammaCandidates_Pt", gamma->GetPt());
-               fHistograms->FillHistogram("ESD_GammaCandidates_Eta", gamma->GetEta());
-       }
-       
-       // psi pair for all candidates
-       //if(fUsePsiPairCut)
-       FillPsiPair(ePosCandidates,eNegCandidates,"ESD_EposEneg_PsiPair_vs_DPhi");
-       
-       // Angle epos,eneg gamma
-       FillAngle(ePosCandidates, fGammaCandidates, "ESD_EposEneg_GammaCandidates_Angle");
-       FillAngle(eNegCandidates, fGammaCandidates, "ESD_EposEneg_GammaCandidates_Angle");
-       
-       
-       for(Int_t iPos=0; iPos < ePosCandidates->GetEntriesFast(); ++iPos) {
-               AliKFParticle* lPosKF = (AliKFParticle*)ePosCandidates->At(iPos);
-
-               for(Int_t iNeg=0; iNeg < eNegCandidates->GetEntriesFast(); ++iNeg) {
-                       AliKFParticle* lNegKF = (AliKFParticle*)eNegCandidates->At(iNeg);
-                       AliKFParticle lPosNeg(*lPosKF,*lNegKF );
-                       
-                       for(Int_t iGam=0; iGam < fGammaCandidates->GetEntriesFast(); ++iGam) {
-                               AliKFParticle* lGamKF = (AliKFParticle*)fGammaCandidates->At(iGam);
-                               
-                               AliKFParticle lPosNegGam( *lPosKF, *lNegKF, *lGamKF );
-
-                               Double_t lDiffMass = lPosNegGam.GetMass() - lPosNeg.GetMass();
-
-                               Double_t RapidityParticle     = RapidityKF(lPosNegGam); 
-                               if (    TMath::Abs(RapidityParticle) < fV0Reader->GetRapidityMesonCut()){ 
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_P", lPosNegGam.GetP());
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_Eta",lPosNegGam.GetEta());
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_Phi",lPosNegGam.GetPhi()); 
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_InvMass",lPosNegGam.GetMass());
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_InvMass_vs_Eta",lPosNegGam.GetMass(),lPosNegGam.GetEta());
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_InvMass_vs_Y",lPosNegGam.GetMass(),RapidityParticle);
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_InvMass_vs_Pt",lPosNegGam.GetMass(),lPosNegGam.GetPt());
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_Pt_vs_Y",lPosNegGam.GetPt(),RapidityParticle);
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_InvMassDiff",lDiffMass );
-                                       fHistograms->FillHistogram("ESD_EposEnegGamma_InvMassDiff_vs_Pt",lDiffMass,lPosNegGam.GetPt());
-                               }
-                       }
-               }
-       }
-
-       delete dalitzPairCandidates;
-       //delete pi0Candidates;
-       
-       if(fComputeBkg) {
-
-               // 1) e+e- dalitz
-               for(Int_t i=0; i < ePosCandidates->GetEntriesFast(); ++i) {
-                       AliKFParticle* epos1 = (AliKFParticle*) ePosCandidates->At(i);
-
-                       for(Int_t j=i+1; j < ePosCandidates->GetEntriesFast(); ++j) {
-                               AliKFParticle* epos2 = (AliKFParticle*) ePosCandidates->At(j);
-                               AliKFParticle ePosePos( *epos1,*epos2 );
-                               fHistograms->FillHistogram("ESD_BKG_LikeSign_InvMass",ePosePos.GetMass());
-                               fHistograms->FillHistogram("ESD_BKG_LikeSign_InvMass_vs_Pt",ePosePos.GetMass(),ePosePos.GetPt());
-                       }
-               }
-               for(Int_t i=0; i < eNegCandidates->GetEntriesFast(); ++i) {
-                       AliKFParticle* eneg1 = (AliKFParticle*) eNegCandidates->At(i);
-
-                       for(Int_t j=i+1; j < eNegCandidates->GetEntriesFast(); ++j) {
-                               AliKFParticle* eneg2 = (AliKFParticle*) eNegCandidates->At(j);
-                               AliKFParticle eNegeNeg( *eneg1,*eneg2 );
-                               fHistograms->FillHistogram("ESD_BKG_LikeSign_InvMass",eNegeNeg.GetMass());
-                               fHistograms->FillHistogram("ESD_BKG_LikeSign_InvMass_vs_Pt",eNegeNeg.GetMass(),eNegeNeg.GetPt());
-                       }
-               }
-
-               TClonesArray* pi0Bkg;
-               TClonesArray* gammaBGHandler;
-               TClonesArray* elecBGHandler;
-
-               if( fBackgroundType == 1 ) {
-
-                       // 1) e+e- with with gammas used in the signal
-                       pi0Bkg = FindParticleDalitz(ePosCandidates, eNegCandidates, fGammaPool,1);
-               
-                       for(Int_t i=0; i < pi0Bkg->GetEntriesFast(); ++i) {
-                               TLorentzVector* pi0 = (TLorentzVector*)pi0Bkg->At(i);
-                               fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMass", pi0->M());
-                               fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMass_vs_Pt",pi0->M(),pi0->Pt());
-                       }
-                       
-                       if(ePosCandidates->GetEntriesFast() > 0 &&
-                               eNegCandidates->GetEntriesFast() > 0 &&
-                               fGammaCandidates->GetEntriesFast() > 0) {
-                               
-                               UpdateGammaPool(fGammaCandidates);
-                       }
-                       
-                       delete pi0Bkg;
-               } else if( fBackgroundType == 2) { // 2) e+e- with gammas from a pool of events
-                       gammaBGHandler = GammasFromBGHandler();
-                       pi0Bkg = FindParticleDalitz(ePosCandidates, eNegCandidates, gammaBGHandler,2);
-                       
-                       for(Int_t i=0; i < pi0Bkg->GetEntriesFast(); ++i) {
-                               TLorentzVector* pi0 = (TLorentzVector*)pi0Bkg->At(i);
-                               fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMass", pi0->M());
-                               fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMass_vs_Pt",pi0->M(), pi0->Pt());
-                       }
-               
-                       delete pi0Bkg;
-         delete gammaBGHandler;
-               }
-               
-               // 3) e+ with e-, gamma from a pool of events
-               else if( fBackgroundType == 3 ){
-
-                       elecBGHandler = ElectronFromBGHandler();
-                       gammaBGHandler = GammasFromBGHandler();
-                       pi0Bkg = FindParticleDalitz(ePosCandidates, elecBGHandler, gammaBGHandler,3);
-               
-                       for(Int_t i=0; i < pi0Bkg->GetEntriesFast(); ++i){
-                               TLorentzVector* pi0 = (TLorentzVector*)pi0Bkg->At(i);
-                               fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMass", pi0->M());
-                               fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMass_vs_Pt",pi0->M(), pi0->Pt());
-                       }
-               
-                       if(eNegCandidates->GetEntriesFast() > 0) {
-                               UpdateElectronPool(eNegCandidates);
-                       }
-               
-                       delete gammaBGHandler;
-                       delete elecBGHandler;
-                       delete pi0Bkg;
-               }
-       }
-       
-       delete ePosCandidates;
-       delete eNegCandidates;
-       
-       if(fDoMC) {
-               TClonesArray* ePosPi0Dalitz = FindElectronFromPi0Dalitz(fEposCandidateIndex, ::kPositron);
-               for(Int_t i=0; i < ePosPi0Dalitz->GetEntriesFast(); ++i) {
-                       AliKFParticle* epos = (AliKFParticle*) ePosPi0Dalitz->At(i);
-
-                       fHistograms->FillHistogram("MC_ESD_Pi0_EposDalitz_Pt", epos->GetPt());
-                       fHistograms->FillHistogram("MC_ESD_Pi0_EposDalitz_Eta", epos->GetEta());
-
-                       fHistograms->FillTable( "Table_Reconstruction", 3);
-               }
-               
-               TClonesArray* eNegPi0Dalitz = FindElectronFromPi0Dalitz(fEnegCandidateIndex, ::kElectron);
-               for(Int_t i=0; i < eNegPi0Dalitz->GetEntriesFast(); ++i){
-                       AliKFParticle* eneg = (AliKFParticle*) eNegPi0Dalitz->At(i);
-                       fHistograms->FillHistogram("MC_ESD_Pi0_EnegDalitz_Pt", eneg->GetPt());
-                       fHistograms->FillHistogram("MC_ESD_Pi0_EnegDalitz_Eta", eneg->GetEta());
-                       fHistograms->FillTable( "Table_Reconstruction", 4);
-               }
-               
-               TClonesArray* dalitzPairPi0 = FindDalitzPair(fEposCandidateIndex, fEnegCandidateIndex,1);
-               for(Int_t i=0; i < dalitzPairPi0->GetEntriesFast(); ++i) {
-                       TLorentzVector* dalitz = (TLorentzVector*) dalitzPairPi0->At(i);
-                       fHistograms->FillHistogram("MC_ESD_Pi0_DalitzPair_Pt", dalitz->Pt());
-                       fHistograms->FillHistogram("MC_ESD_Pi0_DalitzPair_Mass", dalitz->M());
-                       fHistograms->FillHistogram( "Table_Reconstruction", 5 );
-               }
-               
-               TClonesArray* dalitzPairEta = FindDalitzPair(fEposCandidateIndex, fEnegCandidateIndex,2);
-               for(Int_t i=0; i < dalitzPairEta->GetEntriesFast(); ++i) {
-                       TLorentzVector* dalitz = (TLorentzVector*) dalitzPairEta->At(i);
-                       fHistograms->FillHistogram("MC_ESD_Eta0_DalitzPair_Pt", dalitz->Pt());
-                       fHistograms->FillHistogram("MC_ESD_Eta0_DalitzPair_InvMass", dalitz->M());
-               }
-
-               TClonesArray* lJpsiAll = FindJpsi(fEposCandidateIndex, fEnegCandidateIndex,-1);
-
-               for(Int_t i=0; i < lJpsiAll->GetEntriesFast(); ++i){
-                               TLorentzVector* jpsi = (TLorentzVector*) lJpsiAll->At(i);
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Pt",jpsi->Pt());
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_InvMass",jpsi->M());
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_InvMass_vs_Pt",jpsi->M(),jpsi->Pt());
-               }
-
-
-               TClonesArray* lJpsiChic0 = FindJpsi(fEposCandidateIndex, fEnegCandidateIndex,0);
-
-               for(Int_t i=0; i < lJpsiChic0->GetEntriesFast(); ++i) {
-                               TLorentzVector* jpsi = (TLorentzVector*) lJpsiChic0->At(i);
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Chic0_Pt",jpsi->Pt());
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Chic0_InvMass",jpsi->M());
-               }
-               TClonesArray* lJpsiChic1 = FindJpsi(fEposCandidateIndex, fEnegCandidateIndex,1);
-
-               for(Int_t i=0; i < lJpsiChic1->GetEntriesFast(); ++i) {
-                               TLorentzVector* jpsi = (TLorentzVector*) lJpsiChic1->At(i);
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Chic1_Pt",jpsi->Pt());
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Chic1_InvMass",jpsi->M());
-               }
-               TClonesArray* lJpsiChic2 = FindJpsi(fEposCandidateIndex, fEnegCandidateIndex,2);
-
-               for(Int_t i=0; i < lJpsiChic2->GetEntriesFast(); ++i) {
-                               TLorentzVector* jpsi = (TLorentzVector*) lJpsiChic2->At(i);
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Chic2_Pt",jpsi->Pt());
-                               fHistograms->FillHistogram("MC_ESD_Jpsi_Chic2_InvMass",jpsi->M());
-               }
-
-               // psi pair for dalitz pairs
-               //if(fUsePsiPairCut)
-               FillPsiPair(ePosPi0Dalitz,eNegPi0Dalitz,"MC_ESD_Pi0_DalitzPair_PsiPair_vs_DPhi");
-               
-               delete ePosPi0Dalitz;
-               delete eNegPi0Dalitz;
-               delete dalitzPairPi0;
-               delete dalitzPairEta;
-               delete lJpsiAll;
-               delete lJpsiChic0;
-               delete lJpsiChic1;
-               delete lJpsiChic2;
-               // all gammas
-               TClonesArray* gamma = FindGamma(fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex);
-               for(Int_t i=0; i < gamma->GetEntriesFast(); ++i){
-                       AliKFParticle* iGamma = (AliKFParticle*) gamma->At(i);
-                       fHistograms->FillHistogram("MC_ESD_Gamma_Pt", iGamma->GetPt());
-                       fHistograms->FillHistogram("MC_ESD_Gamma_Eta", iGamma->GetEta());
-               }
-               
-               delete gamma;
-               
-               // gamma from pi0 dalitz
-               TClonesArray* gammaPi0Dalitz = FindGammaFromPi0Dalitz(fGammaCandidates, fGammaCandidatePosIndex, fGammaCandidateNegIndex);
-               for(Int_t i=0; i < gammaPi0Dalitz->GetEntriesFast(); ++i)
-               {
-                       AliKFParticle* iGamma = (AliKFParticle*) gammaPi0Dalitz->At(i);
-                       fHistograms->FillHistogram("MC_ESD_GammaPi0Dalitz_Pt", iGamma->GetPt());
-                       fHistograms->FillHistogram("MC_ESD_GammaPi0Dalitz_Eta", iGamma->GetEta());
-                       fHistograms->FillTable( "Table_Reconstruction", 6);
-               }
-               
-               delete gammaPi0Dalitz;
-               
-               for( UInt_t iPos=0; iPos < fEposCandidateIndex.size(); ++iPos ) {
-                       AliESDtrack* posTrack = fESDEvent->GetTrack(fEposCandidateIndex[iPos]);
-                       Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-                       Int_t posLabel = TMath::Abs(posTrack->GetLabel());
-                                                       
-                       AliKFParticle posKF( *posTrack->GetConstrainedParam(), ::kPositron );
-               
-                       for( UInt_t iNeg=0; iNeg < fEnegCandidateIndex.size(); ++iNeg ) {
-                               AliESDtrack* negTrack = fESDEvent->GetTrack(fEnegCandidateIndex[iNeg]);
-                               Int_t negLabel = TMath::Abs(negTrack->GetLabel());
-
-                               Int_t jpsiLabel = fStack->Particle(negLabel)->GetMother(0);
-
-                               if( !HaveSameMother(posLabel,negLabel) ) continue; //Check if both particles have same mother
-
-                               Bool_t kPi0Mother  = IsDalitzPair(posLabel,negLabel,1); //comes from Pi0
-                               Bool_t kEta0Mother = IsDalitzPair(posLabel,negLabel,2); //comes from Eta0
-                               Bool_t kJpsiMother  = kFALSE;
-                               Bool_t kGammaMother = kFALSE;
-
-
-                               if ( fStack->Particle(jpsiLabel)->GetPdgCode() == 443  ) {
-                                       kJpsiMother = kTRUE;
-                               } else if( fStack->Particle(jpsiLabel)->GetPdgCode() ==  ::kGamma   ) {
-                                       kGammaMother = kTRUE;
-                               }
-
-                               
-                               if( !kPi0Mother  &&  //1: Pi0->DalitzDecay 
-                                               !kEta0Mother &&  //2: Eta0->DalitzDecay
-                                               !kJpsiMother &&  //3: Jpsi
-                                               !kGammaMother   ) continue;
-                               
-                               Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                               AliKFParticle negKF( *negTrack->GetConstrainedParam(), ::kElectron );
-                               AliKFParticle lPosNeg(posKF,negKF );
-                               
-                               for(Int_t iGam=0; iGam < fGammaCandidates->GetEntriesFast(); ++iGam) {
-                                       AliKFParticle* gamKF = (AliKFParticle*)fGammaCandidates->At(iGam);
-                                       
-                                       Int_t labelv1 = TMath::Abs((fESDEvent->GetTrack(fGammaCandidatePosIndex[iGam]))->GetLabel());
-                                       Int_t labelv2 = TMath::Abs((fESDEvent->GetTrack(fGammaCandidateNegIndex[iGam]))->GetLabel());
-                                       
-                                       if( !HaveSameMother(labelv1,labelv2) ) continue;
-                                       
-                                       Int_t labelGamma = TMath::Abs(fStack->Particle(labelv1)->GetMother(0));
-                                       
-                                       if( fStack->Particle(labelGamma)->GetPdgCode() != ::kGamma ) continue;
-
-                                       AliKFParticle lPosNegGam( posKF, negKF, *gamKF );
-
-                                       Double_t lDiffMass = lPosNegGam.GetMass() - lPosNeg.GetMass();
-                                       Double_t RapidityParticle     = RapidityKF(lPosNegGam); 
-
-                                       if (    TMath::Abs(RapidityParticle) < fV0Reader->GetRapidityMesonCut()){ 
-                                               if( kPi0Mother == kTRUE || kEta0Mother == kTRUE ){
-                                                       if( !HaveSameMother(labelGamma, posLabel) ) continue;
-                                               
-                                                       if( IsDalitzPair(posLabel,negLabel,1) == kTRUE ){
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_P", lPosNegGam.GetP());
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_Phi", lPosNegGam.GetPhi());
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_InvMass", lPosNegGam.GetMass());
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_InvMass_vs_Pt",lPosNegGam.GetMass(),lPosNegGam.GetPt());
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_InvMass_vs_Y", lPosNegGam.GetMass(), RapidityParticle);
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_InvMass_vs_Eta", lPosNegGam.GetMass(),lPosNegGam.GetEta());
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_Pt_vs_Y",lPosNegGam.GetPt(), RapidityParticle);
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_InvMassDiff",lDiffMass);
-                                                               fHistograms->FillHistogram("MC_ESD_Pi0_InvMassDiff_vs_Pt",lDiffMass,lPosNegGam.GetPt());
-                                                       } else if( IsDalitzPair(posLabel,negLabel,2) == kTRUE ) {
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_P", lPosNegGam.GetP());
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_Phi", lPosNegGam.GetPhi());
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_InvMass",lPosNegGam.GetMass());
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_InvMass_vs_Pt", lPosNegGam.GetMass(),lPosNegGam.GetPt());
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_InvMass_vs_Y",lPosNegGam.GetMass(),RapidityParticle);
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_InvMass_vs_Eta",lPosNegGam.GetMass(),lPosNegGam.GetEta());
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_Pt_vs_Y", lPosNegGam.GetPt(),RapidityParticle);
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_InvMassDiff",lDiffMass);
-                                                               fHistograms->FillHistogram("MC_ESD_Eta0_InvMassDiff_vs_Pt",lDiffMass,lPosNegGam.GetPt());
-                                                       }
-                                                       fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMassDiff",lDiffMass);
-                                                       fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMassDiff_vs_Pt",lDiffMass,lPosNegGam.GetPt());
-                                                       fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMass",lPosNegGam.GetMass());
-                                                       fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMass_vs_Pt",lPosNegGam.GetMass(),lPosNegGam.GetPt());
-                                               } else if( kGammaMother == kTRUE ) {
-                                                       if( !HaveSameMother(labelGamma, jpsiLabel ) ) continue;
-                                                       if( fStack->Particle(labelGamma)->GetMother(0) < 0 ) continue;
-
-                                                       Int_t MotherGammaGammalabel = fStack->Particle(labelGamma)->GetMother(0);
-                                                       TParticle* parMotherGammaGamma = fStack->Particle(MotherGammaGammalabel);
-                                                       
-
-                                                       if( parMotherGammaGamma->GetPdgCode() == ::kPi0 || parMotherGammaGamma->GetPdgCode() == 221 ){
-                                                               fHistograms->FillHistogram("MC_ESD_GammaGamma_InvMassDiff",lDiffMass);
-                                                               fHistograms->FillHistogram("MC_ESD_GammaGamma_InvMassDiff_vs_Pt",lDiffMass,lPosNegGam.GetPt());
-                                                               fHistograms->FillHistogram("MC_ESD_GammaGamma_InvMass",lPosNegGam.GetMass());
-                                                               fHistograms->FillHistogram("MC_ESD_GammaGamma_InvMass_vs_Pt",lPosNegGam.GetMass(),lPosNegGam.GetPt());
-                                                       }
-                                               } else if( kJpsiMother == kTRUE ){
-                                                       if( !HaveSameMother(labelGamma, jpsiLabel ) ) continue;
-
-
-                                                       TParticle *jpsiParticle = fStack->Particle(jpsiLabel);
-
-                                                       if ( jpsiParticle->GetMother(0) < 0 ) continue; 
-
-
-                                                       Int_t chicLabel = jpsiParticle->GetMother(0);
-
-                                                       Int_t MotherpdgCode = fStack->Particle(chicLabel)->GetPdgCode();
-
-
-                                                       if( MotherpdgCode == 10441 || MotherpdgCode == 20443 || MotherpdgCode == 445 ) {
-                                                               fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMassDiff",lDiffMass);
-                                                               fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMassDiff_vs_Pt",lDiffMass,lPosNegGam.GetPt());
-                                                               fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMass",lPosNegGam.GetMass());
-                                                               fHistograms->FillHistogram("MC_ESD_EposEnegGamma_InvMass_vs_Pt",lPosNegGam.GetMass(),lPosNegGam.GetPt());
-                                                       }
-                                               }
-                                       }
-                               } 
-                       }
-               }
-               
-               // psi pair for electrons from gamma conversions assuming they came from main vertex
-               // if(fUsePsiPairCut)
-               for(UInt_t i=0; i < fEposCandidateIndex.size(); ++i) {
-                       AliESDtrack* posTrack = fESDEvent->GetTrack(fEposCandidateIndex[i]);
-                       Int_t posLabel = TMath::Abs(posTrack->GetLabel());
-                       
-                       for(UInt_t j=0; j < fEnegCandidateIndex.size(); ++j) {
-                               AliESDtrack* negTrack = fESDEvent->GetTrack(fEnegCandidateIndex[j]);
-                               Int_t negLabel = TMath::Abs(negTrack->GetLabel());
-                               
-                               if(!IsFromGammaConversion(posLabel,negLabel)) continue;
-                               
-                               Double_t psiPair = GetPsiPair(posTrack, negTrack);
-                               Double_t deltaPhi = fMagFieldSign * TVector2::Phi_mpi_pi( negTrack->GetConstrainedParam()->Phi()-posTrack->GetConstrainedParam()->Phi());
-                               
-                               fHistograms->FillHistogram("MC_ESD_EposEnegGamma_PsiPair_vs_DPhi", deltaPhi, psiPair);
-                       }
-               }
-               // FIXME: eta -> e+e-gamma
-       }
-}
-
-//--------------------------------------------------------------------------
-Double_t AliAnalysisTaskGammaConvDalitz::Rapidity(const TParticle* p) const
-{
-//
-// Get rapidity
-//
-       const double kEPSILON=1.e-16;
-       
-       if(p->Energy() - TMath::Abs(p->Pz()) < kEPSILON ) {
-               return 1.e10;
-       }
-       return 0.5*TMath::Log( (p->Energy()+p->Pz()) / (p->Energy()-p->Pz()) );
-}
-
-Double_t AliAnalysisTaskGammaConvDalitz::RapidityKF(const AliKFParticle p) const
-{
-//
-// Get rapidity
-//
-       const double kEPSILON=1.e-16;
-       
-       if((p.GetE()-TMath::Abs(p.GetPz())) < kEPSILON ) {
-               return 1.e10;
-       }
-       return 0.5*TMath::Log( (p.GetE()+p.GetPz()) / (p.GetE()-p.GetPz()) );
-}
-
-//--------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::FillPsiPair(const TClonesArray* pos, const TClonesArray* neg, const TString& hName)
-{
-//
-// Fill histogram with psipair(pos,neg)
-//
-       for(Int_t i=0; i < pos->GetEntriesFast(); ++i ){
-               AliKFParticle* posKF = (AliKFParticle*) pos->At(i);
-               for( Int_t j=0; j < neg->GetEntriesFast(); ++j ){
-                       AliKFParticle* negKF = (AliKFParticle*) neg->At(j);
-                       Double_t psiPair = GetPsiPair(posKF, negKF);
-                       Double_t deltaPhi = fMagFieldSign * TVector2::Phi_mpi_pi( negKF->GetPhi() - posKF->GetPhi());
-                       fHistograms->FillHistogram(hName, deltaPhi, psiPair);
-               }
-       }
-}
-
-//--------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::FillAngle(const TClonesArray* x, const TClonesArray* y, const TString& hName)
-{
-//
-// Fill histogram with angle(x,y)
-//
-       for(Int_t i=0; i < x->GetEntriesFast(); ++i ){
-               AliKFParticle* xKF = (AliKFParticle*) x->At(i);
-               TVector3 xMom(xKF->Px(),xKF->Py(),xKF->Pz());
-               for( Int_t j=0; j < y->GetEntriesFast(); ++j ){
-                       AliKFParticle* yKF = (AliKFParticle*) y->At(j);
-                       TVector3 yMom(yKF->Px(),yKF->Py(),yKF->Pz());
-                       fHistograms->FillHistogram(hName, xMom.Angle(yMom));
-               }
-       }
-}
-
-//--------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::FillPidTable(const TParticle* p, Int_t pid)
-{
-//
-// Fill table with pid info
-//
-       Int_t iGen=-1;
-       switch(TMath::Abs(p->GetPdgCode())){
-               case ::kElectron:   iGen=0; break;
-               case ::kMuonMinus:  iGen=1; break;
-               case ::kPiPlus:     iGen=2; break;
-               case ::kKPlus:      iGen=3; break;
-               case ::kProton:     iGen=4; break;
-               default: iGen=-1;
-       }
-       
-       int jRec=-1;
-       if(pid > -1 && pid < 5) jRec = pid;
-       
-       if ((iGen > -1) && (jRec > -1)){
-               fHistograms->FillTable("Table_PID", iGen, jRec);
-               // sum
-               fHistograms->FillTable("Table_PID", iGen, 5);
-               fHistograms->FillTable("Table_PID", 5, jRec);
-       }
-}
-
-//--------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::GetGammaCandidates(TClonesArray*& gamma, vector<Int_t>& posIndex, vector<Int_t>& negIndex)
-{
-//
-// Make a copy of gamma candidates from V0reader
-//
-       posIndex.clear();
-       negIndex.clear();
-       
-       if(gamma) delete gamma;
-       
-       TClonesArray* gammaV0 = fV0Reader->GetCurrentEventGoodV0s();
-       
-       gamma = new TClonesArray("AliKFParticle", gammaV0->GetEntriesFast());
-       gamma->SetOwner(kTRUE);
-       
-       // make a copy
-       for(Int_t i=0; i < gammaV0->GetEntriesFast(); ++i){
-               AliKFParticle* gamKF = (AliKFParticle*)gammaV0->At(i);
-               new ((*gamma)[i]) AliKFParticle(*gamKF);
-               posIndex.push_back(fV0Reader->GetPindex(i));
-               negIndex.push_back(fV0Reader->GetNindex(i));
-       }
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::IndexToAliKFParticle(const vector<Int_t>& index, Int_t PDG)
-{
-//
-// Convert track index vector to AliKFParticle array
-//
-       TClonesArray* indexKF = new TClonesArray("AliKFParticle",index.size());
-       indexKF->SetOwner(kTRUE);
-       
-       for(UInt_t i = 0; i < index.size(); ++i){
-               AliESDtrack* t = fESDEvent->GetTrack(index[i]);
-               new((*indexKF)[i]) AliKFParticle(*t->GetConstrainedParam(), PDG);
-       }
-       
-       return indexKF;
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindElectronFromPi0Dalitz(const vector<Int_t>& candidates, Int_t PDG)
-{
-//
-// Find true electrons from pi0 Dalitz decay candidates with MC
-//
-       TClonesArray* elec = new TClonesArray("AliKFParticle");
-       elec->SetOwner(kTRUE);
-       
-       for(UInt_t i=0, j=0; i < candidates.size(); ++i){
-               AliESDtrack* track = fESDEvent->GetTrack(candidates[i]);
-               Int_t trackLabel = TMath::Abs(track->GetLabel());
-               
-               if( fStack->Particle(trackLabel)->GetPdgCode() != PDG ) continue;
-               if( !IsPi0DalitzDaughter(trackLabel) ) continue;
-               
-               new ((*elec)[j++]) AliKFParticle(*track->GetConstrainedParam(), PDG);
-       }
-       
-       return elec;
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindGammaFromPi0Dalitz(const TClonesArray* gamma, const vector<Int_t>& posIdx, const vector<Int_t>& negIdx)
-{
-//
-// Find true gammas from pi0 Dalitz decay candidates with MC
-//
-       TClonesArray* gammaPi0 = new TClonesArray("AliKFParticle");
-       gammaPi0->SetOwner(kTRUE);
-       
-       for(Int_t i=0, j=0; i < gamma->GetEntriesFast(); ++i) {
-               AliKFParticle* gamKF = (AliKFParticle*)gamma->At(i);
-               
-               Int_t labelv1 = TMath::Abs((fESDEvent->GetTrack(posIdx[i]))->GetLabel());
-               Int_t labelv2 = TMath::Abs((fESDEvent->GetTrack(negIdx[i]))->GetLabel());
-               
-               if( !HaveSameMother(labelv1,labelv2) ) continue;
-               
-               Int_t labelGamma = TMath::Abs(fStack->Particle(labelv1)->GetMother(0));
-               
-               if( fStack->Particle(labelGamma)->GetPdgCode() != ::kGamma ) continue;
-               
-               if( !IsPi0DalitzDaughter( labelGamma) ) continue;
-               
-               new ((*gammaPi0)[j++]) AliKFParticle(*gamKF);
-       }
-       
-       return gammaPi0;
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindGamma(const TClonesArray* gamma, const vector<Int_t>& posIdx, const vector<Int_t>& negIdx)
-{
-//
-// Find true gammas from gamma candidates with MC
-//
-       TClonesArray* gammaConv = new TClonesArray("AliKFParticle");
-       gammaConv->SetOwner(kTRUE);
-       
-       for(Int_t i=0, j=0; i < gamma->GetEntriesFast(); ++i){
-               AliKFParticle* gamKF = (AliKFParticle*)gamma->At(i);
-               
-               Int_t labelv1 = TMath::Abs((fESDEvent->GetTrack(posIdx[i]))->GetLabel());
-               Int_t labelv2 = TMath::Abs((fESDEvent->GetTrack(negIdx[i]))->GetLabel());
-               
-               if( !HaveSameMother(labelv1,labelv2) ) continue;
-               
-               Int_t labelGamma = TMath::Abs(fStack->Particle(labelv1)->GetMother(0));
-               
-               if( fStack->Particle(labelGamma)->GetPdgCode() != ::kGamma ) continue;
-               
-               new ((*gammaConv)[j++]) AliKFParticle(*gamKF);
-       }
-       
-       return gammaConv;
-}
-
-//--------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::ESDtrackIndexCut(vector<Int_t>& pos, vector<Int_t>& neg, const TClonesArray* gamma)
-{
-//
-// Remove repeated electron candidate tracks
-// according to the gamma candidate array
-//
-       vector<Bool_t> posTag(pos.size(),kTRUE);
-       vector<Bool_t> negTag(neg.size(),kTRUE);
-       
-       for(Int_t i=0; i < gamma->GetEntriesFast(); ++i){
-               Int_t gamPosIndex = fGammaCandidatePosIndex[i];
-               Int_t gamNegIndex = fGammaCandidateNegIndex[i];
-               
-               for( UInt_t j=0; j < pos.size(); ++j ){
-                       if(pos[j] == gamPosIndex || pos[j] == gamNegIndex) posTag[j] = kFALSE;
-               }
-               
-               for( UInt_t j=0; j < neg.size(); ++j )  {
-                       if(neg[j] == gamPosIndex || neg[j] == gamNegIndex) negTag[j] = kFALSE;
-               }
-       }
-       
-       CleanArray(pos, posTag);
-       CleanArray(neg, negTag);
-}
-
-//--------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::PsiPairCut(vector<Int_t>& pos, vector<Int_t>& neg)
-{
-//
-// Remove electron candidates from gamma conversions
-// according to the Psi pair angle
-//
-       vector<Bool_t> posTag(pos.size(), kTRUE);
-       vector<Bool_t> negTag(neg.size(), kTRUE);
-
-       for( UInt_t i=0; i < pos.size(); ++i ){
-               AliESDtrack* posTrack = fESDEvent->GetTrack(pos[i]);
-
-               for( UInt_t j=0; j < neg.size(); ++j ){
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(neg[j]);
-
-                       Double_t psiPair = GetPsiPair(posTrack, negTrack);
-                       Double_t deltaPhi = fMagFieldSign * TVector2::Phi_mpi_pi( negTrack->GetConstrainedParam()->Phi()-posTrack->GetConstrainedParam()->Phi());
-
-                       if(IsFromGammaConversion( psiPair, deltaPhi )) {
-                                       posTag[i] = kFALSE;
-                                       negTag[j] = kFALSE;
-                       }
-               }
-       }
-
-       CleanArray(pos, posTag);
-       CleanArray(neg, negTag);
-}
-
-//-----------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::MassCut(vector<Int_t>& pos, vector<Int_t>& neg)
-{
-//
-// Remove electron candidates pairs 
-// which have mass not in the range (fMassCutMin,fMassCutMax)
-//
-       vector<Bool_t> posTag(pos.size(), kTRUE);
-       vector<Bool_t> negTag(neg.size(), kTRUE);
-
-       for( UInt_t i=0; i < pos.size(); ++i ) {
-               AliESDtrack* posTrack = fESDEvent->GetTrack(pos[i]);
-
-               Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-               TLorentzVector posLV;
-               posLV.SetXYZM(posMom[0],posMom[1],posMom[2],fkElectronMass);
-
-               for( UInt_t j=0; j < neg.size(); ++j ){
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(neg[j]);
-
-                       Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                       TLorentzVector negLV;
-                       negLV.SetXYZM(negMom[0],negMom[1],negMom[2],fkElectronMass);
-
-                       TLorentzVector posnegLV = posLV + negLV;
-
-                       if( (posnegLV.M() < fMassCutMin) || (posnegLV.M() > fMassCutMax) ){
-                                       posTag[i] = kFALSE;
-                                       negTag[j] = kFALSE;
-                       }
-               }
-       }
-
-       CleanArray(pos, posTag);
-       CleanArray(neg, negTag);
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::CleanArray(vector<Int_t>& x, const vector<Bool_t>& tag)
-{
-//
-// Clean the x array according to the tag parameter
-//
-       vector<Int_t> tmp;
-       for(UInt_t i=0; i< x.size(); ++i){
-               if(tag[i]) tmp.push_back(x[i]);
-       }
-       
-       x = tmp;
-}
-
-//--------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::AngleEposEnegGammaCut( const vector<Int_t>& posIdx, const vector<Int_t>& negIdx, const TClonesArray* candidates, TClonesArray*& gamma, vector<Int_t>& posGamIdx, vector<Int_t>& negGamIdx)
-{
-//
-// Remove gamma candidates according to
-// the angle between the plane e+,e- and the gamma
-//
-       vector<Bool_t> gammaTag(candidates->GetEntriesFast(), kTRUE);
-       
-       for( UInt_t iPos=0; iPos < posIdx.size(); ++iPos ) {
-               AliESDtrack* posTrack = fESDEvent->GetTrack(posIdx[iPos]);
-               Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-               TVector3 xMom(posMom[0],posMom[1],posMom[2]);
-               
-               for( UInt_t iNeg=0; iNeg < negIdx.size(); ++iNeg ) {
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(negIdx[iNeg]);
-                       Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                       TVector3 yMom(negMom[0],negMom[1],negMom[2]);
-                       
-                       // normal vector to x+y- plane
-                       TVector3 planePosNeg = xMom.Cross(yMom);
-                       for(Int_t i=0; i < candidates->GetEntriesFast(); ++i) {
-                               AliKFParticle* gamKF = (AliKFParticle*)candidates->At(i);
-                               TVector3 gamMom(gamKF->Px(),gamKF->Py(),gamKF->Pz());
-                               if (planePosNeg.Angle(gamMom) < 1. || planePosNeg.Angle(gamMom) > 2.) {
-                                       gammaTag[i] = kFALSE;
-                               }
-                       }
-               }
-       }
-       
-       // Rebuild gamma candidates array
-       
-       if(gamma) delete gamma;
-       gamma = new TClonesArray("AliKFParticle");
-       gamma->SetOwner(kTRUE);
-       
-       posGamIdx.clear();
-       negGamIdx.clear();
-       
-       for(Int_t i=0, j=0; i < candidates->GetEntriesFast(); ++i) {
-               AliKFParticle* iGamma = (AliKFParticle*)candidates->At(i);
-               if(gammaTag[i]) {
-                       new ((*gamma)[j++]) AliKFParticle(*iGamma);
-                       posGamIdx.push_back(fV0Reader->GetPindex(i));
-                       negGamIdx.push_back(fV0Reader->GetNindex(i));
-               }
-       }
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindDalitzPair(const TClonesArray* pos, const TClonesArray* neg)
-{
-//
-// Find Dalitz pair candidates
-//
-       TClonesArray* dalitz = new TClonesArray("TLorentzVector");
-       dalitz->SetOwner(kTRUE);
-       
-       for( Int_t iPos=0, j=0; iPos < pos->GetEntriesFast(); ++iPos ) {
-               AliKFParticle* posKF = (AliKFParticle*)pos->At(iPos);
-               
-               TLorentzVector posLV;
-               posLV.SetXYZM(posKF->Px(),posKF->Py(),posKF->Pz(),fkElectronMass);
-               
-               for( Int_t iNeg=0; iNeg < neg->GetEntriesFast(); ++iNeg ) {
-                       AliKFParticle* negKF = (AliKFParticle*)neg->At(iNeg);
-                       
-                       TLorentzVector negLV;
-                       negLV.SetXYZM(negKF->Px(),negKF->Py(),negKF->Pz(),fkElectronMass);
-                       
-                       if(fUseAliKF) {
-                               AliKFParticle posNeg( *posKF, *negKF);
-                               
-                               TLorentzVector posNegLV;
-                               posNegLV.SetXYZM(posNeg.Px(), posNeg.Py(), posNeg.Pz(), posNeg.GetMass());
-                               new ((*dalitz)[j++]) TLorentzVector(posNegLV);
-                       } else {
-                               new ((*dalitz)[j++]) TLorentzVector(posLV + negLV);
-                       }
-               }
-       }
-       
-       return dalitz;
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindParticleDalitz(const TClonesArray* pos, const TClonesArray* neg, const TClonesArray* gamma,Int_t opc)
-{
-//
-// Find pi0 Dalitz decay candidates
-//
-       TClonesArray* pi0 = new TClonesArray("TLorentzVector");
-       pi0->SetOwner(kTRUE);
-       
-       for( Int_t iPos=0, j=0; iPos < pos->GetEntriesFast(); ++iPos ){
-               AliKFParticle* posKF = (AliKFParticle*)pos->At(iPos);
-               
-               TLorentzVector posLV;
-               posLV.SetXYZM(posKF->Px(),posKF->Py(),posKF->Pz(),fkElectronMass);
-               
-               for( Int_t iNeg=0; iNeg < neg->GetEntriesFast(); ++iNeg ) {
-                       AliKFParticle* negKF = (AliKFParticle*)neg->At(iNeg);
-                       
-                       TLorentzVector negLV;
-                       negLV.SetXYZM(negKF->Px(),negKF->Py(),negKF->Pz(),fkElectronMass);
-                       AliKFParticle posNegKF(*posKF,*negKF);
-
-                       for(Int_t iGam=0; iGam < gamma->GetEntriesFast(); ++iGam){
-                               AliKFParticle* gamKF = (AliKFParticle*)gamma->At(iGam);
-                               AliKFParticle posNegGam( *posKF, *negKF, *gamKF );
-                               
-                               Double_t lDiffMass = posNegGam.GetMass() - posNegKF.GetMass(); 
-
-                               if( opc == 1 ) {
-                                       fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMassDiff",lDiffMass );
-                                       fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMassDiff_vs_Pt",lDiffMass,posNegGam.GetPt());
-                               } else if ( opc == 2 ) {
-                                       fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMassDiff",lDiffMass );
-                                       fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMassDiff_vs_Pt",lDiffMass,posNegGam.GetPt());
-                               } else if ( opc == 3 ) {
-                                       fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMassDiff",lDiffMass );
-                                       fHistograms->FillHistogram("ESD_BKG_BGHandler_InvMassDiff_vs_Pt",lDiffMass,posNegGam.GetPt());
-                               }
-
-                               if(fUseAliKF) {
-                                       TLorentzVector posNegGamLV;
-                                       posNegGamLV.SetXYZM(posNegGam.Px(),posNegGam.Py(),posNegGam.Pz(),posNegGam.GetMass());
-                                       new ((*pi0)[j++]) TLorentzVector(posNegGamLV);
-                               } else {
-                                       TLorentzVector gamLV;
-                                       gamLV.SetXYZM(gamKF->Px(),gamKF->Py(),gamKF->Pz(),0);
-                                       new ((*pi0)[j++]) TLorentzVector(posLV + negLV + gamLV);
-                               }
-                       }
-               }
-       }
-       
-       return pi0;
-}
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindDalitzPair(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx,Int_t motherOpc)
-{
-//
-// Find true Dalitz pairs from Dalitz pair candidats with MC
-//
-       TClonesArray* dalitz = new TClonesArray("TLorentzVector");
-       dalitz->SetOwner(kTRUE);
-       
-       for( UInt_t iPos=0, j=0; iPos < posIdx.size(); ++iPos ) {
-               AliESDtrack* posTrack = fESDEvent->GetTrack(posIdx[iPos]);
-               Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-               Int_t posLabel = TMath::Abs(posTrack->GetLabel());
-               
-               TLorentzVector posLV;
-               posLV.SetXYZM(posMom[0],posMom[1],posMom[2],fkElectronMass);
-               
-               AliKFParticle posKF( *posTrack->GetConstrainedParam(), ::kPositron );
-               
-               for( UInt_t iNeg=0; iNeg < negIdx.size(); ++iNeg ) {
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(negIdx[iNeg]);
-                       Int_t negLabel = TMath::Abs(negTrack->GetLabel());
-                       
-                       if(!IsDalitzPair(posLabel,negLabel,motherOpc)) continue;
-                       
-                       if(fUseAliKF) {
-                               AliKFParticle negKF( *negTrack->GetConstrainedParam(), ::kElectron );
-                               AliKFParticle posNeg( posKF, negKF);
-                               
-                               TLorentzVector posNegLV;
-                               posNegLV.SetXYZM(posNeg.Px(),posNeg.Py(),posNeg.Pz(),posNeg.GetMass());
-                               
-                               new ((*dalitz)[j++]) TLorentzVector(posNegLV);
-                       } else {// TLorentzVector
-                       
-                               Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                               
-                               TLorentzVector negLV;
-                               negLV.SetXYZM(negMom[0],negMom[1],negMom[2],fkElectronMass);
-                               
-                               new ((*dalitz)[j++]) TLorentzVector(posLV + negLV);
-                       }
-               }
-       }
-       return dalitz;
-}
-
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindJpsi(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx,Int_t motherOpc)
-{
-//
-// Find true Jpsi's
-// If mother
-// -1: from the all sources
-// 0: from the Chic_0
-// 1: from the Chic_1
-// 2: from the Chic_2
-
-       TClonesArray* jPsi = new TClonesArray("TLorentzVector");
-       jPsi->SetOwner(kTRUE);
-       
-       for( UInt_t iPos=0, j=0; iPos < posIdx.size(); ++iPos )
-       {
-               AliESDtrack* posTrack = fESDEvent->GetTrack(posIdx[iPos]);
-               Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-               Int_t posLabel = TMath::Abs(posTrack->GetLabel());
-
-               if( fStack->Particle(posLabel)->GetPdgCode() != ::kPositron ) continue;
-               
-               TLorentzVector posLV;
-               posLV.SetXYZM(posMom[0],posMom[1],posMom[2],fkElectronMass);
-               
-               AliKFParticle posKF( *posTrack->GetConstrainedParam(), ::kPositron );
-               
-               for( UInt_t iNeg=0; iNeg < negIdx.size(); ++iNeg ) {
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(negIdx[iNeg]);
-                       Int_t negLabel = TMath::Abs(negTrack->GetLabel());
-
-                       if( fStack->Particle(negLabel)->GetPdgCode() != ::kElectron ) continue;
-                       
-                       if( !HaveSameMother(posLabel,negLabel) ) continue;
-                       
-                       Int_t motherLabel = fStack->Particle(negLabel)->GetMother(0);
-                       TParticle *motherJpsi = fStack->Particle(motherLabel);
-
-                       if( motherJpsi->GetPdgCode() != 443 ){
-                                       continue;
-                       }
-                       if( motherOpc > -1 ) { 
-                               if( motherJpsi->GetMother(0) < 0 ) continue;
-                               
-                               TParticle *gmotherChic = fStack->Particle(motherJpsi->GetMother(0));
-                               Int_t pdgCode = gmotherChic->GetPdgCode();
-
-                               Bool_t lson = kTRUE;
-                               
-                               switch(motherOpc){
-
-                                               case 0:     if ( pdgCode != 10441 )
-                                                                               lson = kFALSE;
-                                                                               break;
-                                               case 1:     if ( pdgCode != 20443 )
-                                                                               lson = kFALSE;
-                                                                               break;
-                                               case 2:     if ( pdgCode != 445   )
-                                                                               lson = kFALSE;
-                                                                               break;
-                               }
-                               if( lson == kFALSE ) continue;
-                       }
-                       if(fUseAliKF) {
-                               AliKFParticle negKF( *negTrack->GetConstrainedParam(), ::kElectron );
-                               AliKFParticle posNeg( posKF, negKF);
-                               
-                               TLorentzVector posNegLV;
-                               posNegLV.SetXYZM(posNeg.Px(),posNeg.Py(),posNeg.Pz(),posNeg.GetMass());
-                               
-                               new ((*jPsi)[j++]) TLorentzVector(posNegLV);
-                       } else {// TLorentzVector
-                       
-                                               Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                                               
-                                               TLorentzVector negLV;
-                                               negLV.SetXYZM(negMom[0],negMom[1],negMom[2],fkElectronMass);
-                                               
-                                               new ((*jPsi)[j++]) TLorentzVector(posLV + negLV);
-                       }
-               }
-       }
-       return jPsi;
-}
-
-
-
-//--------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindParticleDalitz(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx, const TClonesArray* gamma, const vector<Int_t>& posGam, const vector<Int_t>& negGam,Int_t motherOpc)
-{
-//
-// Find true pi0 Dalitz decay from pi0 candidates with MC
-//
-       TClonesArray* pi0 = new TClonesArray("TLorentzVector");
-       pi0->SetOwner(kTRUE);
-       
-       for( UInt_t iPos=0, j=0; iPos < posIdx.size(); ++iPos ) {
-               AliESDtrack* posTrack = fESDEvent->GetTrack(posIdx[iPos]);
-               Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-               Int_t posLabel = TMath::Abs(posTrack->GetLabel());
-               
-               TLorentzVector posLV;
-               posLV.SetXYZM(posMom[0],posMom[1],posMom[2],fkElectronMass);
-               
-               AliKFParticle posKF( *posTrack->GetConstrainedParam(), ::kPositron );
-               
-               for( UInt_t iNeg=0; iNeg < negIdx.size(); ++iNeg ) {
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(negIdx[iNeg]);
-                       Int_t negLabel = TMath::Abs(negTrack->GetLabel());
-               
-                       if( !HaveSameMother(posLabel,negLabel) ) continue; //Check if both particles have same mother
-                       if(!IsDalitzPair(posLabel,negLabel,motherOpc)) continue; //check if mohter is eta0 or pi0
-               
-                       Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                       
-                       TLorentzVector negLV;
-                       negLV.SetXYZM(negMom[0],negMom[1],negMom[2],fkElectronMass);
-                       
-                       AliKFParticle negKF( *negTrack->GetConstrainedParam(), ::kElectron );
-                       
-                       for(Int_t iGam=0; iGam < gamma->GetEntriesFast(); ++iGam) {
-                               AliKFParticle* gamKF = (AliKFParticle*)gamma->At(iGam);
-                               
-                               Int_t labelv1 = TMath::Abs((fESDEvent->GetTrack(posGam[iGam]))->GetLabel());
-                               Int_t labelv2 = TMath::Abs((fESDEvent->GetTrack(negGam[iGam]))->GetLabel());
-                               
-                               if( !HaveSameMother(labelv1,labelv2) ) continue;
-                               
-                               Int_t labelGamma = TMath::Abs(fStack->Particle(labelv1)->GetMother(0));
-                               
-                               if( fStack->Particle(labelGamma)->GetPdgCode() != ::kGamma ) continue;
-
-                               if( !HaveSameMother(labelGamma, posLabel) ) continue;
-                               
-                               if(fUseAliKF) {
-                                       AliKFParticle posNegGam( posKF, negKF, *gamKF );
-                                       TLorentzVector posNegGamLV;
-                                       posNegGamLV.SetXYZM(posNegGam.Px(),posNegGam.Py(),posNegGam.Pz(),posNegGam.GetMass());
-                                       new ((*pi0)[j++]) TLorentzVector(posNegGamLV);
-                               } else { // TLorentzVector
-                                       TLorentzVector gamLV;
-                                       gamLV.SetXYZM(gamKF->Px(),gamKF->Py(),gamKF->Pz(),0);
-                                       
-                                       new ((*pi0)[j++]) TLorentzVector(posLV + negLV + gamLV);
-                               }
-                       }
-               }
-       }
-       
-       return pi0;
-}
-TClonesArray* AliAnalysisTaskGammaConvDalitz::FindParticleChic(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx, const TClonesArray* gamma, const vector<Int_t>& posGam, const vector<Int_t>& negGam,Int_t motherOpc)
-{
-//
-// Find true pi0 Dalitz decay from pi0 candidates with MC
-//
-       TClonesArray* chic = new TClonesArray("TLorentzVector");
-       chic->SetOwner(kTRUE);
-       
-       for( UInt_t iPos=0, j=0; iPos < posIdx.size(); ++iPos ) {
-               AliESDtrack* posTrack = fESDEvent->GetTrack(posIdx[iPos]);
-               Double_t posMom[3]; posTrack->GetConstrainedPxPyPz(posMom);
-               Int_t posLabel = TMath::Abs(posTrack->GetLabel());
-
-               if( fStack->Particle(posLabel)->GetPdgCode() != ::kPositron ) continue;
-               
-               TLorentzVector posLV;
-               posLV.SetXYZM(posMom[0],posMom[1],posMom[2],fkElectronMass);
-               
-               AliKFParticle posKF( *posTrack->GetConstrainedParam(), ::kPositron );
-               
-               for( UInt_t iNeg=0; iNeg < negIdx.size(); ++iNeg ) {
-                       AliESDtrack* negTrack = fESDEvent->GetTrack(negIdx[iNeg]);
-                       Int_t negLabel = TMath::Abs(negTrack->GetLabel());
-
-                       if( fStack->Particle(negLabel)->GetPdgCode() != ::kElectron ) continue;
-                       if( !HaveSameMother(posLabel,negLabel) ) continue;
-
-                       Int_t jpsiLabel = fStack->Particle(negLabel)->GetMother(0);
-
-                       if( fStack->Particle(jpsiLabel)->GetPdgCode() != 443 ) continue;
-                       
-                       TParticle *jpsiParticle = fStack->Particle(jpsiLabel);
-
-                       if ( jpsiParticle->GetMother(0) < 0 ) continue; 
-                       Int_t chicLabel = jpsiParticle->GetMother(0);
-
-                       Int_t pdgCode = fStack->Particle(chicLabel)->GetPdgCode();
-                       Bool_t lSon = kTRUE;
-                                       
-                       switch(motherOpc){
-                               case 0:     if ( pdgCode != 10441 )
-                                                               lSon = kFALSE;
-                                                               break;
-                               case 1:     if ( pdgCode != 20443 )
-                                                               lSon = kFALSE;
-                                                               break;
-                               case 2:     if ( pdgCode != 445   )
-                                                               lSon = kFALSE;
-                                                               break;
-                       }
-
-
-                       if( lSon == kFALSE ) continue;
-
-                       Double_t negMom[3]; negTrack->GetConstrainedPxPyPz(negMom);
-                       
-                       TLorentzVector negLV;
-                       negLV.SetXYZM(negMom[0],negMom[1],negMom[2],fkElectronMass);
-                       
-                       AliKFParticle negKF( *negTrack->GetConstrainedParam(), ::kElectron );
-                       
-                       for(Int_t iGam=0; iGam < gamma->GetEntriesFast(); ++iGam) {
-                               AliKFParticle* gamKF = (AliKFParticle*)gamma->At(iGam);
-                               
-                               Int_t labelv1 = TMath::Abs((fESDEvent->GetTrack(posGam[iGam]))->GetLabel());
-                               Int_t labelv2 = TMath::Abs((fESDEvent->GetTrack(negGam[iGam]))->GetLabel());
-                               
-                               if( !HaveSameMother(labelv1,labelv2) ) continue;
-                               
-                               Int_t labelGamma = TMath::Abs(fStack->Particle(labelv1)->GetMother(0));
-                               
-                               if( fStack->Particle(labelGamma)->GetPdgCode() != ::kGamma ) continue;
-
-                               if( !HaveSameMother(labelGamma, jpsiLabel) ) continue;
-
-                               if(fUseAliKF) {
-                                       AliKFParticle posNegGam( posKF, negKF, *gamKF );
-                                       TLorentzVector posNegGamLV;
-                                       posNegGamLV.SetXYZM(posNegGam.Px(),posNegGam.Py(),posNegGam.Pz(),posNegGam.GetMass());
-                                       new ((*chic)[j++]) TLorentzVector(posNegGamLV);
-                               } else {// TLorentzVector
-               
-                                       TLorentzVector gamLV;
-                                       gamLV.SetXYZM(gamKF->Px(),gamKF->Py(),gamKF->Pz(),0);
-                                       
-                                       new ((*chic)[j++]) TLorentzVector(posLV + negLV + gamLV);
-                               }
-                       }
-               }
-       }
-       
-       return chic;
-}
-
-//-----------------------------------------------------------------------------------------------
-void AliAnalysisTaskGammaConvDalitz::UpdateGammaPool(const TClonesArray* gamma)
-{
-//
-// Update gamma event pool for background computation
-//
-       if( fDebug ) AliInfo("=> UpdateGammaPool");
-       
-       // cycle
-       for(Int_t j=0; j< gamma->GetEntriesFast(); ++j) {
-               if((AliKFParticle*)fGammaPool->At(fGamPoolPos)) delete (AliKFParticle*)fGammaPool->RemoveAt(fGamPoolPos);
-               new ((*fGammaPool)[fGamPoolPos]) AliKFParticle( *((AliKFParticle*)gamma->At(j)));
-               ++fGamPoolPos;
-               if(fGamPoolPos == fPoolMaxSize) {
-                       fGamPoolPos = 0;
-               }
-       }
-}
-
-void AliAnalysisTaskGammaConvDalitz::UpdateElectronPool(TClonesArray* elec) // FIXME: const
-{
-//
-// Update electron event pool for background computation
-//
-       Int_t multiplicity = fV0Reader->CountESDTracks();
-       fBGEventHandler->AddElectronEvent(elec,fESDEvent->GetPrimaryVertex()->GetZ(),multiplicity);
-}
-
-//-----------------------------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::GammasFromBGHandler() const
-{
-//
-// Gamma copy from events with same multiplicity and Z
-//
-       if( fDebug ) AliInfo("=> GammasFromBGHandler");
-
-       Int_t zbin = fBGEventHandler->GetZBinIndex(fV0Reader->GetVertexZ());
-       Int_t mbin = fBGEventHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
-
-       TClonesArray* gammaPool = new TClonesArray("AliKFParticle");
-       gammaPool->SetOwner(kTRUE);
-       
-       for( Int_t iEventBG=0; iEventBG < fV0Reader->GetNBGEvents(); ++iEventBG ) {
-               AliGammaConversionKFVector* gammaV0s = fBGEventHandler->GetBGGoodV0s(zbin,mbin,iEventBG);
-               for( UInt_t i = 0; i < gammaV0s->size(); ++i) {
-                       new ((*gammaPool)[i]) AliKFParticle( *((AliKFParticle*)gammaV0s->at(i)) );
-               }
-       }
-       return gammaPool;
-}
-
-//-----------------------------------------------------------------------------------------------
-TClonesArray* AliAnalysisTaskGammaConvDalitz::ElectronFromBGHandler() const
-{
-//
-// Electron copy from events with same multiplicity and Z
-//
-       if( fDebug ) AliInfo("=> ElectronFromBGHandler");
-       
-       TClonesArray* electronPool = new TClonesArray("AliKFParticle");
-       electronPool->SetOwner(kTRUE);
-
-       Int_t multiplicity = fV0Reader->CountESDTracks();
-       for( Int_t iEventBG=0; iEventBG < fV0Reader->GetNBGEvents(); ++iEventBG ) {
-               AliGammaConversionKFVector* electronNeg =  fBGEventHandler->GetBGGoodENeg(iEventBG,fESDEvent->GetPrimaryVertex()->GetZ(),multiplicity);
-               for (UInt_t i = 0; i < electronNeg->size(); ++i  ) {
-                       new ((*electronPool)[i]) AliKFParticle( *((AliKFParticle*)electronNeg->at(i)) );
-               }
-       }
-       
-       return electronPool;
-}
-
-//-----------------------------------------------------------------------------------------------
-Int_t AliAnalysisTaskGammaConvDalitz::GetMonteCarloPid(const AliESDtrack* t) const
-{
-//
-// Get track pid according to MC
-//
-    Int_t label   = TMath::Abs(t->GetLabel());
-    Int_t pdgCode = TMath::Abs(fStack->Particle(label)->GetPdgCode());
-
-    switch(pdgCode) {
-               case ::kElectron:  return AliPID::kElectron;
-               case ::kMuonMinus: return AliPID::kMuon;
-               case ::kPiPlus:    return AliPID::kPion;
-               case ::kKPlus:     return AliPID::kKaon;
-               case ::kProton:    return AliPID::kProton;
-    }
-    return -1;
-}
-
-//-----------------------------------------------------------------------------------------------
-//FIXME PID ITS
-// NOTE prior should be estimated from data
-// NOTE: move to config
-
-Int_t AliAnalysisTaskGammaConvDalitz::GetBayesPid(const AliESDtrack* t, Int_t trackType ) const
-{
-//
-// Get track pid according to Bayes' formula
-//
-       double priors[AliPID::kSPECIES] = {0.009, 0.01, 0.82, 0.10, 0.05};
-       Double_t detectoProb[AliPID::kSPECIES];
-
-       if( trackType == kITSsaTrack ) { // ITS standalone pid
-               t->GetITSpid( detectoProb );
-       } else { // global track
-               t->GetESDpid( detectoProb );
-       }
-
-       AliPID bayesPID( detectoProb );
-       return bayesPID.GetMostProbable( priors );
-}
-
-
-
-
-Int_t AliAnalysisTaskGammaConvDalitz::GetNSigmaPid(const AliESDtrack* track, Int_t trackType ) const
-{
-//
-// Get track pid according to a n-sigma cut around ITS and/or TPC signals
-//
-
-       if( trackType == kITSsaTrack) {  // ITS standalone tracks
-               Double_t mom = track->GetP();
-
-               // ITS Number of sigmas (FIXME: add new fESDpidCuts)
-               // NOTE there is not AliESDpidCuts::SetITSnSigmaCut yet
-               Double_t nElecSigma = fESDpid->NumberOfSigmasITS(track, AliPID::kElectron );
-               Double_t nPionSigma = fESDpid->NumberOfSigmasITS(track, AliPID::kPion );
-
-               if( nElecSigma < 4. && nElecSigma > -3. && mom < .2  &&  nPionSigma < -1.5 ) {
-                       return AliPID::kElectron;
-               }
-       } else { // global track
-               fHistograms->FillHistogram("ESD_DalitzBeforeCorresCut_E_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kElectron));
-
-               if( fESDpid->NumberOfSigmasTPC(track,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
-                               fESDpid->NumberOfSigmasTPC(track,AliPID::kElectron)>fPIDnSigmaAboveElectronLine){
-                                       return -1;
-               }
-               fHistograms->FillHistogram("ESD_DalitzAfterCorresCut_E_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kElectron));
-               fHistograms->FillHistogram("ESD_DalitzBeforeCorresCut_Pi_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kPion));
-               fHistograms->FillHistogram("ESD_DalitzBeforeCorresCut_Mu_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kMuon));
-
-               if( track->P()>fPIDMinPnSigmaAbovePionLine && track->P()<fPIDMaxPnSigmaAbovePionLine ){
-                       if( fESDpid->NumberOfSigmasTPC(track,AliPID::kPion)<fPIDnSigmaAbovePionLine){
-                               return -1;
-                       }
-               }
-               
-               // High Pt
-               
-               if( track->P()>fPIDMaxPnSigmaAbovePionLine ){
-                       if( fESDpid->NumberOfSigmasTPC(track,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
-                               return -1;
-                       }
-               }
-
-               fHistograms->FillHistogram("ESD_DalitzAfterCorresCut_Pi_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kPion));
-               fHistograms->FillHistogram("ESD_DalitzAfterCorresCut_Mu_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kMuon));
-
-               if(fDoKaonRejectionLowP == kTRUE){
-                       
-                       fHistograms->FillHistogram("ESD_DalitzBeforeCorresCut_K_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kKaon));
-                       if( track->P()<fPIDMinPKaonRejectionLowP ){      
-                               if( TMath::Abs(fESDpid->NumberOfSigmasTPC(track,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
-                                       return -1;
-                               }
-                       }
-
-                       fHistograms->FillHistogram("ESD_DalitzAfterCorresCut_K_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kKaon));
-               }
-
-               if(fDoProtonRejectionLowP == kTRUE){
-                       fHistograms->FillHistogram("ESD_DalitzBeforeCorresCut_P_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kProton));
-                       if( track->P()<fPIDMinPProtonRejectionLowP ){   
-                               if( TMath::Abs(fESDpid->NumberOfSigmasTPC(track,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
-                                       return -1;
-                               }
-                       }
-                       fHistograms->FillHistogram("ESD_DalitzAfterCorresCut_P_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kProton));
-               }
-
-               if(fDoPionRejectionLowP == kTRUE){
-                       fHistograms->FillHistogram("ESD_DalitzBeforeCorresCut_Low_Pi_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kPion));
-       
-                       if( track->P()<fPIDMinPPionRejectionLowP ){
-                               if( TMath::Abs(fESDpid->NumberOfSigmasTPC(track,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
-                                       return -1;
-                               }
-                       }
-                       fHistograms->FillHistogram("ESD_DalitzAfterCorresCut_Low_Pi_SigdEdxP",track->P(),fESDpid->NumberOfSigmasTPC(track,AliPID::kPion));
-               }
-
-               if( fDoTOFsigmaCut == kTRUE ){ 
-                       if( (track->GetStatus() & AliESDtrack::kTOFpid) && !(track->GetStatus() & AliESDtrack::kTOFmismatch) ){
-
-                               Double_t t0pos = fESDpid->GetTOFResponse().GetStartTime(track->P());
-                               Double_t nSigma = fESDpid->NumberOfSigmasTOF(track, AliPID::kElectron, t0pos);
-                               fHistograms->FillHistogram("ESD_TOF_BeforeCorresCutE_P_SigdT", track->GetP(), nSigma); //if( (statusNeg & AliESD 
-                               if( (nSigma>fTofPIDnSigmaAboveElectronLine) || (nSigma<fTofPIDnSigmaBelowElectronLine) ){
-                                       return -1;
-                               }    
-                               fHistograms->FillHistogram("ESD_TOF_AfterCorresCutE_P_SigdT", track->GetP(), nSigma); //if( (statusNeg & AliESD 
-                       }
-               }
-               return AliPID::kElectron;
-
-       // NOTE: add other particle types
-       }
-       return -1;
-}
-
-
-//-----------------------------------------------------------------------------------------------
-Bool_t AliAnalysisTaskGammaConvDalitz::IsDalitzPair( Int_t posLabel, Int_t negLabel,Int_t motherOpc ) const
-{
-//
-// Returns true if the two particles is a Dalitz pair
-//
-//motherOpc 1:  for Pi0Dalitz
-//motherOpc 2:  for EtaDalitz 
-
-       if(!HaveSameMother(posLabel, negLabel)) return kFALSE;
-
-       TParticle* pos = fStack->Particle( posLabel );
-       TParticle* neg = fStack->Particle( negLabel );
-
-       if( pos->GetPdgCode() != ::kPositron ) return kFALSE;
-       if( neg->GetPdgCode() != ::kElectron ) return kFALSE;
-       
-       //if( pos->GetUniqueID() != ::kPDecay ) return kFALSE;
-       //if( neg->GetUniqueID() != ::kPDecay ) return kFALSE;
-       
-       Int_t motherLabel = pos->GetMother(0);
-       if( motherLabel < 0 ) return kFALSE;
-
-       TParticle* mother = fStack->Particle( motherLabel );
-               
-       if( mother->GetNDaughters() != 3)    return kFALSE;
-
-       if( motherOpc == 1 ){ //Pi0Dalitz 
-               if( mother->GetPdgCode() != ::kPi0 ) return kFALSE;
-       } else if(motherOpc == 2) {
-               if( mother->GetPdgCode() != 221 ) return kFALSE; 
-       } else {
-               return kFALSE;
-       }
-       // NOTE: one of them must be a photon
-
-       return kTRUE;
-}
-
-//-----------------------------------------------------------------------------------------------
-Bool_t AliAnalysisTaskGammaConvDalitz::IsPi0DalitzDaughter( Int_t label ) const
-{
-//
-// Returns true if the particle comes from Pi0 -> e+ e- gamma
-//
-       Bool_t ePlusFlag  = kFALSE;
-       Bool_t eMinusFlag = kFALSE;
-       Bool_t gammaFlag  = kFALSE;
-       
-       Int_t motherLabel = fStack->Particle( label )->GetMother(0);
-       
-       if( motherLabel < 0 ) return kFALSE;
-       
-       TParticle* mother = fStack->Particle( motherLabel );
-       
-       if ( mother->GetPdgCode() != ::kPi0 ) return kFALSE;
-       
-       if ( mother->GetNDaughters() != 3 ) return kFALSE;
-       
-       for( Int_t idx = mother->GetFirstDaughter(); idx <= mother->GetLastDaughter(); ++idx ) {
-               switch( fStack->Particle(idx)->GetPdgCode()) {
-                       case ::kPositron:
-                               ePlusFlag  = kTRUE;
-                               break;
-                       case ::kElectron:
-                               eMinusFlag = kTRUE;
-                               break;
-                       case ::kGamma:
-                               gammaFlag  = kTRUE;
-                               break;
-               }
-       }
-       return ( ePlusFlag && eMinusFlag && gammaFlag );
-}
-
-//--------------------------------------------------------------------------
-Bool_t AliAnalysisTaskGammaConvDalitz::IsFromGammaConversion( Double_t psiPair, Double_t deltaPhi ) const
-{
-//
-// Returns true if it is a gamma conversion according to psi pair value
-//
-       return ( (deltaPhi > fDeltaPhiCutMin  &&  deltaPhi < fDeltaPhiCutMax) &&
-       TMath::Abs(psiPair) < ( fPsiPairCut - fPsiPairCut/fDeltaPhiCutMax * deltaPhi ) );
-}
-
-//--------------------------------------------------------------------------
-Bool_t AliAnalysisTaskGammaConvDalitz::IsFromGammaConversion( Int_t posLabel, Int_t negLabel ) const
-{
-//
-// Returns true if it is a gamma conversion according to MC
-//
-       if( !HaveSameMother(posLabel,negLabel) ) return kFALSE;
-       
-       TParticle* pos = fStack->Particle( posLabel );
-       TParticle* neg = fStack->Particle( negLabel );
-       
-       if( pos->GetPdgCode() != ::kPositron ) return kFALSE;
-       if( neg->GetPdgCode() != ::kElectron ) return kFALSE;
-
-       if( pos->GetUniqueID() != kPPair ) return kFALSE;
-
-       Int_t motherLabel = pos->GetMother(0);
-       if( motherLabel < 0 ) return kFALSE;
-
-       TParticle* mother = fStack->Particle( motherLabel );
-
-       if( mother->GetPdgCode() != ::kGamma ) return kFALSE;
-       
-       return kTRUE;
-}
-
-//-----------------------------------------------------------------------------------------------
-Bool_t AliAnalysisTaskGammaConvDalitz::HaveSameMother( Int_t label1, Int_t label2 ) const
-{
-//
-// Returns true if the two particle have the same mother
-//
-       if(fStack->Particle( label1 )->GetMother(0) < 0 ) return kFALSE;
-       return (fStack->Particle( label1 )->GetMother(0) == fStack->Particle( label2 )->GetMother(0));
-}
-
-//-----------------------------------------------------------------------------------------------
-Double_t AliAnalysisTaskGammaConvDalitz::GetPsiPair( const AliESDtrack* trackPos, const AliESDtrack* trackNeg ) const
-{
-//
-// This angle is a measure for the contribution of the opening in polar
-// direction Δ0 to the opening angle ξ Pair
-//
-// Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC
-//      Master Thesis. Thorsten Dahms. 2005
-// https://twiki.cern.ch/twiki/pub/ALICE/GammaPhysicsPublications/tdahms_thesis.pdf
-//
-       Double_t momPos[3];
-       Double_t momNeg[3];
-       if( trackPos->GetConstrainedPxPyPz(momPos) == 0 ) trackPos->GetPxPyPz( momPos );
-       if( trackNeg->GetConstrainedPxPyPz(momNeg) == 0 ) trackNeg->GetPxPyPz( momNeg );
-
-       TVector3 posDaughter;
-       TVector3 negDaughter;
-
-       posDaughter.SetXYZ( momPos[0], momPos[1], momPos[2] );
-       negDaughter.SetXYZ( momNeg[0], momNeg[1], momNeg[2] );
-
-       Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();
-       Double_t openingAngle =  posDaughter.Angle( negDaughter );  //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );
-       if( openingAngle < 1e-20 ) return 0.;
-       Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
-
-       return psiAngle;
-}
-
-//-----------------------------------------------------------------------------------------------
-Double_t AliAnalysisTaskGammaConvDalitz::GetPsiPair(const AliKFParticle* xPos, const AliKFParticle* yNeg ) const
-{
-//
-// Get psi pair value
-//
-       TVector3 pos(xPos->GetPx(), xPos->GetPy(), xPos->GetPz());
-       TVector3 neg(yNeg->GetPx(), yNeg->GetPy(), yNeg->GetPz());
-
-       Double_t deltaTheta = neg.Theta() - pos.Theta();
-       Double_t openingAngle = pos.Angle( neg );
-
-       if( openingAngle < 1e-20 ) return 0.;
-
-       return TMath::ASin( deltaTheta/openingAngle );
-}
-//-----------------------------------------------------------------------------------------------
-Double_t AliAnalysisTaskGammaConvDalitz::GetPsiPair(const TLorentzVector* xPos, const TLorentzVector* yNeg ) const
-{
-//
-// Get psi pair value
-//
-       Double_t deltaTheta = yNeg->Theta() - xPos->Theta();
-       Double_t openingAngle = xPos->Angle( yNeg->Vect() );
-       
-       if( openingAngle < 1e-20 ) return 0.;
-       
-       return TMath::ASin( deltaTheta/openingAngle );;
-}
-//------------------------------------------------------------------------------------------------
-Int_t AliAnalysisTaskGammaConvDalitz::CalculateMultiplicityBin(){
-       // Get Centrality bin
-
-       Int_t multiplicity = 0;
-
-       if ( fUseMultiplicity == 1 ) {
-               if (fMultiplicity>= 0 && fMultiplicity<= 5) multiplicity=1;
-               if (fMultiplicity>= 6 && fMultiplicity<= 9) multiplicity=2;
-               if (fMultiplicity>=10 && fMultiplicity<=14) multiplicity=3;
-               if (fMultiplicity>=15 && fMultiplicity<=22) multiplicity=4;
-               if (fMultiplicity>=23 )multiplicity=5;
-       }
-
-       if ( fUseHBTMultiplicity == 1 ) {
-               if (fMultiplicity>= 0 && fMultiplicity<=11)     multiplicity=1;
-               if (fMultiplicity>=12 && fMultiplicity<=16)     multiplicity=2;
-               if (fMultiplicity>=17 && fMultiplicity<=22)     multiplicity=3;
-               if (fMultiplicity>=23 && fMultiplicity<=29)     multiplicity=4;
-               if (fMultiplicity>=30 && fMultiplicity<=36)     multiplicity=5;
-               if (fMultiplicity>=37 && fMultiplicity<=44)     multiplicity=6;
-               if (fMultiplicity>=45 && fMultiplicity<=57)     multiplicity=7;
-               if (fMultiplicity>=58 && fMultiplicity<=149) multiplicity=8;
-       }
-
-       return multiplicity;
-}
-
diff --git a/PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.h b/PWGGA/GammaConv/AliAnalysisTaskGammaConvDalitz.h
deleted file mode 100644 (file)
index 7bd5cb7..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-#ifndef ALIANALYSISTASKGAMMACONVDALITZ_H
-#define ALIANALYSISTASKGAMMACONVDALITZ_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// Analysis task for pi0->e+e-gamma (Dalitz decay)
-
-#include "AliAnalysisTaskSE.h"
-
-class AliESDInputHandler;
-class AliMCEventHandler;
-class AliESDEvent;
-class AliESDtrack;
-class AliESDtrackCuts;
-class AliESDpidCuts;
-class AliV0Reader;
-class AliGammaConversionHistograms;
-class AliTriggerAnalysis;
-
-class AliAnalysisTaskGammaConvDalitz: public AliAnalysisTaskSE
-{
-  public:
-
-       AliAnalysisTaskGammaConvDalitz();
-       AliAnalysisTaskGammaConvDalitz( const char* name );
-       virtual ~AliAnalysisTaskGammaConvDalitz();
-
-       virtual void UserExec(Option_t *option);
-       virtual void UserCreateOutputObjects();
-       virtual void ConnectInputData(Option_t *option);
-       virtual void Terminate(Option_t *option);
-               
-       enum TrackSelectionCriteria { kITSsaTrack=0, kGlobalTrack=1, kITSsaGlobalTrack=2 };
-       
-       void SetRunStandalone( Bool_t flag=kFALSE ) { fStandalone = flag; }
-       void SetComputeBackground( Bool_t flag=kTRUE ) { fComputeBkg = flag; }
-       void SetUseBayesPID( Bool_t flag=kTRUE ) { fUseBayesPID = flag; }
-       void SetUseESDtrackIndexCut( Bool_t flag=kTRUE) { fUseTrackIndexCut = flag; }
-       void SetUsePsiPairCut(Bool_t flag=kTRUE) { fUsePsiPairCut = flag; }
-       void SetUseMassCut(Bool_t flag=kTRUE) { fUseMassCut = flag; }
-       void SetUseGammaCut(Bool_t flag=kTRUE) { fUseGammaCut = flag; }
-       void SetUseAliKF(Bool_t flag=kFALSE) { fUseAliKF = flag; }
-       void SetTrackSelectionCriteria(AliAnalysisTaskGammaConvDalitz::TrackSelectionCriteria sel=kGlobalTrack) { fTrkSelectionCriteria = sel; }
-       void SetUseCorrectedTPCClsInfo(Bool_t flag){fUseCorrectedTPCClsInfo = flag;}
-       Bool_t GetUseCorrectedTPCClsInfo() const {return fUseCorrectedTPCClsInfo;}
-
-
-       void SetMinClsTPCCutToF(Double_t minClsTPCToF){fMinClsTPCToF=minClsTPCToF;}
-       void SetPsiPairCut(Double_t psi=0.45, Double_t phiMin=0., Double_t phiMax=0.12, Bool_t readMagFieldSgn=kTRUE){fPsiPairCut = psi; fDeltaPhiCutMin = phiMin; fDeltaPhiCutMax = phiMax; fReadMagFieldSign = readMagFieldSgn;}
-       void SetMassCut(Double_t min, Double_t max) {fMassCutMin = min; fMassCutMax = max; }
-
-       void SetDoTOFsigmaCut( Bool_t doTOFsigmaCut){fDoTOFsigmaCut=doTOFsigmaCut;}
-       void SetDoKaonRejectionLowP( Bool_t doKaonRejectionLowP){fDoKaonRejectionLowP=doKaonRejectionLowP;}
-       void SetDoProtonRejectionLowP( Bool_t doProtonRejectionLowP){fDoProtonRejectionLowP=doProtonRejectionLowP;}
-       void SetDoPionRejectionLowP( Bool_t doPionRejectionLowP){fDoPionRejectionLowP=doPionRejectionLowP;}
-
-       void SetNSigmasElecTPC( Double_t min, Double_t max) { fPIDnSigmaBelowElectronLine    = min; fPIDnSigmaAboveElectronLine    = max; }
-       void SetNSigmasElecTOF( Double_t min, Double_t max) { fTofPIDnSigmaBelowElectronLine = min; fTofPIDnSigmaAboveElectronLine = max; }
-       void SetPIDMinMaxPnSigmaAbovePionLine(Double_t min, Double_t max){ fPIDMinPnSigmaAbovePionLine = min; fPIDMaxPnSigmaAbovePionLine =  max;}
-       void SetPIDnSigmaAbovePionLine(Double_t val){ fPIDnSigmaAbovePionLine = val; };
-       void SetPIDnSigmaAbovePionLineHighPt(Double_t val){ fPIDnSigmaAbovePionLineHighPt = val; };
-
-       void SetPIDMinPKaonRejectionLowP  (Double_t val){   fPIDMinPKaonRejectionLowP   = val; }
-       void SetPIDMinPProtonRejectionLowP(Double_t val){   fPIDMinPProtonRejectionLowP = val; }
-       void SetPIDMinPPionRejectionLowP  (Double_t val){   fPIDMinPPionRejectionLowP   = val; }
-
-       void SetPIDnSigmaAtLowPAroundKaonLine(Double_t val)  { fPIDnSigmaAtLowPAroundKaonLine   = val; }
-       void SetPIDnSigmaAtLowPAroundProtonLine(Double_t val){ fPIDnSigmaAtLowPAroundProtonLine = val; }
-       void SetPIDnSigmaAtLowPAroundPionLine(Double_t val)  { fPIDnSigmaAtLowPAroundPionLine   = val; }
-               
-       void SetV0Reader( AliV0Reader* reader ) { fV0Reader = reader; }
-       void SetDoMC(Bool_t flag) { fDoMC = flag; }
-       void SetBGHandler( AliGammaConversionBGHandler* BG ) {  fBGEventHandler = BG; }
-       
-       void AdoptHistograms( AliGammaConversionHistograms* histograms ) { fHistograms = histograms; }
-       void AdoptITSsaTrackCuts( AliESDtrackCuts* esdCuts = 0 );
-       void AdoptESDtrackCuts( AliESDtrackCuts* esdCuts = 0 );
-       void AdoptESDpidCuts( AliESDpidCuts* esdPIDCuts = 0 );
-        
-
-       void SetBackgroundType(Int_t type){ fBackgroundType = type; }
-       void SetRemovePileUp(Bool_t removePileUp) { fRemovePileUp = removePileUp; }
-       void SetSelectV0AND(Bool_t selectV0AND) { fSelectV0AND = selectV0AND; }
-       void SetUseMultiplicity(Int_t useMultiplicity) {fUseMultiplicity=useMultiplicity;}
-       void SetUseMultiplicityBin(Int_t useMultiplicityBin) {fUseMultiplicityBin=useMultiplicityBin;}
-       void SetUseHBTMultiplicity(Int_t useHBTMultiplicity) {fUseHBTMultiplicity=useHBTMultiplicity;}
-       void SetUseHBTMultiplicityBin(Int_t useHBTMultiplicityBin) {fUseHBTMultiplicityBin=useHBTMultiplicityBin;}
-       void SetUseCentrality(Int_t useCentrality) {fUseCentrality=useCentrality;}
-       void SetUseCentralityBin(Int_t useCentralityBin) {fUseCentralityBin=useCentralityBin;}
-       
-       private:
-
-               void ProcessMCData();
-               void CreateListOfDalitzPairCandidates();
-               void ProcessGammaElectronsForDalitzAnalysis();
-               
-               void ESDtrackIndexCut(vector<Int_t>& pos, vector<Int_t>& neg, const TClonesArray* gamma);
-               void PsiPairCut(vector<Int_t>& pos, vector<Int_t>& neg);
-               void MassCut(vector<Int_t>& pos, vector<Int_t>& neg);
-               void CleanArray(vector<Int_t>& x, const vector<Bool_t>& tag);
-               
-               TClonesArray* IndexToAliKFParticle(const vector<Int_t>& v, Int_t PDG);
-               TClonesArray* FindElectronFromPi0Dalitz(const vector<Int_t>& candidates, const Int_t PDG);
-               TClonesArray* FindGammaFromPi0Dalitz(const TClonesArray* candidates, const vector<Int_t>& pos, const vector<Int_t>& neg);
-               TClonesArray* FindGamma(const TClonesArray* candidates, const vector<Int_t>& pos, const vector<Int_t>& neg);
-               TClonesArray* FindDalitzPair(const TClonesArray* pos, const TClonesArray* neg);
-               TClonesArray* FindDalitzPair(const vector<Int_t>& pos, const vector<Int_t>& neg,Int_t motherOpc);
-               TClonesArray* FindJpsi(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx,Int_t motherOpc);
-               TClonesArray* FindParticleDalitz(const TClonesArray* pos, const TClonesArray* neg, const TClonesArray* gamma,Int_t opc);
-               TClonesArray* FindParticleDalitz(const vector<Int_t>& pos, const vector<Int_t>& neg, const TClonesArray* gamma, const vector<Int_t>& posGam, const vector<Int_t>& negGam,Int_t motherOpc);
-               TClonesArray* FindParticleChic(const vector<Int_t>& posIdx, const vector<Int_t>& negIdx, const TClonesArray* gamma, const vector<Int_t>& posGam, const vector<Int_t>& negGam,Int_t motherOpc);
-
-               void SetGammaPoolMaxSize(UInt_t maxSize=10) { fPoolMaxSize = maxSize; }
-               void UpdateGammaPool(const TClonesArray* gamma);
-               void UpdateElectronPool(TClonesArray* elec);
-               TClonesArray* GammasFromBGHandler() const;
-               TClonesArray* ElectronFromBGHandler() const;
-
-               Bool_t IsPi0DalitzDaughter( Int_t label ) const;
-               Bool_t IsDalitzPair( Int_t labelPos, Int_t labelNeg, Int_t motherOpc ) const;
-               Bool_t IsFromGammaConversion( Int_t labelPos, Int_t labelNeg  ) const;
-               Bool_t IsFromGammaConversion( Double_t psiPair, Double_t deltaPhi ) const;
-               Bool_t HaveSameMother( Int_t label1, Int_t label2 ) const;
-               
-               Double_t GetPsiPair( const AliKFParticle* pos, const AliKFParticle* neg ) const;
-               Double_t GetPsiPair( const TLorentzVector* pos, const TLorentzVector* neg ) const;
-               Double_t GetPsiPair( const AliESDtrack* trackPos, const AliESDtrack* trackNeg ) const;
-               
-               Int_t GetMonteCarloPid(const AliESDtrack* t) const;
-               Int_t GetBayesPid(const AliESDtrack* t, Int_t trackType ) const;
-               Int_t GetNSigmaPid(const AliESDtrack* t, Int_t trackType ) const;
-               
-               void GetGammaCandidates(TClonesArray*& gamma, vector<Int_t>& posIndex, vector<Int_t>& negIndex);
-               void AngleEposEnegGammaCut( const vector<Int_t>& xPosIndex, const vector<Int_t>& yNegIndex, const TClonesArray* zGamma, TClonesArray*& gamma, vector<Int_t>& posIndex, vector<Int_t>& negIndex);
-               void FillPsiPair(const TClonesArray* pos, const TClonesArray* neg, const TString& hName);
-               void FillAngle(const TClonesArray* x, const TClonesArray* y, const TString& hName);
-               Double_t Rapidity(const TParticle* p) const;
-               Double_t RapidityKF(const AliKFParticle p) const;
-               void FillPidTable(const TParticle* p, Int_t pid);
-               Int_t  CalculateMultiplicityBin();
-
-       
-  // protected:
-       private:
-
-               AliStack*   fStack;                 //! MC particle stack
-               AliMCEvent* fGCMCEvent;               //! for CF pointer to the MC Event
-
-               AliESDEvent* fESDEvent;             //! ESD event
-
-               vector<Int_t> fEposCandidateIndex;  //! track indexes of e+ candidates
-               vector<Int_t> fEnegCandidateIndex;  //! track indexes of e- candidates
-               vector<Int_t> fGammaCandidatePosIndex; //! track indexes for gamma candidates positive track
-               vector<Int_t> fGammaCandidateNegIndex; //! track indexes for gamma candidates negative track
-
-               TClonesArray* fGammaCandidates;     //! AliKFParticle gamma candidates
-               TClonesArray* fGammaPool;           //! AliKFParticle gamma pool of previous events
-               Int_t fPoolMaxSize; // size of the gamma pool
-               Int_t fGamPoolPos; // Posisiton of last added gamma in the pool
-               
-               AliGammaConversionBGHandler* fBGEventHandler; // Background event handler
-
-               TList* fOutputContainer;           // Histogram container
-               AliMCEventHandler* fMCTruth;       // for CF pointer to MCTruth
-               AliV0Reader* fV0Reader;            // The V0 reader object
-               AliESDpid* fESDpid;                // for dEdx cut based on nSigma to a particle line
-               AliESDtrackCuts* fESDtrackCuts;    // ESD global track cuts
-               AliESDtrackCuts* fITSsaTrackCuts;  // ITS standalone ESD track cuts
-               AliESDpidCuts* fESDpidCuts;        // ESD PID cuts
-               
-               Bool_t fRemovePileUp;                 // Remove Pile Up
-               Bool_t fSelectV0AND;                 // Select V0AND
-               AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
-               Int_t fMultiplicity;
-               Int_t fUseMultiplicity;
-               Int_t fUseMultiplicityBin;
-               Int_t fUseHBTMultiplicity;
-               Int_t fUseHBTMultiplicityBin;
-               Int_t fUseCentrality;
-               Int_t fUseCentralityBin;
-
-
-
-               AliGammaConversionHistograms* fHistograms;  // histogram container
-               
-               Bool_t fStandalone;        // Run the task as standalone for the V0reader
-               Bool_t fDoMC;              // process montecarlo simulation
-               Bool_t fComputeBkg;        // Compute combinatorial background
-               Bool_t fUseBayesPID;       // use bayesian pid
-               Bool_t fUseTrackIndexCut;  // use esd track index cut
-               Bool_t fUsePsiPairCut;     // use psi pair cut
-               Bool_t fUseMassCut;        // use mass cut
-               Bool_t fUseGammaCut;       // use e+e- plane angle gamma cut
-               Bool_t fUseCorrectedTPCClsInfo; // use
-               Bool_t fReadMagFieldSign;  // Read the magnetic field sign from the ESD for Psi pair cut
-               Bool_t fUseAliKF;          // Use AliKFParticle to reconstruct the pi0 instead of TLorentzVector class
-               Int_t fBackgroundType;    
-
-               Double_t fMinClsTPCToF;              // minimum clusters to findable clusters
-
-               Int_t fMagFieldSign;                 // Magnetic field sign
-               const Double_t fkElectronMass;        // Electron mass
-               Double_t fPsiPairCut;                // Psi pair cut value
-               Double_t fDeltaPhiCutMin;              // Delta_Phi minimum cut value
-               Double_t fDeltaPhiCutMax;              // Delta_Phi maximum cut value
-               Double_t fMassCutMin;                // Minimum value of e+e- mass (GeV/c2)
-               Double_t fMassCutMax;                // Maximum value of e+e- mass (GeV/c2)
-               
-                       /*Double_t fNSigmaBelowElecTPCbethe;   // Number of sigmas below the electron BB in the TPC
-               Double_t fNSigmaAboveElecTPCbethe;   // Number of sigmas above the electron BB in the TPC
-               Double_t fNSigmaAbovePionTPCbethe;   // Number of sigmas above the Pion BB in the TPC
-               Double_t fNSigmaAboveKaonTPCbethe;   // Number of sigmas above the Kaon BB in the TPC
-               Double_t fNSigmaAboveProtonTPCbethe; // Number of sigmas above the Proton BB in the TPC*/
-
-        ////////////////PID de/dx/////////////////////////////////////////////////////
-               Bool_t   fDoTOFsigmaCut; 
-               Double_t fPIDnSigmaAboveElectronLine; // sigma cut
-               Double_t fPIDnSigmaBelowElectronLine; // sigma cut
-               Double_t fTofPIDnSigmaAboveElectronLine; // sigma cut RRnewTOF
-               Double_t fTofPIDnSigmaBelowElectronLine; // sigma cut RRnewTOF 
-               Double_t fPIDnSigmaAbovePionLine;     // sigma cut
-               Double_t fPIDnSigmaAbovePionLineHighPt;     // sigma cut
-               Double_t fPIDMinPnSigmaAbovePionLine; // sigma cut
-               Double_t fPIDMaxPnSigmaAbovePionLine; // sigma cut
-
-
-               Bool_t fDoKaonRejectionLowP;   // Kaon rejection at low p
-               Bool_t fDoProtonRejectionLowP; // Proton rejection at low p
-               Bool_t fDoPionRejectionLowP;   // Pion rejection at low p*/
-
-
-               Double_t fPIDnSigmaAtLowPAroundKaonLine; // sigma cut
-               Double_t fPIDnSigmaAtLowPAroundProtonLine; // sigma cut
-               Double_t fPIDnSigmaAtLowPAroundPionLine; // sigma cut
-
-
-               Double_t fPIDMinPKaonRejectionLowP; // Momentum limit to apply kaon rejection
-               Double_t fPIDMinPProtonRejectionLowP; // Momentum limit to apply proton rejection
-               Double_t fPIDMinPPionRejectionLowP; // Momentum limit to apply proton rejection
-               ///////////////////////////////////////////////////////////////////////////////////
-
-               TrackSelectionCriteria fTrkSelectionCriteria;      // Selected criteria for track cuts
-
-       private:
-               AliAnalysisTaskGammaConvDalitz( const AliAnalysisTaskGammaConvDalitz& ); // Not implemented
-               AliAnalysisTaskGammaConvDalitz& operator=( const AliAnalysisTaskGammaConvDalitz& ); // Not implemented
-
-               ClassDef( AliAnalysisTaskGammaConvDalitz, 2 );
-};
-
-#endif // ALIANALYSISTASKGAMMACONVDALITZ_H
index 9841fba11c71c1e26f09f48dee51bf277bfdb85c..c2e171b974f3adf64a60bc1f7b5b6ab1123a6123 100644 (file)
 #include "TList.h"
 #include "TChain.h"
 #include "TDirectory.h"
-
+#include "TTree.h"
+#include "TH1.h"
+#include "TH1F.h"
+#include "THnSparse.h"
+#include "TH2F.h"
 #include "AliStack.h"
 #include "AliAnalysisManager.h"
 #include "AliESDInputHandler.h"
@@ -48,9 +52,7 @@
 #include "AliCentrality.h"
 #include "AliMultiplicity.h"
 #include "AliAnalysisTaskGammaConvDalitzV1.h"
-#include "TH1.h"
-#include "TH2F.h"
-#include "THnSparse.h"
+
 
 ClassImp( AliAnalysisTaskGammaConvDalitzV1 )
 
@@ -85,6 +87,7 @@ fV0Reader(NULL),
    hESDDalitzPositronPt(NULL),
    hESDEposEnegPsiPairDPhi(NULL),
    hESDEposEnegInvMassPt(NULL),
+   hESDEposEnegLikeSignBackInvMassPt(NULL),
    hESDMotherInvMassPt(NULL),
    hESDPi0MotherInvMassPt(NULL),
    hESDPi0MotherDiffInvMassPt(NULL),
@@ -156,6 +159,7 @@ AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1( const char*
    hESDDalitzPositronPt(NULL),
    hESDEposEnegPsiPairDPhi(NULL),
    hESDEposEnegInvMassPt(NULL),
+   hESDEposEnegLikeSignBackInvMassPt(NULL),
    hESDMotherInvMassPt(NULL),
    hESDPi0MotherInvMassPt(NULL),
    hESDPi0MotherDiffInvMassPt(NULL),
@@ -232,7 +236,7 @@ AliAnalysisTaskGammaConvDalitzV1::~AliAnalysisTaskGammaConvDalitzV1()
 //___________________________________________________________
 void AliAnalysisTaskGammaConvDalitzV1::InitBack(){
 
-   Double_t *zBinLimitsArray = new Double_t[9];
+   Double_t *zBinLimitsArray= new Double_t[9];
    zBinLimitsArray[0] = -50.00;
    zBinLimitsArray[1] = -3.375;
    zBinLimitsArray[2] = -1.605;
@@ -243,7 +247,7 @@ void AliAnalysisTaskGammaConvDalitzV1::InitBack(){
    zBinLimitsArray[7] = 50.00;
    zBinLimitsArray[8] = 1000.00;
 
-   Double_t *multiplicityBinLimitsArrayTracks = new Double_t[6];
+   Double_t *multiplicityBinLimitsArrayTracks= new Double_t[6];
    multiplicityBinLimitsArrayTracks[0] = 0;
    multiplicityBinLimitsArrayTracks[1] = 8.5;
    multiplicityBinLimitsArrayTracks[2] = 16.5;
@@ -260,7 +264,7 @@ void AliAnalysisTaskGammaConvDalitzV1::InitBack(){
       multiplicityBinLimitsArrayTracks[5] = 5000.;
    }
 
-   Double_t *multiplicityBinLimitsArrayV0s = new Double_t[5];
+   Double_t *multiplicityBinLimitsArrayV0s= new Double_t[5];
 
    multiplicityBinLimitsArrayV0s[0] = 2;
    multiplicityBinLimitsArrayV0s[1] = 3;
@@ -361,6 +365,7 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
    hESDDalitzPositronPt            = new TH1F*[fnCuts];
    hESDEposEnegPsiPairDPhi         = new TH2F*[fnCuts];
    hESDEposEnegInvMassPt           = new TH2F*[fnCuts];
+   hESDEposEnegLikeSignBackInvMassPt = new TH2F*[fnCuts];
    hESDMotherInvMassPt             = new TH2F*[fnCuts];
    hESDPi0MotherInvMassPt          = new TH2F*[fnCuts];
    hESDPi0MotherDiffInvMassPt      = new TH2F*[fnCuts];
@@ -419,6 +424,9 @@ void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
 
       hESDEposEnegInvMassPt[iCut] = new TH2F("ESD_EposEneg_InvMassPt","ESD_EposEneg_InvMassPt",5000,0.,5.,100,0.,10.);
       fESDList[iCut]->Add(hESDEposEnegInvMassPt[iCut]);
+      
+      hESDEposEnegLikeSignBackInvMassPt[iCut]  = new TH2F("ESD_EposEneg_LikeSignBack_InvMassPt","ESD_EposEneg_LikeSignBack_InvMassPt",5000,0.,5.,100,0.,10.);
+      fESDList[iCut]->Add(hESDEposEnegLikeSignBackInvMassPt[iCut]);
 
 
       hESDMotherInvMassPt[iCut] = new TH2F("ESD_DalitzMother_InvMass_Pt","ESD_DalitzMother_InvMass_Pt",1000,0,1,250,0,25);
@@ -892,6 +900,77 @@ void AliAnalysisTaskGammaConvDalitzV1::ProcessElectronCandidates(){
          fGoodVirtualGammas->Add(  vphoton );
       }
    }
+   
+   
+   //Computing mixing event
+
+   for(UInt_t i = 0; i < lGoodElectronIndex.size(); i++){
+         
+         if( lElectronPsiIndex[i] == kFALSE ) continue;
+         
+          AliESDtrack *electronCandidate1 = fESDEvent->GetTrack(lGoodElectronIndex[i]);
+
+          AliKFParticle electronCandidate1KF( *electronCandidate1->GetConstrainedParam(), ::kElectron );
+         
+        
+          for(UInt_t j = i+1; j < lGoodElectronIndex.size(); j++){
+           
+              if( lElectronPsiIndex[j] == kFALSE ) continue;
+              
+              
+               AliESDtrack *electronCandidate2 = fESDEvent->GetTrack(lGoodElectronIndex[j]);
+
+                AliKFParticle electronCandidate2KF( *electronCandidate2->GetConstrainedParam(), ::kElectron );
+              
+               AliKFConversionPhoton* virtualPhoton = new AliKFConversionPhoton(electronCandidate1KF,electronCandidate2KF);
+               
+               AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
+               primaryVertexImproved+=*virtualPhoton;
+               virtualPhoton->SetProductionVertex(primaryVertexImproved);
+
+                   
+               AliAODConversionPhoton *vphoton = new AliAODConversionPhoton(virtualPhoton); 
+               hESDEposEnegLikeSignBackInvMassPt[fiCut]->Fill(vphoton->GetMass(),vphoton->Pt());
+               delete vphoton;
+               delete virtualPhoton;
+                           
+          
+         }
+   }   
+   
+   
+   for(UInt_t i = 0; i < lGoodPositronIndex.size(); i++){
+         
+         if( lPositronPsiIndex[i] == kFALSE ) continue;
+         
+          AliESDtrack *positronCandidate1 = fESDEvent->GetTrack(lGoodPositronIndex[i]);
+
+          AliKFParticle positronCandidate1KF( *positronCandidate1->GetConstrainedParam(), ::kPositron );
+         
+        
+          for(UInt_t j = i+1; j < lGoodPositronIndex.size(); j++){
+           
+              if( lPositronPsiIndex[j] == kFALSE ) continue;
+              
+               AliESDtrack *positronCandidate2 = fESDEvent->GetTrack(lGoodPositronIndex[j]);
+
+                AliKFParticle positronCandidate2KF( *positronCandidate2->GetConstrainedParam(), ::kPositron );
+              
+               AliKFConversionPhoton* virtualPhoton = new AliKFConversionPhoton(positronCandidate1KF,positronCandidate2KF);
+               AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
+               primaryVertexImproved+=*virtualPhoton;
+               virtualPhoton->SetProductionVertex(primaryVertexImproved);
+              
+               AliAODConversionPhoton *vphoton = new AliAODConversionPhoton(virtualPhoton); 
+               hESDEposEnegLikeSignBackInvMassPt[fiCut]->Fill(vphoton->GetMass(),vphoton->Pt());
+               
+               
+               delete vphoton;
+               delete virtualPhoton;        
+          
+         }
+   }   
+
 
 }
 
@@ -909,10 +988,11 @@ void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
       for(Int_t GammaIndex=0; GammaIndex<fGoodGammas->GetEntries(); GammaIndex++){
 
          AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(GammaIndex));
-
+         if (gamma==NULL) continue;
          for(Int_t virtualGammaIndex=0;virtualGammaIndex<fGoodVirtualGammas->GetEntries();virtualGammaIndex++){
 
             AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(virtualGammaIndex));
+            if (Vgamma==NULL) continue;
             //Check for same Electron ID
             if(gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelPositive() ||
                gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelNegative() ||
@@ -1239,10 +1319,9 @@ void AliAnalysisTaskGammaConvDalitzV1::MoveParticleAccordingToVertex(AliAODConve
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvDalitzV1::CountESDTracks(){
 
-   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
    // Using standard function for setting Cuts
    Bool_t selectPrimaries=kTRUE;
-   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
    EsdTrackCuts->SetMaxDCAToVertexZ(2);
    EsdTrackCuts->SetEtaRange(-0.8, 0.8);
    EsdTrackCuts->SetPtRange(0.15);
index cf2519ad97c1fd30a7cf11b6e9ade7615c6b3f6f..66906550db6e42a82347086e3b8facb3e044d3fb 100644 (file)
@@ -99,6 +99,7 @@ class AliAnalysisTaskGammaConvDalitzV1: public AliAnalysisTaskSE
     TH1F **hESDDalitzPositronPt;
     TH2F **hESDEposEnegPsiPairDPhi;
     TH2F **hESDEposEnegInvMassPt;
+    TH2F **hESDEposEnegLikeSignBackInvMassPt;
     TH2F **hESDMotherInvMassPt;
     TH2F **hESDPi0MotherInvMassPt;
     TH2F **hESDPi0MotherDiffInvMassPt;
index 5de8e58be0648254545e9d3889beff70d64e02e9..40d14e25afa3b3518e5397f7952df421e8cfa28f 100644 (file)
@@ -1,9 +1,13 @@
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                       *
- * Author: Martin Wilde, Daniel Lohner                                   *
+ * Author: Martin Wilde, Daniel Lohner, Friederike Bock                          *
  * Version 1.0                                                           *
  *                                                                       *
+ * based on: on older version (see aliroot up to v5-04-42-AN)             *
+ *           AliAnalysisTaskGammaConversion.cxx                           *
+ *           Authors: Kathrin Koch, Kenneth Aamodt, Ana Marin             *
+ *                                                                        *
  * Permission to use, copy, modify and distribute this software and its          *
  * documentation strictly for non-commercial purposes is hereby granted          *
  * without fee, provided that the above copyright notice appears in all          *
@@ -58,7 +62,9 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fESDList(NULL),
    fBackList(NULL),
    fMotherList(NULL),
+   fMotherRapList(NULL),
    fTrueList(NULL),
+   fTrueMotherRapList(NULL),
    fMCList(NULL),
    fHeaderNameList(NULL),
    fOutputContainer(0),
@@ -72,6 +78,7 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    hESDConvGammaR(NULL),
    hESDMotherInvMassPt(NULL),
    sESDMotherInvMassPtZM(NULL),
+   sESDMotherInvMassPtY(NULL),
    hESDMotherBackInvMassPt(NULL),
    sESDMotherBackInvMassPtZM(NULL),
    hESDMotherInvMassEalpha(NULL),
@@ -93,12 +100,13 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    hMCEtaPt(NULL),
    hMCPi0InAccPt(NULL),
    hMCEtaInAccPt(NULL),
+   hMCPi0PtY(NULL),
+   hMCEtaPtY(NULL),
    hESDTrueMotherInvMassPt(NULL),
-   hESDTruePi0FromEtaInvMassPt(NULL),
    hESDTruePrimaryMotherInvMassPt(NULL),
-   hESDTruePrimaryMotherInvMassMCPt(NULL),
-   hESDTruePrimaryPi0ESDPtMCPt(NULL),
-   hESDTruePrimaryEtaESDPtMCPt(NULL),
+   hESDTruePrimaryPi0MCPtResolPt(NULL),
+   hESDTruePrimaryEtaMCPtResolPt(NULL),
+   sESDTruePrimaryMotherInvMassPtY(NULL),
    hESDTrueSecondaryMotherInvMassPt(NULL),
    hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
    hESDTrueK0sWithPi0DaughterMCPt(NULL),
@@ -133,6 +141,8 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fMoveParticleAccordingToVertex(kTRUE),
    fIsHeavyIon(kFALSE),
    fDoMesonAnalysis(kTRUE),
+   fDoMesonQA(kFALSE),
+   fDoPhotonQA(kFALSE),
    fIsFromMBHeader(kTRUE)
 {
 
@@ -151,7 +161,9 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fESDList(NULL),
    fBackList(NULL),
    fMotherList(NULL),
+   fMotherRapList(NULL),
    fTrueList(NULL),
+   fTrueMotherRapList(NULL),
    fMCList(NULL),
    fHeaderNameList(NULL),
    fOutputContainer(0),
@@ -165,6 +177,7 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    hESDConvGammaR(NULL),
    hESDMotherInvMassPt(NULL),
    sESDMotherInvMassPtZM(NULL),
+   sESDMotherInvMassPtY(NULL),
    hESDMotherBackInvMassPt(NULL),
    sESDMotherBackInvMassPtZM(NULL),
    hESDMotherInvMassEalpha(NULL),
@@ -186,12 +199,13 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    hMCEtaPt(NULL),
    hMCPi0InAccPt(NULL),
    hMCEtaInAccPt(NULL),
+   hMCPi0PtY(NULL),
+   hMCEtaPtY(NULL),
    hESDTrueMotherInvMassPt(NULL),
-   hESDTruePi0FromEtaInvMassPt(NULL),
    hESDTruePrimaryMotherInvMassPt(NULL),
-   hESDTruePrimaryMotherInvMassMCPt(NULL),
-   hESDTruePrimaryPi0ESDPtMCPt(NULL),
-   hESDTruePrimaryEtaESDPtMCPt(NULL),
+   hESDTruePrimaryPi0MCPtResolPt(NULL),
+   hESDTruePrimaryEtaMCPtResolPt(NULL),
+   sESDTruePrimaryMotherInvMassPtY(NULL),
    hESDTrueSecondaryMotherInvMassPt(NULL),
    hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
    hESDTrueK0sWithPi0DaughterMCPt(NULL),
@@ -226,6 +240,8 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fMoveParticleAccordingToVertex(kTRUE),
    fIsHeavyIon(kFALSE),
    fDoMesonAnalysis(kTRUE),
+   fDoMesonQA(kFALSE),
+   fDoPhotonQA(kFALSE),
    fIsFromMBHeader(kTRUE)
 {
    // Define output slots here
@@ -250,7 +266,7 @@ AliAnalysisTaskGammaConvV1::~AliAnalysisTaskGammaConvV1()
 //___________________________________________________________
 void AliAnalysisTaskGammaConvV1::InitBack(){
 
-   Double_t *zBinLimitsArray = new Double_t[9];
+   Double_t *zBinLimitsArray= new Double_t[9] ;
    zBinLimitsArray[0] = -50.00;
    zBinLimitsArray[1] = -3.375;
    zBinLimitsArray[2] = -1.605;
@@ -261,7 +277,7 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
    zBinLimitsArray[7] = 50.00;
    zBinLimitsArray[8] = 1000.00;
 
-   Double_t *multiplicityBinLimitsArrayTracks = new Double_t[6];
+   Double_t *multiplicityBinLimitsArrayTracks= new Double_t[6];
    multiplicityBinLimitsArrayTracks[0] = 0;
    multiplicityBinLimitsArrayTracks[1] = 8.5;
    multiplicityBinLimitsArrayTracks[2] = 16.5;
@@ -277,7 +293,7 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
       multiplicityBinLimitsArrayTracks[5] = 5000.;
    }
 
-   Double_t *multiplicityBinLimitsArrayV0s = new Double_t[5];
+   Double_t *multiplicityBinLimitsArrayV0s= new Double_t[5];
    multiplicityBinLimitsArrayV0s[0] = 2;
    multiplicityBinLimitsArrayV0s[1] = 3;
    multiplicityBinLimitsArrayV0s[2] = 4;
@@ -311,7 +327,6 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
          fCutFolder[iCut]->Add(fBackList[iCut]);
 
          sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-         sESDMotherBackInvMassPtZM[iCut]->Sumw2();
          fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
 
          fMotherList[iCut] = new TList();
@@ -320,7 +335,6 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
          fCutFolder[iCut]->Add(fMotherList[iCut]);
 
          sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-         sESDMotherInvMassPtZM[iCut]->Sumw2();
          fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
 
          if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
@@ -348,7 +362,6 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
 {
-   TH1::SetDefaultSumw2(kTRUE);
 
    // Create histograms
    if(fOutputContainer != NULL){
@@ -367,18 +380,29 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
    fESDList = new TList*[fnCuts];
    fBackList = new TList*[fnCuts];
    fMotherList = new TList*[fnCuts];
-   hESDConvGammaPt = new TH1F*[fnCuts];
-   hESDConvGammaR = new TH1F*[fnCuts];
    hNEvents = new TH1I*[fnCuts];
    hNGoodESDTracks = new TH1I*[fnCuts];
    hNGammaCandidates = new TH1I*[fnCuts];
    hNV0Tracks = new TH1I*[fnCuts];
+   hESDConvGammaPt = new TH1F*[fnCuts];
+   if (fDoPhotonQA){
+      hESDConvGammaR = new TH1F*[fnCuts];
+   }
+   const Int_t nDim = 3;
+   Int_t nBins[nDim] = {800,250,40};
+   Double_t xMin[nDim] = {0,0, -1};
+   Double_t xMax[nDim] = {0.8,25,1};
 
    if(fDoMesonAnalysis){
       hESDMotherInvMassPt = new TH2F*[fnCuts];
       hESDMotherBackInvMassPt = new TH2F*[fnCuts];
       hESDMotherInvMassEalpha = new TH2F*[fnCuts];
+      if (fDoMesonQA){
+         fMotherRapList = new TList*[fnCuts];
+         sESDMotherInvMassPtY = new THnSparseF*[fnCuts];
+      }
    }
+
    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
 
       TString cutstring = ((AliConversionCuts*)fCutArray->At(iCut))->GetCutNumber();
@@ -413,11 +437,13 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       if(fIsHeavyIon) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
       else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
       fESDList[iCut]->Add(hNV0Tracks[iCut]);
-
       hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
       fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
-      hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
-      fESDList[iCut]->Add(hESDConvGammaR[iCut]);
+
+      if (fDoPhotonQA){
+         hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
+         fESDList[iCut]->Add(hESDConvGammaR[iCut]);
+      }
 
       if(fDoMesonAnalysis){
          hESDMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
@@ -426,8 +452,17 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
          fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
          hESDMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
          fESDList[iCut]->Add(hESDMotherInvMassEalpha[iCut]);
+         if (fDoMesonQA){
+            fMotherRapList[iCut] = new TList();
+            fMotherRapList[iCut]->SetName(Form("%s_%s Mother Y histograms",cutstring.Data(),cutstringMeson.Data()));
+            fMotherRapList[iCut]->SetOwner(kTRUE);
+            fCutFolder[iCut]->Add(fMotherRapList[iCut]);
+            sESDMotherInvMassPtY[iCut] = new THnSparseF("Mother_InvMass_Pt_Y","Mother_InvMass_Pt_Y",nDim,nBins,xMin,xMax);
+            fMotherRapList[iCut]->Add(sESDMotherInvMassPtY[iCut]);
+         }
       }
 
+
    }
    if(fDoMesonAnalysis){
       InitBack(); // Init Background Handler
@@ -450,23 +485,27 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       hMCDecayGammaPhiPt = new TH1F*[fnCuts];
       hMCDecayGammaSigmaPt = new TH1F*[fnCuts];
       hMCConvGammaPt = new TH1F*[fnCuts];
-      hMCConvGammaR = new TH1F*[fnCuts];
-      hMCConvGammaEta = new TH1F*[fnCuts];
       hMCConvGammaRSPt = new TH1F*[fnCuts];
-      hMCConvGammaRSR = new TH1F*[fnCuts];
-      hMCConvGammaRSEta = new TH1F*[fnCuts];
       hESDTrueConvGammaPt = new TH1F*[fnCuts];
 
       hESDCombinatorialPt = new TH2F*[fnCuts];
       hESDTruePrimaryConvGammaPt = new TH1F*[fnCuts];
-      hESDTruePrimaryConvGammaR = new TH1F*[fnCuts];
-      hESDTruePrimaryConvGammaEta = new TH1F*[fnCuts];
       hESDTruePrimaryConvGammaESDPtMCPt = new TH2F*[fnCuts];
       hESDTruePrimaryConvGammaRSESDPtMCPt = new TH2F*[fnCuts];
       hESDTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
-      hESDTrueSecondaryConvGammaR = new TH1F*[fnCuts];
+
       hESDTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
 
+      if (fDoPhotonQA){
+         hMCConvGammaR = new TH1F*[fnCuts];
+         hMCConvGammaEta = new TH1F*[fnCuts];
+         hMCConvGammaRSR = new TH1F*[fnCuts];
+         hMCConvGammaRSEta = new TH1F*[fnCuts];
+         hESDTruePrimaryConvGammaR = new TH1F*[fnCuts];
+         hESDTruePrimaryConvGammaEta = new TH1F*[fnCuts];
+         hESDTrueSecondaryConvGammaR = new TH1F*[fnCuts];
+      }
+
       if(fDoMesonAnalysis){
          hMCPi0Pt = new TH1F*[fnCuts];
          hMCEtaPt = new TH1F*[fnCuts];
@@ -474,18 +513,23 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
          hMCEtaInAccPt = new TH1F*[fnCuts];
 
          hESDTrueMotherInvMassPt = new TH2F*[fnCuts];
-         hESDTruePrimaryPi0ESDPtMCPt = new TH2F*[fnCuts];
-         hESDTruePrimaryEtaESDPtMCPt = new TH2F*[fnCuts];
          hESDTruePrimaryMotherInvMassPt = new TH2F*[fnCuts];
-         hESDTruePrimaryMotherInvMassMCPt = new TH2F*[fnCuts];
          hESDTrueSecondaryMotherInvMassPt = new TH2F*[fnCuts];
          hESDTrueSecondaryMotherFromK0sInvMassPt = new TH2F*[fnCuts];
-         hESDTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
          hESDTrueSecondaryMotherFromEtaInvMassPt = new TH2F*[fnCuts];
-         hESDTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
-         hESDTrueBckGGInvMassPt = new TH2F*[fnCuts];
-         hESDTrueBckContInvMassPt = new TH2F*[fnCuts];
-         hESDTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
+         if (fDoMesonQA){
+            hMCPi0PtY = new TH2F*[fnCuts];
+            hMCEtaPtY = new TH2F*[fnCuts];
+            hESDTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
+            hESDTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
+            hESDTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
+            hESDTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
+            hESDTrueBckGGInvMassPt = new TH2F*[fnCuts];
+            hESDTrueBckContInvMassPt = new TH2F*[fnCuts];
+            hESDTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
+            fTrueMotherRapList = new TList*[fnCuts];
+            sESDTruePrimaryMotherInvMassPtY = new THnSparseF*[fnCuts];
+         }
       }
 
       for(Int_t iCut = 0; iCut<fnCuts;iCut++){
@@ -515,26 +559,42 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
          fMCList[iCut]->Add(hMCDecayGammaSigmaPt[iCut]);
          hMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
          fMCList[iCut]->Add(hMCConvGammaPt[iCut]);
-         hMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
-         fMCList[iCut]->Add(hMCConvGammaR[iCut]);
-         hMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",100,-4,4);
-         fMCList[iCut]->Add(hMCConvGammaEta[iCut]);
          hMCConvGammaRSPt[iCut] = new TH1F("MC_ConvGamma_RS_Pt","MC_ConvGamma_RS_Pt",250,0,25);
          fMCList[iCut]->Add(hMCConvGammaRSPt[iCut]);
-         hMCConvGammaRSR[iCut] = new TH1F("MC_ConvGamma_RS_R","MC_ConvGamma_RS_R",800,0,200);
-         fMCList[iCut]->Add(hMCConvGammaRSR[iCut]);
-         hMCConvGammaRSEta[iCut] = new TH1F("MC_ConvGamma_RS_Eta","MC_ConvGamma_RS_Eta",100,-4,4);
-         fMCList[iCut]->Add(hMCConvGammaRSEta[iCut]);
+
+         if (fDoPhotonQA){
+            hMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
+            fMCList[iCut]->Add(hMCConvGammaR[iCut]);
+            hMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",100,-4,4);
+            fMCList[iCut]->Add(hMCConvGammaEta[iCut]);
+            hMCConvGammaRSR[iCut] = new TH1F("MC_ConvGamma_RS_R","MC_ConvGamma_RS_R",800,0,200);
+            fMCList[iCut]->Add(hMCConvGammaRSR[iCut]);
+            hMCConvGammaRSEta[iCut] = new TH1F("MC_ConvGamma_RS_Eta","MC_ConvGamma_RS_Eta",100,-4,4);
+            fMCList[iCut]->Add(hMCConvGammaRSEta[iCut]);
+         }
 
          if(fDoMesonAnalysis){
             hMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
+            hMCPi0Pt[iCut]->Sumw2();
             fMCList[iCut]->Add(hMCPi0Pt[iCut]);
             hMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
+            hMCEtaPt[iCut]->Sumw2();
             fMCList[iCut]->Add(hMCEtaPt[iCut]);
             hMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
+            hMCPi0InAccPt[iCut]->Sumw2();
             fMCList[iCut]->Add(hMCPi0InAccPt[iCut]);
             hMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
+            hMCEtaInAccPt[iCut]->Sumw2();
             fMCList[iCut]->Add(hMCEtaInAccPt[iCut]);
+            if (fDoMesonQA){
+               hMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",250,0,25,20,-1,1);
+               hMCPi0PtY[iCut]->Sumw2();
+               fMCList[iCut]->Add(hMCPi0PtY[iCut]);
+               hMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",250,0,25,20,-1,1);
+               hMCEtaPtY[iCut]->Sumw2();
+               fMCList[iCut]->Add(hMCEtaPtY[iCut]);
+            }
+
          }
          fTrueList[iCut] = new TList();
          fTrueList[iCut]->SetName(Form("%s_%s True histograms",cutstring.Data(),cutstringMeson.Data()));
@@ -564,14 +624,9 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
          fTrueList[iCut]->Add(hESDCombinatorialPt[iCut]);
          hESDTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTruePrimaryConvGammaPt[iCut]);
-         hESDTruePrimaryConvGammaR[iCut] = new TH1F("ESD_TruePrimaryConvGamma_R","ESD_TruePrimaryConvGamma_R",800,0,200);
-         fTrueList[iCut]->Add(hESDTruePrimaryConvGammaR[iCut]);
-         hESDTruePrimaryConvGammaEta[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Eta","ESD_TruePrimaryConvGamma_Eta",100,-4,4);
-         fTrueList[iCut]->Add(hESDTruePrimaryConvGammaEta[iCut]);
          hESDTrueSecondaryConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaPt[iCut]);
-         hESDTrueSecondaryConvGammaR[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_R","ESD_TrueSecondaryConvGamma_R",800,0,200);
-         fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaR[iCut]);
+
          hESDTrueSecondaryConvGammaFromXFromK0sPt[iCut]
             = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
          fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
@@ -581,19 +636,21 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
             = new TH2F("ESD_TruePrimaryConvGammaESD_RS_PtMCPt", "ESD_TruePrimaryConvGammaESD_RS_PtMCPt",250,0,25,250,0,25);
          fTrueList[iCut]->Add(hESDTruePrimaryConvGammaRSESDPtMCPt[iCut]);
 
+         if (fDoPhotonQA){
+            hESDTruePrimaryConvGammaR[iCut] = new TH1F("ESD_TruePrimaryConvGamma_R","ESD_TruePrimaryConvGamma_R",800,0,200);
+            fTrueList[iCut]->Add(hESDTruePrimaryConvGammaR[iCut]);
+            hESDTrueSecondaryConvGammaR[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_R","ESD_TrueSecondaryConvGamma_R",800,0,200);
+            fTrueList[iCut]->Add(hESDTrueSecondaryConvGammaR[iCut]);
+            hESDTruePrimaryConvGammaEta[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Eta","ESD_TruePrimaryConvGamma_Eta",100,-4,4);
+            fTrueList[iCut]->Add(hESDTruePrimaryConvGammaEta[iCut]);
+         }
 
          if(fDoMesonAnalysis){
             hESDTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
             fTrueList[iCut]->Add(hESDTrueMotherInvMassPt[iCut]);
-            hESDTruePrimaryPi0ESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryPi0_ESDPt_MCPt","ESD_TruePrimaryPi0_ESDPt_MCPt",250,0,25,250,0,25);
-            fTrueList[iCut]->Add(hESDTruePrimaryPi0ESDPtMCPt[iCut]);
-            hESDTruePrimaryEtaESDPtMCPt[iCut]  = new TH2F("ESD_TruePrimaryPi0_ESDPt_MCPt","ESD_TruePrimaryPi0_ESDPt_MCPt",250,0,25,250,0,25);
-            fTrueList[iCut]->Add(hESDTruePrimaryEtaESDPtMCPt[iCut]);
-            hESDTruePrimaryMotherInvMassMCPt[iCut]
-               = new TH2F("ESD_TruePrimaryMother_InvMass_MCPt", "ESD_TruePrimaryMother_InvMass_MCPt", 800,0,0.8,250,0,25);
-            fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassMCPt[iCut]);
             hESDTruePrimaryMotherInvMassPt[iCut]
                = new TH2F("ESD_TruePrimaryMother_InvMass_Pt", "ESD_TruePrimaryMother_InvMass_Pt", 800,0,0.8,250,0,25);
+            hESDTruePrimaryMotherInvMassPt[iCut]->Sumw2();
             fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassPt[iCut]);
             hESDTrueSecondaryMotherInvMassPt[iCut]
                = new TH2F("ESD_TrueSecondaryMother_InvMass_Pt", "ESD_TrueSecondaryMother_InvMass_Pt", 800,0,0.8,250,0,25);
@@ -601,19 +658,36 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
             hESDTrueSecondaryMotherFromK0sInvMassPt[iCut]
                = new TH2F("ESD_TrueSecondaryMotherFromK0s_InvMass_Pt","ESD_TrueSecondaryMotherFromK0s_InvMass_Pt",800,0,0.8,250,0,25);
             fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromK0sInvMassPt[iCut]);
-            hESDTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
-            fTrueList[iCut]->Add(hESDTrueK0sWithPi0DaughterMCPt[iCut]);
             hESDTrueSecondaryMotherFromEtaInvMassPt[iCut]
                = new TH2F("ESD_TrueSecondaryMotherFromEta_InvMass_Pt","ESD_TrueSecondaryMotherFromEta_InvMass_Pt",800,0,0.8,250,0,25);
             fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromEtaInvMassPt[iCut]);
-            hESDTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
-            fTrueList[iCut]->Add(hESDTrueEtaWithPi0DaughterMCPt[iCut]);
-            hESDTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueBckGGInvMassPt[iCut]);
-            hESDTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueBckContInvMassPt[iCut]);
-            hESDTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueDalitz_InvMass_Pt","ESD_TrueDalitz_InvMass_Pt",800,0,0.8,250,0,25);
-            fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPt[iCut]);
+
+            if (fDoMesonQA){
+               hESDTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0,25,1000,-1.,1.);
+               hESDTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
+               fTrueList[iCut]->Add(hESDTruePrimaryPi0MCPtResolPt[iCut]);
+               hESDTruePrimaryEtaMCPtResolPt[iCut]  = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0,25,1000,-1.,1.);
+               hESDTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
+               fTrueList[iCut]->Add(hESDTruePrimaryEtaMCPtResolPt[iCut]);
+               hESDTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
+               fTrueList[iCut]->Add(hESDTrueBckGGInvMassPt[iCut]);
+               hESDTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
+               fTrueList[iCut]->Add(hESDTrueBckContInvMassPt[iCut]);
+               hESDTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueDalitz_InvMass_Pt","ESD_TrueDalitz_InvMass_Pt",800,0,0.8,250,0,25);
+               fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPt[iCut]);
+               hESDTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
+               fTrueList[iCut]->Add(hESDTrueK0sWithPi0DaughterMCPt[iCut]);
+               hESDTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
+               fTrueList[iCut]->Add(hESDTrueEtaWithPi0DaughterMCPt[iCut]);
+
+               fTrueMotherRapList[iCut] = new TList();
+               fTrueMotherRapList[iCut]->SetName(Form("%s_%s True Mother Y histograms",cutstring.Data(),cutstringMeson.Data()));
+               fTrueMotherRapList[iCut]->SetOwner(kTRUE);
+               fCutFolder[iCut]->Add(fTrueMotherRapList[iCut]);
+               sESDTruePrimaryMotherInvMassPtY[iCut] = new THnSparseF("TruePrimaryMother_InvMass_Pt_Y","TruePrimaryMother_InvMass_Pt_Y",nDim,nBins,xMin,xMax);
+               fTrueMotherRapList[iCut]->Add(sESDTruePrimaryMotherInvMassPtY[iCut]);
+
+            }
          }
       }
    }
@@ -639,8 +713,6 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       }
    }
 
-   TH1::SetDefaultSumw2(kFALSE);
-
    PostData(1, fOutputContainer);
 }
 
@@ -778,7 +850,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
 
          if(fIsFromMBHeader){
             hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-            hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
+            if (fDoPhotonQA)hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
          }
          if(fMCEvent){
             ProcessTruePhotonCandidates(PhotonCandidate);
@@ -811,7 +883,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
             fGammaCandidates->Add(PhotonCandidate);
             if(fIsFromMBHeader){
                hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-               hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
+               if (fDoPhotonQA)hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
             }
             if(fMCEvent){
                ProcessTruePhotonCandidates(PhotonCandidate);
@@ -836,7 +908,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
          fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
          if(fIsFromMBHeader){
             hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-            hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
+            if (fDoPhotonQA)hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
          }
          if(fMCEvent){
             ProcessTruePhotonCandidates(PhotonCandidate);
@@ -938,8 +1010,10 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
       // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
       if(fIsFromMBHeader){
          hESDTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-         hESDTruePrimaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
-         hESDTruePrimaryConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
+         if (fDoPhotonQA){
+            hESDTruePrimaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
+            hESDTruePrimaryConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
+         }
          hESDTruePrimaryConvGammaRSESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
       }
       hESDTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
@@ -948,7 +1022,7 @@ void AliAnalysisTaskGammaConvV1::ProcessTruePhotonCandidates(AliAODConversionPho
    else{
       if(fIsFromMBHeader){
          hESDTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-         hESDTrueSecondaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
+         if (fDoPhotonQA) hESDTrueSecondaryConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
          if(MCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
             MCStack->Particle(MCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
             hESDTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
@@ -1003,12 +1077,16 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
       }
       if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
          hMCConvGammaPt[fiCut]->Fill(particle->Pt());
-         hMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
-         hMCConvGammaEta[fiCut]->Fill(particle->Eta());
+         if (fDoPhotonQA){
+            hMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
+            hMCConvGammaEta[fiCut]->Fill(particle->Eta());
+         }
          if(mcIsFromMB){
             hMCConvGammaRSPt[fiCut]->Fill(particle->Pt());
-            hMCConvGammaRSR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
-            hMCConvGammaRSEta[fiCut]->Fill(particle->Eta());
+            if (fDoPhotonQA){
+               hMCConvGammaRSR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
+               hMCConvGammaRSEta[fiCut]->Fill(particle->Eta());
+            }
          }
       } // Converted MC Gamma
       if(fDoMesonAnalysis){
@@ -1022,15 +1100,25 @@ void AliAnalysisTaskGammaConvV1::ProcessMCParticles()
                   weighted= ((AliConversionCuts*)fCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack);
                }
             }
+            Double_t mesonY = 10.;
+            if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
+               mesonY=10.;
+            } else{
+               mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
+            }
+
             if(particle->GetPdgCode() == 111){
                hMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
+               if (fDoMesonQA) hMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
             } else if(particle->GetPdgCode() == 221){
                hMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
+               if (fDoMesonQA) hMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
             }
 
             // Check the acceptance for both gammas
             if(((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
                ((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) ){
+
                if(particle->GetPdgCode() == 111){
                   hMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
                } else if(particle->GetPdgCode() == 221){
@@ -1048,9 +1136,11 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
    if(fGammaCandidates->GetEntries()>1){
       for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries()-1;firstGammaIndex++){
          AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
+         if (gamma0==NULL) continue;
          for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
             AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
             //Check for same Electron ID
+            if (gamma1==NULL) continue;
             if(gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelPositive() ||
                gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelNegative() ||
                gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelPositive() ||
@@ -1064,12 +1154,16 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
 
                if(pi0cand->GetAlpha()<0.1)
                   hESDMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
-
+               if (fDoMesonQA){
+                  Double_t sparesFill2[3] = {pi0cand->M(),pi0cand->Pt(),pi0cand->Rapidity()};
+                  sESDMotherInvMassPtY[fiCut]->Fill(sparesFill2,1);
+               }
                if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
                   Int_t zbin = 0;
                   Int_t mbin = 0;
 
                   if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
+
                      zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
                      if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
                         mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
@@ -1166,17 +1260,16 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0) >-1){
                   if(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->GetPdgCode()==kK0Short){
                      hESDTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                     hESDTrueK0sWithPi0DaughterMCPt[fiCut]
-                        ->Fill(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->Pt());
+                     if (fDoMesonQA)hESDTrueK0sWithPi0DaughterMCPt[fiCut]
+                                       ->Fill(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->Pt());
                   }
                   if(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->GetPdgCode()==221){
                      hESDTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                     hESDTrueEtaWithPi0DaughterMCPt[fiCut]
-                        ->Fill(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->Pt());
+                     if (fDoMesonQA)hESDTrueEtaWithPi0DaughterMCPt[fiCut]
+                                       ->Fill(MCStack->Particle(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0))->Pt());
                   }
                }
-            }
-            else{ // Only primary pi0 for efficiency calculation
+            }else{ // Only primary pi0 for efficiency calculation
                Float_t weighted= 1;
                if(((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack)){
                   if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
@@ -1184,16 +1277,20 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidates(AliAODConversionMoth
                   }
                }
                hESDTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
-               hESDTruePrimaryMotherInvMassMCPt[fiCut]->Fill(Pi0Candidate->M(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
-               if(isTruePi0){ // Only primary pi0 for unfolding
-                  hESDTruePrimaryPi0ESDPtMCPt[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
-               }
-               if (isTrueEta){ // Only primary eta for unfolding
-                  hESDTruePrimaryEtaESDPtMCPt[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
+
+               if (fDoMesonQA){
+                  Double_t sparesFill[3] = {Pi0Candidate->M(),Pi0Candidate->Pt(),Pi0Candidate->Rapidity()};
+                  sESDTruePrimaryMotherInvMassPtY[fiCut]->Fill(sparesFill,1);
+                  if(isTruePi0){ // Only primary pi0 for resolution
+                     hESDTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
+                  }
+                  if (isTrueEta){ // Only primary eta for resolution
+                     hESDTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
+                  }
                }
             }
          }
-         else if(!isTruePi0 && !isTrueEta){ // Background
+         else if(!isTruePi0 && !isTrueEta && fDoMesonQA){ // Background
             if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
                hESDTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
             } else { // No photon or without mother
@@ -1337,9 +1434,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
       for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
 
          AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
-
+         if (gamma0==NULL) continue;
          for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
             AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
+            if (gamma1 == NULL) continue;
             if(!((AliConversionCuts*)fCutArray->At(fiCut))->PhotonIsSelected(gamma1,fInputEvent))continue;
             for(Int_t nRandom=0;nRandom<((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents();nRandom++){
 
@@ -1426,10 +1524,9 @@ void AliAnalysisTaskGammaConvV1::UpdateEventByEventData(){
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::CountESDTracks(){
 
-   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
    // Using standard function for setting Cuts
    Bool_t selectPrimaries=kTRUE;
-   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
    EsdTrackCuts->SetMaxDCAToVertexZ(2);
    EsdTrackCuts->SetEtaRange(-0.8, 0.8);
    EsdTrackCuts->SetPtRange(0.15);
index 0dcade59e9a56aa29b05b11b302719b015656346..ba6b2e6a48a0f809355aca81ee2b490ab1d096a2 100644 (file)
@@ -23,8 +23,16 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    virtual void   Terminate(const Option_t*);
    void InitBack();
 
-   void SetIsHeavyIon(Bool_t flag){fIsHeavyIon = flag;}
+   void SetIsHeavyIon(Int_t flag){
+      if (flag == 1 || flag ==2 ){
+         fIsHeavyIon = 1;    
+      } else {
+         fIsHeavyIon = 0;    
+      }
+   }
    void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
+   void SetDoMesonQA(Bool_t flag){fDoMesonQA = flag;}
+   void SetDoPhotonQA(Bool_t flag){fDoPhotonQA = flag;}
    void ProcessPhotonCandidates();
    void CalculatePi0Candidates();
    void CalculateBackground();
@@ -59,7 +67,9 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TList **fESDList;
    TList **fBackList;
    TList **fMotherList;
+   TList **fMotherRapList;
    TList **fTrueList;
+   TList **fTrueMotherRapList;
    TList **fMCList;
    TList **fHeaderNameList;
    TList *fOutputContainer;
@@ -73,6 +83,7 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TH1F **hESDConvGammaR;
    TH2F **hESDMotherInvMassPt;
    THnSparseF **sESDMotherInvMassPtZM;
+   THnSparseF **sESDMotherInvMassPtY;
    TH2F **hESDMotherBackInvMassPt;
    THnSparseF **sESDMotherBackInvMassPtZM;
    TH2F **hESDMotherInvMassEalpha;
@@ -94,12 +105,13 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    TH1F **hMCEtaPt;
    TH1F **hMCPi0InAccPt;
    TH1F **hMCEtaInAccPt;
+   TH2F **hMCPi0PtY;
+   TH2F **hMCEtaPtY;
    TH2F **hESDTrueMotherInvMassPt;
-   TH2F **hESDTruePi0FromEtaInvMassPt;
    TH2F **hESDTruePrimaryMotherInvMassPt;
-   TH2F **hESDTruePrimaryMotherInvMassMCPt;
-   TH2F **hESDTruePrimaryPi0ESDPtMCPt;
-   TH2F **hESDTruePrimaryEtaESDPtMCPt;
+   TH2F **hESDTruePrimaryPi0MCPtResolPt;
+   TH2F **hESDTruePrimaryEtaMCPtResolPt;
+   THnSparseF **sESDTruePrimaryMotherInvMassPtY;
    TH2F **hESDTrueSecondaryMotherInvMassPt;
    TH2F **hESDTrueSecondaryMotherFromK0sInvMassPt;
    TH1F **hESDTrueK0sWithPi0DaughterMCPt;
@@ -135,6 +147,8 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    Bool_t fMoveParticleAccordingToVertex;
    Bool_t fIsHeavyIon;
    Bool_t fDoMesonAnalysis;
+   Bool_t fDoMesonQA;
+   Bool_t fDoPhotonQA;
    Bool_t fIsFromMBHeader;
 
 private:
@@ -143,7 +157,7 @@ private:
    AliAnalysisTaskGammaConvV1 &operator=(const AliAnalysisTaskGammaConvV1&); // Prevent assignment
 
 
-   ClassDef(AliAnalysisTaskGammaConvV1, 3);
+   ClassDef(AliAnalysisTaskGammaConvV1, 4);
 };
 
 #endif
diff --git a/PWGGA/GammaConv/AliAnalysisTaskGammaConversion.cxx b/PWGGA/GammaConv/AliAnalysisTaskGammaConversion.cxx
deleted file mode 100644 (file)
index 8a2e82d..0000000
+++ /dev/null
@@ -1,5262 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                                                                                                                                                                                                                                             *
- * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                                                                                             *
- * Version 1.1                                                                                                                                                                                                                                         *
- *                                                                                                                                                                                                                                                                                             *
- * Permission to use, copy, modify and distribute this software and its         *
- * documentation strictly for non-commercial purposes is hereby granted         *
- * without fee, provided that the above copyright notice appears in all         *
- * copies and that both the copyright notice and this permission notice         *
- * appear in the supporting documentation. The authors make no claims           *
- * about the suitability of this software for any purpose. It is                                       *
- * provided "as is" without express or implied warranty.                                                                       *
- **************************************************************************/
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class used to do analysis on conversion pairs
-//---------------------------------------------
-///////////////////////////////////////////////
-
-// root
-#include <TChain.h>
-
-// analysis
-#include "AliAnalysisTaskGammaConversion.h"
-#include "AliStack.h"
-#include "AliLog.h"
-#include "TTree.h"
-#include "AliESDtrackCuts.h"
-#include "TNtuple.h"
-//#include "AliCFManager.h"    // for CF
-//#include "AliCFContainer.h"   // for CF
-#include "AliESDInputHandler.h"
-#include "AliAnalysisManager.h"
-#include "AliAODPWG4Particle.h"
-#include "AliAODPWG4ParticleCorrelation.h"
-#include "AliAODConversionPhoton.h"
-#include "AliGammaConversionBGHandler.h"
-#include "AliESDCaloCluster.h" // for combining PHOS and GammaConv
-#include "AliKFVertex.h"
-#include "AliGenPythiaEventHeader.h"
-#include "AliGenDPMjetEventHeader.h"   
-#include "AliGenEventHeader.h"
-#include <AliMCEventHandler.h>
-#include "TRandom3.h"
-#include "AliTriggerAnalysis.h"
-#include "AliCentrality.h"
-#include "AliMultiplicity.h"
-#include "AliAODHandler.h"
-#include "AliKFConversionPhoton.h"
-#include "AliKFConversionMother.h"
-#include "AliESDVertex.h"
-#include "AliESDTZERO.h"
-#include "AliESDVZERO.h"
-
-class AliESDTrackCuts;
-class AliCFContainer;
-class AliCFManager;
-class AliKFVertex;
-class AliAODHandler;
-class AliAODEvent;
-class ALiESDEvent;
-class AliMCEvent;
-class AliMCEventHandler;
-class AliESDInputHandler;
-class AliAnalysisManager;
-class Riostream;
-class TFile;
-class TInterpreter;
-class TSystem;
-class TROOT;
-
-ClassImp(AliAnalysisTaskGammaConversion)
-
-
-AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion():
-AliAnalysisTaskSE(),
-        fpcstream(0x0),
-       fV0Reader(NULL),
-       fStack(NULL),
-       fMCTruth(NULL),         // for CF
-       fGCMCEvent(NULL),               // for CF
-       fESDEvent(NULL),        
-       fOutputContainer(NULL),
-       fCFManager(0x0),         // for CF
-       fHistograms(NULL),
-       fTriggerCINT1B(kFALSE),
-       fDoMCTruth(kFALSE),
-       fDoNeutralMeson(kFALSE),
-       fDoOmegaMeson(kFALSE),
-       fDoJet(kFALSE),
-       fDoChic(kFALSE),
-       fRecalculateV0ForGamma(kFALSE),
-       fKFReconstructedGammasTClone(NULL),
-       fKFReconstructedPi0sTClone(NULL),
-       fKFRecalculatedGammasTClone(NULL),
-       fCurrentEventPosElectronTClone(NULL),
-       fCurrentEventNegElectronTClone(NULL),
-       fKFReconstructedGammasCutTClone(NULL),
-       fPreviousEventTLVNegElectronTClone(NULL),
-       fPreviousEventTLVPosElectronTClone(NULL),       
-       //  fElectronRecalculatedv1(),
-       // fElectronRecalculatedv2(),
-       fElectronMass(-1),
-       fGammaMass(-1),
-       fPi0Mass(-1),
-       fEtaMass(-1),
-       fGammaWidth(-1),
-       fPi0Width(-1),
-       fEtaWidth(-1),
-       fMinOpeningAngleGhostCut(0.),
-       fEsdTrackCuts(NULL),
-       fCalculateBackground(kFALSE),
-       fWriteNtuple(kFALSE),
-       fGammaNtuple(NULL),
-       fNeutralMesonNtuple(NULL),
-       fTotalNumberOfAddedNtupleEntries(0),
-       fChargedParticles(NULL),
-       fChargedParticlesId(),
-       fGammaPtHighest(0.),
-       fMinPtForGammaJet(1.),
-       fMinIsoConeSize(0.2),
-       fMinPtIsoCone(0.7),
-       fMinPtGamChargedCorr(0.5),
-       fMinPtJetCone(0.5),
-       fLeadingChargedIndex(-1),
-       fLowPtMapping(1.),
-       fHighPtMapping(3.),
-       fDoCF(kFALSE),
-       fAODGamma(NULL),
-       //fAODPi0(NULL),
-       //fAODOmega(NULL),
-       fAODBranchName("GammaConv"),
-       fKFCreateAOD(kTRUE),
-       fKFExchangeAOD(kFALSE),
-       fKFForceAOD(kFALSE),
-       fKFDeltaAODFileName(""),
-       fDoNeutralMesonV0MCCheck(kFALSE),
-       fUseTrackMultiplicityForBG(kTRUE),
-       fMoveParticleAccordingToVertex(kFALSE),
-       fApplyChi2Cut(kFALSE),
-       fNRandomEventsForBG(15),
-       fNDegreesPMBackground(15),
-       fDoRotation(kTRUE),
-       fCheckBGProbability(kTRUE),
-       fRemovePileUp(kFALSE),
-       fSelectV0AND(0),
-       fTriggerAnalysis(NULL),
-       fMultiplicity(0),
-       fUseMultiplicity(0), 
-       fUseMultiplicityBin(0),
-       fUseHBTMultiplicity(0),
-       fUseHBTMultiplicityBin(0),
-       fUseCentrality(0), 
-       fUseCentralityBin(0),
-       fMultSelection(0),
-       fRandom(0)
-{
-       // Default constructor
-
-       /*       Kenneth: the default constructor should not have any define input/output or the call to SetESDtrackCuts
-       // Common I/O in slot 0
-       DefineInput (0, TChain::Class());
-       DefineOutput(0, TTree::Class());
-       
-       // Your private output
-       DefineOutput(1, TList::Class());
-       
-       // Define standard ESD track cuts for Gamma-hadron correlation 
-       SetESDtrackCuts();
-       */
-}
-
-AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name):
-       AliAnalysisTaskSE(name),
-        fpcstream(0x0),
-       fV0Reader(NULL),
-       fStack(NULL),
-       fMCTruth(NULL),         // for CF
-       fGCMCEvent(NULL),               // for CF
-       fESDEvent(NULL),        
-       fOutputContainer(0x0),
-       fCFManager(0x0),         // for CF
-       fHistograms(NULL),
-       fTriggerCINT1B(kFALSE),
-       fDoMCTruth(kFALSE),
-       fDoNeutralMeson(kFALSE),
-       fDoOmegaMeson(kFALSE),
-       fDoJet(kFALSE),
-       fDoChic(kFALSE),
-       fRecalculateV0ForGamma(kFALSE),
-       fKFReconstructedGammasTClone(NULL),
-       fKFReconstructedPi0sTClone(NULL),
-       fKFRecalculatedGammasTClone(NULL),
-       fCurrentEventPosElectronTClone(NULL),
-       fCurrentEventNegElectronTClone(NULL),
-       fKFReconstructedGammasCutTClone(NULL),
-       fPreviousEventTLVNegElectronTClone(NULL),
-       fPreviousEventTLVPosElectronTClone(NULL),       
-      //  fElectronRecalculatedv1(),
-      //  fElectronRecalculatedv2(),
-       fElectronMass(-1),
-       fGammaMass(-1),
-       fPi0Mass(-1),
-       fEtaMass(-1),
-       fGammaWidth(-1),
-       fPi0Width(-1),
-       fEtaWidth(-1),
-       fMinOpeningAngleGhostCut(0.),
-       fEsdTrackCuts(NULL),
-       fCalculateBackground(kFALSE),
-       fWriteNtuple(kFALSE),
-       fGammaNtuple(NULL),
-       fNeutralMesonNtuple(NULL),
-       fTotalNumberOfAddedNtupleEntries(0),
-       fChargedParticles(NULL),
-       fChargedParticlesId(),
-       fGammaPtHighest(0.),
-       fMinPtForGammaJet(1.),
-       fMinIsoConeSize(0.2),
-       fMinPtIsoCone(0.7),
-       fMinPtGamChargedCorr(0.5),
-       fMinPtJetCone(0.5),
-       fLeadingChargedIndex(-1),
-       fLowPtMapping(1.),
-       fHighPtMapping(3.),
-       fDoCF(kFALSE),
-       fAODGamma(NULL),
-       //fAODPi0(NULL),
-       //fAODOmega(NULL),
-       fAODBranchName("GammaConv"),
-       fKFCreateAOD(kTRUE),
-       fKFExchangeAOD(kFALSE),
-       fKFForceAOD(kFALSE),
-       fKFDeltaAODFileName(""),
-       fDoNeutralMesonV0MCCheck(kFALSE),
-       fUseTrackMultiplicityForBG(kTRUE),
-       fMoveParticleAccordingToVertex(kFALSE),
-       fApplyChi2Cut(kFALSE),
-       fNRandomEventsForBG(15),
-       fNDegreesPMBackground(15),
-       fDoRotation(kTRUE),
-       fCheckBGProbability(kTRUE),
-       fRemovePileUp(kFALSE),
-       fSelectV0AND(0),
-       fTriggerAnalysis(NULL),
-       fMultiplicity(0),
-       fUseMultiplicity(0), 
-       fUseMultiplicityBin(0), 
-       fUseHBTMultiplicity(0),
-       fUseHBTMultiplicityBin(0),
-       fUseCentrality(0), 
-       fUseCentralityBin(0),
-        fMultSelection(0),
-       fRandom(0)
-{
-       // Common I/O in slot 0, don't define when inheriting from AnalysisTaskSE
-       // DefineInput (0, TChain::Class());    
-       // DefineOutput(0, TTree::Class()); 
-       
-       // Your private output
-       DefineOutput(1, TList::Class());
-       DefineOutput(2, AliCFContainer::Class());       // for CF
-       DefineOutput(3, TClonesArray::Class());
-       
-       // Define standard ESD track cuts for Gamma-hadron correlation 
-       SetESDtrackCuts();
-
-}
-
-AliAnalysisTaskGammaConversion::~AliAnalysisTaskGammaConversion() 
-{
-       // Remove all pointers
-       
-       if(fOutputContainer){
-               fOutputContainer->Clear() ; 
-               delete fOutputContainer ;
-       }
-       if(fHistograms){
-               delete fHistograms;
-       }
-       if(fV0Reader){
-               delete fV0Reader;
-       }
-       
-       // for CF
-       if(fCFManager){
-               delete fCFManager;
-       }
-
-       if(fEsdTrackCuts){
-               delete fEsdTrackCuts;
-       }
-
-       //Delete AODs
-       if (fAODGamma) {
-               fAODGamma->Clear();
-               delete fAODGamma;
-       }
-       fAODGamma = NULL;
-
-       /*if (fAODPi0) {
-               fAODPi0->Clear();
-               delete fAODPi0;
-       }
-       fAODPi0 = NULL;
-
-       if (fAODOmega) {
-               fAODOmega->Clear();
-               delete fAODOmega;
-       }
-       fAODOmega = NULL;
-       */
-       if(fTriggerAnalysis) {
-               delete fTriggerAnalysis;
-       }
-       if (fpcstream)
-               delete fpcstream;
-       fpcstream = NULL;
-}
-
-
-void AliAnalysisTaskGammaConversion::Init()
-{
-       // Initialization
-       // AliLog::SetGlobalLogLevel(AliLog::kError);
-}
-void AliAnalysisTaskGammaConversion::SetESDtrackCuts()
-{
-       // SetESDtrackCuts
-       if (fEsdTrackCuts!=NULL){
-               delete fEsdTrackCuts;
-       }
-       fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
-       //standard cuts from:
-       //http://aliceinfo.cern.ch/alicvs/viewvc/PWG0/dNdEta/CreateCuts.C?revision=1.4&view=markup
-
-       // Cuts used up to 3rd of March
-
-       //      fEsdTrackCuts->SetMinNClustersTPC(50);
-       //       fEsdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
-       //       fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
-       //       fEsdTrackCuts->SetRequireITSRefit(kTRUE);
-       //       fEsdTrackCuts->SetMaxNsigmaToVertex(3);
-       //       fEsdTrackCuts->SetRequireSigmaToVertex(kTRUE);
-
-       //------- To be tested-----------
-       // Cuts used up to 26th of Agost
-       //              Int_t minNClustersTPC = 70;
-       //              Double_t maxChi2PerClusterTPC = 4.0;
-       //              Double_t maxDCAtoVertexXY = 2.4; // cm
-       //              Double_t maxDCAtoVertexZ        = 3.2; // cm
-       //              fEsdTrackCuts->SetRequireSigmaToVertex(kFALSE);
-       //              fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
-       //              fEsdTrackCuts->SetRequireITSRefit(kTRUE);
-       //              //       fEsdTrackCuts->SetRequireTPCStandAlone(kTRUE);
-       //              fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
-       //              fEsdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
-       //              fEsdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
-       //              fEsdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
-       //              fEsdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
-       //              fEsdTrackCuts->SetDCAToVertex2D(kTRUE);
-       //              fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
-       //              fEsdTrackCuts->SetPtRange(0.15);
-
-       //              fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
-
-
-       // Using standard function      for setting Cuts
-       Bool_t selectPrimaries=kTRUE;
-       fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
-       fEsdTrackCuts->SetMaxDCAToVertexZ(2);
-       fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
-       fEsdTrackCuts->SetPtRange(0.15);
-       
-       //----- From Jacek 10.03.03 ------------------/
-       //               minNClustersTPC = 70;
-       //               maxChi2PerClusterTPC = 4.0;
-       //               maxDCAtoVertexXY = 2.4; // cm
-       //               maxDCAtoVertexZ        = 3.2; // cm
-
-       //               esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
-       //               esdTrackCuts->SetRequireTPCRefit(kFALSE);
-       //               esdTrackCuts->SetRequireTPCStandAlone(kTRUE);
-       //               esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
-       //               esdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
-       //               esdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
-       //               esdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
-       //               esdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
-       //               esdTrackCuts->SetDCAToVertex2D(kTRUE);
-       
-
-
-       //      fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
-       //      fV0Reader->SetESDtrackCuts(fEsdTrackCuts);
-}
-
-void AliAnalysisTaskGammaConversion::UserExec(Option_t */*option*/)
-{
-       // Execute analysis for current event
-
-       //      Load the esdpid from the esdhandler if exists (tender was applied) otherwise set the Bethe Bloch parameters
-
-       AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
-       AliESDInputHandler *esdHandler=0x0;
-       if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){
-               AliV0Reader::SetESDpid(esdHandler->GetESDpid());
-       } else {
-               //load esd pid bethe bloch parameters depending on the existance of the MC handler
-               // yes: MC parameters
-               // no:  data parameters
-               if (!AliV0Reader::GetESDpid()){
-                       if (fMCEvent ) {
-                               AliV0Reader::InitESDpid();
-                       } else {
-                               AliV0Reader::InitESDpid(1);
-                       }
-               }
-       } 
-
-       if(fAODGamma) fAODGamma->Clear();
-       
-
-       ///Make sure MC event is complete if present
-       if (fMCEvent ) {
-         if( !CheckMCEvent() ) {
-               PostAODEvent();
-               return;
-         }
-       }
-
-       fV0Reader->SetInputAndMCEvent(InputEvent(), MCEvent());
-
-       fV0Reader->Initialize();
-       fDoMCTruth = fV0Reader->GetDoMCTruth();
-
-       
-       if(fKFReconstructedGammasTClone == NULL){
-               fKFReconstructedGammasTClone = new TClonesArray("AliKFConversionPhoton",0);
-       }
-       if(fCurrentEventPosElectronTClone == NULL){
-               fCurrentEventPosElectronTClone = new TClonesArray("AliESDtrack",0);
-       }
-       if(fCurrentEventNegElectronTClone == NULL){
-               fCurrentEventNegElectronTClone = new TClonesArray("AliESDtrack",0);
-       }
-       if(fKFReconstructedGammasCutTClone == NULL){
-               fKFReconstructedGammasCutTClone = new TClonesArray("AliKFConversionPhoton",0);
-       }
-       if(fPreviousEventTLVNegElectronTClone == NULL){
-               fPreviousEventTLVNegElectronTClone = new TClonesArray("TLorentzVector",0);
-       }
-       if(fPreviousEventTLVPosElectronTClone == NULL){
-               fPreviousEventTLVPosElectronTClone      = new TClonesArray("TLorentzVector",0);
-       }
-       if(fChargedParticles == NULL){
-               fChargedParticles = new TClonesArray("AliESDtrack",0);
-       }
-
-       if(fKFReconstructedPi0sTClone == NULL){
-               fKFReconstructedPi0sTClone = new TClonesArray("AliKFConversionMother",0);
-       }
-/*     if(fKFRecalculatedGammasTClone == NULL){
-               fKFRecalculatedGammasTClone = new TClonesArray("AliKFParticle",0);
-       }
-  */
-       if(fTriggerAnalysis== NULL){
-               fTriggerAnalysis = new AliTriggerAnalysis;
-       }
-
-       //clear TClones
-       fKFReconstructedGammasTClone->Delete();
-       fCurrentEventPosElectronTClone->Delete();
-       fCurrentEventNegElectronTClone->Delete();
-       fKFReconstructedGammasCutTClone->Delete();
-       fPreviousEventTLVNegElectronTClone->Delete();
-       fPreviousEventTLVPosElectronTClone->Delete();
-       fKFReconstructedPi0sTClone->Delete();
-     //   fKFRecalculatedGammasTClone->Delete();
-
-       //clear vectors
-
-       fChargedParticles->Delete();    
-
-       fChargedParticlesId.clear();    
-
-
-       if(!DoEventSelection()) {
-         PostAODEvent();
-         return;
-       }
-
-
-       //Clear the data in the v0Reader
-       //      fV0Reader->UpdateEventByEventData();
-
-
-       // Process the MC information
-       if(fDoMCTruth){
-           ProcessMCData();
-       }
-
-       
-       //Process the v0 information with no cuts
-       ProcessV0sNoCut();
-
-       // Process the v0 information
-       ProcessV0s();
-       
-
-       //Fill Gamma AOD
-       if(fKFCreateAOD) {
-         FillAODWithConversionGammas() ; 
-       }
-
-
-       // Process reconstructed gammas
-       if(fDoNeutralMeson == kTRUE){
-               ProcessGammasForNeutralMesonAnalysis();
-
-       }
-       
-       if(fDoMCTruth == kTRUE){
-               CheckV0Efficiency();
-       }
-       //Process reconstructed gammas electrons for Chi_c Analysis
-       if(fDoChic == kTRUE){
-               ProcessGammaElectronsForChicAnalysis();
-       }
-       // Process reconstructed gammas for gamma Jet/hadron correlations
-       if(fDoJet == kTRUE){
-               ProcessGammasForGammaJetAnalysis();
-       }
-       
-       //calculate background if flag is set
-       if(fCalculateBackground){
-               CalculateBackground();
-       }
-
-       if(fDoNeutralMeson == kTRUE){
-               //               ProcessConvPHOSGammasForNeutralMesonAnalysis();
-               if(fDoOmegaMeson == kTRUE){
-                       ProcessGammasForOmegaMesonAnalysis();
-               }
-       }
-
-
-       //Must set fForceAOD to true for the AOD to get filled. (Unless called by other task)
-       if(fKFForceAOD) {
-               if (!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) { 
-                       AliFatal("Cannot run ESD filter without an output event handler");
-        
-               } else {
-                       if(fAODGamma && fAODGamma->GetEntriesFast() > 0) {
-       AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
-       AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);      
-                       }
-               }
-       
-       }
-
-       ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod)
-       if(fKFCreateAOD && !fKFExchangeAOD) {
-               AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
-               if (aodhandler && aodhandler->GetFillAOD()) {
-                       AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);      
-               }
-       }
-
-
-
-
-       //Clear the data in the v0Reader
-       fV0Reader->UpdateEventByEventData();
-       //if(fRecalculateV0ForGamma==kTRUE){
-       //      RecalculateV0ForGamma();
-       // }
-        
-
-       PostAODEvent();
-       PostData(1, fOutputContainer);
-       PostData(2, fCFManager->GetParticleContainer());        // for CF
-}
-
-Bool_t AliAnalysisTaskGammaConversion::CheckMCEvent() {
-  // To avoid crashes due to unzip errors. Sometimes the trees are not there.
-
-  Int_t eventQuality=-1;
-  AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
-  if (!mcHandler){ 
-       AliError("Could not retrive MC event handler!"); 
-       eventQuality=0;
-       fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-       return kFALSE;
-  }
-
-  if (!mcHandler->InitOk() ){
-       eventQuality=0;
-       fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-       return kFALSE;
-  }
-
-  if (!mcHandler->TreeK() ){
-       eventQuality=0;
-       fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-       return kFALSE;
-  }
-
-  if (!mcHandler->TreeTR() ) {
-       eventQuality=0;
-       fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-       return kFALSE;
-  }
-
-       return kTRUE;
-}
-
-Bool_t AliAnalysisTaskGammaConversion::DoEventSelection() {
-
-
-  Int_t eventQuality = -1;
-
-       //Take Only events with proper trigger
-       /*
-               if(fTriggerCINT1B){
-               if(!fV0Reader->GetESDEvent()->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL")) return;
-               }
-       */
-       Bool_t v0A                       = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0A);
-       Bool_t v0C                       = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0C);
-       Bool_t v0AND = v0A && v0C;
-
-       
-
-
-
-       if(fSelectV0AND==1 && !v0AND){
-               eventQuality=5;
-               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               if(fDoMCTruth){
-                       if(!fV0Reader->GetIsHeavyIon()){
-                           CheckMesonProcessTypeEventQuality(eventQuality);
-                       }
-               }
-
-               return kFALSE;
-       }
-
-       Int_t hitsA = 0, hitsC =0;
-       if(fSelectV0AND>1 ){
-               for(Int_t iA = 0; iA < 32; ++iA) {
-                       if (fV0Reader->GetESDEvent()->GetVZEROData()->BBTriggerV0A(iA)) hitsA++;
-               }
-               for(Int_t iC = 0; iC < 32; ++iC) {
-                       if (fV0Reader->GetESDEvent()->GetVZEROData()->BBTriggerV0C(iC)) hitsC++;
-               }
-                if (fSelectV0AND==2 ){
-                   if (hitsA<2 || hitsC<2) {
-                      eventQuality=5;
-                      fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                      if(fDoMCTruth){
-                         if(!fV0Reader->GetIsHeavyIon()){
-                            CheckMesonProcessTypeEventQuality(eventQuality);
-                         }
-                      }
-                      
-                      return kFALSE;
-                   }
-               }
-               if (fSelectV0AND==3 ){
-                       if (hitsA>=2 && hitsC>=2) {
-                               eventQuality=5;
-                               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-                               if(fDoMCTruth){
-                                       if(!fV0Reader->GetIsHeavyIon()){
-                                               CheckMesonProcessTypeEventQuality(eventQuality);
-                                       }
-                               }
-                               return kFALSE;
-                       }
-               }
-       }
-
-
-
-       if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
-               //              cout<< "Event not taken"<< endl;
-               eventQuality=1;
-               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               if(fDoMCTruth){
-                       if(!fV0Reader->GetIsHeavyIon()){
-                               CheckMesonProcessTypeEventQuality(eventQuality);
-                       }
-               }
-               return kFALSE; // aborts if the primary vertex does not have contributors.
-       }
-
-        
-
-       if(!fV0Reader->CheckForPrimaryVertexZ() ){
-               eventQuality=2;
-               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               if(fDoMCTruth){
-                       if(!fV0Reader->GetIsHeavyIon()){
-                               CheckMesonProcessTypeEventQuality(eventQuality);
-                       }
-               }
-               return kFALSE;
-       }
-
-
-       if(fV0Reader->GetESDEvent()->GetPrimaryVertexTracks()->GetNContributors()>0) {
-               fHistograms->FillHistogram("ESD_GlobalPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
-       }else{
-               if(fV0Reader->GetESDEvent()->GetPrimaryVertexSPD()->GetNContributors()>0) {
-                       fHistograms->FillHistogram("ESD_SPDPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
-               }
-       }
-
-       if(fRemovePileUp && fV0Reader->GetESDEvent()->IsPileupFromSPD()) {
-               eventQuality=4;
-               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               return kFALSE;
-       }
-       
-
-       Int_t tTracklet=0, tITSTPC=0, tITSPure=0;
-       fV0Reader->GetESDEvent()->EstimateMultiplicity(tTracklet, tITSTPC, tITSPure, 0.8);
-       Int_t fMultiplicityITS = tITSPure;
-
-       fMultiplicity = fEsdTrackCuts->CountAcceptedTracks(fV0Reader->GetESDEvent());
-       Int_t fMultiplicityStandard = fMultiplicity;
-
-       if( fUseHBTMultiplicity==1) {
-               fMultiplicity = fMultiplicityITS;
-       }
-
-
-       fHistograms->FillHistogram("ESD_MultiplicityDeviation",fMultiplicityStandard,fMultiplicityITS);
-
-       
-       if(fUseMultiplicity!=0 && CalculateMultiplicityBin()!=fUseMultiplicityBin ){
-               eventQuality=6;
-               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               return kFALSE;
-       }
-
-       
-       if(fUseHBTMultiplicity!=0 && CalculateMultiplicityBin()!=fUseHBTMultiplicityBin ){
-               eventQuality=6;
-               fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-               return kFALSE;
-       }
-
-
-       if(fV0Reader->GetIsHeavyIon()){
-           
-           if(!CheckCentrality()){
-              eventQuality=7;
-              fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-              return kFALSE;
-           }
-        }
-        
-//            if(fUseCentrality>0){
-//                     AliCentrality *esdCentrality = fV0Reader->GetESDEvent()->GetCentrality();
-//                     Int_t centralityC = -1;
-
-//                     if(fUseCentrality==1){
-//     centralityC = esdCentrality->GetCentralityClass10("V0M");
-//     if( centralityC != fUseCentralityBin ){
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//                     }
-
-//                     if(fUseCentrality==2){
-//     centralityC = esdCentrality->GetCentralityClass10("CL1");
-//     if( centralityC != fUseCentralityBin ){
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//                     }
-
-//                     ////////////////////////////////////// RRnew start /////////////////////////////////////////////////////
-//                     if(fUseCentrality==3){
-//     centralityC = esdCentrality->GetCentralityClass10("V0M");
-//     if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;          
-//     }
-//     if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 3) && (centralityC!=0) && (centralityC!=1) ){ // 0-20%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 7) && (centralityC!=6) && (centralityC!=7) ){ // 60-80%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 8) && (centralityC>=8) ){ // 0-80%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 9) && (centralityC>=9) ){ // 0-90%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//                     }
-
-//                     if(fUseCentrality==4){
-//     centralityC = esdCentrality->GetCentralityClass10("CL1");
-//     if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;          
-//     }
-//     if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//     if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
-//             eventQuality=7;
-//             fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-//             return kFALSE;
-//     }
-//                     }
-//                     ////////////////////////////////////// RRnew end ///////////////////////////////////////////////////////
-                       
-//             }
-//     }
-
-
-       eventQuality=3;
-
-       fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
-
-
-
-       fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",fMultiplicity);
-       if (fV0Reader->GetNumberOfContributorsVtx()>=1){
-               fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",fMultiplicity);
-       } 
-
-
-
-       return kTRUE;
-
-}
-
-
-///_______________________________________________________________
-void AliAnalysisTaskGammaConversion::PostAODEvent() {
-  ///Post AOD array to correct output slot
-  if(fKFCreateAOD) {
-       if(!fKFExchangeAOD) {
-         PostData(0, fAODGamma);
-       }  else {
-         PostData(3, fAODGamma); 
-       }
-  }
-}
-
-// void AliAnalysisTaskGammaConversion::ConnectInputData(Option_t *option){
-//      // see header file for documentation
-//      //     printf("         ConnectInputData %s\n", GetName());
-
-//      AliAnalysisTaskSE::ConnectInputData(option);
-
-//      if(fV0Reader == NULL){
-//              // Write warning here cuts and so on are default if this ever happens
-//      }
-//      fV0Reader->Initialize();
-//      fDoMCTruth = fV0Reader->GetDoMCTruth();
-// }
-
-void AliAnalysisTaskGammaConversion::CheckMesonProcessTypeEventQuality(Int_t evtQ){
-       // Check meson process type event quality
-       fStack= MCEvent()->Stack();
-       fGCMCEvent=MCEvent();
-
-
-       for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
-               TParticle* particle = (TParticle *)fStack->Particle(iTracks);
-               if (!particle) {
-                       //print warning here
-                       continue;
-               }
-               //               if(particle->GetPdgCode()!=111 || particle->GetPdgCode()!=221){
-               //                       continue;
-               //               }
-               
-               Double_t rapidity;
-               if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
-                       rapidity=8.;
-               }
-               else{
-                       rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
-               }       
-               
-
-               if( particle->GetPdgCode()==111){
-                       fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
-                       if(particle->GetNDaughters()==2){
-                               fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
-                               if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                                       fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
-                               }
-                       }
-                       if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
-                       }
-               }
-                       
-                       
-               if(particle->GetPdgCode()==221){
-                       fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
-                       if(particle->GetNDaughters()==2){
-                               fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
-                               if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                                       fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
-                               }
-                       }
-                       if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
-                       }
-                       
-               }
-
-
-               if(particle->GetPdgCode()!=111){                 //Pi0
-                       continue;
-               }
-
-
-               if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue; 
-               if(fV0Reader->GetIsHeavyIon()) continue;
-
-               if(evtQ==1){
-                       switch(GetProcessType(fGCMCEvent)){
-                       case    kProcSD:
-                               fHistograms->FillHistogram("MC_SD_EvtQ1_Pi0_Pt", particle->Pt());
-                               break;
-                       case    kProcDD:
-                               fHistograms->FillHistogram("MC_DD_EvtQ1_Pi0_Pt", particle->Pt());
-                               break;
-                       case    kProcND:
-                               fHistograms->FillHistogram("MC_ND_EvtQ1_Pi0_Pt", particle->Pt());
-                               break;
-                       default:
-                               AliError("Unknown Process");
-                       }
-               }
-               if(evtQ==2){
-                       switch(GetProcessType(fGCMCEvent)){
-                       case    kProcSD:
-                               fHistograms->FillHistogram("MC_SD_EvtQ2_Pi0_Pt", particle->Pt());
-                       break;
-                       case    kProcDD:
-                               fHistograms->FillHistogram("MC_DD_EvtQ2_Pi0_Pt", particle->Pt());
-                       break;
-                       case    kProcND:
-                               fHistograms->FillHistogram("MC_ND_EvtQ2_Pi0_Pt", particle->Pt());
-                       break;
-                       default:
-                               AliError("Unknown Process");
-                       }
-               }
-
-               if(evtQ==4){
-                       switch(GetProcessType(fGCMCEvent)){
-                       case    kProcSD:
-                               fHistograms->FillHistogram("MC_SD_EvtQ4_Pi0_Pt", particle->Pt());
-                       break;
-                       case    kProcDD:
-                               fHistograms->FillHistogram("MC_DD_EvtQ4_Pi0_Pt", particle->Pt());
-                       break;
-                       case    kProcND:
-                               fHistograms->FillHistogram("MC_ND_EvtQ4_Pi0_Pt", particle->Pt());
-                       break;
-                       default:
-                               AliError("Unknown Process");
-                       }
-               }
-
-               if(evtQ==5){
-                       switch(GetProcessType(fGCMCEvent)){
-                       case    kProcSD:
-                               fHistograms->FillHistogram("MC_SD_EvtQ5_Pi0_Pt", particle->Pt());
-                       break;
-                       case    kProcDD:
-                               fHistograms->FillHistogram("MC_DD_EvtQ5_Pi0_Pt", particle->Pt());
-                       break;
-                       case    kProcND:
-                               fHistograms->FillHistogram("MC_ND_EvtQ5_Pi0_Pt", particle->Pt());
-                       break;
-                       default:
-                               AliError("Unknown Process");
-                       }
-               }
-
-       }
-
-}
-
-void AliAnalysisTaskGammaConversion::ProcessMCData(){
-       // see header file for documentation
-       //InputEvent(), MCEvent());
-       /* TestAnaMarin
-               fStack = fV0Reader->GetMCStack();
-               fMCTruth = fV0Reader->GetMCTruth();     // for CF
-               fGCMCEvent = fV0Reader->GetMCEvent();   // for CF
-       */
-       fStack= MCEvent()->Stack();
-       fGCMCEvent=MCEvent();
-               
-       // for CF
-       Double_t containerInput[3];
-       if(fDoCF){
-               if(!fGCMCEvent) cout << "NO MC INFO FOUND" << endl;
-               fCFManager->SetEventInfo(fGCMCEvent);
-       } 
-       // end for CF
-               
-       if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
-               return; // aborts if the primary vertex does not have contributors.
-       }
-       
-       Int_t nCharged = 0;
-       Int_t nCharged150MeV = 0;
-
-       for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
-               //      for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++) {
-               TParticle* particle = (TParticle *)fStack->Particle(iTracks);
-
-                if (!particle) {
-                   //print warning here
-                   continue;
-                }
-
-
-                if(fV0Reader->GetExcludeBackgroundEventForGammaCorrection()){
-                   Bool_t isFromBGEvent = kFALSE;
-                   isFromBGEvent = fV0Reader->IsParticleFromBGEvent(iTracks);
-                   if(isFromBGEvent) continue;
-                }
-                
-
-               
-               ///////////////////////Begin Chic Analysis/////////////////////////////
-               if(fDoChic) {
-                       if(particle->GetPdgCode() == 443){//Is JPsi     
-                               if(particle->GetNDaughters()==2){
-                                       if(TMath::Abs(fStack->Particle(particle->GetFirstDaughter())->GetPdgCode()) == 11 &&
-                                               TMath::Abs(fStack->Particle(particle->GetLastDaughter())->GetPdgCode()) == 11){
-
-                                               TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
-                                               TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
-                                               if(TMath::Abs(daug0->Eta()) < 0.9 && TMath::Abs(daug1->Eta()) < 0.9)
-                                                       fHistograms->FillTable("Table_Electrons",3);//e+ e-     from J/Psi inside acceptance
-                                                               
-                                               if( TMath::Abs(daug0->Eta()) < 0.9){
-                                                       if(daug0->GetPdgCode() == -11)
-                                                               fHistograms->FillTable("Table_Electrons",1);//e+        from J/Psi inside acceptance
-                                                       else
-                                                               fHistograms->FillTable("Table_Electrons",2);//e-         from J/Psi inside acceptance
-                                                                       
-                                               }
-                                               if(TMath::Abs(daug1->Eta()) < 0.9){
-                                                       if(daug1->GetPdgCode() == -11)
-                                                               fHistograms->FillTable("Table_Electrons",1);//e+        from J/Psi inside acceptance
-                                                       else
-                                                               fHistograms->FillTable("Table_Electrons",2);//e-         from J/Psi inside acceptance
-                                               }
-                                       }
-                               }
-                       }
-                       //                                                      const int CHI_C0         = 10441;
-                       //                                                      const int CHI_C1         = 20443;
-                       //                                                      const int CHI_C2         = 445
-                       if(particle->GetPdgCode() == 22){//gamma from JPsi
-                               if(particle->GetMother(0) > -1){
-                                       if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 10441 ||
-                                       fStack->Particle(particle->GetMother(0))->GetPdgCode() == 20443 ||
-                                       fStack->Particle(particle->GetMother(0))->GetPdgCode() == 445){
-                                               if(TMath::Abs(particle->Eta()) < 1.2)
-                                                       fHistograms->FillTable("Table_Electrons",17);// gamma from chic inside accptance
-                                       }
-                               }
-                       }
-                       if(particle->GetPdgCode() == 10441 || particle->GetPdgCode() == 20443 || particle->GetPdgCode() == 445){
-                               if( particle->GetNDaughters() == 2){
-                                       TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
-                                       TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
-                                                               
-                                       if( (daug0->GetPdgCode() == 443 || daug0->GetPdgCode() == 22) && (daug1->GetPdgCode() == 443 || daug1->GetPdgCode() == 22) ){
-                                               if( daug0->GetPdgCode() == 443){
-                                                       TParticle* daugE0 = fStack->Particle(daug0->GetFirstDaughter());
-                                                       TParticle* daugE1 = fStack->Particle(daug0->GetLastDaughter());
-                                                       if( TMath::Abs(daug1->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
-                                                               fHistograms->FillTable("Table_Electrons",18);
-                                                               
-                                               } else if (daug1->GetPdgCode() == 443){
-                                                       TParticle* daugE0 = fStack->Particle(daug1->GetFirstDaughter());
-                                                       TParticle* daugE1 = fStack->Particle(daug1->GetLastDaughter());
-                                                       if( TMath::Abs(daug0->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
-                                                       fHistograms->FillTable("Table_Electrons",18);
-                                               }//else if
-                                       }//gamma o Jpsi
-                               }//GetNDaughters
-                       }
-               }
-                               
-               /////////////////////End Chic Analysis////////////////////////////
-                               
-               //              if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() )        continue;
-
-
-
-
-               if(particle->Eta() <0.8 && particle->Eta() > (-0.8) && particle->GetPDG()->Charge() != 0) {
-                  nCharged++;
-                  if(particle->Pt()>0.150){
-                  nCharged150MeV++;}
-               }
-               
-               
-                               
-               if(particle->R()>fV0Reader->GetMaxRCut())       continue; // cuts on distance from collision point
-                               
-               Double_t tmpPhi=particle->Phi();
-                               
-               if(particle->Phi()> TMath::Pi()){
-                       tmpPhi = particle->Phi()-(2*TMath::Pi());
-               }
-                               
-               Double_t rapidity;
-               if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
-                       rapidity=8.;
-               } else{
-                       rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
-               }       
-                               
-               if( particle->GetPdgCode()==111){
-
-                       //AM move here, otherwise for evt we consider only pi0 to 2 g
-                       if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               if(!fV0Reader->GetIsHeavyIon()) {
-                               
-                                       switch(GetProcessType(fGCMCEvent)){
-                                       case    kProcSD:
-                                               fHistograms->FillHistogram("MC_SD_EvtQ3_Pi0_Pt", particle->Pt());
-                                               break;
-                                       case    kProcDD:
-                                               fHistograms->FillHistogram("MC_DD_EvtQ3_Pi0_Pt", particle->Pt());
-                                               break;
-                                       case    kProcND:
-                                               fHistograms->FillHistogram("MC_ND_EvtQ3_Pi0_Pt", particle->Pt());
-                                               break;
-                                       default:
-                                               AliError("Unknown Process");
-                                       }       
-                               }       
-                       }
-                       fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
-                       if(particle->GetNDaughters()==2){
-                               fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
-                               if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                                       fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
-                               }
-                       }
-                       if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
-                       }
-               }
-                       
-                       
-               if(particle->GetPdgCode()==221){
-                       fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
-                       if(particle->GetNDaughters()==2){
-                               fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
-                               if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                                       fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
-                               }
-                       }
-                       if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
-                       }
-               }
-
-               if(  particle->GetPdgCode()==310 ){
-                       if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               fHistograms->FillHistogram("MC_K0S_Pt", particle->Pt());
-                       }
-               }
-
-               if(iTracks<=fStack->GetNprimary()){
-                   if(!particle->GetPDG()) continue; // No PDG -> exotic stuff
-                   if(particle->GetPDG()->Charge() !=0 && TMath::Abs(particle->GetPDG()->Charge())>=3  ) {
-                      if(TMath::Abs(particle->Eta())> 0.8)     continue;        // Eta cut used in charged particle spectrum
-                                                                                       if (!fStack->IsPhysicalPrimary(iTracks) ) continue;
-                                                                                       //                      if ( TMath::Abs(particle->GetPdgCode())== 213 || TMath::Abs(particle->GetPdgCode())== 1114 ||TMath::Abs(particle->GetPdgCode())== 2224 ||       
-                                                                                       //   TMath::Abs(particle->GetPdgCode())== 3222 || TMath::Abs(particle->GetPdgCode())== 323) continue;
-                      
-                      //cout<<"Charge::"<< particle->GetPDG()->Charge()<<" "<<particle->GetPdgCode()<<  endl;
-                      
-                      fHistograms->FillHistogram("MC_PhysicalPrimaryChargedNoPID_Pt", particle->Pt());
-                                                                        }
-                   if ( particle->GetPdgCode()== -211 ||       particle->GetPdgCode()== 211 ||
-                        particle->GetPdgCode()== 2212 ||       particle->GetPdgCode()==-2212 ||
-                        particle->GetPdgCode()== 321   ||      particle->GetPdgCode()==-321 ){
-                      if(TMath::Abs(particle->Eta())> 0.8)     continue;        // Eta cut used in charged particle spectrum
-                      //if( !particle->IsPhysicalPrimary() ){
-                      // cout<<"not Physical primary"<< particle->IsPhysicalPrimary()<<endl;
-                      //}
-                      //                               if(particle->GetMother(0)>-1){
-                      // cout<<"Mother ::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
-                      //if (fStack->Particle(particle->GetMother(0))->GetPdgCode()== -211 ||fStack->Particle(particle->GetMother(0))->GetPdgCode()== -3122 ){
-                      //                                               cout<<"Mother K0, lambda::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
-                      //continue;
-                      //}
-                      //}
-                      
-                      fHistograms->FillHistogram("MC_PhysicalPrimaryCharged_Pt", particle->Pt());
-                      
-                      if (particle->GetPdgCode() == 211 ) fHistograms->FillHistogram("MC_PiPlus_Pt", particle->Pt());
-                      if (particle->GetPdgCode() == 321 ) fHistograms->FillHistogram("MC_KaonPlus_Pt", particle->Pt());
-                      if (particle->GetPdgCode() == 2212 ) fHistograms->FillHistogram("MC_Proton_Pt", particle->Pt());
-                      if (particle->GetPdgCode() == -211 ) fHistograms->FillHistogram("MC_PiMinus_Pt", particle->Pt());
-                      if (particle->GetPdgCode() == -321 ) fHistograms->FillHistogram("MC_KaonMinus_Pt", particle->Pt());
-                      if (particle->GetPdgCode() == -2212 ) fHistograms->FillHistogram("MC_AntiProton_Pt", particle->Pt()); 
-                   }
-                   if(TMath::Abs(particle->Eta())<=0.8 ){
-                      if (particle->GetPdgCode() == 111 ) fHistograms->FillHistogram("MC_Pi0_Test_Pt", particle->Pt());
-                   }
-               }
-                
-                
-               //process the gammas
-               if (particle->GetPdgCode() == 22){
-                       if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(particle->Eta())< fV0Reader->GetEtaCutMin())       continue;                       
-
-                       if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
-                               continue; // no photon as mothers!
-                       }
-                       
-                       if(particle->GetMother(0) >= fStack->GetNprimary()){
-                               continue; // the gamma has a mother, and it is not a primary particle
-                       }
-                               
-                       if(particle->GetMother(0) >-1){
-                               fHistograms->FillHistogram("MC_DecayAllGamma_Pt", particle->Pt()); // All
-                               switch(fStack->Particle(particle->GetMother(0))->GetPdgCode()){
-                                       case 111: // Pi0
-                                               fHistograms->FillHistogram("MC_DecayPi0Gamma_Pt", particle->Pt());
-                                               break;
-                                       case 113: // Rho0
-                                               fHistograms->FillHistogram("MC_DecayRho0Gamma_Pt", particle->Pt());
-                                               break;
-                                       case 221: // Eta
-                                               fHistograms->FillHistogram("MC_DecayEtaGamma_Pt", particle->Pt());
-                                               break;
-                                       case 223: // Omega
-                                               fHistograms->FillHistogram("MC_DecayOmegaGamma_Pt", particle->Pt());
-                                               break;
-                                       case 310: // K_s0
-                                               fHistograms->FillHistogram("MC_DecayK0sGamma_Pt", particle->Pt());
-                                               break;
-                                       case 331: // Eta'
-                                               fHistograms->FillHistogram("MC_DecayEtapGamma_Pt", particle->Pt());
-                                               break;
-                                       case 333: // Phi
-                                               fHistograms->FillHistogram("MC_DecayPhiGamma_Pt", particle->Pt());
-                                               break;
-                               }
-                       }
-                       
-                       fHistograms->FillHistogram("MC_allGamma_Energy", particle->Energy());
-                        fHistograms->FillHistogram("MC_allGamma_Pt", particle->Pt());
-                        fHistograms->FillHistogram("MC_allGamma_Eta", particle->Eta());
-                       fHistograms->FillHistogram("MC_allGamma_Phi", tmpPhi);
-                       fHistograms->FillHistogram("MC_allGamma_Rapid", rapidity);
-                                       
-                       // for CF
-                       if(fDoCF){
-                               containerInput[0] = particle->Pt();
-                               containerInput[1] = particle->Eta();
-                               if(particle->GetMother(0) >=0){
-                                       containerInput[2] = fStack->Particle(particle->GetMother(0))->GetMass();
-                               } else{
-                                       containerInput[2]=-1;
-                               }
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated);                                        // generated gamma
-                       }
-                       
-                       if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
-                       ((particle->GetMother(0) > -1) && 
-                       ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)|| 
-                       (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
-                       ){       // direct gamma
-                               fHistograms->FillHistogram("MC_allDirectGamma_Energy",particle->Energy());
-                               fHistograms->FillHistogram("MC_allDirectGamma_Pt", particle->Pt());
-                               fHistograms->FillHistogram("MC_allDirectGamma_Eta", particle->Eta());
-                               fHistograms->FillHistogram("MC_allDirectGamma_Phi", tmpPhi);
-                               fHistograms->FillHistogram("MC_allDirectGamma_Rapid", rapidity);                                
-                       }
-                                       
-                       // looking for conversion (electron + positron from pairbuilding (= 5) )
-                       TParticle* ePos = NULL;
-                       TParticle* eNeg = NULL;
-                                       
-                       if(particle->GetNDaughters() >= 2){
-                               for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
-                                       TParticle *tmpDaughter = fStack->Particle(daughterIndex);
-                                       if(tmpDaughter->GetUniqueID() == 5){
-                                               if(tmpDaughter->GetPdgCode() == 11){
-                                                       eNeg = tmpDaughter;
-                                               } else if(tmpDaughter->GetPdgCode() == -11){
-                                                       ePos = tmpDaughter;
-                                               }
-                                       }
-                               }
-                       }
-                                               
-                       if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
-                               continue;
-                       }
-                                       
-                                       
-                       Double_t ePosPhi = ePos->Phi();
-                       if(ePos->Phi()> TMath::Pi()) ePosPhi = ePos->Phi()-(2*TMath::Pi());
-                                       
-                       Double_t eNegPhi = eNeg->Phi();
-                       if(eNeg->Phi()> TMath::Pi()) eNegPhi = eNeg->Phi()-(2*TMath::Pi());
-                                                       
-                       if(ePos->Pt()<fV0Reader->GetSinglePtCut() || eNeg->Pt()<fV0Reader->GetSinglePtCut()){
-                               continue; // no reconstruction below the Pt cut
-                       }
-                                       
-                       if( TMath::Abs(ePos->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(ePos->Eta())< fV0Reader->GetEtaCutMin()  || 
-                           TMath::Abs(eNeg->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(eNeg->Eta())< fV0Reader->GetEtaCutMin() ) {
-                               continue;
-                       }       
-                                       
-                       if(ePos->R()>fV0Reader->GetMaxRCut()){
-                               continue; // cuts on distance from collision point
-                       }
-
-                       if(TMath::Abs(ePos->Vz()) > fV0Reader->GetMaxZCut()){
-                               continue;        // outside material
-                       }
-                       if(TMath::Abs(eNeg->Vz()) > fV0Reader->GetMaxZCut()){
-                               continue;        // outside material
-                       }
-
-                       if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
-                               continue;                                                        // line cut to exclude regions where we do not reconstruct
-                       } else if ( fV0Reader->GetEtaCutMin() != -0.1 &&   ePos->R() >= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())       ){
-                               continue;
-                       }
-                                       
-                       if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
-                               continue;                                                        // line cut to exclude regions where we do not reconstruct
-                       } else if ( fV0Reader->GetEtaCutMin() != -0.1 &&   eNeg->R() >= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())       ){
-                               continue;
-                       }
-                                       
-                       // for CF
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructable);  // reconstructable gamma        
-                       }
-                       fHistograms->FillHistogram("MC_ConvGamma_Energy", particle->Energy());
-                        fHistograms->FillHistogram("MC_ConvGamma_Pt", particle->Pt());
-                        // Move down, in the if that mother exists
-                       //                      if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
-                       //                      fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
-                       fHistograms->FillHistogram("MC_ConvGamma_Eta", particle->Eta());
-                       fHistograms->FillHistogram("MC_ConvGamma_Phi", tmpPhi);
-                       fHistograms->FillHistogram("MC_ConvGamma_Rapid", rapidity);
-                       fHistograms->FillHistogram("MC_ConvGamma_Pt_Eta", particle->Pt(),particle->Eta());
-                                       
-                       fHistograms->FillHistogram("MC_E_Energy", eNeg->Energy());
-                       fHistograms->FillHistogram("MC_E_Pt", eNeg->Pt());
-                       fHistograms->FillHistogram("MC_E_Eta", eNeg->Eta());
-                       fHistograms->FillHistogram("MC_E_Phi", eNegPhi);
-                                       
-                       fHistograms->FillHistogram("MC_P_Energy", ePos->Energy());
-                       fHistograms->FillHistogram("MC_P_Pt", ePos->Pt());
-                       fHistograms->FillHistogram("MC_P_Eta", ePos->Eta());
-                       fHistograms->FillHistogram("MC_P_Phi", ePosPhi);
-                                       
-                       if(!fV0Reader->GetIsHeavyIon()){
-                                       
-                               // begin Mapping 
-                               Int_t rBin              = fHistograms->GetRBin(ePos->R());
-                               Int_t zBin              = fHistograms->GetZBin(ePos->Vz());
-                               Int_t phiBin    = fHistograms->GetPhiBin(particle->Phi());
-                               Double_t rFMD=30;
-                               Double_t rITSTPCMin=40;
-                               Double_t rITSTPCInt=55;
-                               Double_t rITSTPCMax=72.5;
-                               
-                               TVector3 vtxPos(ePos->Vx(),ePos->Vy(),ePos->Vz());      
-                               
-                               TString nameMCMappingPhiR="";
-                               nameMCMappingPhiR.Form("MC_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
-                               // fHistograms->FillHistogram(nameMCMappingPhiR, ePos->Vz(), particle->Eta());
-                               
-                               TString nameMCMappingPhi="";
-                               nameMCMappingPhi.Form("MC_Conversion_Mapping_Phi%02d",phiBin);
-                               //                      fHistograms->FillHistogram(nameMCMappingPhi, particle->Eta());
-                               //fHistograms->FillHistogram(nameMCMappingPhi, ePos->Vz(), particle->Eta());
-                               
-                               TString nameMCMappingR="";
-                               nameMCMappingR.Form("MC_Conversion_Mapping_R%02d",rBin);
-                               //                      fHistograms->FillHistogram(nameMCMappingR, particle->Eta());
-                               //fHistograms->FillHistogram(nameMCMappingR,ePos->Vz(), particle->Eta());
-                               
-                               TString nameMCMappingPhiInR="";
-                               nameMCMappingPhiInR.Form("MC_Conversion_Mapping_Phi_in_R_%02d",rBin);
-                               //                      fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
-                               fHistograms->FillHistogram(nameMCMappingPhiInR, vtxPos.Phi());
-                               
-                               TString nameMCMappingZInR="";
-                               nameMCMappingZInR.Form("MC_Conversion_Mapping_Z_in_R_%02d",rBin);
-                               fHistograms->FillHistogram(nameMCMappingZInR,ePos->Vz() );
-                               
-                               
-                               TString nameMCMappingPhiInZ="";
-                               nameMCMappingPhiInZ.Form("MC_Conversion_Mapping_Phi_in_Z_%02d",zBin);
-                               //                      fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
-                               fHistograms->FillHistogram(nameMCMappingPhiInZ, vtxPos.Phi());
-                               
-                               
-                               if(ePos->R()<rFMD){
-                                       TString nameMCMappingFMDPhiInZ="";
-                                       nameMCMappingFMDPhiInZ.Form("MC_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
-                                       fHistograms->FillHistogram(nameMCMappingFMDPhiInZ, vtxPos.Phi());
-                               }
-                       
-                               if(ePos->R()>rITSTPCMin && ePos->R()<rITSTPCInt){
-                                       TString nameMCMappingITSTPCPhiInZ="";
-                                       nameMCMappingITSTPCPhiInZ.Form("MC_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
-                                       fHistograms->FillHistogram(nameMCMappingITSTPCPhiInZ, vtxPos.Phi());
-                               }
-                       
-                               if(ePos->R()>rITSTPCInt && ePos->R()<rITSTPCMax){
-                                       TString nameMCMappingITSTPC2PhiInZ="";
-                                       nameMCMappingITSTPC2PhiInZ.Form("MC_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",zBin);
-                                       fHistograms->FillHistogram(nameMCMappingITSTPC2PhiInZ, vtxPos.Phi());
-                               }
-
-                               TString nameMCMappingRInZ="";
-                               nameMCMappingRInZ.Form("MC_Conversion_Mapping_R_in_Z_%02d",zBin);
-                               fHistograms->FillHistogram(nameMCMappingRInZ,ePos->R() );
-                               
-                               if(particle->Pt() > fLowPtMapping && particle->Pt()< fHighPtMapping){
-                                       TString nameMCMappingMidPtPhiInR="";
-                                       nameMCMappingMidPtPhiInR.Form("MC_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
-                                       fHistograms->FillHistogram(nameMCMappingMidPtPhiInR, vtxPos.Phi());
-                                       
-                                       TString nameMCMappingMidPtZInR="";
-                                       nameMCMappingMidPtZInR.Form("MC_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
-                                       fHistograms->FillHistogram(nameMCMappingMidPtZInR,ePos->Vz() );
-                                       
-                                       
-                                       TString nameMCMappingMidPtPhiInZ="";
-                                       nameMCMappingMidPtPhiInZ.Form("MC_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
-                                       fHistograms->FillHistogram(nameMCMappingMidPtPhiInZ, vtxPos.Phi());
-                                       
-                                       
-                                       if(ePos->R()<rFMD){
-                                               TString nameMCMappingMidPtFMDPhiInZ="";
-                                               nameMCMappingMidPtFMDPhiInZ.Form("MC_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
-                                               fHistograms->FillHistogram(nameMCMappingMidPtFMDPhiInZ, vtxPos.Phi());
-                                       }
-                               
-                                       TString nameMCMappingMidPtRInZ="";
-                                       nameMCMappingMidPtRInZ.Form("MC_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
-                                       fHistograms->FillHistogram(nameMCMappingMidPtRInZ,ePos->R() );
-                                       
-                               }
-                       }
-
-                       //end mapping
-                                       
-                       fHistograms->FillHistogram("MC_Conversion_R",ePos->R());
-                       fHistograms->FillHistogram("MC_Conversion_ZR",ePos->Vz(),ePos->R());
-                       fHistograms->FillHistogram("MC_Conversion_XY",ePos->Vx(),ePos->Vy());
-                       fHistograms->FillHistogram("MC_Conversion_OpeningAngle",GetMCOpeningAngle(ePos, eNeg));
-                       fHistograms->FillHistogram("MC_ConvGamma_E_AsymmetryP",particle->P(),eNeg->P()/particle->P());
-                       fHistograms->FillHistogram("MC_ConvGamma_P_AsymmetryP",particle->P(),ePos->P()/particle->P());
-
-
-                       if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
-                                ((particle->GetMother(0) > -1) && 
-                                       ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)|| 
-                                        (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
-                                ){      // direct gamma, still inside converted
-                               fHistograms->FillHistogram("MC_ConvDirectGamma_Energy",particle->Energy());
-                               fHistograms->FillHistogram("MC_ConvDirectGamma_Pt", particle->Pt());
-                               fHistograms->FillHistogram("MC_ConvDirectGamma_Eta", particle->Eta());
-                               fHistograms->FillHistogram("MC_ConvDirectGamma_Phi", tmpPhi);
-                               fHistograms->FillHistogram("MC_ConvDirectGamma_Rapid", rapidity);
-                                               
-                       } else{  // mother exits 
-                               if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
-                                       fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
-                       /*      if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==10441 ||//chic0 
-                               fStack->Particle(particle->GetMother(0))->GetPdgCode()==20443 ||//psi2S
-                               fStack->Particle(particle->GetMother(0))->GetPdgCode()==445     //chic2
-                               ){ 
-                               fMCGammaChic.push_back(particle);
-                               }
-                       */
-                       }       // end if mother exits
-               } // end if particle is a photon
-                               
-                               
-                               
-               // process motherparticles (2 gammas as daughters)
-               // the motherparticle had already to pass the R and the eta cut, but no line cut.
-               // the line cut is just valid for the conversions!
-
-               // RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////////
-               if (particle->GetPdgCode()==111){
-                       if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
-                               fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid_allDaughters", particle->Pt(),rapidity);
-                       }
-               }
-               // end RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////
-                               
-               if(particle->GetNDaughters() == 2){
-                                       
-                       TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter());
-                       TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter());
-                                       
-                       if(daughter0->GetPdgCode() != 22 || daughter1->GetPdgCode() != 22) continue; //check for gamma gamma daughters
-
-                       if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue; 
-
-                       // Check the acceptance for both gammas
-                       Bool_t gammaEtaCut = kTRUE;
-                       if(TMath::Abs(daughter0->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter0->Eta()) < fV0Reader->GetEtaCutMin() || 
-                          TMath::Abs(daughter1->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter1->Eta()) < fV0Reader->GetEtaCutMin()    ) gammaEtaCut = kFALSE;
-                       
-                       Bool_t gammaRCut = kTRUE;
-                       if(daughter0->R() > fV0Reader->GetMaxRCut() || daughter1->R() > fV0Reader->GetMaxRCut() ) gammaRCut = kFALSE;
-                       
-                       // check for conversions now -> have to pass eta, R and line cut!
-                       Bool_t daughter0Electron = kFALSE;
-                       Bool_t daughter0Positron = kFALSE;
-                       Bool_t daughter1Electron = kFALSE;
-                       Bool_t daughter1Positron = kFALSE;
-                                       
-                       if(daughter0->GetNDaughters() >= 2){    // first gamma
-                               for(Int_t TrackIndex=daughter0->GetFirstDaughter();TrackIndex<=daughter0->GetLastDaughter();TrackIndex++){
-                                       TParticle *tmpDaughter = fStack->Particle(TrackIndex);
-                                       if(tmpDaughter->GetUniqueID() == 5){
-                                               if(tmpDaughter->GetPdgCode() == 11){    
-                                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                                       daughter0Electron = kTRUE;
-                                                                               }
-                                                                       }
-                                                               }                       
-                                                       }
-                                               } else if(tmpDaughter->GetPdgCode() == -11){
-                                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                                       daughter0Positron = kTRUE;
-                                                                               }
-                                                                       }
-                                                               }                       
-                                                       }                                       
-                                               }
-                                       }
-                               }
-                       }
-                                       
-                       if(daughter1->GetNDaughters() >= 2){     // second gamma
-                               for(Int_t TrackIndex=daughter1->GetFirstDaughter();TrackIndex<=daughter1->GetLastDaughter();TrackIndex++){
-                                       TParticle *tmpDaughter = fStack->Particle(TrackIndex);
-                                       if(tmpDaughter->GetUniqueID() == 5){
-                                               if(tmpDaughter->GetPdgCode() == 11){
-                                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                                       daughter1Electron = kTRUE;
-                                                                               }
-                                                                       }
-                                                               }                       
-                                                       }
-                                               } else if(tmpDaughter->GetPdgCode() == -11){
-                                                       if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
-                                                               if(  tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
-                                                                       if ( (fV0Reader->GetEtaCutMin() != -0.1 &&  tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1   ){
-                                                                               if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
-                                                                                       daughter1Positron = kTRUE;
-                                                                               }
-                                                                       }
-                                                               }                       
-                                                       }                                       
-                                               }
-                                       }
-                               }
-                       }       
-                       if(particle->GetPdgCode()==111){                 //Pi0
-                               if( iTracks >= fStack->GetNprimary()){
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Eta", particle->Eta());
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Rapid", rapidity);
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Phi", tmpPhi);
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt", particle->Pt());
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Energy", particle->Energy());
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_R", particle->R());
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_ZR", particle->Vz(),particle->R());
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
-                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_XY", particle->Vx(),particle->Vy());//only fill from one daughter to avoid multiple filling
-                                                                       
-                                       if(gammaEtaCut && gammaRCut){   
-                                               //if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
-                                               fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
-                                               fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
-                                               if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
-                                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
-                                                       fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
-                                               }
-                                               if(particle->GetMother(0) > -1){
-                                                       Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
-                                                       if(pdgPionMother ==310 ){
-                                                               fHistograms->FillHistogram("MC_K0S_Pt_FromPi0", fStack->Particle(particle->GetMother(0))->Pt());
-                                                       }
-                                               }
-                                       }
-                               } else{
-
-                                       fHistograms->FillHistogram("MC_Pi0_Eta", particle->Eta());      
-                                       fHistograms->FillHistogram("MC_Pi0_Rapid", rapidity);
-                                       fHistograms->FillHistogram("MC_Pi0_Phi", tmpPhi);
-                                       fHistograms->FillHistogram("MC_Pi0_Pt", particle->Pt());
-                                       //if(fGCMCEvent->IsFromBGEvent(iTracks)) fHistograms->FillHistogram("MC_Pi0_Pt_under", particle->Pt());
-                                       fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid", particle->Pt(),rapidity);
-                                       fHistograms->FillHistogram("MC_Pi0_Energy", particle->Energy());
-                                       fHistograms->FillHistogram("MC_Pi0_R", particle->R());
-                                       fHistograms->FillHistogram("MC_Pi0_ZR", particle->Vz(),particle->R());
-                                       fHistograms->FillHistogram("MC_Pi0_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
-                                       fHistograms->FillHistogram("MC_Pi0_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
-                                       if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_Fiducial", particle->Pt());
-                                       if(particle->GetMother(0) > -1){
-                                               Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
-                                               if(pdgPionMother ==221 ){
-                                                       fHistograms->FillHistogram("MC_Pi0_Pt_FromEta", particle->Pt());
-                                               }else   if( pdgPionMother==223 ){
-                                                       fHistograms->FillHistogram("MC_Pi0_Pt_FromOmega", particle->Pt());
-                                               }else if(TMath::Abs(pdgPionMother) ==213 ){
-                                                       fHistograms->FillHistogram("MC_Pi0_Pt_FromRhoPlusMinus", particle->Pt());
-                                               }else{
-                                                       fHistograms->FillHistogram("MC_Pi0_Pt_FromOthers", particle->Pt());
-                                               }
-                                       }else{
-                                               fHistograms->FillHistogram("MC_Pi0_Pt_Direct", particle->Pt());
-                                       }
-
-                                       if(gammaEtaCut && gammaRCut){
-                       //              if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
-                                               fHistograms->FillHistogram("MC_Pi0_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
-                                               fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
-                                               if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_withinAcceptance_Fiducial", particle->Pt());
-                                               if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
-                                                       fHistograms->FillHistogram("MC_Pi0_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
-                                                       fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
-                                                       fHistograms->FillHistogram("MC_Pi0_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
-                                                       fHistograms->FillHistogram("MC_Pi0_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
-                                                       fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
-                                                       fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
-
-                                                       Double_t alfa=0.;
-                                                       if((daughter0->Energy()+daughter1->Energy()) > 0.){
-                                                               alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
-                                                       }
-                                                       fHistograms->FillHistogram("MC_Pi0_alpha",alfa);
-                                                       if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_ConvGamma_withinAcceptance_Fiducial", particle->Pt());
-                                               }
-                                       }
-                               }
-                       }
-                                       
-                       if(particle->GetPdgCode()==221){         //Eta
-                               fHistograms->FillHistogram("MC_Eta_Eta", particle->Eta());
-                               fHistograms->FillHistogram("MC_Eta_Rapid", rapidity);
-                               fHistograms->FillHistogram("MC_Eta_Phi",tmpPhi);
-                               fHistograms->FillHistogram("MC_Eta_Pt", particle->Pt());
-                               fHistograms->FillHistogram("MC_Eta_Pt_vs_Rapid", particle->Pt(),rapidity);
-                               fHistograms->FillHistogram("MC_Eta_Energy", particle->Energy());
-                               fHistograms->FillHistogram("MC_Eta_R", particle->R());
-                               fHistograms->FillHistogram("MC_Eta_ZR", particle->Vz(),particle->R());
-                               fHistograms->FillHistogram("MC_Eta_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
-                               fHistograms->FillHistogram("MC_Eta_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
-                                                       
-                               if(gammaEtaCut && gammaRCut){   
-                                       //      if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
-                                       fHistograms->FillHistogram("MC_Eta_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
-                                       fHistograms->FillHistogram("MC_Eta_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
-                                       if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
-                                               fHistograms->FillHistogram("MC_Eta_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
-                                               fHistograms->FillHistogram("MC_Eta_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
-                                               fHistograms->FillHistogram("MC_Eta_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
-                                               fHistograms->FillHistogram("MC_Eta_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
-                                               fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
-                                               fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
-
-                                               Double_t alfa=0.;
-                                               if((daughter0->Energy()+daughter1->Energy()) > 0.){
-                                                       alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
-                                               }
-                                               fHistograms->FillHistogram("MC_Eta_alpha",alfa);
-                                       }                       
-                               }                       
-                       }
-                                       
-                       // all motherparticles with 2 gammas as daughters
-                       fHistograms->FillHistogram("MC_Mother_R", particle->R());
-                       fHistograms->FillHistogram("MC_Mother_ZR", particle->Vz(),particle->R());
-                       fHistograms->FillHistogram("MC_Mother_XY", particle->Vx(),particle->Vy());
-                       fHistograms->FillHistogram("MC_Mother_Mass", particle->GetCalcMass());
-                       fHistograms->FillHistogram("MC_Mother_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
-                       fHistograms->FillHistogram("MC_Mother_Energy", particle->Energy());
-                       fHistograms->FillHistogram("MC_Mother_Pt", particle->Pt());
-                       fHistograms->FillHistogram("MC_Mother_Eta", particle->Eta());
-                       fHistograms->FillHistogram("MC_Mother_Rapid", rapidity);
-                       fHistograms->FillHistogram("MC_Mother_Phi",tmpPhi);
-                       fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt",particle->GetMass(),particle->Pt());                       
-                                       
-                       if(gammaEtaCut && gammaRCut){   
-                               //                      if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
-                               fHistograms->FillHistogram("MC_Mother_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
-                               fHistograms->FillHistogram("MC_Mother_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
-                               fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_withinAcceptance",particle->GetMass(),particle->Pt());                      
-                               if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
-                                       fHistograms->FillHistogram("MC_Mother_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
-                                       fHistograms->FillHistogram("MC_Mother_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
-                                       fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_ConvGamma_withinAcceptance",particle->GetMass(),particle->Pt());                    
-                               }                       
-                       }       // end passed R and eta cut
-               } // end if(particle->GetNDaughters() == 2)
-       }// end for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++)
-       
-       fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult", nCharged,fMultiplicity);
-       fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult_pt150MeV", nCharged150MeV,fMultiplicity);
-       //cout << "True   " <<  nCharged << "     Meas.     " << fMultiplicity << endl;
-
-} // end ProcessMCData
-
-
-
-void AliAnalysisTaskGammaConversion::FillNtuple(){
-       //Fills the ntuple with the different values
-       
-       if(fGammaNtuple == NULL){
-               return;
-       }
-       Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
-       for(Int_t i=0;i<numberOfV0s;i++){
-               Float_t values[27] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-               AliESDv0 * cV0 = fV0Reader->GetV0(i);
-               Double_t negPID=0;
-               Double_t posPID=0;
-               fV0Reader->GetPIDProbability(negPID,posPID);
-               values[0]=cV0->GetOnFlyStatus();
-               values[1]=fV0Reader->CheckForPrimaryVertex();
-               values[2]=negPID;
-               values[3]=posPID;
-               values[4]=fV0Reader->GetX();
-               values[5]=fV0Reader->GetY();
-               values[6]=fV0Reader->GetZ();
-               values[7]=fV0Reader->GetXYRadius();
-               values[8]=fV0Reader->GetMotherCandidateNDF();
-               values[9]=fV0Reader->GetMotherCandidateChi2();
-               values[10]=fV0Reader->GetMotherCandidateEnergy();
-               values[11]=fV0Reader->GetMotherCandidateEta();
-               values[12]=fV0Reader->GetMotherCandidatePt();
-               values[13]=fV0Reader->GetMotherCandidateMass();
-               values[14]=fV0Reader->GetMotherCandidateWidth();
-               //              values[15]=fV0Reader->GetMotherMCParticle()->Pt();       MOVED TO THE END, HAS TO BE CALLED AFTER HasSameMother NB: still has the same entry in the array
-               values[16]=fV0Reader->GetOpeningAngle();
-               values[17]=fV0Reader->GetNegativeTrackEnergy();
-               values[18]=fV0Reader->GetNegativeTrackPt();
-               values[19]=fV0Reader->GetNegativeTrackEta();
-               values[20]=fV0Reader->GetNegativeTrackPhi();
-               values[21]=fV0Reader->GetPositiveTrackEnergy();
-               values[22]=fV0Reader->GetPositiveTrackPt();
-               values[23]=fV0Reader->GetPositiveTrackEta();
-               values[24]=fV0Reader->GetPositiveTrackPhi();
-               values[25]=fV0Reader->HasSameMCMother();
-               if(values[25] != 0){
-                       values[26]=fV0Reader->GetMotherMCParticlePDGCode();
-                       values[15]=fV0Reader->GetMotherMCParticle()->Pt();
-               }
-               fTotalNumberOfAddedNtupleEntries++;
-               fGammaNtuple->Fill(values);
-       }
-       fV0Reader->ResetV0IndexNumber();
-       
-}
-
-void AliAnalysisTaskGammaConversion::ProcessV0sNoCut(){
-       // Process all the V0's without applying any cuts to it
-       
-       Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
-       for(Int_t i=0;i<numberOfV0s;i++){
-               /*AliESDv0 * cV0 = */fV0Reader->GetV0(i);
-               
-               if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
-                       continue;
-               }
-
-               //              if( !fV0Reader->GetV0(i)->GetOnFlyStatus()){
-               if( !fV0Reader->CheckV0FinderStatus(fV0Reader->GetV0(i))){
-                       continue;
-               }
-
-
-               if( !((fV0Reader->GetNegativeESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) || 
-                               !((fV0Reader->GetPositiveESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ){
-                       continue;
-               }
-
-               if( fV0Reader->GetNegativeESDTrack()->GetSign()== fV0Reader->GetPositiveESDTrack()->GetSign()){
-                       continue;
-               }
-
-               if( fV0Reader->GetNegativeESDTrack()->GetKinkIndex(0) > 0 || 
-                       fV0Reader->GetPositiveESDTrack()->GetKinkIndex(0) > 0) {                        
-                       continue;
-               }
-               if(TMath::Abs(fV0Reader->GetMotherCandidateEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetMotherCandidateEta())< fV0Reader->GetEtaCutMin()){
-                       continue;
-               }
-               if(TMath::Abs(fV0Reader->GetPositiveTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetPositiveTrackEta())< fV0Reader->GetEtaCutMin()){
-                       continue;
-               }
-               if(TMath::Abs(fV0Reader->GetNegativeTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetNegativeTrackEta())< fV0Reader->GetEtaCutMin()){
-                       continue;
-               }
-               if( fV0Reader->GetXYRadius() <= ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlope())-fV0Reader->GetLineCutZValue()) ){ // cuts out regions where we do not reconstruct
-                       continue; 
-               } else if ( fV0Reader->GetEtaCutMin() != -0.1 && fV0Reader->GetXYRadius() > ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlopeMin())-fV0Reader->GetLineCutZValueMin()) ) {
-                       continue; 
-               }
-
-               fHistograms->FillHistogram("ESD_NoCutAllV0_Pt", fV0Reader->GetMotherCandidatePt());
-
-               // RRnewTOF start ///////////////////////////////////////////////
-               UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus();
-               UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus(); 
-
-               Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
-               Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
-
-               Double_t timesPos[5];
-               fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
-               Double_t timesNeg[5];
-               fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
-
-               Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
-               Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
-
-               Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
-               Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
-
-               if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_WOCutConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
-               if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_WOCutConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
-               // RRnewTOF end /////////////////////////////////////////////////
-               
-               if(fDoMCTruth){
-                       
-                       if(fV0Reader->HasSameMCMother() == kFALSE){
-                               continue;
-                       }
-                       
-                       TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-                       TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-                       
-                       if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
-                               continue;
-                       }
-                       if(negativeMC->GetPdgCode() == positiveMC->GetPdgCode()){
-                               continue;
-                       }
-
-                       if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){ // id 5 is conversion
-                               continue;
-                       }
-               
-                       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){                               
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
-                                if(negativeMC->GetMother(0) <= fStack->GetNprimary()){
-                                   fHistograms->FillHistogram("ESD_NoCutConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
-                                }
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta", fV0Reader->GetMotherCandidateEta());                               
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
-                                                       
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
-                                                       
-                               fHistograms->FillHistogram("ESD_NoCutConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
-                               fHistograms->FillHistogram("ESD_NoCutConversion_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_NoCutConversion_MCR",fV0Reader->GetNegativeMCParticle()->R());
-                               fHistograms->FillHistogram("ESD_NoCutConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_NoCutConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
-
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
-
-                               //store MCTruth properties
-                               fHistograms->FillHistogram("ESD_NoCutConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
-                               fHistograms->FillHistogram("ESD_NoCutConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
-                               fHistograms->FillHistogram("ESD_NoCutConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
-                       }
-               }
-       }
-       fV0Reader->ResetV0IndexNumber();
-}
-
-void AliAnalysisTaskGammaConversion::ProcessV0s(){
-       // see header file for documentation
-
-
-       if(fWriteNtuple == kTRUE){
-               FillNtuple();
-       }
-       
-       Int_t nSurvivingV0s=0;
-       fV0Reader->ResetNGoodV0s();
-       while(fV0Reader->NextV0()){
-               nSurvivingV0s++;
-               
-
-               TVector3 vtxConv(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
-       
-               //-------------------------- filling v0 information -------------------------------------
-               fHistograms->FillHistogram("ESD_Conversion_R", fV0Reader->GetXYRadius());
-               fHistograms->FillHistogram("ESD_Conversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
-               fHistograms->FillHistogram("ESD_Conversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
-               fHistograms->FillHistogram("ESD_Conversion_OpeningAngle", fV0Reader->GetOpeningAngle());                
-               fHistograms->FillHistogram("ESD_ConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
-               fHistograms->FillHistogram("ESD_ConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
-               fHistograms->FillHistogram("ESD_ConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
-                       
-               if ( fV0Reader->GetMotherCandidatePt() >= 2.){
-                       fHistograms->FillHistogram("ESD_Conversion_minPt_R", fV0Reader->GetXYRadius());
-                       fHistograms->FillHistogram("ESD_Conversion_minPt_Z", fV0Reader->GetZ());
-               }
-
-               // Specific histograms for beam pipe studies
-               if( TMath::Abs(fV0Reader->GetZ()) < fV0Reader->GetLineCutZValue() && TMath::Abs(fV0Reader->GetZ()) > fV0Reader->GetLineCutZValueMin()){
-                       fHistograms->FillHistogram("ESD_Conversion_XY_BeamPipe", fV0Reader->GetX(),fV0Reader->GetY());
-                       fHistograms->FillHistogram("ESD_Conversion_RPhi_BeamPipe", vtxConv.Phi(),fV0Reader->GetXYRadius());
-               }
-
-       
-               fHistograms->FillHistogram("ESD_E_Energy", fV0Reader->GetNegativeTrackEnergy());
-               fHistograms->FillHistogram("ESD_E_Pt", fV0Reader->GetNegativeTrackPt());
-               fHistograms->FillHistogram("ESD_E_Eta", fV0Reader->GetNegativeTrackEta());
-               fHistograms->FillHistogram("ESD_E_Phi", fV0Reader->GetNegativeTrackPhi());
-               fHistograms->FillHistogram("ESD_E_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
-               fHistograms->FillHistogram("ESD_E_nITSClusters", fV0Reader->GetNegativeTracknITSClusters());
-               if ( fV0Reader->GetNegativeTrackPt()> 0.150){
-                       fHistograms->FillHistogram("ESD_E_minPt_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
-               }
-               if ( fV0Reader->GetNegativeTracknITSClusters()==0){
-                       fHistograms->FillHistogram("ESD_E_onlyTPC_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
-               }
-
-               Double_t eClsToF= 0;
-               if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
-                       if(fV0Reader->GetNegativeTracknTPCFClusters()!=0 ){
-                               eClsToF=(Double_t)fV0Reader->GetNegativeTracknTPCClusters()/(Double_t)fV0Reader->GetNegativeTracknTPCFClusters();
-                       }
-               } else {
-                       eClsToF= fV0Reader->GetNegativeESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
-               }
-                       fHistograms->FillHistogram("ESD_E_nTPCClustersToFP", fV0Reader->GetNegativeTrackP(),eClsToF );
-                       fHistograms->FillHistogram("ESD_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
-
-               if(fV0Reader->GetNegativeTracknTPCClusters()!=0 ){
-                       fHistograms->FillHistogram("ESD_E_TPCchi2", fV0Reader->GetNegativeTrackTPCchi2()/(Double_t)fV0Reader->GetNegativeTracknTPCClusters());
-               }
-
-
-
-               fHistograms->FillHistogram("ESD_P_Energy", fV0Reader->GetPositiveTrackEnergy());
-               fHistograms->FillHistogram("ESD_P_Pt", fV0Reader->GetPositiveTrackPt());
-               fHistograms->FillHistogram("ESD_P_Eta", fV0Reader->GetPositiveTrackEta());
-               fHistograms->FillHistogram("ESD_P_Phi", fV0Reader->GetPositiveTrackPhi());
-               fHistograms->FillHistogram("ESD_P_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
-               fHistograms->FillHistogram("ESD_P_nITSClusters", fV0Reader->GetPositiveTracknITSClusters());
-               if ( fV0Reader->GetPositiveTrackPt()> 0.150){
-                       fHistograms->FillHistogram("ESD_P_minPt_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
-               }
-               if (fV0Reader->GetPositiveTracknITSClusters()==0){
-                       fHistograms->FillHistogram("ESD_P_onlyTPC_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
-               }
-
-               Double_t pClsToF= 0;
-               if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
-                       if(fV0Reader->GetPositiveTracknTPCFClusters()!=0){
-                               pClsToF = (Double_t)fV0Reader->GetPositiveTracknTPCClusters()/(Double_t)fV0Reader->GetPositiveTracknTPCFClusters();
-                       }
-               } else {
-                       pClsToF= fV0Reader->GetPositiveESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
-               }
-
-               fHistograms->FillHistogram("ESD_P_nTPCClustersToFP",fV0Reader->GetPositiveTrackP(), pClsToF);
-               fHistograms->FillHistogram("ESD_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
-
-               if(fV0Reader->GetPositiveTracknTPCClusters()!=0){
-                       fHistograms->FillHistogram("ESD_P_TPCchi2", fV0Reader->GetPositiveTrackTPCchi2()/(Double_t)fV0Reader->GetPositiveTracknTPCClusters());
-               }
-
-
-
-               fHistograms->FillHistogram("ESD_ConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
-               fHistograms->FillHistogram("ESD_ConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
-               fHistograms->FillHistogram("ESD_ConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
-               fHistograms->FillHistogram("ESD_ConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
-               fHistograms->FillHistogram("ESD_ConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
-               fHistograms->FillHistogram("ESD_ConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
-               fHistograms->FillHistogram("ESD_ConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
-               fHistograms->FillHistogram("ESD_ConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
-               fHistograms->FillHistogram("ESD_ConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
-               fHistograms->FillHistogram("ESD_ConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
-               
-               fHistograms->FillHistogram("ESD_ConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
-               fHistograms->FillHistogram("ESD_ConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
-               
-               fHistograms->FillHistogram("ESD_ConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
-               fHistograms->FillHistogram("ESD_ConvGamma_CosPoint_RecCosPoint",fV0Reader->GetCosPointingAngle(),fV0Reader->GetV0CosineOfPointingAngle(fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ()));
-               fHistograms->FillHistogram("ESD_ConvGamma_PsiPair", fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
-               
-               fHistograms->FillHistogram("ESD_ConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
-               fHistograms->FillHistogram("ESD_ConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
-               fHistograms->FillHistogram("ESD_ConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
-               
-               fHistograms->FillHistogram("ESD_ConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
-               fHistograms->FillHistogram("ESD_ConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
-               fHistograms->FillHistogram("ESD_ConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
-               fHistograms->FillHistogram("ESD_ConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
-               fHistograms->FillHistogram("ESD_ConvGamma_E_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kElectron));
-               fHistograms->FillHistogram("ESD_ConvGamma_P_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kElectron));
-               fHistograms->FillHistogram("ESD_ConvGamma_PiPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kPion));
-               fHistograms->FillHistogram("ESD_ConvGamma_PiMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kPion));
-               fHistograms->FillHistogram("ESD_ConvGamma_KPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kKaon));
-               fHistograms->FillHistogram("ESD_ConvGamma_KMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kKaon));
-               fHistograms->FillHistogram("ESD_ConvGamma_PPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kProton));
-               fHistograms->FillHistogram("ESD_ConvGamma_PMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kProton));
-               fHistograms->FillHistogram("ESD_ConvGamma_MuPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kMuon));
-               fHistograms->FillHistogram("ESD_ConvGamma_MuMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kMuon));
-               
-
-               UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); //moved up here from below RRnewTOF
-               UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus(); 
-               // RRnewTOF start ///////////////////////////////////////////////
-               Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
-               Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
-
-               Double_t timesPos[5];
-               fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
-               Double_t timesNeg[5];
-               fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
-
-               Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
-               Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
-
-               Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
-               Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
-
-               if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
-               if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
-               // RRnewTOF end /////////////////////////////////////////////////
-
-               Double_t negPID=0;
-               Double_t posPID=0;
-               fV0Reader->GetPIDProbability(negPID,posPID);
-               fHistograms->FillHistogram("ESD_ConvGamma_E_EProbP",fV0Reader->GetNegativeTrackP(),negPID);
-               fHistograms->FillHistogram("ESD_ConvGamma_P_EProbP",fV0Reader->GetPositiveTrackP(),posPID);
-
-               Double_t negPIDmupi=0;
-               Double_t posPIDmupi=0;
-               fV0Reader->GetPIDProbabilityMuonPion(negPIDmupi,posPIDmupi);
-               fHistograms->FillHistogram("ESD_ConvGamma_E_mupiProbP",fV0Reader->GetNegativeTrackP(),negPIDmupi);
-               fHistograms->FillHistogram("ESD_ConvGamma_P_mupiProbP",fV0Reader->GetPositiveTrackP(),posPIDmupi);
-
-               Double_t armenterosQtAlpha[2] = {0,0};
-               if(fV0Reader->GetUseESDQtCut() == 0){
-                  fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetNegativeKFParticle(),
-                                                   fV0Reader->GetPositiveKFParticle(),
-                                                   fV0Reader->GetMotherCandidateKFCombination(),
-                                                   armenterosQtAlpha);
-               }
-               else if(fV0Reader->GetUseESDQtCut() == 1){
-                  fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetCurrentV0(), armenterosQtAlpha);
-               }
-               else if(fV0Reader->GetUseESDQtCut() == 2 || fV0Reader->GetUseESDQtCut() == 3){
-                  fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetNegativeKFParticle(),
-                                                   fV0Reader->GetPositiveKFParticle(),
-                                                   armenterosQtAlpha,
-                                                   fV0Reader->GetUseESDQtCut());
-               }
-                
-               fHistograms->FillHistogram("ESD_ConvGamma_alfa_qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-               fHistograms->FillHistogram("ESD_ConvGamma_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlpha[0]);
-       
-               if(!fV0Reader->GetIsHeavyIon()){
-                       fHistograms->FillHistogram("3DPlots_Conversion_XYZ", fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ());            
-                       //fHistograms->FillHistogram("3DPlots_Conversion_ZRPhi", fV0Reader->GetZ(),fV0Reader->GetXYRadius(), vtxConv.Phi());
-
-                       // begin mapping
-                       Int_t rBin              = fHistograms->GetRBin(fV0Reader->GetXYRadius());
-                       Int_t zBin              = fHistograms->GetZBin(fV0Reader->GetZ());
-                       Int_t phiBin    = fHistograms->GetPhiBin(fV0Reader->GetNegativeTrackPhi());
-                       Double_t rFMD=25;
-                       Double_t rITSTPCMin=40;
-                       Double_t rITSTPCInt=55;
-                       Double_t rITSTPCMax=72.5;
-                       
-                       //              Double_t motherCandidateEta= fV0Reader->GetMotherCandidateEta();
-                       
-                       TString nameESDMappingPhiR="";
-                       nameESDMappingPhiR.Form("ESD_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
-                       //fHistograms->FillHistogram(nameESDMappingPhiR, fV0Reader->GetZ(), motherCandidateEta);
-                       
-                       TString nameESDMappingPhi="";
-                       nameESDMappingPhi.Form("ESD_Conversion_Mapping_Phi%02d",phiBin);
-                       //fHistograms->FillHistogram(nameESDMappingPhi, fV0Reader->GetZ(), motherCandidateEta);
-                       
-                       TString nameESDMappingR="";
-                       nameESDMappingR.Form("ESD_Conversion_Mapping_R%02d",rBin);
-                       //fHistograms->FillHistogram(nameESDMappingR, fV0Reader->GetZ(), motherCandidateEta);   
-                       
-                       TString nameESDMappingPhiInR="";
-                       nameESDMappingPhiInR.Form("ESD_Conversion_Mapping_Phi_in_R_%02d",rBin);
-                       //              fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
-                       fHistograms->FillHistogram(nameESDMappingPhiInR, vtxConv.Phi());
-                       
-                       TString nameESDMappingZInR="";
-                       nameESDMappingZInR.Form("ESD_Conversion_Mapping_Z_in_R_%02d",rBin);
-                       fHistograms->FillHistogram(nameESDMappingZInR, fV0Reader->GetZ());
-                       
-                       TString nameESDMappingPhiInZ="";
-                       nameESDMappingPhiInZ.Form("ESD_Conversion_Mapping_Phi_in_Z_%02d",zBin);
-                       //              fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
-                       fHistograms->FillHistogram(nameESDMappingPhiInZ, vtxConv.Phi());
-                       
-                       if(fV0Reader->GetXYRadius()<rFMD){
-                               TString nameESDMappingFMDPhiInZ="";
-                               nameESDMappingFMDPhiInZ.Form("ESD_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
-                               fHistograms->FillHistogram(nameESDMappingFMDPhiInZ, vtxConv.Phi());
-                               fHistograms->FillHistogram("ESD_ConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                       }
-                       if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
-                               fHistograms->FillHistogram("ESD_ConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                       }
-
-                       if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCInt){
-                               TString nameESDMappingITSTPCPhiInZ="";
-                               nameESDMappingITSTPCPhiInZ.Form("ESD_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
-                               fHistograms->FillHistogram(nameESDMappingITSTPCPhiInZ, vtxConv.Phi());
-                               fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                       }
-                       
-                       if(fV0Reader->GetXYRadius()>rITSTPCInt && fV0Reader->GetXYRadius()<rITSTPCMax){
-                               TString nameESDMappingITSTPC2PhiInZ="";
-                               nameESDMappingITSTPC2PhiInZ.Form("ESD_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",zBin);
-                               fHistograms->FillHistogram(nameESDMappingITSTPC2PhiInZ, vtxConv.Phi());
-                               fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                       }
-
-                       TString nameESDMappingRInZ="";
-                       nameESDMappingRInZ.Form("ESD_Conversion_Mapping_R_in_Z_%02d",zBin);
-                       fHistograms->FillHistogram(nameESDMappingRInZ, fV0Reader->GetXYRadius());
-                       
-                       if(fV0Reader->GetMotherCandidatePt() > fLowPtMapping && fV0Reader->GetMotherCandidatePt()< fHighPtMapping){
-                               TString nameESDMappingMidPtPhiInR="";
-                               nameESDMappingMidPtPhiInR.Form("ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
-                               fHistograms->FillHistogram(nameESDMappingMidPtPhiInR, vtxConv.Phi());
-                               
-                               TString nameESDMappingMidPtZInR="";
-                               nameESDMappingMidPtZInR.Form("ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
-                               fHistograms->FillHistogram(nameESDMappingMidPtZInR, fV0Reader->GetZ());
-                               
-                               TString nameESDMappingMidPtPhiInZ="";
-                               nameESDMappingMidPtPhiInZ.Form("ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
-                               fHistograms->FillHistogram(nameESDMappingMidPtPhiInZ, vtxConv.Phi());
-                               if(fV0Reader->GetXYRadius()<rFMD){
-                                       TString nameESDMappingMidPtFMDPhiInZ="";
-                                       nameESDMappingMidPtFMDPhiInZ.Form("ESD_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
-                                       fHistograms->FillHistogram(nameESDMappingMidPtFMDPhiInZ, vtxConv.Phi());
-                               }
-                               TString nameESDMappingMidPtRInZ="";
-                               nameESDMappingMidPtRInZ.Form("ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
-                               fHistograms->FillHistogram(nameESDMappingMidPtRInZ, fV0Reader->GetXYRadius());  
-                       }
-               }
-
-               // end mapping
-               
-                   
-               new((*fKFReconstructedGammasTClone)[fKFReconstructedGammasTClone->GetEntriesFast()])    AliKFConversionPhoton(fV0Reader);
-            
-                
-               //----------------------------------- checking for "real" conversions (MC match) --------------------------------------
-               if(fDoMCTruth){
-                       TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-                       TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-                       Double_t rFMD=25;
-                       Double_t rITSTPCMin=40;
-                       Double_t rITSTPCInt=55;
-                       Double_t rITSTPCMax=72.5;
-                       if(fV0Reader->HasSameMCMother() == kFALSE){
-                               fHistograms->FillHistogram("ESD_TrueConvCombinatorial_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Z", fV0Reader->GetZ());
-                               fHistograms->FillHistogram("ESD_TrueConvCombSelected_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_Z", fV0Reader->GetZ());                      
-                               }
-                               fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Pt", fV0Reader->GetMotherCandidatePt());
-                               fHistograms->FillHistogram("ESD_TrueConvCombinatorialDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
-                               if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_Pt", fV0Reader->GetMotherCandidatePt());
-                               }
-                               if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_Pt", fV0Reader->GetMotherCandidatePt());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
-                               }
-                               if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
-                                       (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_Pt", fV0Reader->GetMotherCandidatePt());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiPDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
-                               }
-                               if((TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==211) ||
-                                       (TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==11)){
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_Pt", fV0Reader->GetMotherCandidatePt());
-                               }
-                               if( (statusPos & AliESDtrack::kTOFpid) && ( TMath::Abs(positiveMC->GetPdgCode()) != 11 ) && !(statusPos & AliESDtrack::kTOFmismatch) )
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
-                               if( (statusNeg & AliESDtrack::kTOFpid) && ( TMath::Abs(negativeMC->GetPdgCode()) != 11 ) && !(statusNeg & AliESDtrack::kTOFmismatch) )
-                                       fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
-                               continue;
-                       } 
-
-                                               // Moved up to check true electron background
-                                               //                      TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-                                               //                      TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-                                               
-                       if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
-                               fHistograms->FillHistogram("ESD_TrueConvHadronicBck_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Z", fV0Reader->GetZ());
-                               if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
-                                       fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_Z", fV0Reader->GetZ());                        
-                               }
-                               fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Pt", fV0Reader->GetMotherCandidatePt());
-                               fHistograms->FillHistogram("ESD_TrueConvHadronicBckDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
-                               if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) )
-                                       fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
-                               if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) )
-                                       fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
-                               if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
-                                       (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
-                                       fHistograms->FillHistogram("ESD_TrueConvLambda_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvLambda_Pt", fV0Reader->GetMotherCandidatePt());
-                               }
-                               if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
-                                       fHistograms->FillHistogram("ESD_TrueConvMeson_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvMeson_Pt", fV0Reader->GetMotherCandidatePt());
-                               }
-                               continue;
-                       }
-                        
-
-                       if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
-                               continue;
-                       }
-
-                       //UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); moved higher
-                       //UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus(); 
-                       UChar_t itsPixelPos = fV0Reader->GetPositiveESDTrack()->GetITSClusterMap();
-                       UChar_t itsPixelNeg = fV0Reader->GetNegativeESDTrack()->GetITSClusterMap();
-
-                       // Using the UniqueID Phojet does not get the Dalitz right
-                       //                      if( (negativeMC->GetUniqueID() == 4 && positiveMC->GetUniqueID() ==4) ||
-                       //      (negativeMC->GetUniqueID() == 0 && positiveMC->GetUniqueID() ==0) ){// fill r distribution for Dalitz decays 
-                       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 111){ //pi0
-                               fHistograms->FillHistogram("ESD_TrueDalitzContamination_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_Z", fV0Reader->GetZ());               
-                               if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
-                                       fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_Z", fV0Reader->GetZ());                  
-                               }
-                       
-                               //--------Histos for HFE 
-
-                               if(statusPos & AliESDtrack::kTOFpid){
-                                       fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_R", fV0Reader->GetXYRadius());
-                                       if( TESTBIT(itsPixelPos, 0) ){ 
-                                               fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_kFirst_R", fV0Reader->GetXYRadius());
-                                       }
-                               }
-                               if(statusNeg & AliESDtrack::kTOFpid){
-                                       fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_R", fV0Reader->GetXYRadius());
-                                       if( TESTBIT(itsPixelNeg, 0) ){ 
-                                               fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_kFirst_R", fV0Reader->GetXYRadius());
-                                       }
-                               }
-                               //--------------------------------------------------------
-
-                       }
-                       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 221){ //eta
-                               fHistograms->FillHistogram("ESD_TrueConvDalitzEta_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConvDalitzEta_Z", fV0Reader->GetZ());                               
-                               if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
-                                       fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_Z", fV0Reader->GetZ());                  
-                               }
-                       }
-
-                       //}
-
-                       if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){// check if the daughters come from a conversion
-                               continue;
-                       }
-                       
-                       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
-                               if(fDoCF){
-                                       Double_t containerInput[3];
-                                       containerInput[0] = fV0Reader->GetMotherCandidatePt();
-                                       containerInput[1] = fV0Reader->GetMotherCandidateEta();
-                                       containerInput[2] = fV0Reader->GetMotherCandidateMass();
-                                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepTrueGamma); // for CF 
-                               }
-
-                               // RRnewTOF start ///////////////////////////////////////////////
-                               if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) {
-                                       fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
-                               }
-                               if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) {
-                                       fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
-                               }
-                                                               // RRnewTOF end /////////////////////////////////////////////////
-                               if (fV0Reader->HasSameMCMother() == kTRUE){
-                                       fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                                       fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlpha[0]);   
-                               }
-                               // RRnewTOF end /////////////////////////////////////////////////
-
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_CosPoint_RecCosPoint",fV0Reader->GetCosPointingAngle(),fV0Reader->GetV0CosineOfPointingAngle(fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ()));
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_PsiPair", fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
-                               if(negativeMC->GetMother(0) <= fStack->GetNprimary()){ // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
-                                       fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
-                                       fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Z", fV0Reader->GetZ());
-                                        fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_ESDPt_MCPt",fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherMCParticle()->Pt());                            
-                                       if(  fV0Reader->GetMotherCandidatePt() > 2. ) {
-                                               fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_R", fV0Reader->GetXYRadius());
-                                               fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_Z", fV0Reader->GetZ());                               
-                                       }
-                               }
-                                else{
-                                   fHistograms->FillHistogram("ESD_TrueConvSecondaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
-                                   if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
-                                      if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 310){
-                                         fHistograms->FillHistogram("ESD_TrueConvSecondaryGammaFromK0s_Pt", fV0Reader->GetMotherCandidatePt());                                         
-                                      }
-                                      if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetMother(0) > -1 && 
-                                         fStack->Particle(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
-                                         fHistograms->FillHistogram("ESD_TrueConvSecondaryGammaFromXFromK0s_Pt", fV0Reader->GetMotherCandidatePt());                                         
-                                      }
-                                   }
-                                }
-                               if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
-                                       if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 221){ // Use just gamma from eta for ratio esdtruegamma / mcconvgamma
-                                               fHistograms->FillHistogram("ESD_TrueConvEtaGamma_Pt", fV0Reader->GetMotherCandidatePt());
-                                       }
-                               }
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Eta", fV0Reader->GetMotherCandidateEta());                                
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetNegativeNTPCClusters());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetPositiveNTPCClusters());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetNegativeNTPCClusters(),fV0Reader->GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetPositiveNTPCClusters(),fV0Reader->GetMotherCandidateMass());
-                                                       
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
-                               if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
-                                       fHistograms->FillHistogram("ESD_TrueConversionMinPt_R", fV0Reader->GetXYRadius());
-                                       fHistograms->FillHistogram("ESD_TrueConversionMinPt_Z", fV0Reader->GetZ());                     
-                               }
-                                                       
-                               fHistograms->FillHistogram("ESD_TrueConversion_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
-                               fHistograms->FillHistogram("ESD_TrueConversion_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
-
-                               fHistograms->FillHistogram("ESD_TrueConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
-                               fHistograms->FillHistogram("ESD_TrueConversion_R", fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConversion_Z", fV0Reader->GetZ());                          
-                               fHistograms->FillHistogram("ESD_TrueConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("ESD_TrueConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
-                               fHistograms->FillHistogram("ESD_TrueConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
-                               if(fV0Reader->GetXYRadius()<rFMD){
-                                       fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                               }
-                               if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
-                                       fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                               }
-                               if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCInt){
-                                       fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                               }
-                               if(fV0Reader->GetXYRadius()>rITSTPCInt && fV0Reader->GetXYRadius()<rITSTPCMax){
-                                       fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
-                               }
-
-                               fHistograms->FillHistogram("ESD_TrueConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
-
-                               //----Histos for HFE-------------------------------------- 
-
-                               if(statusPos & AliESDtrack::kTOFpid){
-                                       fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
-                                       if( TESTBIT(itsPixelPos, 0) ){ 
-                                               fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_kFirst_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
-                                       }
-                               }
-                               if(statusNeg & AliESDtrack::kTOFpid){
-                                       fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
-                                       if( TESTBIT(itsPixelNeg, 0) ){ 
-                                               fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_kFirst_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
-                                       }
-                               }
-                               //--------------------------------------------------------
-
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
-                               if (fV0Reader->GetMotherCandidateP() != 0) {
-                                       fHistograms->FillHistogram("ESD_TrueConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
-                                       fHistograms->FillHistogram("ESD_TrueConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
-                               } else { 
-                                       cout << "Error::fV0Reader->GetNegativeTrackP() == 0 !!!" << endl;               
-                               }
-                               
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
-                                       
-                               //store MCTruth properties
-                               fHistograms->FillHistogram("ESD_TrueConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
-                               fHistograms->FillHistogram("ESD_TrueConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
-                               fHistograms->FillHistogram("ESD_TrueConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
-                               
-                               
-                               //___________________________________________Resolution______________________________________________________
-                               // Different Ways of Producing a Gamma                          
-                               // Standard V0 Information                              
-                               Double_t mcPt   = fV0Reader->GetMotherMCParticle()->Pt();
-                               Double_t mcR = fV0Reader->GetNegativeMCParticle()->R();
-                               Double_t mcZ = fV0Reader->GetNegativeMCParticle()->Vz();
-                               Double_t resPt = 0.;
-                               Double_t resR = 0;
-                               Double_t resZ = 0;
-
-                               AliKFParticle AliKFPosParticle(*(fV0Reader->GetExternalTrackParamP(fV0Reader->GetCurrentV0())),-11);
-                               AliKFParticle AliKFNegParticle(*(fV0Reader->GetExternalTrackParamN(fV0Reader->GetCurrentV0())),11);
-
-                               // Resolution Normal V0 unchanged from the On-fly/Offline
-                               Double_t xyz[3] = {0,0,0};
-                               fV0Reader->GetCurrentV0()->GetXYZ(xyz[0],xyz[1],xyz[2]);
-                               resPt = mcPt-fV0Reader->GetCurrentV0()->Pt();
-                               resR = mcR-TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
-                               resZ = mcZ-xyz[2];
-                               fHistograms->FillHistogram("Resolution_Gamma_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_Gamma_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_Gamma_AbsdZ_Z", mcZ,resZ);
-                               
-                               // Resolution Recalculated V0
-                               resR = mcR-fV0Reader->GetXYRadius();
-                               resZ = mcZ-fV0Reader->GetZ();
-                               // No pt, because we not recalculate v0 pt
-                               fHistograms->FillHistogram("Resolution_GammaRecalcPos_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaRecalcPos_AbsdZ_Z", mcZ,resZ);
-
-                               // Resolution ConstructGamma
-                               AliKFParticle constructGammaKF;
-                               constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
-                               resPt = mcPt-constructGammaKF.GetPt();
-                               resR = mcR-constructGammaKF.GetR();
-                               resZ = mcZ-constructGammaKF.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaConstr_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaConstr_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaConstr_AbsdZ_Z", mcZ,resZ);
-                               if(constructGammaKF.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaConstr_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
-                               
-
-                               // Construct Gamma + Mass Constrained
-                               constructGammaKF.SetMassConstraint(0,0.0001);
-                               resPt = mcPt-constructGammaKF.GetPt();
-                               resR = mcR-constructGammaKF.GetR();
-                               resZ = mcZ-constructGammaKF.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdZ_Z", mcZ,resZ);
-                               if(constructGammaKF.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaConstrMass_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
-
-                               // Construct Gamma + ProductionVertex
-                               constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
-                               AliKFVertex primaryVertexImprovedConstruct(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
-                               primaryVertexImprovedConstruct+=constructGammaKF;
-                               constructGammaKF.SetProductionVertex(primaryVertexImprovedConstruct);
-                               resPt = mcPt-constructGammaKF.GetPt();
-                               resR = mcR-constructGammaKF.GetR();
-                               resZ = mcZ-constructGammaKF.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdZ_Z", mcZ,resZ);
-                               if(constructGammaKF.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaConstrVtx_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
-
-                               // Construct Gamma + Mass Constrained + Production Vtx
-                               constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
-                               constructGammaKF.SetMassConstraint(0,0.0001);
-                               AliKFVertex primaryVertexImprovedConstructC(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
-                               primaryVertexImprovedConstructC+=constructGammaKF;
-                               constructGammaKF.SetProductionVertex(primaryVertexImprovedConstructC);
-                               resPt = mcPt-constructGammaKF.GetPt();
-                               resR = mcR-constructGammaKF.GetR();
-                               resZ = mcZ-constructGammaKF.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdZ_Z", mcZ,resZ);
-                               if(constructGammaKF.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
-
-                               // Resolution Normal Gamma
-                               AliKFParticle normalGammaKF(AliKFNegParticle,AliKFPosParticle);
-                               resPt = mcPt-normalGammaKF.GetPt();
-                               resR = mcR-normalGammaKF.GetR();
-                               resZ = mcZ-normalGammaKF.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaNormal_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaNormal_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaNormal_AbsdZ_Z", mcZ,resZ);
-                               if(normalGammaKF.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaNormal_Chi2NDF", normalGammaKF.GetChi2()/normalGammaKF.GetNDF());
-
-                               // Normal Gamma + Mass Constrained
-                               normalGammaKF.SetMassConstraint(0,0.0001);
-                               resPt = mcPt-normalGammaKF.GetPt();
-                               resR = mcR-normalGammaKF.GetR();
-                               resZ = mcZ-normalGammaKF.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdZ_Z", mcZ,resZ);
-                               if(normalGammaKF.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaNormalMass_Chi2NDF", normalGammaKF.GetChi2()/normalGammaKF.GetNDF());
-                               
-                               // Normal Gamma + ProductionVertex
-                               AliKFParticle normalGammaKFVtx(AliKFNegParticle,AliKFPosParticle);
-                               AliKFVertex primaryVertexImprovedNormal(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
-                               primaryVertexImprovedNormal+=normalGammaKFVtx;
-                               normalGammaKFVtx.SetProductionVertex(primaryVertexImprovedNormal);
-                               resPt = mcPt-normalGammaKFVtx.GetPt();
-                               resR = mcR-normalGammaKFVtx.GetR();
-                               resZ = mcZ-normalGammaKFVtx.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdZ_Z", mcZ,resZ);
-                               if(normalGammaKFVtx.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaNormalVtx_Chi2NDF", normalGammaKFVtx.GetChi2()/normalGammaKFVtx.GetNDF());
-                               
-                               // Normal Gamma + Mass Constrained + Production Vtx
-                               AliKFParticle normalGammaKFMassVtx(AliKFNegParticle,AliKFPosParticle);
-                               normalGammaKFMassVtx.SetMassConstraint(0,0.0001);
-                               AliKFVertex primaryVertexImprovedNormalMassVtx(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
-                               primaryVertexImprovedNormalMassVtx+=normalGammaKFMassVtx;
-                               normalGammaKFMassVtx.SetProductionVertex(primaryVertexImprovedNormalMassVtx);
-                               resPt = mcPt-normalGammaKFMassVtx.GetPt();
-                               resR = mcR-normalGammaKFMassVtx.GetR();
-                               resZ = mcZ-normalGammaKFMassVtx.GetZ();
-                               fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdPt_Pt", mcPt, resPt);
-                                fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdR_R", mcR,resR);
-                               fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdZ_Z", mcZ,resZ);
-                               if(normalGammaKFMassVtx.GetNDF() !=0)
-                                  fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_Chi2NDF", normalGammaKFMassVtx.GetChi2()/normalGammaKFMassVtx.GetNDF());
-
-
-                               // ---------- End new Resolution ------------------
-                               Double_t mcpt    = fV0Reader->GetMotherMCParticle()->Pt();
-                               Double_t esdpt  = fV0Reader->GetMotherCandidatePt();
-                               Double_t resdPt = 0.;
-                               if(mcpt > 0){
-                                       resdPt = ((esdpt - mcpt)/mcpt)*100.;
-                               } else if(mcpt < 0){
-                                       cout<<"Pt of MC particle is negative, this will cause wrong calculation of resPt"<<endl; 
-                               }
-                               
-                               TVector3 vtxConvRes(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
-                               
-                               fHistograms->FillHistogram("Resolution_Gamma_dPt_Pt", mcpt, resdPt);
-                               fHistograms->FillHistogram("Resolution_MCPt_ESDPt", mcpt,esdpt);
-                               fHistograms->FillHistogram("Resolution_Gamma_dPt_Phi", vtxConvRes.Phi(), resdPt);
-                               if (esdpt> 0.150){
-                                       fHistograms->FillHistogram("Resolution_Gamma_minPt_dPt_Phi", vtxConvRes.Phi(), resdPt);
-                               }
-                                               
-                               Double_t resdZ = 0.;
-                               if(fV0Reader->GetNegativeMCParticle()->Vz() != 0){
-                                       resdZ = ((fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz())/fV0Reader->GetNegativeMCParticle()->Vz())*100.;
-                               }
-                               Double_t resdZAbs = 0.;
-                               resdZAbs = (fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz());
-
-                               fHistograms->FillHistogram("Resolution_dZAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdZAbs);
-                               fHistograms->FillHistogram("Resolution_dZAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdZAbs);
-                               fHistograms->FillHistogram("Resolution_dZAbs_VS_Phi", vtxConvRes.Phi(), resdZAbs);
-                               fHistograms->FillHistogram("Resolution_dZ", fV0Reader->GetNegativeMCParticle()->Vz(), resdZ);
-                               fHistograms->FillHistogram("Resolution_MCZ_ESDZ", fV0Reader->GetNegativeMCParticle()->Vz(),fV0Reader->GetZ());
-                                       
-                               // new for dPt_Pt-histograms for Electron and Positron
-                               Double_t mcEpt;
-                               Double_t resEdPt=0;
-                               UInt_t kTRDoutN, statusN;
-                               Int_t nITSclsE;
-                               // new for dPt_Pt-histograms for Electron and Positron
-                               if (fV0Reader->GetNegativeMCParticle()->GetPdgCode() == 11) {
-                                       mcEpt = fV0Reader->GetNegativeMCParticle()->Pt();
-                               } else {
-                                       mcEpt = fV0Reader->GetPositiveMCParticle()->Pt();
-                               }
-                               if (mcEpt > 0){ 
-                                       resEdPt = ((fV0Reader->GetNegativeTrackPt()-mcEpt)/mcEpt)*100.;
-                               }
-                               statusN = fV0Reader->GetNegativeESDTrack()->GetStatus(); 
-                               kTRDoutN =      (statusN & AliESDtrack::kTRDout);
-                               nITSclsE= fV0Reader->GetNegativeTracknITSClusters();
-
-                               // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
-                               switch(nITSclsE){
-                               case 0: // 0 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS0", mcEpt, resEdPt);
-                                       break;
-                               case 1: // 1 ITS cluster
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS1", mcEpt, resEdPt);
-                                       break;
-                               case 2: // 2 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS2", mcEpt, resEdPt);
-                                       break;
-                               case 3: // 3 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS3", mcEpt, resEdPt);
-                                       break;
-                               case 4: // 4 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS4", mcEpt, resEdPt);
-                                       break;
-                               case 5: // 5 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS5", mcEpt, resEdPt);
-                                       break;
-                               case 6: // 6 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS6", mcEpt, resEdPt);
-                                       break;
-                               }
-                               //Filling histograms with respect to Electron resolution
-                               fHistograms->FillHistogram("Resolution_E_dPt_Pt", mcEpt, resEdPt);
-                               fHistograms->FillHistogram("Resolution_E_dPt_Phi", vtxConvRes.Phi(), resEdPt);
-                               if (fV0Reader->GetNegativeTrackPt()> 0.150){
-                                       fHistograms->FillHistogram("Resolution_E_minPt_dPt_Phi", vtxConvRes.Phi(), resEdPt);
-                               }
-
-                               if(kTRDoutN){
-                                       fHistograms->FillHistogram("Resolution_E_nTRDtracklets_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
-                                       fHistograms->FillHistogram("Resolution_E_nTRDtracklets_MCPt", mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());     
-                                       fHistograms->FillHistogram("Resolution_E_nTRDclusters_ESDPt",fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDncls());
-                                       fHistograms->FillHistogram("Resolution_E_nTRDclusters_MCPt",mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDncls());
-                                       fHistograms->FillHistogram("Resolution_E_TRDsignal_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDsignal());
-                               }
-
-                               Double_t mcPpt;
-                               if (fV0Reader->GetPositiveMCParticle()->GetPdgCode() == -11) {
-                                       mcPpt = fV0Reader->GetPositiveMCParticle()->Pt();
-                               } else {
-                                       mcPpt = fV0Reader->GetNegativeMCParticle()->Pt();
-                               }
-
-                               Double_t resPdPt = 0;
-                               if (mcPpt > 0){ 
-                                       resPdPt = ((fV0Reader->GetPositiveTrackPt()-mcPpt)/mcPpt)*100.;
-                               }
-
-                               UInt_t statusP = fV0Reader->GetPositiveESDTrack()->GetStatus(); 
-                               //               AliESDtrack * posTr= fV0Reader->GetPositiveESDTrack();
-                               UInt_t kTRDoutP =       (statusP & AliESDtrack::kTRDout);
-                               
-                               Int_t nITSclsP = fV0Reader->GetPositiveTracknITSClusters();
-                               // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
-                               switch(nITSclsP){
-                               case 0: // 0 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS0", mcPpt, resPdPt);
-                                       break;
-                               case 1: // 1 ITS cluster
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS1", mcPpt, resPdPt);
-                                       break;
-                               case 2: // 2 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS2", mcPpt, resPdPt);
-                                       break;
-                               case 3: // 3 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS3", mcPpt, resPdPt);
-                                       break;
-                               case 4: // 4 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS4", mcPpt, resPdPt);
-                                       break;
-                               case 5: // 5 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS5", mcPpt, resPdPt);
-                                       break;
-                               case 6: // 6 ITS clusters
-                                       fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS6", mcPpt, resPdPt);
-                                       break;
-                               }
-                               //Filling histograms with respect to Positron resolution
-                               fHistograms->FillHistogram("Resolution_P_dPt_Pt", mcPpt, resPdPt);
-                               fHistograms->FillHistogram("Resolution_P_dPt_Phi", vtxConvRes.Phi(), resPdPt);
-                               if (fV0Reader->GetPositiveTrackPt()> 0.150){
-                                       fHistograms->FillHistogram("Resolution_P_minPt_dPt_Phi", vtxConvRes.Phi(), resPdPt);
-                               }
-
-                               if(kTRDoutP){
-                                       fHistograms->FillHistogram("Resolution_P_nTRDtracklets_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
-                                       fHistograms->FillHistogram("Resolution_P_nTRDtracklets_MCPt", mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
-                                       fHistograms->FillHistogram("Resolution_P_nTRDclusters_ESDPt",fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDncls());
-                                       fHistograms->FillHistogram("Resolution_P_nTRDclusters_MCPt",mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDncls());
-                                       fHistograms->FillHistogram("Resolution_P_TRDsignal_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDsignal());
-                               }
-
-                       
-                               Double_t resdR = 0.;
-                               if(fV0Reader->GetNegativeMCParticle()->R() != 0){
-                                       resdR = ((fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R())/fV0Reader->GetNegativeMCParticle()->R())*100.;
-                               }
-                               Double_t resdRAbs = 0.;
-                               resdRAbs = (fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R());
-
-                               fHistograms->FillHistogram("Resolution_dRAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdRAbs);
-                               fHistograms->FillHistogram("Resolution_dRAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdRAbs);
-                               fHistograms->FillHistogram("Resolution_dRAbs_VS_Phi",  vtxConvRes.Phi(), resdRAbs);
-                               fHistograms->FillHistogram("Resolution_dR", fV0Reader->GetNegativeMCParticle()->R(), resdR);
-                               fHistograms->FillHistogram("Resolution_MCR_ESDR", fV0Reader->GetNegativeMCParticle()->R(),fV0Reader->GetXYRadius());
-                               fHistograms->FillHistogram("Resolution_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
-                               if (esdpt> 0.150){
-                                       fHistograms->FillHistogram("Resolution_minPt_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
-                               }
-
-                               Double_t resdPhiAbs=0.;
-                               resdPhiAbs=0.;
-                               resdPhiAbs= (vtxConvRes.Phi()-fV0Reader->GetNegativeMCParticle()->Phi());
-                               fHistograms->FillHistogram("Resolution_MCPhi_ESDPhi", fV0Reader->GetNegativeMCParticle()->Phi(),vtxConvRes.Phi());
-                               fHistograms->FillHistogram("Resolution_dPhiAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdPhiAbs);
-                               fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdPhiAbs);
-                               fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Phi",  vtxConvRes.Phi(), resdPhiAbs);
-                       }//if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22)
-               }//if(fDoMCTruth)
-       }//while(fV0Reader->NextV0)
-       fHistograms->FillHistogram("ESD_NumberOfSurvivingV0s", nSurvivingV0s);
-       fHistograms->FillHistogram("ESD_NumberOfV0s", fV0Reader->GetNumberOfV0s());
-       fHistograms->FillHistogram("ESD_NumberOfContributorsVtx", fV0Reader->GetNumberOfContributorsVtx());
-       fV0Reader->ResetV0IndexNumber();
-}
-
-
-//_____________________________________________________________________________________
-void AliAnalysisTaskGammaConversion::ProcessGammasForOmegaMesonAnalysis(){
-       // omega meson analysis pi0+gamma decay
-       for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
-               AliKFConversionMother * omegaCandidatePi0Daughter = (AliKFConversionMother *)fKFReconstructedPi0sTClone->At(firstPi0Index);
-               for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
-
-                       AliKFConversionPhoton * omegaCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
-                           if(omegaCandidatePi0Daughter->GetGammaLabel(0)==firstGammaIndex || omegaCandidatePi0Daughter->GetGammaLabel(1)==firstGammaIndex){
-                               continue;
-                       }
-
-                       AliKFParticle omegaCandidate(*omegaCandidatePi0Daughter,*omegaCandidateGammaDaughter);
-                       Double_t massOmegaCandidate = 0.;
-                       Double_t widthOmegaCandidate = 0.;
-
-                       omegaCandidate.GetMass(massOmegaCandidate,widthOmegaCandidate);
-
-                       if ( massOmegaCandidate > 733 && massOmegaCandidate < 833 ) {
-                               //AddOmegaToAOD(&omegaCandidate, massOmegaCandidate, firstPi0Index, firstGammaIndex);
-                       }
-                       
-                       fHistograms->FillHistogram("ESD_Omega_InvMass_vs_Pt",massOmegaCandidate ,omegaCandidate.GetPt());
-                       fHistograms->FillHistogram("ESD_Omega_InvMass",massOmegaCandidate);
-                       //delete omegaCandidate;
-
-               }// end of omega reconstruction in pi0+gamma channel
-
-               if(fDoJet == kTRUE){
-                       AliKFParticle* negPiKF=NULL;
-                       AliKFParticle* posPiKF=NULL;
-                       Int_t piPlusMotherLabel=-1;
-                       Int_t piMinusMotherLabel=-1;
-                       
-                       // look at the pi+pi+pi0 channel 
-                       for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-                               AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-                               if (posTrack->GetSign()<0) continue;
-                               if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
-                               if (posPiKF) delete posPiKF; posPiKF=NULL;
-                               posPiKF = new AliKFParticle( *(posTrack) ,211);
-                               if(fDoMCTruth){
-                                       TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
-                                       if(positiveMCParticle->GetMother(0)>-1){
-                                               piPlusMotherLabel = positiveMCParticle->GetMother(0);
-                                       }
-                               }
-                               
-                               for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
-                                       AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
-                                       if( negTrack->GetSign()>0) continue;
-                                       if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
-                                       if (negPiKF) delete negPiKF; negPiKF=NULL;
-                                       negPiKF = new AliKFParticle( *(negTrack) ,-211);
-                                       AliKFParticle omegaCandidatePipPinPi0(*omegaCandidatePi0Daughter,*posPiKF,*negPiKF);
-                                       Double_t massOmegaCandidatePipPinPi0 = 0.;
-                                       Double_t widthOmegaCandidatePipPinPi0 = 0.;
-                                       
-                                       omegaCandidatePipPinPi0.GetMass(massOmegaCandidatePipPinPi0,widthOmegaCandidatePipPinPi0);
-
-                                       if ( massOmegaCandidatePipPinPi0 > 733 && massOmegaCandidatePipPinPi0 < 833 ) {
-                                               // AddOmegaToAOD(&omegaCandidatePipPinPi0, massOmegaCandidatePipPinPi0, -1, -1);
-                                       }
-                                       
-                                       fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
-                                       fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass",massOmegaCandidatePipPinPi0);
-
-
-                                       if(fDoMCTruth){
-                                               TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
-                                               if(negativeMCParticle->GetMother(0)>-1){
-                                                       piMinusMotherLabel = negativeMCParticle->GetMother(0);
-                                                       if(     piMinusMotherLabel ==   piPlusMotherLabel){
-                                                               Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
-                                                               if(geantCode == 221 || geantCode == 223){
-                                                                       fHistograms->FillHistogram("ESD_TrueOmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
-                                                               }
-                                                       }                               
-
-                                               }
-
-                                       }
-       
-                                       //      delete omegaCandidatePipPinPi0;
-                               }
-                       }
-
-                       if (posPiKF) delete posPiKF; posPiKF=NULL;               if (negPiKF) delete negPiKF; negPiKF=NULL;
-
-               } // checking ig gammajet because in that case the chargedparticle list is created
-
-       }
-       ////////////////////////
-
-       // gamma+ pi+
-       if(fDoJet == kTRUE){
-               for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
-                       AliKFConversionPhoton * rhoCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
-                       Int_t gamma1MotherLabel=-1;
-                       if(fDoMCTruth){
-                               Int_t indexKF1 = rhoCandidateGammaDaughter->GetV0Index();
-                               if(indexKF1<fV0Reader->GetNumberOfV0s()){
-                                       fV0Reader->GetV0(indexKF1);//updates to the correct v0
-
-                                       if(fV0Reader->HasSameMCMother() == kTRUE){
-                                               //cout<<"This v0 is a real v0!!!!"<<endl;
-                                               TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-                                               TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-                                               if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
-                                                       if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
-                                                               if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
-                                                                       gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       AliKFParticle* posPiKF=NULL;
-                       AliKFParticle* negPiKF=NULL;
-                       Int_t piPlusMotherLabel=-1;
-                       Int_t piMinusMotherLabel=-1;
-                       
-                       for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-                               AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-                               if (posTrack->GetSign()<0) continue;
-                               if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
-                               if (posPiKF) delete posPiKF; posPiKF=NULL;
-                               posPiKF = new AliKFParticle( *(posTrack) ,211);
-                               AliKFParticle rhoPlusCandidate(*posPiKF,*rhoCandidateGammaDaughter);
-                               Double_t massRhoPlusCandidate = 0.;
-                               Double_t widthRhoPlusCandidate = 0.;
-
-                               rhoPlusCandidate.GetMass(massRhoPlusCandidate,widthRhoPlusCandidate);
-                               fHistograms->FillHistogram("ESD_RhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
-                               fHistograms->FillHistogram("ESD_RhoPlus_InvMass",massRhoPlusCandidate);
-
-
-                               if(fDoMCTruth){
-                                       TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
-                                       if(positiveMCParticle->GetMother(0)>-1){
-                                               piPlusMotherLabel = positiveMCParticle->GetMother(0);
-                                               if(piPlusMotherLabel == gamma1MotherLabel){
-                                                       //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
-              //cout<<"RhoPlus::" << geantCode<< endl;
-                                                       fHistograms->FillHistogram("ESD_TrueRhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
-                                               }
-                                       }
-                               }
-                               for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
-                                       AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
-                                       if (negTrack->GetSign()>0) continue;
-                                       if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
-                                       if (negPiKF) delete negPiKF; negPiKF=NULL;
-                                       negPiKF = new AliKFParticle( *(negTrack) ,-211);
-                                       AliKFParticle rho0Candidate(*posPiKF,*negPiKF,*rhoCandidateGammaDaughter);
-                                       Double_t massRho0Candidate = 0.;
-                                       Double_t widthRho0Candidate = 0.;
-                                       
-                                       rho0Candidate.GetMass(massRho0Candidate,widthRho0Candidate);
-                                       fHistograms->FillHistogram("ESD_Rho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
-                                       fHistograms->FillHistogram("ESD_Rho0_InvMass",massRho0Candidate);
-
-                                       if(fDoMCTruth){
-                                               TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
-                                               if(negativeMCParticle->GetMother(0)>-1){
-                                                       piMinusMotherLabel = negativeMCParticle->GetMother(0);
-                                                       if(     piMinusMotherLabel ==   piPlusMotherLabel && piMinusMotherLabel==gamma1MotherLabel ){
-                                                               Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
-                                                               if(geantCode == 221 || geantCode == 113){
-                                                                       fHistograms->FillHistogram("ESD_TrueRho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
-                                                               }
-                                                       }                               
-                                               }
-                                       }
-                               }
-
-                       }
-
-                       if (posPiKF) delete posPiKF; posPiKF=NULL;               if (negPiKF) delete negPiKF; negPiKF=NULL;
-
-
-                       for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-                               AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-                               if (negTrack->GetSign()>0) continue;
-                               if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
-                               if (negPiKF) delete negPiKF; negPiKF=NULL;
-                               negPiKF = new AliKFParticle( *(negTrack) ,-211);
-                               AliKFParticle rhoMinusCandidate(*negPiKF,*rhoCandidateGammaDaughter);
-                               Double_t massRhoMinusCandidate = 0.;
-                               Double_t widthRhoMinusCandidate = 0.;
-
-                               rhoMinusCandidate.GetMass(massRhoMinusCandidate,widthRhoMinusCandidate);
-                               fHistograms->FillHistogram("ESD_RhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
-                               fHistograms->FillHistogram("ESD_RhoMinus_InvMass",massRhoMinusCandidate);
-
-                               if(fDoMCTruth){
-                                       TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
-                                       Int_t pionMotherLabel=-1;
-
-                                       if(negativeMCParticle->GetMother(0)>-1){
-                                               pionMotherLabel = negativeMCParticle->GetMother(0);
-                                               if(pionMotherLabel == gamma1MotherLabel){
-                                                       //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
-              //cout<<"RhoMinus::" << geantCode<< endl;
-                                                       fHistograms->FillHistogram("ESD_TrueRhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
-                                               }
-                                       }
-                               }
-                       }
-                       if (posPiKF) delete posPiKF; posPiKF=NULL;               if (negPiKF) delete negPiKF; negPiKF=NULL;
-
-                       AliKFParticle* posProtKF=NULL;
-
-                       
-                       for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-                               AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-                               if (posTrack->GetSign()<0) continue;
-                               if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kProton))>2.) continue;
-                               if (posProtKF) delete posProtKF; posProtKF=NULL;
-                               posProtKF = new AliKFParticle( *(posTrack) ,2212);
-                               AliKFParticle deltaPlusCandidate(*posProtKF,*rhoCandidateGammaDaughter);
-                               Double_t massDeltaPlusCandidate = 0.;
-                               Double_t widthDeltaPlusCandidate = 0.;
-
-                               deltaPlusCandidate.GetMass(massDeltaPlusCandidate,widthDeltaPlusCandidate);
-                               fHistograms->FillHistogram("ESD_DeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
-                               fHistograms->FillHistogram("ESD_DeltaPlus_InvMass",massDeltaPlusCandidate);
-
-                               if(fDoMCTruth){
-                                       TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
-                                       Int_t protonMotherLabel=-1;
-
-                                       if(positiveMCParticle->GetMother(0)>-1){
-                                               protonMotherLabel = positiveMCParticle->GetMother(0);
-                                               if(protonMotherLabel == gamma1MotherLabel){
-                                                       //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
-              //cout<<"RhoPlus::" << geantCode<< endl;
-                                                       fHistograms->FillHistogram("ESD_TrueDeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
-                                               }
-                                       }
-                               }
-
-                       }
-                       if (posPiKF) delete posPiKF; posPiKF=NULL;               if (negPiKF) delete negPiKF; negPiKF=NULL; if (posProtKF) delete posProtKF; posProtKF=NULL;
-               }
-       }
-               
-       if(fCalculateBackground){
-
-               AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
-               
-               Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
-               Int_t mbin = 0;
-               if(fUseTrackMultiplicityForBG == kTRUE){
-                       mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
-               } else {
-                       mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
-               }
-               
-               AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
-
-               // Background calculation for the omega
-               for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
-                       AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);
-                       
-                       if(fMoveParticleAccordingToVertex == kTRUE){
-                               bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
-                       }
-                       for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
-                               AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
-
-                               if(fMoveParticleAccordingToVertex == kTRUE){
-                                       MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
-                               }
-
-                               for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
-                                       AliKFParticle * omegaCandidatePi0Daughter = (AliKFParticle *)fKFReconstructedPi0sTClone->At(firstPi0Index);
-                                       AliKFParticle * omegaBckCandidate = new AliKFParticle(*omegaCandidatePi0Daughter,previousGoodV0);
-                                       Double_t massOmegaBckCandidate = 0.;
-                                       Double_t widthOmegaBckCandidate = 0.;
-                                       
-                                       omegaBckCandidate->GetMass(massOmegaBckCandidate,widthOmegaBckCandidate);
-
-
-                                       fHistograms->FillHistogram("ESD_Omega_Bck_InvMass_vs_Pt",massOmegaBckCandidate ,omegaBckCandidate->GetPt());
-                                       fHistograms->FillHistogram("ESD_Omega_Bck_InvMass",massOmegaBckCandidate);
-
-                                       delete omegaBckCandidate; 
-                               }
-
-                               // Bck for gamma pi+ pi-
-
-                               AliKFParticle* posPiKF=NULL;
-                               AliKFParticle* negPiKF=NULL;
-                       
-                               for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-                                       AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-                                       if (posTrack->GetSign()<0) continue;
-                                       if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
-                                       if (posPiKF) delete posPiKF; posPiKF=NULL;
-                                       posPiKF = new AliKFParticle( *(posTrack) ,211);
-
-                                       for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
-                                               AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
-                                               if (negTrack->GetSign()>0) continue;
-                                               if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
-                                               if (negPiKF) delete negPiKF; negPiKF=NULL;
-                                               negPiKF = new AliKFParticle( *(negTrack) ,-211);
-                                               AliKFParticle rho0BckCandidate(*posPiKF,*negPiKF,previousGoodV0);
-                                               Double_t massRho0BckCandidate = 0.;
-                                               Double_t widthRho0BckCandidate = 0.;
-                                               
-                                               rho0BckCandidate.GetMass(massRho0BckCandidate,widthRho0BckCandidate);
-                                               fHistograms->FillHistogram("ESD_Rho0Bck_InvMass_vs_Pt",massRho0BckCandidate ,rho0BckCandidate.GetPt());
-                                               fHistograms->FillHistogram("ESD_Rho0Bck_InvMass",massRho0BckCandidate);
-                                       }
-                                       
-                               }
-
-                               if (posPiKF) delete posPiKF; posPiKF=NULL;               if (negPiKF) delete negPiKF; negPiKF=NULL; 
-
-
-                       }
-               }
-       } // end of checking if background calculation is available
-}
-
-
-void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
-       // see header file for documentation
-       
-       //      for(UInt_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammas.size();firstGammaIndex++){
-       //              for(UInt_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammas.size();secondGammaIndex++){
-
-       fESDEvent = fV0Reader->GetESDEvent();
-
-       if(fKFReconstructedGammasTClone->GetEntriesFast()>fV0Reader->GetNumberOfV0s()){
-               cout<<"Warning, number of entries in the tclone is bigger than number of v0s"<<endl;
-       }
-
-       for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
-               for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();secondGammaIndex++){
-                       
-                       //                      AliKFParticle * twoGammaDecayCandidateDaughter0 = &fKFReconstructedGammas[firstGammaIndex];
-                       //                      AliKFParticle * twoGammaDecayCandidateDaughter1 = &fKFReconstructedGammas[secondGammaIndex];
-                       
-                       AliKFConversionPhoton * twoGammaDecayCandidateDaughter0 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
-                       AliKFConversionPhoton * twoGammaDecayCandidateDaughter1 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(secondGammaIndex);
-
-                           if(twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
-                          twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative()||
-                          twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
-                          twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative())continue;
-                       
-                       AliKFConversionMother *twoGammaCandidate = new AliKFConversionMother(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1);
-                       twoGammaCandidate->SetGammaLabels(firstGammaIndex,secondGammaIndex);
-
-                       Double_t massTwoGammaCandidate = 0.;
-                       Double_t widthTwoGammaCandidate = 0.;
-                       Double_t chi2TwoGammaCandidate =10000.; 
-                       twoGammaCandidate->GetMass(massTwoGammaCandidate,widthTwoGammaCandidate);
-                       //                      if(twoGammaCandidate->GetNDF()>0){
-                       //      chi2TwoGammaCandidate = twoGammaCandidate->GetChi2()/twoGammaCandidate->GetNDF();
-                       chi2TwoGammaCandidate = twoGammaCandidate->GetChi2();
-                               
-                       fHistograms->FillHistogram("ESD_Mother_Chi2",chi2TwoGammaCandidate);
-                       if((chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
-                                       
-                               TVector3 momentumVectorTwoGammaCandidate(twoGammaCandidate->GetPx(),twoGammaCandidate->GetPy(),twoGammaCandidate->GetPz());
-                               TVector3 spaceVectorTwoGammaCandidate(twoGammaCandidate->GetX(),twoGammaCandidate->GetY(),twoGammaCandidate->GetZ());
-                                                               
-                                  Double_t openingAngleTwoGammaCandidate = twoGammaCandidate->GetOpeningAngle();
-
-                               Double_t rapidity=twoGammaCandidate->GetRapidity();
-                             
-                               if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut()){
-                                       delete twoGammaCandidate;
-                                       continue;        // rapidity cut
-                               }
-
-                                Double_t alfa=twoGammaCandidate->GetAlpha();
-
-                                                               
-                               if(openingAngleTwoGammaCandidate < fMinOpeningAngleGhostCut){
-                                       delete twoGammaCandidate;
-                                       continue;        // minimum opening angle to avoid using ghosttracks
-                               }
-                       
-                               if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
-                                       fHistograms->FillHistogram("ESD_Mother_GammaDaughter_OpeningAngle", openingAngleTwoGammaCandidate);
-                                       fHistograms->FillHistogram("ESD_Mother_Energy", twoGammaCandidate->GetE());
-                                       fHistograms->FillHistogram("ESD_Mother_Pt", momentumVectorTwoGammaCandidate.Pt());
-                                       fHistograms->FillHistogram("ESD_Mother_Eta", momentumVectorTwoGammaCandidate.Eta());
-                                       fHistograms->FillHistogram("ESD_Mother_Rapid", rapidity);                                       
-                                       fHistograms->FillHistogram("ESD_Mother_Phi", spaceVectorTwoGammaCandidate.Phi());
-                                       fHistograms->FillHistogram("ESD_Mother_Mass", massTwoGammaCandidate);
-                                       fHistograms->FillHistogram("ESD_Mother_alfa", alfa);
-                                       if( (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) ){
-                                               fHistograms->FillHistogram("ESD_Mother_alfa_Pi0", alfa);
-                                               fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Pi0", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                       }
-                                       if( (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) ){
-                                               fHistograms->FillHistogram("ESD_Mother_alfa_Eta", alfa);
-                                               fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Eta", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                       }
-
-                                       fHistograms->FillHistogram("ESD_Mother_R", spaceVectorTwoGammaCandidate.Pt());          // Pt in Space == R!!!
-                                       fHistograms->FillHistogram("ESD_Mother_ZR", twoGammaCandidate->GetZ(), spaceVectorTwoGammaCandidate.Pt());
-                                       fHistograms->FillHistogram("ESD_Mother_XY", twoGammaCandidate->GetX(), twoGammaCandidate->GetY());
-                                       fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                       fHistograms->FillHistogram("ESD_Mother_InvMass",massTwoGammaCandidate);                 
-                                       fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                               }
-                               if(alfa<0.1){
-                                       fHistograms->FillHistogram("ESD_Mother_InvMass_vs_E_alpha",massTwoGammaCandidate ,twoGammaCandidate->GetE());
-                               }
-
-                               if(fCalculateBackground){
-                                       /* Kenneth, just for testing*/
-                                       AliGammaConversionBGHandler * bgHandlerTest = fV0Reader->GetBGHandler();
-                                               
-                                       Int_t zbin= bgHandlerTest->GetZBinIndex(fV0Reader->GetVertexZ());
-                                       Int_t mbin=0;
-                                       //Int_t multKAA=0;
-                                       if(fUseTrackMultiplicityForBG == kTRUE){
-                                           //multKAA=fV0Reader->CountESDTracks();
-                                               mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
-                                       }
-                                       else{// means we use #v0s for multiplicity
-                                           //multKAA=fV0Reader->GetNGoodV0s();
-                                               mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
-                                       }
-                                       //                      cout<<"Filling bin number "<<zbin<<" and "<<mbin<<endl;
-                                       //                      cout<<"Corresponding to z = "<<fV0Reader->GetVertexZ()<<" and m = "<<multKAA<<endl;
-                                       if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
-                                               fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass",zbin,mbin),massTwoGammaCandidate);
-                                               fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass_vs_Pt",zbin,mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                               /* end Kenneth, just for testing*/
-                                               fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                       }
-                               }
-                               /*              if(fCalculateBackground){
-                                               AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
-                                               Int_t mbin= bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
-                                               fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                               }*/
-                               //              if(fDoNeutralMesonV0MCCheck){
-                               if(fDoMCTruth){
-                                       //Kenneth: Checking the eta of the gamma to check the difference between 0.9 and 1.2
-                                       Int_t indexKF1 = twoGammaDecayCandidateDaughter0->GetV0Index();
-                                       if(indexKF1<fV0Reader->GetNumberOfV0s()){
-                                               fV0Reader->GetV0(indexKF1);//updates to the correct v0
-                                               Double_t eta1 = fV0Reader->GetMotherCandidateEta();
-                                               Bool_t isRealPi0=kFALSE;
-                                               Bool_t isRealEta=kFALSE;
-                                               Int_t gamma1MotherLabel=-1;
-                                               if(fV0Reader->HasSameMCMother() == kTRUE){
-                                                       //cout<<"This v0 is a real v0!!!!"<<endl;
-                                                       TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-                                                       TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-                                                       if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
-                                                               if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
-                                                                       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
-                                                                               gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
-                                                                       }
-                                                               }
-                                                               if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
-                                                                       gamma1MotherLabel=-111;
-                                                               }
-                                                               if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
-                                                                       gamma1MotherLabel=-221;
-                                                               }
-                                                       }
-                                               }
-                                                Int_t indexKF2 = twoGammaDecayCandidateDaughter1->GetV0Index();
-                                               if(indexKF1 == indexKF2){
-                                                       cout<<"index of the two KF particles are the same.... should not happen"<<endl;
-                                               }
-                                               if(indexKF2<fV0Reader->GetNumberOfV0s()){
-                                                       fV0Reader->GetV0(indexKF2);
-                                                       Double_t eta2 = fV0Reader->GetMotherCandidateEta();
-                                                       Int_t gamma2MotherLabel=-1;
-                                                       if(fV0Reader->HasSameMCMother() == kTRUE){
-                                                       TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-                                                       TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-                                                       if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
-                                                               if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
-                                                                       if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
-                                                                               gamma2MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
-                                                                       }
-                                                               }
-                                                               if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
-                                                                       gamma2MotherLabel=-111;
-                                                               }
-                                                               if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
-                                                                       gamma2MotherLabel=-221;
-                                                               }
-                                                                       
-                                                               }
-                                                       }
-                                                       if(gamma1MotherLabel>=0 && gamma1MotherLabel==gamma2MotherLabel){
-                                                               if(fV0Reader->CheckIfPi0IsMother(gamma1MotherLabel)){
-                                                                       isRealPi0=kTRUE;
-                                                               }
-                                                               if(fV0Reader->CheckIfEtaIsMother(gamma1MotherLabel)){
-                                                                       isRealEta=kTRUE;
-                                                               }
-                                                       }
-
-                                                       //cout << "alpha   " << alfa << endl;
-                                                       if(isRealPi0)fHistograms->FillHistogram("ESD_TruePi0_alpha",alfa);
-                                                       if(isRealEta)fHistograms->FillHistogram("ESD_TrueEta_alpha",alfa);
-
-                                                        
-                                                       if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
-                                                               if(TMath::Abs(eta1)>0.9 && TMath::Abs(eta2)>0.9){
-                                                       //                      fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
-                                                       //                      fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                   
-                                                                   
-                                                                       if(isRealPi0 || isRealEta){
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_1212",massTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_1212",openingAngleTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                                                                fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                                                                if(isRealPi0) fHistograms->FillHistogram("ESD_TruePi0_ESDPt_MCPt",momentumVectorTwoGammaCandidate.Pt(), fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt());
-                                                                                
-                                                                               if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                                                               if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
-                                                                                       fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-
-                                                                       }
-
-                                                                       if(!isRealPi0 && !isRealEta){
-                                                                               if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
-                                                                                       fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               } else {
-                                                                                       fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }
-                                                                               if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }
-                                                                       }
-                                                               } else if(TMath::Abs(eta1)>0.9 || TMath::Abs(eta2)>0.9){
-                                                                       //                      fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
-                                                                       //                      fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                       
-                                                                       if(isRealPi0 || isRealEta){
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_0912",massTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0912",openingAngleTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                                                               if(isRealPi0) fHistograms->FillHistogram("ESD_TruePi0_ESDPt_MCPt",momentumVectorTwoGammaCandidate.Pt(), fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt());
-
-                                                                               if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                                                               if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
-                                                                                       fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                                                       }
-                                                                       if(!isRealPi0 && !isRealEta){
-                                                                               if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
-                                                                                       fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }else{
-                                                                                       fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }
-                                                                               if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }
-                                                                       }
-                                                               } else {
-                                                                       //                      fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
-                                                                       //                      fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                       if(isRealPi0 || isRealEta){
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_0909",massTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0909",openingAngleTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_MCPt",massTwoGammaCandidate , fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt());
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
-                                                                               fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                                                               if(isRealPi0) fHistograms->FillHistogram("ESD_TruePi0_ESDPt_MCPt",momentumVectorTwoGammaCandidate.Pt(), fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt());
-                                                                               if(isRealPi0 && fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt()!=0 ) fHistograms->FillHistogram("ESD_TruePi0_PtRes_MCPt",fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt(),
-                                                                                                                                                                                                                                                (momentumVectorTwoGammaCandidate.Pt()-fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt())/fV0Reader->GetMCStack()->Particle(TMath::Abs(gamma1MotherLabel))->Pt());
-                                                                                
-                                                                                if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                                                               if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
-                                                                                       fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
-                                                                               if(gamma1MotherLabel > fV0Reader->GetMCStack()->GetNprimary()){
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0Sec_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                                       TParticle * secPi0MC = (TParticle*)fStack->Particle(fV0Reader->GetMotherMCParticle()->GetFirstMother());
-                                                                                       if (secPi0MC->GetMother(0) >-1){
-                                                                                               if(fStack->Particle(secPi0MC->GetMother(0))->GetPdgCode()==kK0Short){
-                                                                                                       fHistograms->FillHistogram("ESD_TruePi0SecFromK0S_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                                                       if(massTwoGammaCandidate>0.09 && massTwoGammaCandidate<0.145){
-                                                                                                               fHistograms->FillHistogram("ESD_K0SFromSecPi0_Pt",fStack->Particle(secPi0MC->GetMother(0))->Pt());
-                                                                                                       }
-                                                                                               }
-                                                                                       }
-                                                                               }
-                                                                       }
-                                                                       if(!isRealPi0 && !isRealEta){
-                                                                               if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
-                                                                                       fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }else{
-                                                                                       fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }
-                                                                               if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221 ){
-                                                                                       fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                                                               }
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                               if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
-                                       if ( TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())<0.9 &&       TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())<0.9 ){
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_Fiducial",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_Fiducial",massTwoGammaCandidate);
-                                       }
-                                               
-                                       if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                       }
-                                       else if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 || TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                       }
-                                       else{
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
-                                               fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
-                                       }
-
-                                       Double_t lowMassPi0=0.1;
-                                       Double_t highMassPi0=0.15;
-                                       if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
-                                               new((*fKFReconstructedPi0sTClone)[fKFReconstructedPi0sTClone->GetEntriesFast()])        AliKFConversionMother(*twoGammaCandidate);
-                                             }                         
-                                               
-                                       if( fKFCreateAOD ) {
-                                               lowMassPi0=0.08;
-                                               highMassPi0=0.2;
-                                               Double_t lowMassEta=0.4;
-                                               Double_t highMassEta=0.7;
-
-                                               if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
-
-                                                   TagDaughter(twoGammaCandidate->GetGammaLabel(0));
-                                                   TagDaughter(twoGammaCandidate->GetGammaLabel(1));
-                                               //  AddPionToAOD(twoGammaCandidate);
-                                               } else  if ( ( massTwoGammaCandidate > lowMassEta) && (massTwoGammaCandidate < highMassEta) ){
-                                                   TagDaughter(twoGammaCandidate->GetGammaLabel(0));
-                                                   TagDaughter(twoGammaCandidate->GetGammaLabel(1));
-                                                   // AddPionToAOD(twoGammaCandidate);
-                                               }
-                                       } // if create aod
-
-                               }
-                       }
-                       delete twoGammaCandidate;
-               }
-       }
-}
-
-///__________________________________________________________________________________
-void AliAnalysisTaskGammaConversion::AddGammaToAOD(AliKFConversionPhoton * kfParticle) {
-
-    //Fill AOD with particles
-    TClonesArray *branch=fAODGamma;
-    if(branch){
-               new((*branch)[branch->GetEntriesFast()])  AliAODConversionPhoton(kfParticle);
-               static_cast<AliAODConversionPhoton*>(branch->Last())->SetMass(kfParticle->M());
-    }
-    else {
-               return;
-    }
-}
-
-/*///__________________________________________________________________________________
-void AliAnalysisTaskGammaConversion::AddPionToAOD(AliKFConversionMother * kfParticle) {
-
-    //Add pions to AOD
-    TClonesArray *branch=fAODPi0;
-
-    if(branch){
-       new((*branch)[branch->GetEntriesFast()])  AliAODConversionMother(kfParticle);
-    }
-
-    TagDaughter(kfParticle->GetGammaLabel(0));
-    TagDaughter(kfParticle->GetGammaLabel(1));
-}
-
-///__________________________________________________________________________________
-void AliAnalysisTaskGammaConversion::AddOmegaToAOD(AliKFParticle * kfParticle, Int_t daughter1, Int_t daughter2) {
-
-    //Add omegas to AOD
-
-    TClonesArray *branch=fAODOmega;
-    // Get Daughters
-   // AliAODConversionPhoton * fdaughter1 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter1));
-   // AliAODConversionPhoton * fdaughter2 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter2));
-
-    if(branch){
-     //   new((*branch)[branch->GetEntriesFast()])  AliAODConversionMother(kfParticle);
-               }
-
-       TagDaughter(daughter1);
-       TagDaughter(daughter2);
-
-
-}
-*/
-///__________________________________________________________________________________
-void AliAnalysisTaskGammaConversion::TagDaughter(Int_t gammaIndex) {
-       //Set conversion tag on pion daughters
-       AliAODConversionPhoton * daughter = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(gammaIndex));
-       if(daughter) {
-               daughter->SetTag(kTRUE);
-       } else {
-               AliError("Daughter not in gamma tree!!");
-       }
-}
-
-///___________________________________________________________________________________
-void AliAnalysisTaskGammaConversion::FillAODWithConversionGammas(){
-       // Fill AOD with reconstructed Gamma
-       for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
-               AliKFConversionPhoton * gammakf = dynamic_cast<AliKFConversionPhoton*>(fKFReconstructedGammasTClone->At(gammaIndex));
-               if(gammakf) {
-                      AddGammaToAOD(gammakf);
-               }
-       }
-}
-
-/*
-       void AliAnalysisTaskGammaConversion::ProcessConvPHOSGammasForNeutralMesonAnalysis(){
-
-       // see header file for documentation
-       // Analyse Pi0 with one photon from Phos and 1 photon from conversions
-       
-
-
-       Double_t vtx[3];
-       vtx[0] = fV0Reader->GetPrimaryVertex()->GetX();
-       vtx[1] = fV0Reader->GetPrimaryVertex()->GetY();
-       vtx[2] = fV0Reader->GetPrimaryVertex()->GetZ();
-
-
-       // Loop over all CaloClusters and consider only the PHOS ones:
-       AliESDCaloCluster *clu;
-       TLorentzVector pPHOS;
-       TLorentzVector gammaPHOS;
-       TLorentzVector gammaGammaConv;
-       TLorentzVector pi0GammaConvPHOS;
-       TLorentzVector gammaGammaConvBck;
-       TLorentzVector pi0GammaConvPHOSBck;
-
-
-       for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
-       clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
-       if ( !clu->IsPHOS() || clu->E()<0.1 ) continue;
-       clu ->GetMomentum(pPHOS ,vtx);
-       for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
-       AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
-       gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz(),0.);
-       gammaPHOS.SetXYZM(pPHOS.Px(),pPHOS.Py(),pPHOS.Pz(),0.);
-       pi0GammaConvPHOS=gammaGammaConv+gammaPHOS;
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS",pi0GammaConvPHOS.M());
-       fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvPHOS",pi0GammaConvPHOS.M(),pi0GammaConvPHOS.Pt());
-
-       TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz());
-       TVector3 v3D1(gammaPHOS.Px(),gammaPHOS.Py(),gammaPHOS.Pz());
-       Double_t opanConvPHOS= v3D0.Angle(v3D1);
-       if ( opanConvPHOS < 0.35){
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanLow",pi0GammaConvPHOS.M());
-       }else{
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanHigh",pi0GammaConvPHOS.M());
-       }
-
-       }
-
-       //      Now the LorentVector pPHOS is obtained and can be paired with the converted proton
-       }
-       //==== End of the PHOS cluster selection ============
-       TLorentzVector pEMCAL;
-       TLorentzVector gammaEMCAL;
-       TLorentzVector pi0GammaConvEMCAL;
-       TLorentzVector pi0GammaConvEMCALBck;
-
-       for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
-       clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
-       if ( !clu->IsEMCAL()    || clu->E()<0.1 ) continue;
-       if (clu->GetNCells() <= 1) continue;
-       if ( clu->GetTOF()*1e9 < 550    || clu->GetTOF()*1e9 > 750) continue;
-
-       clu ->GetMomentum(pEMCAL ,vtx);
-       for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
-       AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
-       gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),
-       twoGammaDecayCandidateDaughter0->Py(),
-       twoGammaDecayCandidateDaughter0->Pz(),0.);
-       gammaEMCAL.SetXYZM(pEMCAL.Px(),pEMCAL.Py(),pEMCAL.Pz(),0.);
-       pi0GammaConvEMCAL=gammaGammaConv+gammaEMCAL;
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL",pi0GammaConvEMCAL.M());
-       fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL",pi0GammaConvEMCAL.M(),pi0GammaConvEMCAL.Pt());
-       TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),
-       twoGammaDecayCandidateDaughter0->Py(),
-       twoGammaDecayCandidateDaughter0->Pz());
-       TVector3 v3D1(gammaEMCAL.Px(),gammaEMCAL.Py(),gammaEMCAL.Pz());
-
-
-       Double_t opanConvEMCAL= v3D0.Angle(v3D1);
-       if ( opanConvEMCAL < 0.35){
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanLow",pi0GammaConvEMCAL.M());
-       }else{
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanHigh",pi0GammaConvEMCAL.M());
-       }
-
-       }
-       if(fCalculateBackground){
-       for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
-       AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG);
-       for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
-       AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
-       gammaGammaConvBck.SetXYZM(previousGoodV0.Px(),
-       previousGoodV0.Py(),
-       previousGoodV0.Pz(),0.);
-       pi0GammaConvEMCALBck=gammaGammaConvBck+gammaEMCAL;
-       fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M());
-       fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M(),
-       pi0GammaConvEMCALBck.Pt());
-       }
-       }
-                       
-       //      Now the LorentVector pEMCAL is obtained and can be paired with the converted proton
-       } // end of checking if background photons are available
-       }
-       //==== End of the PHOS cluster selection ============
-
-       }
-*/
-
-void AliAnalysisTaskGammaConversion::MoveParticleAccordingToVertex(AliKFParticle * particle,const AliGammaConversionBGHandler::GammaConversionVertex *vertex){
-       //see header file for documentation
-
-       Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
-       Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
-       Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
-       
-       //      cout<<"dx, dy, dz: ["<<dx<<","<<dy<<","<<dz<<"]"<<endl;
-       particle->X() = particle->GetX() - dx;
-       particle->Y() = particle->GetY() - dy;
-       particle->Z() = particle->GetZ() - dz;
-}
-
-void AliAnalysisTaskGammaConversion::RotateKFParticle(AliKFParticle * kfParticle,Double_t angle){
-       // Before rotate needs to be moved to position 0,0,0, ; move back after rotation
-       Double_t dx = fESDEvent->GetPrimaryVertex()->GetX()-0.;
-       Double_t dy = fESDEvent->GetPrimaryVertex()->GetY()-0.;
-       Double_t dz = fESDEvent->GetPrimaryVertex()->GetZ()-0.;
-       
-       kfParticle->X() = kfParticle->GetX() - dx;
-       kfParticle->Y() = kfParticle->GetY() - dy;
-       kfParticle->Z() = kfParticle->GetZ() - dz;
-
-
-       // Rotate the kf particle
-       Double_t c = cos(angle);
-       Double_t s = sin(angle);
-       
-       Double_t mA[8][ 8];
-       for( Int_t i=0; i<8; i++ ){
-               for( Int_t j=0; j<8; j++){
-                       mA[i][j] = 0;
-               }
-       }
-       for( int i=0; i<8; i++ ){
-               mA[i][i] = 1;
-       }
-       mA[0][0] =      c;      mA[0][1] = s;
-       mA[1][0] = -s;  mA[1][1] = c;
-       mA[3][3] =      c;      mA[3][4] = s;
-       mA[4][3] = -s;  mA[4][4] = c;
-       
-       Double_t mAC[8][8];
-       Double_t mAp[8];
-       for( Int_t i=0; i<8; i++ ){
-               mAp[i] = 0;
-               for( Int_t k=0; k<8; k++){
-                       mAp[i]+=mA[i][k] * kfParticle->GetParameter(k);
-               }
-       }
-       
-       for( Int_t i=0; i<8; i++){
-               kfParticle->Parameter(i) = mAp[i];
-       }
-
-       for( Int_t i=0; i<8; i++ ){
-               for( Int_t j=0; j<8; j++ ){
-                       mAC[i][j] = 0;
-                       for( Int_t k=0; k<8; k++ ){
-       mAC[i][j]+= mA[i][k] * kfParticle->GetCovariance(k,j);
-                       }
-               }
-       }
-
-       for( Int_t i=0; i<8; i++ ){
-               for( Int_t j=0; j<=i; j++ ){
-                       Double_t xx = 0;
-                       for( Int_t k=0; k<8; k++){
-       xx+= mAC[i][k]*mA[j][k];
-                       }
-                       kfParticle->Covariance(i,j) = xx;
-               }
-       }
-
-       Double_t dx1 = 0.-fESDEvent->GetPrimaryVertex()->GetX();
-       Double_t dy1 = 0.-fESDEvent->GetPrimaryVertex()->GetY();
-       Double_t dz1 = 0.-fESDEvent->GetPrimaryVertex()->GetZ();
-       
-       kfParticle->X() = kfParticle->GetX() - dx1;
-       kfParticle->Y() = kfParticle->GetY() - dy1;
-       kfParticle->Z() = kfParticle->GetZ() - dz1;
-
-}
-
-
-void AliAnalysisTaskGammaConversion::CalculateBackground(){
-       // see header file for documentation
-
-
-       TClonesArray * currentEventV0s = fV0Reader->GetCurrentEventGoodV0s();
-
-       AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
-       
-       Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
-       Int_t mbin = 0;
-       if(fUseTrackMultiplicityForBG == kTRUE){
-               mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
-       }
-       else{
-               mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
-       }
-
-       if(fDoRotation == kTRUE){
-
-               for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
-                       AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); 
-                       for(Int_t iCurrent2=iCurrent+1;iCurrent2<currentEventV0s->GetEntriesFast();iCurrent2++){
-       for(Int_t nRandom=0;nRandom<fNRandomEventsForBG;nRandom++){
-       
-               AliKFParticle currentEventGoodV02 = *(AliKFParticle *)(currentEventV0s->At(iCurrent2));
-
-               if(fCheckBGProbability == kTRUE){
-                       Double_t massBGprob =0.;
-                       Double_t widthBGprob = 0.;
-                       AliKFParticle *backgroundCandidateProb = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
-                       backgroundCandidateProb->GetMass(massBGprob,widthBGprob);
-                       if(massBGprob>0.1 && massBGprob<0.14){
-                               if(fRandom.Rndm()>bgHandler->GetBGProb(zbin,mbin)){
-               delete backgroundCandidateProb;
-               continue;
-                               }
-                       }
-                       delete backgroundCandidateProb;
-               }
-       
-               Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
-
-               Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
-               
-               RotateKFParticle(&currentEventGoodV02,rotationValue);
-
-               AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
-
-               Double_t massBG =0.;
-               Double_t widthBG = 0.;
-               Double_t chi2BG =10000.;        
-               backgroundCandidate->GetMass(massBG,widthBG);
-               //              if(backgroundCandidate->GetNDF()>0){
-               chi2BG = backgroundCandidate->GetChi2();
-               if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson())    || fApplyChi2Cut == kFALSE){
-               
-                       TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
-                       TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
-               
-                       Double_t openingAngleBG = currentEventGoodV0.GetAngle(currentEventGoodV02);
-               
-                       Double_t rapidity;
-                       if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) {
-                               rapidity=8.;
-                       } else{
-                               rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
-                       }
-                       if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
-                               delete backgroundCandidate;      
-                               continue;        // rapidity cut
-                       }                       
-                                       
-               
-                       Double_t alfa=0.0;
-                       if( (currentEventGoodV0.GetE()+currentEventGoodV02.GetE()) != 0){
-                               alfa=TMath::Abs((currentEventGoodV0.GetE()-currentEventGoodV02.GetE())
-                                               /(currentEventGoodV0.GetE()+currentEventGoodV02.GetE()));
-                       }
-               
-               
-                       if(openingAngleBG < fMinOpeningAngleGhostCut ){
-                               delete backgroundCandidate;      
-                               continue;        // minimum opening angle to avoid using ghosttracks
-                       }                       
-               
-                       // original
-                       if(alfa>fV0Reader->GetAlphaMinCutMeson() &&      alfa<fV0Reader->GetAlphaCutMeson()){
-                               fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
-                               fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
-                               fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
-                               fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
-                               fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
-                               fHistograms->FillHistogram("ESD_Background_Mass", massBG);
-                               fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt());    // Pt in Space == R!!!!
-                               fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
-                               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
-                               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
-
-                               if(massBG>0.1 && massBG<0.15){
-               fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
-               fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
-                               }
-                               if(massBG>0.5 && massBG<0.57){
-               fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
-               fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
-                               }
-
-                               if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&     TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
-               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
-                               }
-                               
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin),     momentumVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt());        // Pt in Space == R!!!!
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
-                               
-                               if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&     TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
-               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
-                               }
-                       }
-                       if(alfa<0.1){
-                               fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
-                       }
-
-               }
-               //}
-               delete backgroundCandidate;                     
-       }
-                       }
-               }
-       }
-       else{ // means no rotation
-               AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
-                       
-               if(fUseTrackMultiplicityForBG){
-                       //              cout<<"Using charged track multiplicity for background calculation"<<endl;
-                       for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
-
-       AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);//fV0Reader->GetBGGoodV0s(nEventsInBG);
-                       
-       if(fMoveParticleAccordingToVertex == kTRUE){
-               bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
-       }
-
-       for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
-               AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); 
-               for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
-                       AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
-                       AliKFParticle previousGoodV0test = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
-
-                       //cout<<"Primary Vertex event: ["<<fESDEvent->GetPrimaryVertex()->GetX()<<","<<fESDEvent->GetPrimaryVertex()->GetY()<<","<<fESDEvent->GetPrimaryVertex()->GetZ()<<"]"<<endl;
-                       //cout<<"BG prim Vertex event: ["<<bgEventVertex->fX<<","<<bgEventVertex->fY<<","<<bgEventVertex->fZ<<"]"<<endl;
-               
-                       //cout<<"XYZ of particle before transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
-                       if(fMoveParticleAccordingToVertex == kTRUE){
-                               MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
-                       }
-                       //cout<<"XYZ of particle after transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
-
-                       AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
-       
-                       Double_t massBG =0.;
-                       Double_t widthBG = 0.;
-                       Double_t chi2BG =10000.;        
-                       backgroundCandidate->GetMass(massBG,widthBG);
-
-                       //      if(backgroundCandidate->GetNDF()>0){
-                       //              chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
-                       chi2BG = backgroundCandidate->GetChi2();
-                       if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
-                                       
-                               TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
-                               TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
-                                       
-                               Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
-                                       
-                               Double_t rapidity;
-                       
-                               if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() <= 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() <= 0){
-               cout << "Error: |Pz| > E !!!! " << endl;
-               rapidity=8.;
-                               } else {
-               rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
-                               }                               
-                               if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
-               delete backgroundCandidate;      
-               continue;        // rapidity cut
-                               }                       
-                                                       
-       
-                               Double_t alfa=0.0;
-                               if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
-               alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
-                               /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
-                               }
-                       
-                                       
-                               if(openingAngleBG < fMinOpeningAngleGhostCut ){
-               delete backgroundCandidate;      
-               continue;        // minimum opening angle to avoid using ghosttracks
-                               }                       
-
-                               // original
-                               if(alfa>fV0Reader->GetAlphaMinCutMeson() &&      alfa<fV0Reader->GetAlphaCutMeson()){
-               fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
-               fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
-               fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
-               fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
-               fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
-               fHistograms->FillHistogram("ESD_Background_Mass", massBG);
-               fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt());    // Pt in Space == R!!!!
-               fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
-               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
-               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
-
-               if(massBG>0.1 && massBG<0.15){
-                       fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
-                       fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
-               }
-               if(massBG>0.5 && massBG<0.57){
-                       fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
-                       fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
-               }
-
-               if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&     TMath::Abs(previousGoodV0.GetEta())<0.9 ){
-                       fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
-               }
-
-               // test
-               fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
-               fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin),     momentumVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
-               fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
-               fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt());        // Pt in Space == R!!!!
-               fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
-               
-               if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&     TMath::Abs(previousGoodV0.GetEta())<0.9 ){
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
-               }
-               //              }
-                               }
-                               if(alfa<0.1){
-               fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
-                               }
-
-                       }
-                       delete backgroundCandidate;                     
-               }
-       }
-                       }
-               }
-               else{ // means using #V0s for multiplicity
-
-                       //              cout<<"Using the v0 multiplicity to calculate background"<<endl;
-               
-                       fHistograms->FillHistogram("ESD_Background_z_m",zbin,mbin);
-                       fHistograms->FillHistogram("ESD_Mother_multpilicityVSv0s",fV0Reader->CountESDTracks(),fV0Reader->GetNumberOfV0s());
-
-                       for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
-       AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);// fV0Reader->GetBGGoodV0s(nEventsInBG);
-       if(previousEventV0s){
-       
-               if(fMoveParticleAccordingToVertex == kTRUE){
-                       bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
-               }
-
-               for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
-                       AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); 
-                       for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
-                               AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
-
-                               if(fMoveParticleAccordingToVertex == kTRUE){
-               MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
-                               }
-
-                               AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
-                               Double_t massBG =0.;
-                               Double_t widthBG = 0.;
-                               Double_t chi2BG =10000.;        
-                               backgroundCandidate->GetMass(massBG,widthBG);
-
-                               /*                      if(backgroundCandidate->GetNDF()>0){
-                                       chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
-                                       {//remember to remove
-                                       TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
-                                       TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
-                               
-                                       Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
-                                       fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle_nochi2", openingAngleBG);
-                                       }
-                               */
-                               chi2BG = backgroundCandidate->GetChi2();
-                               if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
-               TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
-               TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
-                                       
-               Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
-                                       
-               Double_t rapidity;
-               if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0){
-                       rapidity=8.;
-               }else{
-                       rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
-               }               
-               if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
-                       delete backgroundCandidate;      
-                       continue;        // rapidity cut
-               }                       
-                                                               
-
-               Double_t alfa=0.0;
-               if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
-                       alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
-                                       /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
-               }
-                       
-                                       
-               if(openingAngleBG < fMinOpeningAngleGhostCut ){
-                       delete backgroundCandidate;      
-                       continue;        // minimum opening angle to avoid using ghosttracks
-               }                       
-
-               if(alfa>fV0Reader->GetAlphaMinCutMeson() &&      alfa<fV0Reader->GetAlphaCutMeson()){
-                       fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
-                       fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
-                       fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
-                       fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
-                       fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
-                       fHistograms->FillHistogram("ESD_Background_Mass", massBG);
-                       fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt());    // Pt in Space == R!!!!
-                       fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
-                       fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
-                       
-
-                       fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
-
-                       if(massBG>0.1 && massBG<0.15){
-                               fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
-                               fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
-                       }
-                       if(massBG>0.5 && massBG<0.57){
-                               fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
-                               fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
-                       }
-
-                       if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&     TMath::Abs(previousGoodV0.GetEta())<0.9 ){
-                               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
-                       }
-                       
-                       if(massBG>0.5 && massBG<0.6){
-                               fHistograms->FillHistogram("ESD_Background_alfa_pt0506",momentumVectorbackgroundCandidate.Pt(),alfa);
-                       }
-                       if(massBG>0.3 && massBG<0.4){
-                               fHistograms->FillHistogram("ESD_Background_alfa_pt0304",momentumVectorbackgroundCandidate.Pt(),alfa);
-                       }
-                       
-                       // test
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin),     momentumVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt());        // Pt in Space == R!!!!
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-                       fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
-                       
-                       if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&     TMath::Abs(previousGoodV0.GetEta())<0.9 ){
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-                               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
-                       }
-               }
-
-               if(alfa<0.1){
-                       fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
-               }
-               //      }
-                               }
-                               delete backgroundCandidate;                     
-                       }
-               }
-       }
-                       }
-               } // end else (means use #v0s as multiplicity)
-       } // end no rotation
-}
-
-
-void AliAnalysisTaskGammaConversion::ProcessGammasForGammaJetAnalysis(){
-       //ProcessGammasForGammaJetAnalysis
-       
-       Double_t distIsoMin;
-       
-       CreateListOfChargedParticles();
-       
-       
-       //      for(UInt_t gammaIndex=0;gammaIndex<fKFReconstructedGammas.size();gammaIndex++){
-       for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
-               AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
-               TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
-               if( momentumVectorCurrentGamma.Pt()> fMinPtForGammaJet){
-                       distIsoMin=GetMinimumDistanceToCharge(gammaIndex);
-                       if (distIsoMin > fMinIsoConeSize && fLeadingChargedIndex>=0){
-                               CalculateJetCone(gammaIndex);
-                       }
-               }
-       }
-}
-
-//____________________________________________________________________
-Bool_t AliAnalysisTaskGammaConversion::IsGoodImpPar(const AliESDtrack *const track)
-{
-       //
-       // check whether particle has good DCAr(Pt) impact
-       // parameter. Only for TPC+ITS tracks (7*sigma cut)
-       // Origin: Andrea Dainese
-       //
-
-       Float_t d0z0[2],covd0z0[3];
-       track->GetImpactParameters(d0z0,covd0z0);
-       Float_t sigma= 0.0050+0.0060/TMath::Power(track->Pt(),0.9);
-       Float_t d0max = 7.*sigma;
-       if(TMath::Abs(d0z0[0]) < d0max) return kTRUE;
-
-       return kFALSE;
-}
-
-
-void AliAnalysisTaskGammaConversion::CreateListOfChargedParticles(){
-       // CreateListOfChargedParticles
-       
-       fESDEvent = fV0Reader->GetESDEvent();
-       Int_t numberOfESDTracks=0;
-       for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
-               AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
-               
-               if(!curTrack){
-                       continue;
-               }
-               // Not needed if Standard function used.
-               //               if(!IsGoodImpPar(curTrack)){
-               //                       continue;
-               //               }
-               
-               if(fEsdTrackCuts->AcceptTrack(curTrack) ){
-                       new((*fChargedParticles)[fChargedParticles->GetEntriesFast()])  AliESDtrack(*curTrack);
-                       //                      fChargedParticles.push_back(curTrack);
-                       fChargedParticlesId.push_back(iTracks);
-                       numberOfESDTracks++;
-               }
-       }
-       // Moved to UserExec using CountAcceptedTracks function. runjet is not needed by default
-       //       fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",numberOfESDTracks);
-       //       cout<<"esdtracks::"<< numberOfESDTracks<<endl;
-       //       if (fV0Reader->GetNumberOfContributorsVtx()>=1){
-       //               fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",numberOfESDTracks);
-       //       } 
-}
-
-void AliAnalysisTaskGammaConversion::CalculateJetCone(Int_t gammaIndex){
-       // CaculateJetCone
-       
-       Double_t cone;
-       Double_t coneSize=0.3;
-       Double_t ptJet=0;
-       
-       //      AliKFParticle * currentGamma = &fKFReconstructedGammas[gammaIndex];
-       AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
-
-       TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
-       
-       AliESDtrack* leadingCharged = (AliESDtrack*)(fChargedParticles->At(fLeadingChargedIndex));
-
-       Double_t momLeadingCharged[3];
-       leadingCharged->GetConstrainedPxPyPz(momLeadingCharged);
-       
-       TVector3 momentumVectorLeadingCharged(momLeadingCharged[0],momLeadingCharged[1],momLeadingCharged[2]);
-       
-       Double_t phi1=momentumVectorLeadingCharged.Phi();
-       Double_t eta1=momentumVectorLeadingCharged.Eta();
-       Double_t phi3=momentumVectorCurrentGamma.Phi();
-       
-       for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-               AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-               Int_t chId = fChargedParticlesId[iCh];
-               if(fLeadingChargedIndex==chId || fLeadingChargedIndex==chId) continue;
-               Double_t mom[3];
-               curTrack->GetConstrainedPxPyPz(mom);
-               TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
-               Double_t phi2=momentumVectorChargedParticle.Phi();
-               Double_t eta2=momentumVectorChargedParticle.Eta();
-               
-               
-               cone=100.;
-               if( TMath::Abs(phi2 - phi1) <= ( TMath::TwoPi()-coneSize) ){
-                       cone = TMath::Sqrt(     TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-phi1),2) );
-               }else{
-                       if( (phi2 - phi1)> TMath::TwoPi()-coneSize ){
-                               cone = TMath::Sqrt(     TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-TMath::TwoPi()-phi1),2) );
-                       }
-                       if( (phi2 - phi1)< -(TMath::TwoPi()-coneSize) ){
-                               cone = TMath::Sqrt(     TMath::Power((eta2-eta1),2)+ TMath::Power((phi2+TMath::TwoPi()-phi1),2) );
-                       }
-               }
-               
-               if(cone <coneSize&& momentumVectorChargedParticle.Pt()>fMinPtJetCone ){
-                       ptJet+= momentumVectorChargedParticle.Pt();
-                       Double_t ffzHdrGam = momentumVectorChargedParticle.Pt()/momentumVectorCurrentGamma.Pt();
-                       Double_t imbalanceHdrGam=-momentumVectorChargedParticle.Dot(momentumVectorCurrentGamma)/momentumVectorCurrentGamma.Mag2();
-                       fHistograms->FillHistogram("ESD_FFzHdrGam",ffzHdrGam);
-                       fHistograms->FillHistogram("ESD_ImbalanceHdrGam",imbalanceHdrGam);
-                       
-               }
-               
-               Double_t dphiHdrGam=phi3-phi2;
-               if ( dphiHdrGam < (-TMath::PiOver2())){
-                       dphiHdrGam+=(TMath::TwoPi());
-               }
-               
-               if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
-                       dphiHdrGam-=(TMath::TwoPi());
-               }
-               
-//             if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
-               fHistograms->FillHistogram("ESD_dphiHdrGamIsolated",dphiHdrGam,momentumVectorChargedParticle.Pt());
-//             }
-       }//track loop
-       
-       
-       }
-
-
-
-Double_t AliAnalysisTaskGammaConversion::GetMinimumDistanceToCharge(Int_t indexHighestPtGamma){
-       // GetMinimumDistanceToCharge
-       
-       Double_t fIsoMin=100.;
-       Double_t ptLeadingCharged=-1.;
-
-       fLeadingChargedIndex=-1;
-       
-       AliKFConversionPhoton * gammaHighestPt = (AliKFConversionPhoton*)fKFReconstructedGammasTClone->At(indexHighestPtGamma);
-       TVector3 momentumVectorgammaHighestPt(gammaHighestPt->GetPx(),gammaHighestPt->GetPy(),gammaHighestPt->GetPz());
-       
-       Double_t phi1=momentumVectorgammaHighestPt.Phi();
-       Double_t eta1=momentumVectorgammaHighestPt.Eta();
-       
-       for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
-               AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
-               Int_t chId = fChargedParticlesId[iCh];
-               if(gammaHighestPt->GetTrackLabelPositive()==chId || gammaHighestPt->GetTrackLabelNegative()==chId) continue;
-               Double_t mom[3];
-               curTrack->GetConstrainedPxPyPz(mom);
-               TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
-               Double_t phi2=momentumVectorChargedParticle.Phi();
-               Double_t eta2=momentumVectorChargedParticle.Eta();
-               Double_t iso=pow(       (pow( (eta1-eta2),2)+ pow((phi1-phi2),2)),0.5 );
-               
-               if(momentumVectorChargedParticle.Pt()>fMinPtIsoCone ){
-                       if (iso<fIsoMin){
-                               fIsoMin=iso;
-                       }
-               }
-               
-               Double_t dphiHdrGam=phi1-phi2;
-               if ( dphiHdrGam < (-TMath::PiOver2())){
-                       dphiHdrGam+=(TMath::TwoPi());
-               }
-               
-               if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
-                       dphiHdrGam-=(TMath::TwoPi());
-               }
-//             if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
-                       fHistograms->FillHistogram("ESD_dphiHdrGam",dphiHdrGam,momentumVectorChargedParticle.Pt());
-//             }
-               
-               if (dphiHdrGam>0.9*TMath::Pi() && dphiHdrGam<1.1*TMath::Pi()){
-                       if (momentumVectorChargedParticle.Pt()> ptLeadingCharged && momentumVectorChargedParticle.Pt()>0.1*momentumVectorgammaHighestPt.Pt()){
-                               ptLeadingCharged=momentumVectorChargedParticle.Pt();
-                               fLeadingChargedIndex=iCh;
-                       }
-               }
-               
-       }//track loop
-       fHistograms->FillHistogram("ESD_MinimumIsoDistance",fIsoMin);
-       return fIsoMin;
-       
-}
-
-Int_t  AliAnalysisTaskGammaConversion::GetIndexHighestPtGamma(){
-       //GetIndexHighestPtGamma
-       
-       Int_t indexHighestPtGamma=-1;
-       //Double_t 
-       fGammaPtHighest = -100.;
-       
-       for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
-               AliKFParticle * gammaHighestPtCandidate = (AliKFParticle*)fKFReconstructedGammasTClone->At(firstGammaIndex);
-               TVector3 momentumVectorgammaHighestPtCandidate(gammaHighestPtCandidate->GetPx(),gammaHighestPtCandidate->GetPy(),gammaHighestPtCandidate->GetPz());
-               if (momentumVectorgammaHighestPtCandidate.Pt() > fGammaPtHighest){
-                       fGammaPtHighest=momentumVectorgammaHighestPtCandidate.Pt();
-                       //gammaHighestPt = gammaHighestPtCandidate;
-                       indexHighestPtGamma=firstGammaIndex;
-               }
-       }
-       
-       return indexHighestPtGamma;
-       
-}
-
-
-void AliAnalysisTaskGammaConversion::Terminate(Option_t */*option*/)
-{
-       // Terminate analysis
-       //
-       AliDebug(1,"Do nothing in Terminate");
-}
-
-void AliAnalysisTaskGammaConversion::UserCreateOutputObjects()
-{
-       
-       if(fKFCreateAOD) {
-
-               //AOD
-               if(!fAODGamma) fAODGamma = new TClonesArray("AliAODConversionPhoton", 0);
-               else fAODGamma->Delete();
-               fAODGamma->SetOwner(kTRUE);
-               fAODGamma->SetName(Form("%s_gamma", fAODBranchName.Data()));
-               
-               if(GetDeltaAODFileName().Length() > 0) {
-                       AddAODBranch("TClonesArray", &fAODGamma, GetDeltaAODFileName().Data());
-                       AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(GetDeltaAODFileName().Data());
-               } else  {
-                       AddAODBranch("TClonesArray", &fAODGamma);
-               }
-       }
-
-       // Create the output container
-       if(fOutputContainer != NULL){
-               delete fOutputContainer;
-               fOutputContainer = NULL;
-       }
-       if(fOutputContainer == NULL){
-               fOutputContainer = new TList();
-               fOutputContainer->SetOwner(kTRUE);
-       }
-       
-       //Adding the histograms to the output container
-       fHistograms->GetOutputContainer(fOutputContainer);
-       
-       
-       if(fWriteNtuple){
-               if(fGammaNtuple == NULL){
-                       fGammaNtuple = new TNtuple("V0ntuple","V0ntuple","OnTheFly:HasVertex:NegPIDProb:PosPIDProb:X:Y:Z:R:MotherCandidateNDF:MotherCandidateChi2:MotherCandidateEnergy:MotherCandidateEta:MotherCandidatePt:MotherCandidateMass:MotherCandidateWidth:MCMotherCandidatePT:EPOpeningAngle:ElectronEnergy:ElectronPt:ElectronEta:ElectronPhi:PositronEnergy:PositronPt:PositronEta:PositronPhi:HasSameMCMother:MotherMCParticlePIDCode",50000);
-               }
-               if(fNeutralMesonNtuple == NULL){
-                       fNeutralMesonNtuple = new TNtuple("NeutralMesonNtuple","NeutralMesonNtuple","test");
-               }
-               TList * ntupleTList = new TList();
-               ntupleTList->SetOwner(kTRUE);
-               ntupleTList->SetName("Ntuple");
-               ntupleTList->Add((TNtuple*)fGammaNtuple);
-               fOutputContainer->Add(ntupleTList);
-       }
-       
-       fOutputContainer->SetName(GetName());
-
-       PostData(0, fAODGamma);
-       PostData(1, fOutputContainer);
-       PostData(2, fCFManager->GetParticleContainer());        // for CF
-       PostData(3, fAODGamma); 
-}
-
-Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(const TParticle* const daughter0, const TParticle* const daughter1) const{
-       //helper function
-       TVector3 v3D0(daughter0->Px(),daughter0->Py(),daughter0->Pz());
-       TVector3 v3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz());
-       return v3D0.Angle(v3D1);
-}
-
-void AliAnalysisTaskGammaConversion::CheckV0Efficiency(){
-       // see header file for documentation
-
-       vector<Int_t> indexOfGammaParticle;
-       
-       fStack = fV0Reader->GetMCStack();
-       
-       if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
-               return; // aborts if the primary vertex does not have contributors.
-       }
-       
-       for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
-               TParticle* particle = (TParticle *)fStack->Particle(iTracks);
-               if(particle->GetPdgCode()==22){          //Gamma
-                       if(particle->GetNDaughters() >= 2){
-                               TParticle* electron=NULL;
-                               TParticle* positron=NULL; 
-                               for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
-                                       TParticle *tmpDaughter = fStack->Particle(daughterIndex);
-                                       if(tmpDaughter->GetUniqueID() == 5){
-                                               if(tmpDaughter->GetPdgCode() == 11){
-                                                       electron = tmpDaughter;
-                                               }
-                                               else if(tmpDaughter->GetPdgCode() == -11){
-                                                       positron = tmpDaughter;
-                                               }
-                                       }
-                               }
-                               if(electron!=NULL && positron!=0){
-                                       if(electron->R()<160){
-                                               indexOfGammaParticle.push_back(iTracks);
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       Int_t nFoundGammas=0;
-       Int_t nNotFoundGammas=0;
-       
-       Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
-       for(Int_t i=0;i<numberOfV0s;i++){
-               fV0Reader->GetV0(i);
-               
-               if(fV0Reader->HasSameMCMother() == kFALSE){
-                       continue;
-               }
-               
-               TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
-               TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
-               
-               if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
-                       continue;
-               }
-               if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
-                       continue;
-               }
-               
-               if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
-                       //TParticle * v0Gamma = fV0Reader->GetMotherMCParticle();
-                       for(UInt_t mcIndex=0;mcIndex<indexOfGammaParticle.size();mcIndex++){
-                               if(negativeMC->GetFirstMother()==indexOfGammaParticle[mcIndex]){
-                                       nFoundGammas++;
-                               }
-                               else{
-                                       nNotFoundGammas++;
-                               }
-                       }
-               }
-       }
-}
-
-
-
-void AliAnalysisTaskGammaConversion::ProcessGammaElectronsForChicAnalysis(){
-       // see header file for documantation
-       
-       fESDEvent = fV0Reader->GetESDEvent();
-       
-       
-       TClonesArray * vESDeNegTemp = new TClonesArray("AliESDtrack",0);
-       TClonesArray * vESDePosTemp = new TClonesArray("AliESDtrack",0);
-       TClonesArray * vESDxNegTemp = new TClonesArray("AliESDtrack",0);
-       TClonesArray * vESDxPosTemp = new TClonesArray("AliESDtrack",0);
-       TClonesArray * vESDeNegNoJPsi = new TClonesArray("AliESDtrack",0);
-       TClonesArray * vESDePosNoJPsi = new TClonesArray("AliESDtrack",0);
-       
-       /*
-               vector <AliESDtrack*> vESDeNegTemp(0);
-               vector <AliESDtrack*> vESDePosTemp(0);
-               vector <AliESDtrack*> vESDxNegTemp(0);
-               vector <AliESDtrack*> vESDxPosTemp(0);
-               vector <AliESDtrack*> vESDeNegNoJPsi(0);
-               vector <AliESDtrack*> vESDePosNoJPsi(0); 
-       */
-       
-       
-       fHistograms->FillTable("Table_Electrons",0);//Count number of Events
-       
-       for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
-               AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
-               
-               if(!curTrack){
-                       //print warning here
-                       continue;
-               }
-               
-               double p[3];if(!curTrack->GetConstrainedPxPyPz(p))continue;
-               double r[3];curTrack->GetConstrainedXYZ(r);
-               
-               TVector3 rXYZ(r);
-               
-               fHistograms->FillTable("Table_Electrons",4);//Count number of ESD tracks
-               
-               Bool_t flagKink                  =      kTRUE;
-               Bool_t flagTPCrefit      =      kTRUE;
-               Bool_t flagTRDrefit      =      kTRUE;
-               Bool_t flagITSrefit      =      kTRUE;
-               Bool_t flagTRDout                =      kTRUE;
-               Bool_t flagVertex                =      kTRUE;
-               
-               
-               //Cuts ---------------------------------------------------------------
-               
-               if(curTrack->GetKinkIndex(0) > 0){
-                       fHistograms->FillHistogram("Table_Electrons",5);//Count kink
-                       flagKink = kFALSE;
-               }
-               
-               ULong_t trkStatus = curTrack->GetStatus();
-               
-               ULong_t tpcRefit = (trkStatus & AliESDtrack::kTPCrefit);
-               
-               if(!tpcRefit){
-                       fHistograms->FillHistogram("Table_Electrons",9);//Count not TPCrefit
-                       flagTPCrefit = kFALSE;
-               }
-               
-               ULong_t itsRefit = (trkStatus & AliESDtrack::kITSrefit);
-               if(!itsRefit){
-                       fHistograms->FillHistogram("Table_Electrons",10);//Count not ITSrefit
-                       flagITSrefit = kFALSE;
-               }
-               
-               ULong_t trdRefit = (trkStatus & AliESDtrack::kTRDrefit);
-               
-               if(!trdRefit){
-                       fHistograms->FillHistogram("Table_Electrons",8); //Count not TRDrefit
-                       flagTRDrefit = kFALSE;
-               }
-               
-               ULong_t trdOut = (trkStatus & AliESDtrack::kTRDout);
-               
-               if(!trdOut) {
-                       fHistograms->FillHistogram("Table_Electrons",7); //Count not TRDout
-                       flagTRDout = kFALSE;
-               }
-               
-               double nsigmaToVxt = GetSigmaToVertex(curTrack);
-               
-               if(nsigmaToVxt > 3){
-                       fHistograms->FillHistogram("Table_Electrons",6); //Count Tracks with number of sigmas > 3
-                       flagVertex = kFALSE;
-               }
-               
-               if(! (flagKink && flagTPCrefit && flagITSrefit && flagTRDrefit && flagTRDout && flagVertex ) ) continue;
-               fHistograms->FillHistogram("Table_Electrons",11);//Count Tracks passed Cuts
-               
-               
-               Stat_t pid, weight;
-               GetPID(curTrack, pid, weight);
-               
-               if(pid!=0){
-                       fHistograms->FillHistogram("Table_Electrons",12); //Count Tracks with pid != 0
-               }
-               
-               if(pid == 0){
-                       fHistograms->FillHistogram("Table_Electrons",13); //Count Tracks with pid != 0
-               }
-               
-               
-               
-               
-               
-               
-               TLorentzVector curElec;
-               curElec.SetXYZM(p[0],p[1],p[2],fElectronMass);
-               
-               
-               if(fDoMCTruth){         
-                       Int_t labelMC = TMath::Abs(curTrack->GetLabel());
-                       TParticle* curParticle = fStack->Particle(labelMC);
-                       if(curTrack->GetSign() > 0){
-                               if( pid == 0){
-                                       fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
-                                       fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
-                               } else {
-                                       fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
-                                       fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
-                               }
-                       }
-               }
-               
-               
-               if(curTrack->GetSign() > 0){
-                       
-                       //               vESDxPosTemp.push_back(curTrack);
-                       new((*vESDxPosTemp)[vESDxPosTemp->GetEntriesFast()])    AliESDtrack(*curTrack);
-                       
-                       if( pid == 0){
-                               fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
-                               fHistograms->FillHistogram("ESD_ElectronPosPt",curElec.Pt());
-                               //      fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
-                               fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
-                               //      fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
-                               //      vESDePosTemp.push_back(curTrack);
-                               new((*vESDePosTemp)[vESDePosTemp->GetEntriesFast()])    AliESDtrack(*curTrack);
-                       }
-                       
-               } else {
-
-                       new((*vESDxNegTemp)[vESDxNegTemp->GetEntriesFast()])    AliESDtrack(*curTrack);
-                       
-                       if( pid == 0){
-                                       
-                               fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
-                               fHistograms->FillHistogram("ESD_ElectronNegPt",curElec.Pt());
-                               fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
-                               new((*vESDeNegTemp)[vESDeNegTemp->GetEntriesFast()])    AliESDtrack(*curTrack);
-                                       
-                       }
-                       
-               }
-               
-       }
-       
-       
-       Bool_t ePosJPsi = kFALSE;
-       Bool_t eNegJPsi = kFALSE;               
-       Bool_t ePosPi0  = kFALSE;
-       Bool_t eNegPi0  = kFALSE;
-       
-       UInt_t iePosJPsi=0,ieNegJPsi=0,iePosPi0=0,ieNegPi0=0;
-       
-       for(Int_t iNeg=0; iNeg < vESDeNegTemp->GetEntriesFast(); iNeg++){
-               if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetPdgCode() == 11)
-               if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0) > -1){
-               Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0);
-                       TParticle* partMother = fStack ->Particle(labelMother);
-                       if (partMother->GetPdgCode() == 111){
-                               ieNegPi0 = iNeg;
-                               eNegPi0 = kTRUE;
-                       }
-                       if(partMother->GetPdgCode() == 443){ //Mother JPsi
-                               fHistograms->FillTable("Table_Electrons",14);
-                               ieNegJPsi = iNeg;
-                               eNegJPsi = kTRUE;
-                       } else {        
-                               //              vESDeNegNoJPsi.push_back(vESDeNegTemp[iNeg]);
-                               new((*vESDeNegNoJPsi)[vESDeNegNoJPsi->GetEntriesFast()])        AliESDtrack(*(AliESDtrack*)(vESDeNegTemp->At(iNeg)));
-                               //              cout<<"ESD No Positivo JPsi "<<endl;
-                       }
-               }
-       }       
-       
-       for(Int_t iPos=0; iPos < vESDePosTemp->GetEntriesFast(); iPos++){
-               if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetPdgCode() == -11)
-               if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0) > -1){
-                       Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0);
-                       TParticle* partMother = fStack ->Particle(labelMother);
-                       if (partMother->GetPdgCode() == 111){
-                               iePosPi0 = iPos;
-                               ePosPi0 = kTRUE;
-                       }
-                       if(partMother->GetPdgCode() == 443){ //Mother JPsi
-                               fHistograms->FillTable("Table_Electrons",15);
-                               iePosJPsi = iPos;
-                               ePosJPsi = kTRUE;
-                       }
-                       else{
-                               //              vESDePosNoJPsi.push_back(vESDePosTemp[iPos]);
-                               new((*vESDePosNoJPsi)[vESDePosNoJPsi->GetEntriesFast()])        AliESDtrack(*(AliESDtrack*)(vESDePosTemp->At(iPos)));           
-                               //              cout<<"ESD No Negativo JPsi "<<endl;
-                       }                               
-               }
-       }
-       
-       if( eNegJPsi && ePosJPsi ){
-               TVector3 tempeNegV,tempePosV;
-               tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Pz());                  
-               tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Pz());
-               fHistograms->FillTable("Table_Electrons",16);
-               fHistograms->FillHistogram("ESD_ElectronPosNegJPsiAngle",tempeNegV.Angle(tempePosV));   
-               fHistograms->FillHistogram("MC_ElectronPosNegJPsiAngle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->GetLabel())),
-                                                                                               fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->GetLabel()))));      
-       }
-       
-       if( eNegPi0 && ePosPi0 ){
-               TVector3 tempeNegV,tempePosV;
-               tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Pz());
-               tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Pz());
-               fHistograms->FillHistogram("ESD_ElectronPosNegPi0Angle",tempeNegV.Angle(tempePosV));
-               fHistograms->FillHistogram("MC_ElectronPosNegPi0Angle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->GetLabel())),
-                                                                                        fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->GetLabel()))));       
-       }
-       
-       
-       FillAngle("ESD_eNegePosAngleBeforeCut",GetTLorentzVector(vESDeNegTemp),GetTLorentzVector(vESDePosTemp));
-       
-       CleanWithAngleCuts(*vESDeNegTemp,*vESDePosTemp,*fKFReconstructedGammasTClone);
-       
-       //      vector <TLorentzVector> vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectron);
-       //      vector <TLorentzVector> vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectron);
-       
-       TClonesArray vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectronTClone);
-       TClonesArray vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectronTClone);
-       
-       
-       FillAngle("ESD_eNegePosAngleAfterCut",vCurrentTLVeNeg,vCurrentTLVePos);
-       
-       
-       
-       
-       //FillAngle("ESD_eNegePosAngleAfterCut",CurrentTLVeNeg,CurrentTLVePos);
-       
-       
-       FillElectronInvMass("ESD_InvMass_ePluseMinus",vCurrentTLVeNeg,vCurrentTLVePos);
-       FillElectronInvMass("ESD_InvMass_xPlusxMinus",GetTLorentzVector(vESDxNegTemp),GetTLorentzVector(vESDxPosTemp));
-       
-       
-       
-       FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusChiC","ESD_InvMass_GammaePluseMinusChiCDiff",*fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
-       
-       FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusPi0","ESD_InvMass_GammaePluseMinusPi0Diff",
-                                *fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
-       
-       //BackGround
-       
-       //Like Sign e+e-
-       ElectronBackground("ESD_ENegBackground",vCurrentTLVeNeg);
-       ElectronBackground("ESD_EPosBackground",vCurrentTLVePos);
-       ElectronBackground("ESD_EPosENegBackground",vCurrentTLVeNeg);
-       ElectronBackground("ESD_EPosENegBackground",vCurrentTLVePos);
-       
-       //                              Like Sign e+e- no JPsi
-       ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDeNegNoJPsi));
-       ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDePosNoJPsi));
-       
-       //Mixed Event
-       
-       if( fCurrentEventPosElectronTClone->GetEntriesFast() > 0 && fCurrentEventNegElectronTClone->GetEntriesFast() > 0 && fKFReconstructedGammasCutTClone->GetEntriesFast() > 0 ){
-               FillGammaElectronInvMass("ESD_EPosENegGammaBackgroundMX","ESD_EPosENegGammaBackgroundMXDiff",
-                                        *fKFReconstructedGammasCutTClone,*fPreviousEventTLVNegElectronTClone,*fPreviousEventTLVPosElectronTClone);
-               *fPreviousEventTLVNegElectronTClone = vCurrentTLVeNeg;
-               *fPreviousEventTLVPosElectronTClone = vCurrentTLVePos;
-               
-       }
-       
-       /*
-       //Photons P
-       Double_t vtx[3];
-       vtx[0]=0;vtx[1]=0;vtx[2]=0;
-       for(UInt_t i=0;i<fKFReconstructedGammasChic.size();i++){
-        
-       //                      if(fMCGammaChicTempCut[i]->GetMother(0) < 0) continue;
-        
-        
-        
-       Int_t tempLabel = fStack->Particle(fMCGammaChicTempCut[i]->GetMother(0))->GetPdgCode();
-       //                      cout<<" Label Pedro Gonzalez " <<tempLabel <<endl;
-        
-       //                      cout<<" Label Distance"<<fKFReconstructedGammasChic[i].GetDistanceFromVertex(vtx)<<endl;
-        
-       if( tempLabel == 10441 || tempLabel == 20443 || tempLabel == 445 )
-        
-       fHistograms->FillHistogram("ESD_PhotonsMomentum",fKFReconstructedGammasChic[i].GetMomentum());
-        
-        
-       }
-        
-        
-       */
-
-
-       vESDeNegTemp->Delete();
-       vESDePosTemp->Delete();
-       vESDxNegTemp->Delete();
-       vESDxPosTemp->Delete();
-       vESDeNegNoJPsi->Delete();
-       vESDePosNoJPsi->Delete();
-
-       delete vESDeNegTemp;
-       delete vESDePosTemp;
-       delete vESDxNegTemp;
-       delete vESDxPosTemp;
-       delete vESDeNegNoJPsi;
-       delete vESDePosNoJPsi;  
-}
-
-/*
-       void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,vector <TLorentzVector> tlVeNeg, vector <TLorentzVector> tlVePos){
-       //see header file for documentation
-       for( UInt_t iNeg=0; iNeg < tlVeNeg.size(); iNeg++){
-       for (UInt_t iPos=0; iPos < tlVePos.size(); iPos++){
-       fHistograms->FillHistogram(histoName.Data(),tlVeNeg[iNeg].Vect().Angle(tlVePos[iPos].Vect()));
-       }
-       }
-       }
-*/
-void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,TClonesArray const tlVeNeg, TClonesArray const tlVePos){
-       //see header file for documentation
-       for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++){
-               for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
-                       fHistograms->FillHistogram(histoName.Data(),((TLorentzVector*)(tlVeNeg.At(iNeg)))->Vect().Angle(((TLorentzVector*)(tlVePos.At(iPos)))->Vect()));
-               }
-       }
-}
-
-void AliAnalysisTaskGammaConversion::FillElectronInvMass(TString histoName, TClonesArray const eNeg, TClonesArray const ePos){
-       //see header file for documentation
-       for( Int_t n=0; n < eNeg.GetEntriesFast(); n++){
-               TLorentzVector en = (*(TLorentzVector*)(eNeg.At(n)));
-               for (Int_t p=0; p < ePos.GetEntriesFast(); p++){
-                       TLorentzVector ep = (*(TLorentzVector*)(ePos.At(p)));
-                       TLorentzVector np = ep + en;
-                       fHistograms->FillHistogram(histoName.Data(),np.M());
-               }
-       }
-}
-
-void AliAnalysisTaskGammaConversion::FillGammaElectronInvMass(TString histoMass,TString histoDiff,TClonesArray const fKFGammas,
-                                                                               TClonesArray const tlVeNeg,TClonesArray const tlVePos)
-{
-       //see header file for documentation
-       
-       for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++ ){
-               
-               for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
-                       
-                       TLorentzVector xy = *((TLorentzVector *)(tlVePos.At(iPos))) + *((TLorentzVector *)(tlVeNeg.At(iNeg)));
-                       
-                       for (Int_t iGam=0; iGam < fKFGammas.GetEntriesFast(); iGam++){
-                               
-       //      AliKFParticle * gammaCandidate = &fKFGammas[iGam];
-       AliKFParticle * gammaCandidate = (AliKFParticle *)(fKFGammas.At(iGam));
-       TLorentzVector g;
-                               
-       g.SetXYZM(gammaCandidate->GetPx(),gammaCandidate->GetPy(),gammaCandidate->GetPz(),fGammaMass);
-       TLorentzVector xyg = xy + g;
-       fHistograms->FillHistogram(histoMass.Data(),xyg.M());
-       fHistograms->FillHistogram(histoDiff.Data(),(xyg.M()-xy.M()));
-                       }
-               }
-       }
-       
-}
-void AliAnalysisTaskGammaConversion::ElectronBackground(TString hBg, TClonesArray e)
-{
-       // see header file for documentation
-       for(Int_t i=0; i < e.GetEntriesFast(); i++) {
-               for (Int_t j=i+1; j < e.GetEntriesFast(); j++) {
-                       TLorentzVector ee = (*(TLorentzVector*)(e.At(i))) + (*(TLorentzVector*)(e.At(j)));
-                       fHistograms->FillHistogram(hBg.Data(),ee.M());
-               }
-       }
-}
-
-
-void AliAnalysisTaskGammaConversion::CleanWithAngleCuts(TClonesArray const negativeElectrons,
-                                                       TClonesArray const positiveElectrons, 
-                                                       TClonesArray const gammas){
-       // see header file for documentation
-       
-       UInt_t  sizeN = negativeElectrons.GetEntriesFast();
-       UInt_t  sizeP = positiveElectrons.GetEntriesFast();
-       UInt_t  sizeG = gammas.GetEntriesFast();
-       
-       
-       
-       vector <Bool_t> xNegBand(sizeN);
-       vector <Bool_t> xPosBand(sizeP);
-       vector <Bool_t> gammaBand(sizeG);
-       
-       
-       for(UInt_t iNeg=0; iNeg < sizeN; iNeg++) xNegBand[iNeg]=kTRUE;
-       for(UInt_t iPos=0; iPos < sizeP; iPos++) xPosBand[iPos]=kTRUE;
-       for(UInt_t iGam=0; iGam < sizeG; iGam++) gammaBand[iGam]=kTRUE;
-       
-       
-       for(UInt_t iPos=0; iPos < sizeP; iPos++){
-               
-               Double_t aP[3]; 
-               ((AliESDtrack*)(positiveElectrons.At(iPos)))->GetConstrainedPxPyPz(aP); 
-               
-               TVector3 ePosV(aP[0],aP[1],aP[2]);
-               
-               for(UInt_t iNeg=0; iNeg < sizeN; iNeg++){
-                       
-                       Double_t aN[3]; 
-                       ((AliESDtrack*)(negativeElectrons.At(iNeg)))->GetConstrainedPxPyPz(aN); 
-                       TVector3 eNegV(aN[0],aN[1],aN[2]);
-                       
-                       if(ePosV.Angle(eNegV) < 0.05){ //e+e- from gamma
-                               xPosBand[iPos]=kFALSE;
-                               xNegBand[iNeg]=kFALSE;
-                       }
-                       
-                       for(UInt_t iGam=0; iGam < sizeG; iGam++){
-                               AliKFParticle* gammaCandidate = (AliKFParticle*)gammas.At(iGam);
-                               TVector3 gammaCandidateVector(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
-                               if(ePosV.Angle(gammaCandidateVector) < 0.05 || eNegV.Angle(gammaCandidateVector) < 0.05)
-                                       gammaBand[iGam]=kFALSE;
-                       }
-               }
-       }
-       
-       for(UInt_t iPos=0; iPos < sizeP; iPos++){
-               if(xPosBand[iPos]){
-                       new((*fCurrentEventPosElectronTClone)[fCurrentEventPosElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(positiveElectrons.At(iPos))));
-                       //                      fCurrentEventPosElectron.push_back(positiveElectrons[iPos]);
-               }
-       }
-       for(UInt_t iNeg=0;iNeg < sizeN; iNeg++){
-               if(xNegBand[iNeg]){
-                       new((*fCurrentEventNegElectronTClone)[fCurrentEventNegElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(negativeElectrons.At(iNeg))));
-                       //                      fCurrentEventNegElectron.push_back(negativeElectrons[iNeg]);
-               }
-       }
-       for(UInt_t iGam=0; iGam < sizeG; iGam++){
-               if(gammaBand[iGam]){
-                       new((*fKFReconstructedGammasCutTClone)[fKFReconstructedGammasCutTClone->GetEntriesFast()]) AliKFParticle((*(AliKFParticle*)(gammas.At(iGam))));
-                       //fKFReconstructedGammasCut.push_back(*(AliKFParticle*)gammas->At(iGam));
-               }
-       }
-}
-
-
-void   AliAnalysisTaskGammaConversion::GetPID(const AliESDtrack *track, Stat_t &pid, Stat_t &weight)
-{
-       // see header file for documentation
-       pid = -1;
-       weight = -1;
-       
-       double wpart[5];
-       double wpartbayes[5];
-       
-       //get probability of the diffenrent particle types
-       track->GetESDpid(wpart);
-       
-       // Tentative particle type "concentrations"
-       double c[5]={0.01, 0.01, 0.85, 0.10, 0.05};
-       
-       //Bayes' formula
-       double rcc = 0.;
-       for (int i = 0; i < 5; i++){
-               rcc+=(c[i] * wpart[i]);
-       }
-       
-       
-       
-       for (int i=0; i<5; i++) {
-               if( rcc>0 || rcc<0){//Kenneth: not sure if the rcc<0 should be there, this is from fixing a coding violation where we are not allowed to say: rcc!=0 (RC19)     
-                       wpartbayes[i] = c[i] * wpart[i] / rcc;
-               }
-       }
-       
-       Float_t max=0.;
-       int ipid=-1;
-       //find most probable particle in ESD pid
-       //0:Electron - 1:Muon - 2:Pion - 3:Kaon - 4:Proton
-       for (int i = 0; i < 5; i++){
-                       if (wpartbayes[i] > max){
-                               ipid = i;
-                               max = wpartbayes[i];
-                       }
-               }
-       
-       pid = ipid;
-       weight = max;
-}
-
-double AliAnalysisTaskGammaConversion::GetSigmaToVertex(const AliESDtrack* t)
-{
-       // Calculates the number of sigma to the vertex.
-       
-       Float_t b[2];
-       Float_t bRes[2];
-       Float_t bCov[3];
-       t->GetImpactParameters(b,bCov);
-       if (bCov[0]<=0 || bCov[2]<=0) {
-               AliDebug(1, "Estimated b resolution lower or equal zero!");
-               bCov[0]=0; bCov[2]=0;
-       }
-       bRes[0] = TMath::Sqrt(bCov[0]);
-       bRes[1] = TMath::Sqrt(bCov[2]);
-       
-       // -----------------------------------
-       // How to get to a n-sigma cut?
-       //
-       // The accumulated statistics from 0 to d is
-       //
-       // ->   Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
-       // ->   1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
-       //
-       // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2)
-       // Can this be expressed in a different way?
-       
-       if (bRes[0] == 0 || bRes[1] ==0)
-               return -1;
-       
-       double d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
-       
-       // stupid rounding problem screws up everything:
-       // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
-       if (TMath::Exp(-d * d / 2) < 1e-10)
-               return 1000;
-       
-       
-       d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
-       return d;
-}
-
-//vector <TLorentzVector> AliAnalysisTaskGammaConversion::GetTLorentzVector(vector <AliESDtrack*> esdTrack){
-TClonesArray AliAnalysisTaskGammaConversion::GetTLorentzVector(TClonesArray *const esdTrack){
-       //Return TLoresntz vector of track?
-       //      vector <TLorentzVector> tlVtrack(0);
-       TClonesArray array("TLorentzVector",0); 
-       
-       for(Int_t itrack=0; itrack < esdTrack->GetEntriesFast(); itrack++){
-               double p[3]; 
-               //esdTrack[itrack]->GetConstrainedPxPyPz(p);
-               ((AliESDtrack*)(esdTrack->At(itrack)))->GetConstrainedPxPyPz(p);
-               TLorentzVector currentTrack;
-               currentTrack.SetXYZM(p[0],p[1],p[2],fElectronMass);
-               new((array)[array.GetEntriesFast()])    TLorentzVector(currentTrack);
-               //              tlVtrack.push_back(currentTrack);
-       }
-       
-       return array;
-       
-       //      return tlVtrack;
-}
-Int_t AliAnalysisTaskGammaConversion::GetProcessType(const AliMCEvent * mcEvt) {
-
-       // Determine if the event was generated with pythia or phojet and return the process type
-
-       // Check if mcEvt is fine
-       if (!mcEvt) { // coverty does not allow this, the check is done elsewhere
-               AliFatal("NULL mc event");
-               return -1;
-       } 
-
-       // Determine if it was a pythia or phojet header, and return the correct process type
-       AliGenPythiaEventHeader * headPy        = 0;
-       AliGenDPMjetEventHeader * headPho = 0;
-       AliGenEventHeader * htmp = mcEvt->GenEventHeader();
-       if(!htmp) {
-               AliFatal("Cannot Get MC Header!!");
-               return -1;
-       }
-       if( TString(htmp->IsA()->GetName()) == "AliGenPythiaEventHeader") {
-               headPy =        (AliGenPythiaEventHeader*) htmp;
-       } else if (TString(htmp->IsA()->GetName()) == "AliGenDPMjetEventHeader") {
-               headPho = (AliGenDPMjetEventHeader*) htmp;
-       } else {
-               AliError("Unknown header");
-       }
-
-       // Determine process type
-       if(headPy)       {
-               if(headPy->ProcessType() == 92 || headPy->ProcessType() == 93) {
-                       // single difractive
-                       return kProcSD;
-               } else if (headPy->ProcessType() == 94) {
-                       // double diffractive
-                       return kProcDD;
-               }
-               else if(headPy->ProcessType() != 92 && headPy->ProcessType() != 93 && headPy->ProcessType() != 94) {            
-                       // non difractive
-                       return kProcND; 
-               }
-       } else if (headPho) {
-               if(headPho->ProcessType() == 5 || headPho->ProcessType() == 6 ) {
-                       // single difractive
-                       return kProcSD;
-               } else if (headPho->ProcessType() == 7) { 
-                       // double diffractive
-                       return kProcDD;                 
-               } else if(headPho->ProcessType() != 5 && headPho->ProcessType() != 6    && headPho->ProcessType() != 7 ) {
-                       // non difractive
-                       return kProcND; 
-               }                        
-       }
-       
-
-       // no process type found?
-       AliError(Form("Unknown header: %s", htmp->IsA()->GetName()));
-       return kProcUnknown;
-}
-
-
-Int_t AliAnalysisTaskGammaConversion::CalculateMultiplicityBin(){
-       // Get Centrality bin
-
-       Int_t multiplicity = 0;
-
-       if ( fUseMultiplicity == 1 ) {
-
-               if (fMultiplicity>= 0 && fMultiplicity<= 5) multiplicity=1;
-               if (fMultiplicity>= 6 && fMultiplicity<= 9) multiplicity=2;
-               if (fMultiplicity>=10 && fMultiplicity<=14) multiplicity=3;
-               if (fMultiplicity>=15 && fMultiplicity<=22) multiplicity=4;
-               if (fMultiplicity>=23 ) multiplicity=5;
-
-       }
-
-       if ( fUseHBTMultiplicity == 1 ) {
-               
-                       if (fMultiplicity>= 0 && fMultiplicity<=11)     multiplicity=1;
-                       if (fMultiplicity>=12 && fMultiplicity<=16)     multiplicity=2;
-                       if (fMultiplicity>=17 && fMultiplicity<=22)     multiplicity=3;
-                       if (fMultiplicity>=23 && fMultiplicity<=29)     multiplicity=4;
-                       if (fMultiplicity>=30 && fMultiplicity<=36)     multiplicity=5;
-                       if (fMultiplicity>=37 && fMultiplicity<=44)     multiplicity=6;
-                       if (fMultiplicity>=45 && fMultiplicity<=57)     multiplicity=7;
-                       if (fMultiplicity>=58 && fMultiplicity<=149) multiplicity=8;
-               
-               /*
-               if (fMultiplicity>= 0 && fMultiplicity<=5) multiplicity=1;
-               if (fMultiplicity>=6 && fMultiplicity<=11) multiplicity=2;
-               if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=3;
-               if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=4;
-               if (fMultiplicity>=23  )                 multiplicity=5;
-               */
-
-       }
-
-       return multiplicity;
-}
-
-
-Bool_t AliAnalysisTaskGammaConversion::CheckCentrality(){
-   
-   if(fUseCentrality == 0 && fUseCentralityBin == 0) return kTRUE;//0-100%
-   if(fUseCentrality >= fUseCentralityBin) return kTRUE;//0-100%
-
-   TString centralityType = "";
-   if(fMultSelection == 0) 
-      centralityType = "V0M";
-   else if(fMultSelection == 1)
-      centralityType = "CL1";
-   
-   AliCentrality *esdCentrality = fV0Reader->GetESDEvent()->GetCentrality();
-   
-   Float_t low = 10.0*(Float_t)fUseCentrality;
-   Float_t high = 10.0*(Float_t)fUseCentralityBin;
-   if(fUseCentralityBin == 0) high = 100.0;
-
-   return esdCentrality->IsEventInCentralityClass(low,high,centralityType);
-}
-
-
-
-
-
diff --git a/PWGGA/GammaConv/AliAnalysisTaskGammaConversion.h b/PWGGA/GammaConv/AliAnalysisTaskGammaConversion.h
deleted file mode 100644 (file)
index 9466003..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-#ifndef ALIANALYSISTASKGAMMACONVERSION_H
-#define ALIANALYSISTASKGAMMACONVERSION_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class used to do analysis on conversion pairs
-//---------------------------------------------
-////////////////////////////////////////////////
-
-#include "AliAnalysisTaskSE.h"
-#include <vector>
-#include "AliV0Reader.h"
-#include "AliGammaConversionBGHandler.h"
-#include "TRandom3.h"
-#include "TF1.h"
-#include "TTreeStream.h"
-#include "AliMultiplicity.h"
-//#include "AliCFManager.h"  // for CF
-//#include "AliCFContainer.h"   // for CF
-#include "AliAODConversionMother.h"
-
-
-class AliAODPWG4Particle;
-class AliAODConversionPhoton;
-class AliAODConversionMother;
-class AliKFConversionPhoton;
-class AliKFConversionMother;
-class TNtuple;
-class AliGammaConversionHistograms;
-class AliESDv0;
-class AliV0;
-class AliKFParticle;
-class AliKFVertex;
-class AliESDInputHandler;
-class AliESDEvent;
-class AliAODEvent;
-class AliMCEvent;
-class TList;
-class AliStack;
-class AliESDtrackCuts;
-class AliTriggerAnalysis;
-class AliCFManager; // for CF
-class AliCFContainer; // for CF
-class TRandom3;
-class TF1;
-
-class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
-{
-       
-public:
-       typedef enum { kProcSD, kProcDD, kProcND, kProcUnknown, kNProcs } ProcType_t; 
-       AliAnalysisTaskGammaConversion();
-       AliAnalysisTaskGammaConversion(const char* name);
-       virtual ~AliAnalysisTaskGammaConversion() ;// virtual destructor
-                       
-       // Implementation of interface methods
-       virtual void UserCreateOutputObjects();
-       virtual void Init();
-       virtual void LocalInit() {Init();}
-       virtual void UserExec(Option_t *option);
-       virtual void Terminate(Option_t *option);
-       //virtual void ConnectInputData(Option_t * option);
-       void CheckMesonProcessTypeEventQuality(Int_t evtQ);
-        Bool_t CheckCentrality();
-       Int_t GetProcessType(const AliMCEvent * mcEvt) ;
-       void ProcessMCData();
-       void ProcessV0sNoCut();
-       void ProcessV0s();
-       void ProcessGammasForNeutralMesonAnalysis();
-       void ProcessGammasForOmegaMesonAnalysis();
-    Bool_t DoEventSelection();
-    Bool_t CheckMCEvent();
-  //  void ProcessConvPHOSGammasForNeutralMesonAnalysis();
-       //  void RecalculateV0ForGamma();
-       // for CF
-       void SetCFManager(AliCFManager * const io) {fCFManager = io;};
-       AliCFManager *GetCFManager() const {return fCFManager;}
-                       
-                       
-       // AOD
-       TString GetAODBranchName() const {return  fAODBranchName;}
-       void SetAODBranchName(TString name)  {fAODBranchName = name ;}  
-       void SetForceAOD(Bool_t forceAOD ) { fKFForceAOD = forceAOD; }
-       void FillAODWithConversionGammas();
-       void AddGammaToAOD(AliKFConversionPhoton * kfParticle);
-    void PostAODEvent();
-       // void AddPionToAOD(AliKFConversionMother * kfParticle);
-       // void AddOmegaToAOD(AliKFParticle * kfParticle, Int_t daughter1, Int_t daughter2);
-       void TagDaughter(Int_t gammaIndex);
-
-       // end AOD
-                       
-       static Bool_t IsGoodImpPar(const AliESDtrack *const track);
-               
-       // for GammaJetAnalysis
-       void ProcessGammasForGammaJetAnalysis();
-       void CreateListOfChargedParticles();
-       Double_t GetMinimumDistanceToCharge(Int_t indexHighestPtGamma);
-       void CalculateJetCone(Int_t gammaIndex);
-       Int_t GetIndexHighestPtGamma();
-       void SetESDtrackCuts();
-       // end of Gamma Jet
-                       
-       void SetMinPtForGammaJet(Double_t minPtForGammaJet){fMinPtForGammaJet=minPtForGammaJet;}
-       void SetMinIsoConeSize(Double_t minIsoConeSize){fMinIsoConeSize=minIsoConeSize;}
-       void SetMinPtIsoCone(Double_t minPtIsoCone){fMinPtIsoCone=minPtIsoCone;}
-       void SetMinPtGamChargedCorr(Double_t minPtGamChargedCorr){fMinPtGamChargedCorr=minPtGamChargedCorr;}
-       void SetMinPtJetCone(Double_t minPtJetCone){fMinPtJetCone=minPtJetCone;}
-
-       void SetLowPtMapping(Double_t lowPtMapping){fLowPtMapping=lowPtMapping;}
-       void SetHighPtMapping(Double_t highPtMapping){fHighPtMapping=highPtMapping;}
-
-                       
-       void SetHistograms(AliGammaConversionHistograms *const histograms){fHistograms=histograms;}
-       void SetTriggerCINT1B(Bool_t flag){fTriggerCINT1B=flag;}
-       void SetDoMCTruth(Bool_t flag){fDoMCTruth=flag;}
-       void SetDoNeutralMeson(Bool_t flag){fDoNeutralMeson=flag;}
-       void SetDoOmegaMeson(Bool_t flag){fDoOmegaMeson=flag;}
-       void SetDoNeutralMesonV0MCCheck(Bool_t flag){fDoNeutralMesonV0MCCheck=flag;}
-       void SetDoJet(Bool_t flag){fDoJet=flag;}
-       void SetDoChic(Bool_t flag){fDoChic=flag;}
-       void SetRecalculateV0ForGamma(Bool_t flag){fRecalculateV0ForGamma=flag;}                
-
-       void SetElectronMass(Double_t electronMass){fElectronMass = electronMass;}
-       void SetGammaMass(Double_t gammaMass){fGammaMass = gammaMass;}
-       void SetGammaWidth(Double_t gammaWidth){fGammaWidth = gammaWidth;}
-       void SetPi0Mass(Double_t pi0Mass){fPi0Mass = pi0Mass;}
-       void SetPi0Width(Double_t pi0Width){fPi0Width = pi0Width;}
-       void SetEtaMass(Double_t etaMass){fEtaMass = etaMass;}
-       void SetEtaWidth(Double_t etaWidth){fEtaWidth = etaWidth;}
-       void SetMinOpeningAngleGhostCut(Double_t ghostCut){fMinOpeningAngleGhostCut = ghostCut;}
-       void SetV0Reader(AliV0Reader* const reader){fV0Reader=reader; fV0Reader->SetESDtrackCuts(fEsdTrackCuts);}
-       void SetCalculateBackground(Bool_t bg){fCalculateBackground=bg;}
-       void CalculateBackground();
-       void SetWriteNtuple(Bool_t writeNtuple){fWriteNtuple = writeNtuple;}
-       void FillNtuple();
-       Double_t GetMCOpeningAngle(const TParticle* const daughter0,const TParticle* const daughter1) const;
-       void CheckV0Efficiency();
-       void SetDeltaAODFileName(TString fn) { fKFDeltaAODFileName = fn; };
-    void SetCreateAOD(Bool_t doAod) { fKFCreateAOD = doAod; };
-    void SetExchangeAOD(Bool_t xchAOD) { fKFExchangeAOD = xchAOD; };
-       TString GetDeltaAODFileName() const { return fKFDeltaAODFileName; };
-       //////////////////Chi_c Analysis////////////////////////////
-       void GetPID(const AliESDtrack *track, Stat_t &pid, Stat_t &weight);     
-       double GetSigmaToVertex(const AliESDtrack* t);
-       void ElectronBackground(TString hBg, TClonesArray e);
-       void FillAngle(TString histoName,TClonesArray const tlVeNeg, TClonesArray const tlVePos);
-       void FillElectronInvMass(TString histoName, TClonesArray const negativeElectron, TClonesArray const positiveElectron);
-       void FillGammaElectronInvMass(TString histoMass,TString histoDiff, TClonesArray const fKFGammas, TClonesArray const tlVeNeg,TClonesArray const tlVePos);
-       void CleanWithAngleCuts(TClonesArray const negativeElectrons, TClonesArray const positiveElectrons, TClonesArray const gammas);
-       TClonesArray GetTLorentzVector(TClonesArray* esdTrack); 
-       void ProcessGammaElectronsForChicAnalysis();
-       void ProcessHadronicInteraction(AliESDEvent *event);
-       Bool_t CheckLooper(Int_t index, AliESDEvent *event);
-       Bool_t CheckV0(Int_t index, AliESDEvent *event);
-       ///////////////////////////////////////////////////////////////
-
-       void SetDoCF(Bool_t flag){fDoCF = flag;}
-
-       void SetUseChargedTracksMultiplicityForBG(Bool_t flag){fUseTrackMultiplicityForBG = flag;}              
-
-       void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
-
-       void MoveParticleAccordingToVertex(AliKFParticle * particle,const AliGammaConversionBGHandler::GammaConversionVertex *vertex);
-
-       void SetApplyChi2Cut(Bool_t flag){fApplyChi2Cut = flag;}
-
-       void SetDoRotation(Bool_t flag){fDoRotation = flag;}
-
-       void SetPMDegreesBG(Int_t deg){fNDegreesPMBackground=deg;}
-
-       void SetNumberOfRotationsBG(Int_t nRot){fNRandomEventsForBG=nRot;}
-
-       void RotateKFParticle(AliKFParticle * kfParticle,Double_t angle);
-
-       void SetCheckBGProbability(Bool_t flag){fCheckBGProbability = flag;}
-
-       void SetRemovePileUp(Bool_t removePileUp) { fRemovePileUp = removePileUp; }
-
-       void SetSelectV0AND(Int_t selectV0AND) { fSelectV0AND = selectV0AND; }
-       void SetUseMultiplicity(Int_t useMultiplicity) {fUseMultiplicity=useMultiplicity;}
-       void SetUseMultiplicityBin(Int_t useMultiplicityBin) {fUseMultiplicityBin=useMultiplicityBin;}
-       void SetUseHBTMultiplicity(Int_t useHBTMultiplicity) {fUseHBTMultiplicity=useHBTMultiplicity;}
-       void SetUseHBTMultiplicityBin(Int_t useHBTMultiplicityBin) {fUseHBTMultiplicityBin=useHBTMultiplicityBin;}
-
-       Int_t CalculateMultiplicityBin();
-       void SetUseCentrality(Int_t useCentrality) {fUseCentrality=useCentrality;}
-       void SetUseCentralityBin(Int_t useCentralityBin) {fUseCentralityBin=useCentralityBin;}
-        void SetMultSelection(Int_t multselection) {fMultSelection=multselection;}
-
-
-
- private:
-       AliAnalysisTaskGammaConversion(const AliAnalysisTaskGammaConversion&); // Not implemented
-       AliAnalysisTaskGammaConversion& operator=(const AliAnalysisTaskGammaConversion&); // Not implemented
-  
-       TTreeSRedirector *fpcstream;
-                               
-  // for CF
- enum{
-               kStepGenerated = 0,
-               kStepReconstructable = 1, 
-               kStepGetOnFly = 2,
-               kStepLikeSign = 3,
-               kStepTPCRefit = 4,
-               kStepKinks = 5,
-               kStepdEdxElectronSelection = 6,
-               kStepdEdxPpionRejection = 7,
-               kStepNContributors = 8,
-               kStepTPCPID = 9,
-               kStepR = 10,
-               kStepLine = 11,
-               kStepZ = 12,
-               kStepMinClsTPC = 13,
-               kStepSinglePt = 14,
-               kStepNDF = 15,
-               kStepChi2 = 16,
-               kStepEta = 17,
-               kStepPt = 18,
-               kStepTrueGamma = 19
-       };
-       
-       AliV0Reader* fV0Reader; // The V0 reader object 
-                       
-       AliStack * fStack; // pointer to the MC particle stack
-       AliMCEventHandler *fMCTruth; // for CF   pointer to MCTruth
-       AliMCEvent *fGCMCEvent;  // for CF    pointer to the MC Event
-       AliESDEvent* fESDEvent; //pointer to the ESDEvent
-       TList * fOutputContainer; // Histogram container
-       AliCFManager *fCFManager;  // for CF
-       //  AliCFContainer *container;   // for CF
-
-                       
-                       
-       AliGammaConversionHistograms *fHistograms; // Pointer to the histogram handling class
-       Bool_t fTriggerCINT1B; //Flag to select trigger CINT1B
-       Bool_t fDoMCTruth; // Flag to switch on/off MC truth 
-       Bool_t fDoNeutralMeson; // flag
-       Bool_t fDoOmegaMeson; // flag
-       Bool_t fDoJet; // flag
-       Bool_t fDoChic; // flag
-               
-       Bool_t fRecalculateV0ForGamma;//flag
-                       
-       TClonesArray * fKFReconstructedGammasTClone; //! transient
-       TClonesArray * fKFReconstructedPi0sTClone; //! transient
-       TClonesArray * fKFRecalculatedGammasTClone; //! transient
-       TClonesArray * fCurrentEventPosElectronTClone; //! transient
-       TClonesArray * fCurrentEventNegElectronTClone; //! transient
-       TClonesArray * fKFReconstructedGammasCutTClone; //! transient
-       TClonesArray * fPreviousEventTLVNegElectronTClone; //! transient
-       TClonesArray * fPreviousEventTLVPosElectronTClone; //! transient
-                       
-       //  vector<AliKFParticle> fKFReconstructedGammas; // vector containing all reconstructed gammas
-                       
-       //  AliESDpid * fESDpid; // esd pid
-
-
-       ///////Chi_c Analysis///////////////////////////
-       //  vector<AliESDtrack*> fCurrentEventPosElectron;       // comment here
-       //  vector<AliESDtrack*> fCurrentEventNegElectron;       // comment here
-       //  vector<AliKFParticle> fKFReconstructedGammasCut;     // comment here
-       //  vector<TLorentzVector> fPreviousEventTLVNegElectron; // comment here
-       //  vector<TLorentzVector> fPreviousEventTLVPosElectron; // comment here
-       //////////////////////////////////////////////////      
-                       
-       //mass defines
-       Double_t fElectronMass; //electron mass
-       Double_t fGammaMass;    //gamma mass
-       Double_t fPi0Mass;      //pi0mass
-       Double_t fEtaMass;      //eta mass
-                       
-       // width defines
-       Double_t fGammaWidth; //gamma width cut
-       Double_t fPi0Width;   // pi0 width cut
-       Double_t fEtaWidth;   // eta width cut
-                       
-       Double_t fMinOpeningAngleGhostCut; // minimum angle cut
-                       
-       AliESDtrackCuts* fEsdTrackCuts;           // Object containing the parameters of the esd track cuts
-                       
-       Bool_t fCalculateBackground; //flag to set backgrount calculation on/off
-       Bool_t fWriteNtuple;         // flag to set if writing to ntuple on/off
-       TNtuple *fGammaNtuple;       // Ntuple for gamma values
-       TNtuple *fNeutralMesonNtuple;// NTuple for mesons
-                       
-       Int_t fTotalNumberOfAddedNtupleEntries; // number of added ntuple entries
-                       
-       TClonesArray* fChargedParticles;  //! transient
-       vector<Int_t> fChargedParticlesId;  //! transient
-                       
-       Double_t fGammaPtHighest;  //! transient
-       Double_t fMinPtForGammaJet;  //! transient
-       Double_t fMinIsoConeSize; //! transient
-       Double_t fMinPtIsoCone; //! transient
-       Double_t fMinPtGamChargedCorr; //! transient
-       Double_t fMinPtJetCone; //! transient
-       Int_t    fLeadingChargedIndex; //! transient
-       Double_t fLowPtMapping; //! transient
-       Double_t fHighPtMapping; //! transient
-       Bool_t fDoCF; //! transient
-                       
-       TClonesArray * fAODGamma; //TClonesArray for gammas to put in AOD
-       //TClonesArray * fAODPi0; //TTClonesArray for Pi0s to put in AOD
-       //TClonesArray * fAODOmega; //TTClonesArray for omegas to put in AOD
-       TString fAODBranchName; // New AOD branch name
-       Bool_t fKFCreateAOD; //Create the AOD tclones? (regardless if storing or not)
-       Bool_t fKFExchangeAOD; //Create the AOD tclones? (regardless if storing or not)
-       Bool_t fKFForceAOD;  //Set the Analysis Manager FillAOD variable to true every event
-       TString fKFDeltaAODFileName; //! File name for delta AOD (if any)
-       Bool_t fDoNeutralMesonV0MCCheck; //flag
-       Bool_t fUseTrackMultiplicityForBG; //flag
-       Bool_t fMoveParticleAccordingToVertex; //flag
-       Bool_t fApplyChi2Cut; //flag
-       Int_t fNRandomEventsForBG; //number of random events to use in rotation method
-       Int_t fNDegreesPMBackground; // number of degree window to rotate particles for rotation method
-       Bool_t fDoRotation; //flag
-       Bool_t fCheckBGProbability; //flag
-       //  vector<Int_t>fKFReconstructedGammasV0Index; // index of the reconstructed v0s
-       Bool_t fRemovePileUp;                 // Remove Pile Up
-       Int_t fSelectV0AND;                 // Select V0AND
-       AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
-       Int_t fMultiplicity;
-       Int_t fUseMultiplicity;
-       Int_t fUseMultiplicityBin;
-       Int_t fUseHBTMultiplicity;
-       Int_t fUseHBTMultiplicityBin;
-       Int_t fUseCentrality;
-       Int_t fUseCentralityBin;
-        Int_t fMultSelection;
-       TRandom3 fRandom;
-       
-       ClassDef(AliAnalysisTaskGammaConversion, 23); // Analysis task for gamma conversions
-};
-
-#endif //ALIANALYSISTASKGAMMA_H
index 7ffb164b15fc4b79893e7d5846e41bf3c248e887..22ca7b483aedeb456a6e167938f6b5175afd8895 100644 (file)
@@ -97,6 +97,7 @@ void AliAnalysisTaskMaterial::UserExec(Option_t *){
       return;
    }
    fESDEvent = (AliESDEvent*) InputEvent();
+   if (fESDEvent==NULL) return;
    if(fIsHeavyIon && !fConversionCuts->IsCentralitySelected(fESDEvent)) return;
        Int_t nESDtracksEta09 = CountESDTracks09(); // Estimate Event Multiplicity
        Int_t nESDtracksEta0914 = CountESDTracks0914(); // Estimate Event Multiplicity
@@ -213,6 +214,7 @@ void AliAnalysisTaskMaterial::ProcessPhotons(){
        // Fill Histograms for QA and MC
    for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
       AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
+      if (gamma ==NULL) continue;
       if(!fConversionCuts->PhotonIsSelected(gamma,fESDEvent)) continue;
 //             cout << "i=  " <<firstGammaIndex << " of "<< fConversionGammas->GetEntriesFast() << endl;
       Float_t gammaPt = gamma->GetPhotonPt();
@@ -355,11 +357,10 @@ void AliAnalysisTaskMaterial::ProcessPhotons(){
 
 //________________________________________________________________________
 Int_t AliAnalysisTaskMaterial::CountESDTracks09(){
-
-   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
+   
    // Using standard function for setting Cuts
    Bool_t selectPrimaries=kTRUE;
-   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
    EsdTrackCuts->SetMaxDCAToVertexZ(2);
    EsdTrackCuts->SetEtaRange(-0.9, 0.9);
    EsdTrackCuts->SetPtRange(0.15);
@@ -378,11 +379,10 @@ Int_t AliAnalysisTaskMaterial::CountESDTracks09(){
 
 Int_t AliAnalysisTaskMaterial::CountESDTracks0914(){
 
-   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
    // Using standard function for setting Cuts ; We use TPCOnlyTracks for outer eta region
    //Bool_t selectPrimaries=kTRUE;
         //   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
-   EsdTrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
         EsdTrackCuts->SetMaxDCAToVertexXY(5);
         //      EsdTrackCuts->SetMaxDCAToVertexXYPtDep("sqrt(0.15^2+(0.4/pt)^2");
    EsdTrackCuts->SetEtaRange(0.9, 1.4);
@@ -408,10 +408,9 @@ Int_t AliAnalysisTaskMaterial::CountESDTracks0914(){
 
 Int_t AliAnalysisTaskMaterial::CountESDTracks14(){
 
-   AliESDtrackCuts *EsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
    // Using standard function for setting Cuts
    Bool_t selectPrimaries=kTRUE;
-   EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+   AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
    EsdTrackCuts->SetMaxDCAToVertexZ(2);
    EsdTrackCuts->SetEtaRange(-1.4, 1.4);
    EsdTrackCuts->SetPtRange(0.15);
@@ -432,10 +431,10 @@ Int_t AliAnalysisTaskMaterial::CountESDTracks14(){
 //________________________________________________________________________
 void AliAnalysisTaskMaterial::Terminate(Option_t *)
 {
-   if (fStreamMaterial){
-      fStreamMaterial->GetFile()->Write();
-   }
-   if (fStreamResolution){
-      fStreamResolution->GetFile()->Write();
-   }
+//    if (fStreamMaterial){
+//       fStreamMaterial->GetFile()->Write();
+//    }
+//    if (fStreamResolution){
+//       fStreamResolution->GetFile()->Write();
+//    }
 }
index 05bec6fd95006773c9d369c5b502513998ad5d7c..efdb3e4fc4ca27aa73504edbd0b72d35236382e4 100644 (file)
@@ -2,6 +2,13 @@
 #include "TRandom3.h"
 #include "TChain.h"
 #include "AliLog.h"
+#include "TList.h"
+#include "TChain.h"
+#include "TDirectory.h"
+#include "TTree.h"
+#include "TH1.h"
+#include "TH1F.h"
+#include "THnSparse.h"
 #include "AliAnalysisTask.h"
 #include "AliAnalysisManager.h"
 #include "AliAnalysisTaskPi0v2.h"
index 5b5296db0a56a59ca9d511ce9dd0842567443839..c94d56165051188e26dcd15dd42dfe791edc3887 100644 (file)
@@ -5,6 +5,13 @@
 #include "TH1.h"
 #include "TH2.h"
 #include "TH3.h"
+#include "TList.h"
+#include "TChain.h"
+#include "TDirectory.h"
+#include "TTree.h"
+#include "TH1.h"
+#include "TH1F.h"
+#include "THnSparse.h"
 #include "AliLog.h"
 #include "AliConversionSelection.h"
 #include "AliConversionMesonCuts.h"
index f9c89871a4a4473231a75e793993e062b33a82b1..5ae5c66209378c52bab71c7375686c62bb24a489 100644 (file)
@@ -141,7 +141,7 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
    fDoPhotonAsymmetryCut(kTRUE),
    fMinPPhotonAsymmetryCut(100.),
    fMinPhotonAsymmetry(0.),
-   fIsHeavyIon(kFALSE),
+   fIsHeavyIon(0),
    fDetectorCentrality(0),
    fModCentralityClass(0),
    fMaxVertexZ(10),
@@ -173,6 +173,7 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
    fNotRejectedEnd(NULL),
    fGeneratorNames(NULL),
    fCutString(NULL),
+   fUtils(NULL),
    hdEdxCuts(NULL),
    hTPCdEdxbefore(NULL),
    hTPCdEdxafter(NULL),
@@ -200,7 +201,11 @@ AliConversionCuts::AliConversionCuts(const char *name,const char *title) :
    fCutString=new TObjString((GetCutNumber()).Data());
 
    fElectronLabelArray = new Int_t[fElectronArraySize];
+   fUtils = new AliAnalysisUtils();
+   //if you do not want to apply the cut on the distance between the SPD and TRK vertex:
+   //fUtils->SetCutOnZVertexSPD(kFALSE); 
 
+   
 }
 
 //________________________________________________________________________
@@ -258,7 +263,7 @@ AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
    fNSigmaMass(ref.fNSigmaMass),
    fUseEtaMinCut(ref.fUseEtaMinCut),
    fUseOnFlyV0Finder(ref.fUseOnFlyV0Finder),
-   fDoPhotonAsymmetryCut(fDoPhotonAsymmetryCut),
+   fDoPhotonAsymmetryCut(ref.fDoPhotonAsymmetryCut),
    fMinPPhotonAsymmetryCut(ref.fMinPPhotonAsymmetryCut),
    fMinPhotonAsymmetry(ref.fMinPhotonAsymmetry),
    fIsHeavyIon(ref.fIsHeavyIon),
@@ -293,6 +298,7 @@ AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
    fNotRejectedEnd(NULL),
    fGeneratorNames(ref.fGeneratorNames),
    fCutString(NULL),
+   fUtils(NULL),
    hdEdxCuts(NULL),
    hTPCdEdxbefore(NULL),
    hTPCdEdxafter(NULL),
@@ -319,6 +325,7 @@ AliConversionCuts::AliConversionCuts(const AliConversionCuts &ref) :
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
    fCutString=new TObjString((GetCutNumber()).Data());
    fElectronLabelArray = new Int_t[fElectronArraySize];
+   fUtils = new AliAnalysisUtils();
    // dont copy histograms (if you like histograms, call InitCutHistograms())
 }
 
@@ -350,6 +357,11 @@ AliConversionCuts::~AliConversionCuts() {
       delete[] fGeneratorNames;
       fGeneratorNames = NULL;
    }
+   if(fUtils){
+     delete fUtils;
+     fUtils = NULL;
+   }
+
 }
 
 //________________________________________________________________________
@@ -892,6 +904,19 @@ Bool_t AliConversionCuts::PhotonIsSelected(AliConversionPhotonBase *photon, AliV
    //Selection of Reconstructed Photons
 
    FillPhotonCutIndex(kPhotonIn);
+   
+   if(event->IsA()==AliESDEvent::Class()) {
+      if(!SelectV0Finder( ( ((AliESDEvent*)event)->GetV0(photon->GetV0Index())) ) ){
+         FillPhotonCutIndex(kOnFly);
+         return kFALSE;
+      }
+   }
+   // else if(event->IsA()==AliAODEvent::Class()) {
+   //    if(!SelectV0Finder( ( ((AliAODEvent*)event)->GetV0(photon->GetV0Index())) ) ){
+   //       FillPhotonCutIndex(kOnFly);
+   //       return kFALSE;
+   //    }
+   // }
 
    // Get Tracks
    AliVTrack * negTrack = GetTrack(event, photon->GetTrackLabelNegative());
@@ -1690,12 +1715,21 @@ Bool_t AliConversionCuts::SetIsHeavyIon(Int_t isHeavyIon)
       fDetectorCentrality=0;
       fModCentralityClass=5;
       break;
+   case 8:
+      fIsHeavyIon=2;
+      fDetectorCentrality=0;
+      break;
+   case 9:
+      fIsHeavyIon=2;
+      fDetectorCentrality=1;
+      break;         
    default:
       AliError(Form("SetHeavyIon not defined %d",isHeavyIon));
       return kFALSE;
    }
    return kTRUE;
 }
+
 //___________________________________________________________________
 Bool_t AliConversionCuts::SetCentralityMin(Int_t minCentrality)
 {
@@ -2578,7 +2612,12 @@ Double_t AliConversionCuts::GetCentrality(AliVEvent *event)
       AliCentrality *fESDCentrality=(AliCentrality*)esdEvent->GetCentrality();
 
       if(fDetectorCentrality==0){
-         return fESDCentrality->GetCentralityPercentile("V0M"); // default
+       if (fIsHeavyIon==2){
+         return fESDCentrality->GetCentralityPercentile("V0A"); // default for pPb
+       }
+       else{         
+         return fESDCentrality->GetCentralityPercentile("V0M"); // default
+       }
       }
       if(fDetectorCentrality==1){
          return fESDCentrality->GetCentralityPercentile("CL1");
@@ -2680,6 +2719,13 @@ Bool_t AliConversionCuts::VertexZCut(AliVEvent *event){
    Double_t fVertexZ=event->GetPrimaryVertex()->GetZ();
 
    if(abs(fVertexZ)>fMaxVertexZ)return kFALSE;
+   
+   if (fIsHeavyIon == 2){
+     if(fUtils->IsFirstEventInChunk(event)) return kFALSE;
+     if(!fUtils->IsVertexSelected2013pA(event)) return kFALSE;
+
+   }
+   
    return kTRUE;
 }
 ///________________________________________________________________________
@@ -2733,7 +2779,8 @@ Bool_t AliConversionCuts::IsTriggerSelected()
    AliInputEventHandler *fInputHandler=(AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
 
    UInt_t isSelected = AliVEvent::kAny;
-   if( fInputHandler && fInputHandler->GetEventSelection()) {
+   if (fInputHandler==NULL) return kFALSE;
+   if( fInputHandler->GetEventSelection()) {
       // Get the actual offline trigger mask for the event and AND it with the
       // requested mask. If no mask requested select by default the event.
       if (fOfflineTriggerMask)
@@ -3052,7 +3099,7 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
       fnHeaders = 1;
       fNotRejectedStart[0] = 0;
       fNotRejectedEnd[0] = MCEvent->Stack()->GetNprimary()-1;
-//       if(rejection == 2){
+      //       if(rejection == 2){
       fGeneratorNames = new TString[1];
       fGeneratorNames[0] = "NoCocktailGeneratorFound";
 //       }
@@ -3147,12 +3194,6 @@ Float_t AliConversionCuts::GetWeightForMeson(TString period, Int_t index, AliSta
    
    Double_t mesonPt = ((TParticle*)MCStack->Particle(index))->Pt();
    
-//   Double_t mesonY = 10.;
-//   if(((TParticle*)MCStack->Particle(index))->Energy() - ((TParticle*)MCStack->Particle(index))->Pz() == 0 || ((TParticle*)MCStack->Particle(index))->Energy() + ((TParticle*)MCStack->Particle(index))->Pz() == 0){
-//      mesonY=10.;
-//   } else{
-//      mesonY = 0.5*(TMath::Log((((TParticle*)MCStack->Particle(index))->Energy()+((TParticle*)MCStack->Particle(index))->Pz()) / (((TParticle*)MCStack->Particle(index))->Energy()-((TParticle*)MCStack->Particle(index))->Pz())));
-//   }
    Double_t mesonMass = ((TParticle*)MCStack->Particle(index))->GetCalcMass();
    Float_t functionResult = 1.;
    if (kCaseGen == 1){
index 17e0a4d423b989fbf5a4934a6cc73a9c37a73bf7..41f0a51d610d4dc3b25907317fbfde1b0d07c856 100644 (file)
@@ -14,6 +14,8 @@
 #include "AliStack.h"
 #include "AliAnalysisCuts.h"
 #include "TH1F.h"
+#include "AliAnalysisUtils.h"
+
 
 class AliESDEvent;
 class AliAODEvent;
@@ -198,7 +200,7 @@ class AliConversionCuts : public AliAnalysisCuts {
   Bool_t SetRejectExtraSignalsCut(Int_t extraSignal);
   // Request Flags
 
-  Bool_t IsHeavyIon(){return fIsHeavyIon;}
+  Int_t IsHeavyIon(){return fIsHeavyIon;}
   Int_t GetFirstTPCRow(Double_t radius);
   Float_t GetWeightForMeson(TString period, Int_t index, AliStack *MCStack);
 
@@ -272,7 +274,7 @@ class AliConversionCuts : public AliAnalysisCuts {
   Bool_t   fDoPhotonAsymmetryCut; // flag to use the PhotonAsymetryCut
   Double_t fMinPPhotonAsymmetryCut; // Min Momentum for Asymmetry Cut
   Double_t fMinPhotonAsymmetry;  // Asymmetry Cut
-  Bool_t fIsHeavyIon;               // flag for heavy ion
+  Int_t  fIsHeavyIon;               // flag for heavy ion
   Int_t fDetectorCentrality;   // centrality detecotor V0M or CL1
   Int_t fModCentralityClass; // allows to select smaller centrality classes
   Double_t fMaxVertexZ;    // max z offset of vertex
@@ -303,11 +305,10 @@ class AliConversionCuts : public AliAnalysisCuts {
   Int_t *fNotRejectedStart; //[fnHeaders]
   Int_t *fNotRejectedEnd; //[fnHeaders]
   TString *fGeneratorNames; //[fnHeaders]
-
-
+  TObjString *fCutString; // cut number used for analysis
+  AliAnalysisUtils *fUtils;
 
   // Histograms
-  TObjString *fCutString; // cut number used for analysis
   TH1F *hdEdxCuts;  // bookkeeping for dEdx cuts
   TH2F *hTPCdEdxbefore; // TPC dEdx before cuts
   TH2F *hTPCdEdxafter; // TPC dEdx after cuts
index b4bd35255c66a559af03e32d1070a06075c2b8ca..0a74603c85dc51deb7a5165fdb499e8a1418e3d1 100644 (file)
@@ -47,17 +47,17 @@ ClassImp(AliConversionMesonCuts)
 
 
 const char* AliConversionMesonCuts::fgkCutNames[AliConversionMesonCuts::kNCuts] = {
-   "MesonKind",
-   "BackgroundScheme",
-   "NumberOfBGEvents",
-   "DegreesForRotationMethod",
-   "RapidityMesonCut",
-   "RCut",
-   "AlphaMesonCut",
-   "Chi2MesonCut",
-   "SharedElectronCuts",
-   "RejectToCloseV0s",
-   "UseMCPSmearing",
+   "MesonKind", //0
+   "BackgroundScheme", //1
+   "NumberOfBGEvents", //2
+   "DegreesForRotationMethod", //3
+   "RapidityMesonCut", //4
+   "RCut", //5
+   "AlphaMesonCut", //6
+   "Chi2MesonCut", //7
+   "SharedElectronCuts", //8
+   "RejectToCloseV0s", //9
+   "UseMCPSmearing", //10
 };
 
 
@@ -957,6 +957,8 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
 ///________________________________________________________________________
 void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
 {
+   
+   if (photon==NULL) return;
    Double_t facPBrem = 1.;
    Double_t facPSig = 0.;
 
index ce9e0d0509283c654e3e3286458bafabf5af85f6..e11be17cc96dae58618f5f871f823c5510214eb7 100644 (file)
@@ -6,6 +6,22 @@
 #include "AliStack.h"
 #include "AliLog.h"
 #include "TObject.h"
+#include "AliMCEvent.h"   
+#include "AliESDEvent.h"
+#include "AliKFParticle.h"
+#include "TParticle.h"
+#include <vector>
+#include "AliESDpid.h"
+#include "TF1.h"
+#include "TRandom3.h"
+#include "AliPID.h"
+#include "AliESDtrack.h"
+#include "AliKFVertex.h"
+#include "AliMCEventHandler.h"
+#include "AliESDtrackCuts.h"
+#include "AliGenCocktailEventHeader.h"
+#include "TList.h"
+
 
 using namespace std;
 
index 791fc684baa9645ac88fddf6a8feab6738f8c846..e54a689ad62685d3d5f19b397e04f0cf77c0010a 100644 (file)
@@ -241,13 +241,13 @@ void AliConversionSelection::CalculatePi0Candidates(){
        for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodGammas->GetEntriesFast()-1;firstGammaIndex++){
 
            AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(firstGammaIndex));
-
+      if (gamma0==NULL) continue;
            // Combine Photons
 
            for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGoodGammas->GetEntriesFast();secondGammaIndex++){
 
                AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(secondGammaIndex));
-
+      if (gamma1==NULL) continue;
                //Check for same Electron ID
                if(gamma0->GetTrackLabelPositive()==gamma1->GetTrackLabelPositive()||gamma0->GetTrackLabelNegative()==gamma1->GetTrackLabelNegative()
                   ||gamma0->GetTrackLabelNegative()==gamma1->GetTrackLabelPositive()||gamma0->GetTrackLabelPositive()==gamma1->GetTrackLabelNegative())continue;
@@ -319,9 +319,10 @@ void AliConversionSelection::CalculateBackground(){
        for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodGammas->GetEntriesFast();firstGammaIndex++){
 
            AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(firstGammaIndex));
-
+       if (gamma0 ==NULL) continue;
            for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGoodGammas->GetEntriesFast();secondGammaIndex++){
                AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(secondGammaIndex));
+      if (gamma1==NULL) continue;
                if(!fConversionCut->PhotonIsSelected(gamma1,fInputEvent))continue;
                for(Int_t nRandom=0;nRandom<fMesonCut->GetNumberOfBGEvents();nRandom++){
 
@@ -333,7 +334,7 @@ void AliConversionSelection::CalculateBackground(){
                        if(MesonInMassWindow(&BGcandidate)){
 
                            new((*fBGPi0s)[fBGPi0s->GetEntriesFast()]) AliAODConversionMother(BGcandidate);
-
+             
                            dynamic_cast<AliAODConversionMother*>(fBGPi0s->At(fBGPi0s->GetEntriesFast()-1))->SetWeight(weight);
                        }
                    }
@@ -428,6 +429,7 @@ Int_t AliConversionSelection::GetNumberOfChargedTracks(AliVEvent *inputEvent){
     } else {
        for(Int_t ii=0; ii<inputEvent->GetNumberOfTracks(); ii++) {
            AliVTrack * track = dynamic_cast<AliVTrack*>(inputEvent->GetTrack(ii));
+       if (track==NULL) continue;
            if(TMath::Abs(track->Eta())>fConversionCut->GetEtaCut())continue;
            if(track)ntracks++;
        }
index 5364132a6c135f1db9793e506433fe96c535bace..1c712844ea89ae0697f425b725c7249b47c77177 100644 (file)
@@ -55,6 +55,7 @@ const char* AliDalitzElectronCuts::fgkCutNames[AliDalitzElectronCuts::kNCuts] =
 "piMaxMomdedxSigmaTPCCut",
 "LowPRejectionSigmaCut",
 "kTOFelectronPID",
+"clsITSCut",
 "clsTPCCut",
 "EtaCut",
 "PsiPair",
@@ -67,7 +68,7 @@ const char* AliDalitzElectronCuts::fgkCutNames[AliDalitzElectronCuts::kNCuts] =
 AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title) : AliAnalysisCuts(name,title),
     fHistograms(NULL),
     fPIDResponse(NULL),
-    fesdTrackCuts(0),
+    fesdTrackCuts(NULL),
     fEtaCut(0.9),
     fRadiusCut(1000.0),
     fPsiPairCut(0.45),
@@ -101,6 +102,7 @@ AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title)
     fPIDMinPPionRejectionLowP(0.5),
     fUseCorrectedTPCClsInfo(kFALSE),
     fUseTOFpid(kFALSE),
+    fRequireTOF(kFALSE),
     fUseTrackMultiplicityForBG(kFALSE),
     fBKGMethod(0),
     fnumberOfRotationEventsForBG(0),
@@ -120,7 +122,7 @@ AliDalitzElectronCuts::AliDalitzElectronCuts(const char *name,const char *title)
     fCutString=new TObjString((GetCutNumber()).Data());
 
 
-    fesdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
+    //fesdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
 
    // Using standard function for setting Cuts
     Bool_t selectPrimaries=kTRUE;
@@ -239,6 +241,8 @@ void AliDalitzElectronCuts::InitCutHistograms(TString name, Bool_t preCut,TStrin
     AxisAfter->Set(bins, newBins);
     AxisAfter = hTOFafter->GetXaxis(); 
     AxisAfter->Set(bins, newBins);
+    AxisAfter = hITSdEdxafter->GetXaxis();
+    AxisAfter->Set(bins,newBins); 
     if(preCut){
        AxisBeforeITS->Set(bins, newBins);
        AxisBeforedEdx->Set(bins, newBins);
@@ -276,22 +280,14 @@ Bool_t AliDalitzElectronCuts::ElectronIsSelected(AliESDtrack* lTrack)
 
     if(hCutIndex)hCutIndex->Fill(kElectronIn);
 
-
-    if ( ! lTrack->GetConstrainedParam() ){
-        
+    if (lTrack == NULL){
+      if(hCutIndex)hCutIndex->Fill(kNoTracks);
+         return kFALSE;  
+    }   
        
-
+    if ( ! lTrack->GetConstrainedParam() ){
         return kFALSE;
-
-    }
-
-
-
-    if( ! lTrack ) {
-         if(hCutIndex)hCutIndex->Fill(kNoTracks);
-         return kFALSE;
     }
-
     AliVTrack * track = dynamic_cast<AliVTrack*>(lTrack);
 
 
@@ -495,6 +491,11 @@ Bool_t AliDalitzElectronCuts::dEdxCuts(AliVTrack *fCurrentTrack){
         }
      }
      if(hTOFafter)hTOFafter->Fill(fCurrentTrack->P(),fPIDResponse->NumberOfSigmasTOF(fCurrentTrack, AliPID::kElectron));
+  }
+  else if ( fRequireTOF == kTRUE ) {
+
+            if(hdEdxCuts)hdEdxCuts->Fill(cutIndex);
+            return kFALSE;
   }
      cutIndex++;
 
@@ -556,7 +557,7 @@ Double_t AliDalitzElectronCuts::GetPsiPair( const AliESDtrack *trackPos, const A
 {
 //
 // This angle is a measure for the contribution of the opening in polar
-// direction Δ0 to the opening angle ξ Pair
+// direction ??0 to the opening angle ?? Pair
 //
 // Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC
 //      Master Thesis. Thorsten Dahms. 2005
@@ -708,7 +709,12 @@ Bool_t AliDalitzElectronCuts::SetCut(cutIds cutID, const Int_t value) {
           UpdateCutString(cutID, value);
           return kTRUE;
         } else return kFALSE;
-
+  case kclsITSCut:
+       if( SetITSClusterCut(value) ) {
+         fCuts[kclsITSCut] = value;
+         UpdateCutString(cutID, value);
+         return kTRUE;                 
+        } else return kFALSE;
   case kclsTPCCut:
        if( SetTPCClusterCut(value)) {
          fCuts[kclsTPCCut] = value;
@@ -977,6 +983,39 @@ Bool_t AliDalitzElectronCuts::SetMinMomPiondEdxTPCCut(Int_t piMomdedxSigmaCut)
     }
     return kTRUE;
 }
+///________________________________________________________________________
+Bool_t AliDalitzElectronCuts::SetITSClusterCut(Int_t clsITSCut){
+
+    
+      if( !fesdTrackCuts ) {
+
+         cout<<"Warning: AliESDtrackCut is not initialized "<<endl;
+        return kFALSE;
+      }
+
+      switch(clsITSCut){
+
+       case 0: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
+               break;
+        case 1: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
+               break;  //1 hit first layer of SPD
+        case 2: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+               break; //1 hit in any layer of SPD
+       case 3: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
+               fesdTrackCuts->SetMinNClustersITS(4);
+                // 4 hits in total in the ITS. At least 1 hit in the first layer of SPD  
+                break;
+        case 4: fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+                fesdTrackCuts->SetMinNClustersITS(3);
+                // 3 hits in total in the ITS. At least 1 hit in any layer of SPD
+                break;
+       default:
+        cout<<"Warning: clsITSCut not defined "<<clsITSCut<<endl;
+        return kFALSE;
+    }
+
+return kTRUE;
+}
 
 ///________________________________________________________________________
 Bool_t AliDalitzElectronCuts::SetTPCClusterCut(Int_t clsTPCCut)
@@ -1135,6 +1174,22 @@ Bool_t AliDalitzElectronCuts::SetLowPRejectionCuts(Int_t LowPRejectionSigmaCut)
        fPIDnSigmaAtLowPAroundProtonLine=0.;
        fPIDnSigmaAtLowPAroundPionLine=2.;
        break;
+    case 7: //
+        fDoKaonRejectionLowP=kFALSE;
+        fDoProtonRejectionLowP=kFALSE;
+        fDoPionRejectionLowP=kTRUE;
+        fPIDnSigmaAtLowPAroundKaonLine=0.0;
+        fPIDnSigmaAtLowPAroundProtonLine=0.0;
+        fPIDnSigmaAtLowPAroundPionLine=1.0;
+        break;
+    case 8:
+        fDoKaonRejectionLowP=kFALSE;
+        fDoProtonRejectionLowP=kFALSE;
+        fDoPionRejectionLowP=kTRUE;
+        fPIDnSigmaAtLowPAroundKaonLine=0.;
+        fPIDnSigmaAtLowPAroundProtonLine=0.;
+        fPIDnSigmaAtLowPAroundPionLine=0.5; 
+        break; 
     default:
         cout<<"Warning: LowPRejectionSigmaCut not defined "<<LowPRejectionSigmaCut<<endl;
        return kFALSE;
@@ -1171,6 +1226,12 @@ Bool_t AliDalitzElectronCuts::SetTOFElectronPIDCut(Int_t TOFelectronPID){
        fTofPIDnSigmaBelowElectronLine=-2;
        fTofPIDnSigmaAboveElectronLine=3;
        break;
+    case 5: // -3, 3 TOF mandatory
+        fRequireTOF = kTRUE;
+        fUseTOFpid  = kTRUE;
+        fTofPIDnSigmaBelowElectronLine= -3;
+        fTofPIDnSigmaAboveElectronLine=  3;
+        break;
     default:
         cout<<"Warning: TOFElectronCut not defined "<<TOFelectronPID<<endl;
        return kFALSE;
index 38f607bd7a723016ab039ddbc337d37a75a8c08e..db389b313ece0b3d66447934ca4abf2c8a05af41 100644 (file)
@@ -48,6 +48,7 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
         kpiMaxMomdedxSigmaTPCCut,
         kLowPRejectionSigmaCut,
         kTOFelectronPID,
+        kclsITSCut,
         kclsTPCCut,
        ketaCut,
         kPsiPair,
@@ -121,6 +122,7 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
   Bool_t SetITSdEdxCutElectronLine(Int_t ededxSigmaCut);
   Bool_t SetMinMomPiondEdxTPCCut(Int_t piMomdedxSigmaCut);
   Bool_t SetMaxMomPiondEdxTPCCut(Int_t piMomdedxSigmaCut);
+  Bool_t SetITSClusterCut(Int_t clsITSCut);
   Bool_t SetTPCClusterCut(Int_t clsTPCCut);
   Bool_t SetEtaCut(Int_t etaCut);
   Bool_t SetMinMomPiondEdxCut(Int_t piMinMomdedxSigmaCut);
@@ -184,6 +186,7 @@ class AliDalitzElectronCuts : public AliAnalysisCuts {
 
   Bool_t   fUseCorrectedTPCClsInfo; // flag to use corrected tpc cl info
   Bool_t   fUseTOFpid; // flag to use tof pid
+  Bool_t   fRequireTOF; //flg to analyze only tracks with TOF signal
   Bool_t   fUseTrackMultiplicityForBG; // use multiplicity
   Int_t    fBKGMethod;
   Int_t    fnumberOfRotationEventsForBG;
index 5c50ca7204ca9c48b7d21ea179539f4bedef4781..e647d5ab47fd8ac4343b77482f6d1e60f226d02c 100644 (file)
@@ -23,7 +23,6 @@
 #include "AliKFParticle.h"
 #include "AliAODConversionPhoton.h"
 #include "AliAODConversionMother.h"
-#include "AliAnalysisTaskGammaConversion.h"
 
 using namespace std;
 
diff --git a/PWGGA/GammaConv/AliGammaConversionBGHandler.cxx b/PWGGA/GammaConv/AliGammaConversionBGHandler.cxx
deleted file mode 100644 (file)
index 372aaec..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                        *
- * Version 1.0                                                            *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class for handling of background calculation
-//---------------------------------------------
-////////////////////////////////////////////////
-
-#include "AliGammaConversionBGHandler.h"
-#include "AliKFParticle.h"
-#include "AliAnalysisTaskGammaConversion.h"
-
-using namespace std;
-
-ClassImp(AliGammaConversionBGHandler)
-
-AliGammaConversionBGHandler::AliGammaConversionBGHandler() :
-  TObject(),
-  fNEvents(10),
-  fBGEventCounter(NULL),
-  fBGEventENegCounter(NULL),
-  fBGProbability(NULL),
-  fBGEventVertex(NULL),
-  fNBinsZ(0),
-  fNBinsMultiplicity(0),
-  fBinLimitsArrayZ(NULL),
-  fBinLimitsArrayMultiplicity(NULL),
-  fBGEvents(),
-  fBGEventsENeg()
-{
-  // constructor
-}
-
-AliGammaConversionBGHandler::AliGammaConversionBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents) :
-  TObject(),
-  fNEvents(nEvents),
-  fBGEventCounter(NULL),
-  fBGEventENegCounter(NULL),
-  fBGProbability(NULL),
-  fBGEventVertex(NULL),
-  fNBinsZ(binsZ),
-  fNBinsMultiplicity(binsMultiplicity),
-  fBinLimitsArrayZ(NULL),
-  fBinLimitsArrayMultiplicity(NULL),
-  fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
-  fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents)))
-{
-  // constructor
-}
-
-AliGammaConversionBGHandler::AliGammaConversionBGHandler(const AliGammaConversionBGHandler & original) :
-  TObject(original),
-  fNEvents(original.fNEvents),
-  fBGEventCounter(original.fBGEventCounter),
-  fBGEventENegCounter(original.fBGEventENegCounter),
-  fBGProbability(original.fBGProbability),
-  fBGEventVertex(original.fBGEventVertex),
-  fNBinsZ(original.fNBinsZ),
-  fNBinsMultiplicity(original.fNBinsMultiplicity),
-  fBinLimitsArrayZ(original.fBinLimitsArrayZ),
-  fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity),
-  fBGEvents(original.fBGEvents),
-  fBGEventsENeg(original.fBGEventsENeg)
-{
-  //copy constructor   
-}
-
-AliGammaConversionBGHandler & AliGammaConversionBGHandler::operator = (const AliGammaConversionBGHandler & /*source*/)
-{
-  // assignment operator
-  return *this;
-}
-
-AliGammaConversionBGHandler::~AliGammaConversionBGHandler(){
-
-  //Kenneth remember to clear memory!!!!!!!!!!!!!!!!!!!!!
-  if(fBGEventCounter){
-    for(Int_t z=0;z<fNBinsZ;z++){
-      delete[] fBGEventCounter[z];
-    }
-    delete[] fBGEventCounter;
-    fBGEventCounter = NULL;
-  }
-
-  if(fBGEventVertex){
-    for(Int_t z=0;z<fNBinsZ;z++){
-      for(Int_t m=0;m<fNBinsMultiplicity;m++){
-       delete [] fBGEventVertex[z][m];
-      }
-      delete [] fBGEventVertex[z];
-    }
-    delete [] fBGEventVertex;
-  }
-
-   if(fBGEventENegCounter){
-    for(Int_t z=0;z<fNBinsZ;z++){
-      delete[] fBGEventENegCounter[z];
-    }
-    delete[] fBGEventENegCounter;
-    fBGEventENegCounter = NULL;
-  }
-
-  if(fBinLimitsArrayZ){
-    delete[] fBinLimitsArrayZ;
-  }
-
-  if(fBinLimitsArrayMultiplicity){
-    delete[] fBinLimitsArrayMultiplicity;
-  }
-}
-
-void AliGammaConversionBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){
-  // see header file for documantation  
-
-  if(zBinLimitsArray){
-    fBinLimitsArrayZ = zBinLimitsArray;
-  }
-  else{
-    //Print warning
-  }
-  
-  if(multiplicityBinLimitsArray){
-    fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
-  }
-  else{
-    //Print warning
-  }
-  if(fBGEventCounter == NULL){
-    fBGEventCounter= new Int_t*[fNBinsZ];
-  }
-  for(Int_t z=0;z<fNBinsZ;z++){
-    fBGEventCounter[z]=new Int_t[fNBinsMultiplicity];
-  }
-
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity;m++){
-      fBGEventCounter[z][m]=0;
-    }
-  }
-
-  if(fBGEventVertex == NULL){
-    fBGEventVertex = new GammaConversionVertex**[fNBinsZ];
-  }
-  for(Int_t z=0; z < fNBinsZ; z++){
-    fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity];
-  }
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity; m++){
-      fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents];
-    }
-  }
-  if( fBGEventENegCounter == NULL){
-    fBGEventENegCounter = new Int_t*[fNBinsZ];
-  }
-
-  for(Int_t z=0; z < fNBinsZ; z++){
-    fBGEventENegCounter[z] = new Int_t[fNBinsMultiplicity];
-  }
-
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity; m++){
-      fBGEventENegCounter[z][m] = 0;
-    }
-  }
-
-  if(fBGProbability == NULL){
-    fBGProbability = new Double_t*[fNBinsZ];
-  }
-  for(Int_t z=0; z < fNBinsZ; z++){
-    fBGProbability[z] = new Double_t[fNBinsMultiplicity];
-  }
-
-  for(Int_t z=0;z<fNBinsZ;z++){
-    for(Int_t m=0;m<fNBinsMultiplicity; m++){
-      fBGProbability[z][m] = 0;
-    }
-  }
-  //filling the probability
-  fBGProbability[0][0] = 0.243594;
-  fBGProbability[0][1] = 0.279477;
-  fBGProbability[0][2] = 0.305104;
-  fBGProbability[0][3] = 0.315927;
-  fBGProbability[1][0] = 0.241964;
-  fBGProbability[1][1] = 0.272995;
-  fBGProbability[1][2] = 0.307165;
-  fBGProbability[1][3] = 0.292248;
-  fBGProbability[2][0] = 0.241059;
-  fBGProbability[2][1] = 0.27509;
-  fBGProbability[2][2] = 0.283657;
-  fBGProbability[2][3] = 0.310512;
-  fBGProbability[3][0] = 0.23888;
-  fBGProbability[3][1] = 0.283418;
-  fBGProbability[3][2] = 0.297232;
-  fBGProbability[3][3] = 0.348188;
-  fBGProbability[4][0] = 0.245555;
-  fBGProbability[4][1] = 0.281218;
-  fBGProbability[4][2] = 0.317236;
-  fBGProbability[4][3] = 0.323495;
-  fBGProbability[5][0] = 0.244572;
-  fBGProbability[5][1] = 0.259498;
-  fBGProbability[5][2] = 0.278383;
-  fBGProbability[5][3] = 0.284696;
-  fBGProbability[6][0] = 0.24703;
-  fBGProbability[6][1] = 0.275265;
-  fBGProbability[6][2] = 0.284004;
-  fBGProbability[6][3] = 0.343584;
-}
-
-Int_t AliGammaConversionBGHandler::GetZBinIndex(Double_t zvalue) const{
-  // see header file for documantation
-  if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
-    return 0;
-  }
-
-  for(Int_t i=0; i<fNBinsZ-1 ;i++){
-    if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
-      return i;
-    }
-  }
-  return fNBinsZ-1;
-}
-
-Int_t AliGammaConversionBGHandler::GetMultiplicityBinIndex(Int_t multiplicity) const{
-  // see header file for documantation  
-  if(fNBinsMultiplicity<2){
-    return 0;
-  }
-
-  for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
-    if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
-      return i;
-    }
-  }
-  return fNBinsMultiplicity-1;
-}
-
-void AliGammaConversionBGHandler::AddEvent(TClonesArray * const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity){
-  // see header file for documantation  
-
-  //  cout<<"Entering the AddEvent function"<<endl;
-
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
-
-  if(fBGEventCounter[z][m] >= fNEvents){
-    fBGEventCounter[z][m]=0;
-  }
-  Int_t eventCounter=fBGEventCounter[z][m];
-  
-  /*
-  if(fBGEventVertex[z][m][eventCounter]){
-    delete fBGEventVertex[z][m][eventCounter];
-  }
-  */
-  fBGEventVertex[z][m][eventCounter].fX = xvalue;
-  fBGEventVertex[z][m][eventCounter].fY = yvalue;
-  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
-
-  //first clear the vector
-  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
-
-  //  cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
-    delete (AliKFParticle*)(fBGEvents[z][m][eventCounter][d]);
-  }
-  fBGEvents[z][m][eventCounter].clear();
-  
-  // add the gammas to the vector
-  for(Int_t i=0; i< eventGammas->GetEntriesFast();i++){
-    //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
-    fBGEvents[z][m][eventCounter].push_back(new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i))));
-  }
-  fBGEventCounter[z][m]++;
-}
-void AliGammaConversionBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
-
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
-
-  if(fBGEventENegCounter[z][m] >= fNEvents){
-     fBGEventENegCounter[z][m]=0;
-  }
-
-   Int_t eventENegCounter=fBGEventENegCounter[z][m];
-  
-  //first clear the vector
-  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
-
-  //  cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
-  for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
-    delete (AliKFParticle*)(fBGEventsENeg[z][m][eventENegCounter][d]);
-  }
-
-  fBGEventsENeg[z][m][eventENegCounter].clear();
-
-  // add the electron to the vector
-  for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
-    //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
-    fBGEventsENeg[z][m][eventENegCounter].push_back(new AliKFParticle(*(AliKFParticle*)(eventENeg->At(i))));
-  }
-
-  fBGEventENegCounter[z][m]++;
-
-
-}
-AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event){
-  //see headerfile for documentation
-  return &(fBGEvents[zbin][mbin][event]);
-}
-AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){
-
-
-  //see headerfile for documentation
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
-  return &(fBGEventsENeg[z][m][event]);
-
-
-}
-void AliGammaConversionBGHandler::PrintBGArray(){
-  //see headerfile for documentation
-  for(Int_t z=0;z<fNBinsZ;z++){
-    if(z==2){
-      cout<<"Getting the data for z bin: "<<z<<endl;
-      for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
-       if(multiplicity==2){
-         cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;  
-         for(Int_t event=0;event<fNEvents;event++){
-           if(fBGEvents[z][multiplicity][event].size()>0){
-             cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
-           }
-         }
-       }
-      }
-    }
-  }
-}
diff --git a/PWGGA/GammaConv/AliGammaConversionBGHandler.h b/PWGGA/GammaConv/AliGammaConversionBGHandler.h
deleted file mode 100644 (file)
index 2ded014..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-//-*- Mode: C++ -*-
-#ifndef ALIGAMMACONVERSIONBGHANDLER_H
-#define ALIGAMMACONVERSIONBGHANDLER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice     */
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class  for handling of background calculation
-//---------------------------------------------
-////////////////////////////////////////////////
-
-#include <vector>
-
-
-// --- ROOT system ---
-#include <TObject.h> 
-#include "AliKFParticle.h"
-#include "TClonesArray.h"
-#include "AliESDVertex.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-typedef vector<AliKFParticle*> AliGammaConversionKFVector;
-
-class AliGammaConversionBGHandler : public TObject {
-
- public: 
-  struct GammaConversionVertex
-  {
-    Double_t fX;
-    Double_t fY;
-    Double_t fZ;
-  };
-  typedef struct GammaConversionVertex GammaConversionVertex; //!
-
-  typedef vector<AliGammaConversionKFVector> AliGammaConversionBGEventVector;
-  typedef vector<AliGammaConversionBGEventVector> AliGammaConversionMultipicityVector;
-  typedef vector<AliGammaConversionMultipicityVector> AliGammaConversionBGVector;
-
-  AliGammaConversionBGHandler();                                                        //constructor
-  AliGammaConversionBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t fNEvents);    //constructor
-  AliGammaConversionBGHandler(const AliGammaConversionBGHandler & g);                   //copy constructor
-  AliGammaConversionBGHandler & operator = (const AliGammaConversionBGHandler & g);     //assignment operator
-  virtual ~AliGammaConversionBGHandler();                                               //virtual destructor
-
-  void Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray);
-
-  Int_t GetZBinIndex(Double_t z) const;
-
-  Int_t GetMultiplicityBinIndex(Int_t mult) const;
-
-  void AddEvent(TClonesArray * const eventGammas, Double_t xvalue,Double_t yvalue,Double_t zvalue, Int_t multiplicity);
-  void AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity);
-
-  Int_t GetNBGEvents()const {return fNEvents;}
-
-  AliGammaConversionKFVector* GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event);
-  AliGammaConversionKFVector* GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity);
-  void PrintBGArray();
-
-  GammaConversionVertex * GetBGEventVertex(Int_t zbin, Int_t mbin, Int_t event){return &fBGEventVertex[zbin][mbin][event];}
-
-  Double_t GetBGProb(Int_t z, Int_t m){return fBGProbability[z][m];}
-
- private:
-
-  Int_t fNEvents; // number of events
-  Int_t ** fBGEventCounter; //! bg counter
-  Int_t ** fBGEventENegCounter;//! bg electron counter
-  Double_t ** fBGProbability; //! prob per bin
-  GammaConversionVertex *** fBGEventVertex;//! array of event vertex
-  Int_t fNBinsZ; //n z bins
-  Int_t fNBinsMultiplicity; //n bins multiplicity
-  Double_t *fBinLimitsArrayZ;//! bin limits z array
-  Double_t *fBinLimitsArrayMultiplicity;//! bin limit multiplicity array
-  AliGammaConversionBGVector fBGEvents; //gackground events
-  AliGammaConversionBGVector fBGEventsENeg; //background electron events
-  ClassDef(AliGammaConversionBGHandler,2)
-};
-#endif
diff --git a/PWGGA/GammaConv/AliGammaConversionHistograms.cxx b/PWGGA/GammaConv/AliGammaConversionHistograms.cxx
deleted file mode 100644 (file)
index 89b499e..0000000
+++ /dev/null
@@ -1,928 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                        *
- * Version 1.1                                                            *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class used to do analysis on conversion pairs
-//---------------------------------------------
-////////////////////////////////////////////////
-
-#include "AliGammaConversionHistograms.h"
-#include "TMath.h"
-#include "TObjString.h"
-#include "TMap.h"
-#include "TList.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TH3F.h"
-#include "AliLog.h"
-
-using namespace std;
-
-ClassImp(AliGammaConversionHistograms)
-
-
-AliGammaConversionHistograms::AliGammaConversionHistograms() :
-       fHistogramMap(new TMap()),
-       fNPhiIndex(0),
-       fNRIndex(0),
-       fNZIndex(0),
-       //  fRBinLimits(0),
-       //  fZBinLimits(0),
-       fMinRadius(0.),
-       fMaxRadius(0.),
-       fDeltaR(0.),
-       fMinPhi(0.),
-       fMaxPhi(0.),
-       fDeltaPhi(0.),
-       fMappingContainer(NULL),
-       fBackgroundContainer(NULL),
-       fDebugContainer(NULL),
-       fResolutionContainer(NULL),
-       fMatchContainer(NULL),
-       fESDContainer(NULL),
-       fMCContainer(NULL),
-       fTableContainer(NULL),  
-       fOtherContainer(NULL),
-       f3DContainer(NULL),
-       fHadContainer(NULL)
-{
-  // see header file for documenation
-  for(Int_t i=0;i<14;i++){
-    fRBinLimits[i]=0.;
-  }
-  for(Int_t i=0;i<12;i++){
-    fZBinLimits[i]=0.;
-  }
-}
-
-
-AliGammaConversionHistograms::AliGammaConversionHistograms(const AliGammaConversionHistograms & original) :
-       fHistogramMap(original.fHistogramMap),
-       fNPhiIndex(original.fNPhiIndex),
-       fNRIndex(original.fNRIndex),
-       fNZIndex(original.fNZIndex),
-       //  fRBinLimits(original.fRBinLimits),
-       //  fZBinLimits(original.fZBinLimits),
-       fMinRadius(original.fMinRadius),
-       fMaxRadius(original.fMaxRadius),
-       fDeltaR(original.fDeltaR),
-       fMinPhi(original.fMinPhi),
-       fMaxPhi(original.fMaxPhi),
-       fDeltaPhi(original.fDeltaPhi),
-       fMappingContainer(original.fMappingContainer),
-       fBackgroundContainer(original.fBackgroundContainer),
-       fDebugContainer(original.fDebugContainer),
-       fResolutionContainer(original.fResolutionContainer),
-       fMatchContainer(original.fMatchContainer),
-       fESDContainer(original.fESDContainer),
-       fMCContainer(original.fMCContainer),
-       fTableContainer(original.fTableContainer), 
-       fOtherContainer(original.fOtherContainer),
-       f3DContainer(original.f3DContainer),
-       fHadContainer(original.fHadContainer)
-       {    
-       //see header file for documentation
-       for(Int_t i=0;i<14;i++){
-               fRBinLimits[i]= original.fRBinLimits[i];
-       }
-       for(Int_t i=0;i<12;i++){
-               fZBinLimits[i]=original.fZBinLimits[i];
-       }
-}
-
-
-AliGammaConversionHistograms & AliGammaConversionHistograms::operator = (const AliGammaConversionHistograms & /*original*/)
-{
-  // assignment operator
-  return *this;
-}
-
-
-AliGammaConversionHistograms::~AliGammaConversionHistograms() {
-  //destructor
-       
-       
-}
-
-void AliGammaConversionHistograms::AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX,Double_t lastX,TString xAxisTitle, TString yAxisTitle){
-  // see header file for documentation
-  if( fHistogramMap->Contains(histogramName.Data()) ==  kFALSE ){
-    TH1F *tmp = new TH1F(histogramName, histogramTitle,nXBins,firstX,lastX);
-    tmp->GetXaxis()->SetTitle(xAxisTitle);
-    tmp->GetYaxis()->SetTitle(yAxisTitle);
-    TObjString* tobjstring = new TObjString(histogramName.Data());
-    fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);
-  }
-  else{
-    cout << "Warning: Histogram ( "<<histogramName.Data()<<" ) already exists " << endl;
-  }
-}
-
-void AliGammaConversionHistograms::AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle, Int_t logAxis){
-  // see header file for documentation
-  if( fHistogramMap->Contains(histogramName.Data()) ==  kFALSE ){
-    TH2F *tmp = new TH2F(histogramName, histogramTitle,nXBins,firstX,lastX,nYBins,firstY,lastY);
-    tmp->GetXaxis()->SetTitle(xAxisTitle);
-    tmp->GetYaxis()->SetTitle(yAxisTitle);
-    TObjString *tobjstring = new TObjString(histogramName.Data());
-    fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);
-
-    if(logAxis >= 0){
-      BinLogAxis(histogramName.Data(), logAxis);
-    }
-  }
-  else{
-    cout << "Warning: Histogram ( "<<histogramName.Data()<<" ) already exists " << endl;
-  }
-}
-
-void AliGammaConversionHistograms::AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, Int_t nZBins, Double_t firstZ, Double_t lastZ, TString xAxisTitle, TString yAxisTitle, TString zAxisTitle, Int_t logAxis ){
-  // see header file for documentation
-  if( fHistogramMap->Contains(histogramName.Data()) ==  kFALSE ){
-    TH3F *tmp = new TH3F(histogramName, histogramTitle,nXBins,firstX,lastX,nYBins,firstY,lastY,nZBins,firstZ,lastZ);
-    tmp->GetXaxis()->SetTitle(xAxisTitle);
-    tmp->GetYaxis()->SetTitle(yAxisTitle);
-    tmp->GetZaxis()->SetTitle(zAxisTitle);
-    TObjString *tobjstring = new TObjString(histogramName.Data());
-    fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);
-    if(logAxis >= 0){
-      BinLogAxis(histogramName.Data(), logAxis);
-    }
-  }
-  else{
-    cout << "Warning: Histogram ( "<<histogramName.Data()<<" ) already exists " << endl;
-  }
-}
-
-
-Bool_t AliGammaConversionHistograms::BinLogAxis(const char* name, Int_t dim){
-
-  //
-  // converts the axis (defined by the dimension) of THx or THnSparse
-  // object to Log scale. Number of bins and bin min and bin max are preserved
-  
-  TObject *o =  fHistogramMap->GetValue(name);
-  TAxis *axis = 0x0;
-  if(o->InheritsFrom("TH1")){
-    axis = (dynamic_cast<TH1F*>(o))->GetXaxis();
-  }
-  if(o->InheritsFrom("TH2")){
-    if(0 == dim){
-      axis = (dynamic_cast<TH2F*>(o))->GetXaxis();
-    }
-    else if(1 == dim){
-      axis = (dynamic_cast<TH2F*>(o))->GetYaxis();
-    }
-     else{
-       //  AliError("Only dim = 0 or 1 possible for TH2F");
-     }
-  }
-  //  if(o->InheritsFrom("THnSparse")){
-  //  axis = (dynamic_cast<THnSparse*>(o))->GetAxis(dim);
-  //}
-
-  if(!axis){
-    //AliError(Form("Axis '%d' could not be identified in the object '%s'\n", dim, name));
-    return kFALSE;
-  }
-
-  Int_t bins = axis->GetNbins();
-
-  Double_t from = axis->GetXmin();
-  if(from <= 0){
-    // AliError(Form(" Log binning not possible for object '%s'because the '%d' axis starts from '%f\n'", name, dim, from));
-    return kFALSE;
-  }
-  Double_t to = axis->GetXmax();
-  Double_t *newBins = new Double_t[bins+1];
-  newBins[0] = from;
-  Double_t factor = TMath::Power(to/from, 1./bins);
-  for(Int_t i=1; i<=bins; ++i){
-    newBins[i] = factor * newBins[i-1];
-  }
-  axis->Set(bins, newBins);
-  delete [] newBins;
-
-  return kTRUE;
-
-
-}
-
-void AliGammaConversionHistograms::AddTable(TString tableName,TString tableTitle,Int_t nXBins,const char * axesLabel[]){
-  //see header file for documentation
-
-  if( fHistogramMap->Contains(tableName.Data()) ==  kFALSE ){
-    TH1F *tmp = new TH1F(tableName,tableTitle,nXBins,0,nXBins);
-    for(Int_t xbin=1; xbin<=nXBins; xbin++){
-      tmp->GetXaxis()->SetBinLabel(xbin,axesLabel[xbin-1]);
-    }
-    tmp->SetStats(0);
-    
-    TObjString *tobjstring = new TObjString(tableName.Data());
-    fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);
-  }
-  else{
-    cout << "Warning: Table ( "<<tableName.Data()<<" ) already exists " << endl;
-  }
-}
-void AliGammaConversionHistograms::AddTable(TString tableName,TString tableTitle,Int_t nXBins,const char * axesXLabel[],Int_t nYBins,const char * axesYLabel[]){
-  //see header file for documentation
-
-  if( fHistogramMap->Contains(tableName.Data()) ==  kFALSE ){
-    TH2F *tmp = new TH2F(tableName,tableTitle,nXBins,0,nXBins,nYBins,0,nYBins);
-    for(Int_t xbin=1; xbin<=nXBins; xbin++){
-      tmp->GetXaxis()->SetBinLabel(xbin,axesXLabel[xbin-1]);
-    }
-    for(Int_t ybin=1; ybin<=nYBins; ybin++){
-      tmp->GetYaxis()->SetBinLabel(ybin,axesYLabel[ybin-1]);
-    }
-    tmp->SetStats(0);
-    
-    TObjString *tobjstring = new TObjString(tableName.Data());
-    fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);
-  }
-  else{
-    cout << "Warning: Table ( "<<tableName.Data()<<" ) already exists " << endl;
-  }
-}
-
-void AliGammaConversionHistograms::AddTable(TString tableName,TString tableTitle,Int_t nXBins,const char * axesXLabel[],Int_t nYBins,const char * axesYLabel[], Int_t nZBins,const char * axesZLabel[]){
-  //see header file for documentation
-
-  if( fHistogramMap->Contains(tableName.Data()) ==  kFALSE ){
-    TH3F *tmp = new TH3F(tableName,tableTitle,nXBins,0,nXBins,nYBins,0,nYBins,nZBins,0,nZBins);
-    for(Int_t xbin=1; xbin<=nXBins; xbin++){
-      tmp->GetXaxis()->SetBinLabel(xbin,axesXLabel[xbin-1]);
-    }
-    for(Int_t ybin=1; ybin<=nYBins; ybin++){
-      tmp->GetYaxis()->SetBinLabel(ybin,axesYLabel[ybin-1]);
-    }
-    for(Int_t zbin=1; zbin<=nZBins; zbin++){
-      tmp->GetZaxis()->SetBinLabel(zbin,axesZLabel[zbin-1]);
-    }
-    
-    tmp->SetStats(0);
-    
-    TObjString *tobjstring = new TObjString(tableName.Data());
-    fHistogramMap->Add((TObject*)tobjstring,(TObject*)tmp);
-  }
-  else{
-    cout << "Warning: Table ( "<<tableName.Data()<<" ) already exists " << endl;
-  }
-}
-
-void AliGammaConversionHistograms::FillTable(TString tableName,Double_t xValue) const {
-  //see header file for documentation
-  TH1 *tmp = (TH1*)fHistogramMap->GetValue(tableName.Data());
-  if(tmp){
-    tmp->Fill(xValue);
-  }
-}
-void AliGammaConversionHistograms::FillTable(TString tableName,Double_t xValue,Double_t yValue) const {
-  //see header file for documentation
-  TH2 *tmp = (TH2*)fHistogramMap->GetValue(tableName.Data());
-  if(tmp){
-    tmp->Fill(xValue,yValue);
-  }
-}
-void AliGammaConversionHistograms::FillTable(TString tableName,Double_t xValue,Double_t yValue, Double_t zValue) const {
-  //see header file for documentation
-  TH3 *tmp = (TH3*)fHistogramMap->GetValue(tableName.Data());
-  if(tmp){
-    tmp->Fill(xValue,yValue,zValue);
-  }
-}
-
-void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t xValue) const{
-  //see header file for documentation
-  TH1 *tmp = (TH1*)fHistogramMap->GetValue(histogramName.Data());
-  if(tmp){
-    tmp->Fill(xValue);
-  }
-}
-
-void AliGammaConversionHistograms::FillHistogram(TString histogramName, Float_t* xValue, Int_t nPoints) const{
-       //see header file for documentation
-       TH1 *tmp = (TH1*)fHistogramMap->GetValue(histogramName.Data());
-       if(tmp){
-               for( Int_t ii = 1; ii < nPoints+1; ii++){                 
-                       tmp->SetBinContent(ii,xValue[ii]);
-               }
-       }
-}
-
-void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t xValue, Double_t yValue) const{
-  //see header file for documentation
-  TH1 *tmp = (TH1*)fHistogramMap->GetValue(histogramName.Data());
-  if(tmp){
-    tmp->Fill(xValue, yValue);
-  }
-}
-
-void AliGammaConversionHistograms::FillHistogram(TString histogramName, Double_t xValue, Double_t yValue, Double_t zValue) const{
-  //see header file for documentation
-  TH3 *tmp = (TH3*)fHistogramMap->GetValue(histogramName.Data());
-  if(tmp){
-    tmp->Fill(xValue, yValue, zValue);
-  }
-}
-
-
-TObject* AliGammaConversionHistograms::GetValue(const TString& name)
-{ 
-  //Get pointer to histogram with name
-  return fHistogramMap->GetValue(name.Data());
-}
-
-void AliGammaConversionHistograms::GetOutputContainer(TList *fOutputContainer){
-  //checking if the container is alrerady created
-       
-       if(fOutputContainer == NULL){
-               cout<<"WARNING: GetOutputContainer: output container object is NULL"<<endl;
-               return;
-       }
-
-       if(fHistogramMap != NULL){
-               TIter iter(fHistogramMap);
-               TObjString *histogramName;
-               while ((histogramName = (TObjString*) iter.Next())) {
-                       TString histogramString = histogramName->GetString();
-                       if(histogramString.Contains("Mapping")){// means it should be put in the mapping folder
-                               if(fMappingContainer == NULL){
-                                       fMappingContainer = new TList();
-                                       fMappingContainer->SetOwner(kTRUE);
-                                       fMappingContainer->SetName("Mapping histograms");
-                               }
-                               fMappingContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("HadInt")){// means it should be put in the Table Folder
-                               if(fHadContainer == NULL){
-                                       fHadContainer = new TList();
-                                       fHadContainer->SetOwner(kTRUE);
-                                       fHadContainer->SetName("Hadronic Interactions histograms");
-                               }
-                               fHadContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));      
-                       } else if(histogramString.Contains("Background")){// means it should be put in the background folder
-                               if(fBackgroundContainer == NULL){
-                                       fBackgroundContainer = new TList();
-                                       fBackgroundContainer->SetOwner(kTRUE);
-                                       fBackgroundContainer->SetName("Background histograms");
-                               }
-                               fBackgroundContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("Debug")){// means it should be put in the debug folder
-                               if(fDebugContainer == NULL){
-                                       fDebugContainer = new TList();
-                                       fDebugContainer->SetOwner(kTRUE);
-                                       fDebugContainer->SetName("Debug histograms");
-                               }
-                               fDebugContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("Resolution")){// means it should be put in the resolution folder
-                               if(fResolutionContainer == NULL){
-                                       fResolutionContainer = new TList();
-                                       fResolutionContainer->SetOwner(kTRUE);
-                                       fResolutionContainer->SetName("Resolution histograms");
-                               }
-                               fResolutionContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("TrueConv")){// means it should be put in the true conv folder
-                               if(fMatchContainer == NULL){
-                                       fMatchContainer = new TList();
-                                       fMatchContainer->SetOwner(kTRUE);
-                                       fMatchContainer->SetName("True conversion histograms");
-                               }
-                               fMatchContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("ESD")){// means it should be put in the ESD folder
-                               if(fESDContainer == NULL){
-                                       fESDContainer = new TList();
-                                       fESDContainer->SetOwner(kTRUE);
-                                       fESDContainer->SetName("ESD histograms");
-                               }
-                               fESDContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("MC")){// means it should be put in the MC folder
-                               if(fMCContainer == NULL){
-                                       fMCContainer = new TList();
-                                       fMCContainer->SetOwner(kTRUE);
-                                       fMCContainer->SetName("MC histograms");
-                               }
-                               fMCContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("Table")){// means it should be put in the Table Folder
-                               if(fTableContainer == NULL){
-                                       fTableContainer = new TList();
-                                       fTableContainer->SetOwner(kTRUE);
-                                       fTableContainer->SetName("Tables");
-                               }
-                               fTableContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("3DPlots")){// means it should be put in the Table Folder
-                               if(f3DContainer == NULL){
-                                       f3DContainer = new TList();
-                                       f3DContainer->SetOwner(kTRUE);
-                                       f3DContainer->SetName("3D histograms");
-                               }
-                               f3DContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else if(histogramString.Contains("HadInt")){// means it should be put in the Table Folder
-                               if(fHadContainer == NULL){
-                                       fHadContainer = new TList();
-                                       fHadContainer->SetOwner(kTRUE);
-                                       fHadContainer->SetName("Hadronic Interactions histograms");
-                               }
-                               fHadContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       } else{
-                               if(fOtherContainer == NULL){
-                                       fOtherContainer = new TList();
-                                       fOtherContainer->SetOwner(kTRUE);
-                                       fOtherContainer->SetName("Other histograms");
-                               }
-                               fOtherContainer->Add((TH1*)fHistogramMap->GetValue(histogramString.Data()));
-                       }
-                       histogramName = NULL;
-               } // end while
-
-               if(fMappingContainer != NULL){
-                       fOutputContainer->Add(fMappingContainer);
-               }
-               if(fBackgroundContainer != NULL){
-                       fOutputContainer->Add(fBackgroundContainer);
-               }
-               if(fDebugContainer != NULL){
-                       fOutputContainer->Add(fDebugContainer);
-               }
-               if(fResolutionContainer != NULL){
-                       fOutputContainer->Add(fResolutionContainer);
-               }
-               if(fMatchContainer != NULL){
-                       fOutputContainer->Add(fMatchContainer);
-               }
-               if(fESDContainer != NULL){
-                       fOutputContainer->Add(fESDContainer);
-               }
-               if(fMCContainer != NULL){
-                       fOutputContainer->Add(fMCContainer);
-               }
-               if(fTableContainer !=  NULL){
-                       fOutputContainer->Add(fTableContainer); 
-               }
-               if(f3DContainer !=  NULL){
-                       fOutputContainer->Add(f3DContainer);    
-               }
-               if(fHadContainer !=  NULL){
-                       fOutputContainer->Add(fHadContainer);   
-               }
-               if(fOtherContainer != NULL){
-                       fOutputContainer->Add(fOtherContainer);
-               }
-       }
-}
-
-Int_t AliGammaConversionHistograms::GetRBin(Double_t radius) const{
-  // see header file for documentation
-  Int_t iResult=0;
-//   if(fDeltaR>0){
-//     iResult = (Int_t)((radius - fMinRadius)/fDeltaR);
-//   }
-  for(Int_t i=0;i<fNRIndex;i++){
-    //    cout<<"Test-limits::"<< fRBinLimits[i]<<endl;
-    if( radius>=fRBinLimits[i] && radius<fRBinLimits[i+1] ){
-      iResult=i;
-    }
-  }
-  return iResult;
-}
-
-Int_t AliGammaConversionHistograms::GetZBin(Double_t zPos) const{
-  // see header file for documentation
-  Int_t iResult=0;
-
-  for(Int_t i=0;i<fNZIndex;i++){
-    //    cout<<"Test-limits::"<< fZBinLimits[i]<<endl;
-    if( zPos>=fZBinLimits[i] && zPos<fZBinLimits[i+1] ){
-      iResult=i;
-    }
-  }
-  return iResult;
-}
-
-
-
-Int_t AliGammaConversionHistograms::GetPhiBin(Double_t phi) const{
-  // see header file for documentation
-  Int_t iResult=0;
-  if(fDeltaPhi>0){
-    if(phi>TMath::Pi()){
-      phi-=2*TMath::Pi();
-    }
-    iResult = (Int_t)((phi - fMinPhi)/fDeltaPhi);
-  }
-  return iResult;
-}
-
-
-
-void AliGammaConversionHistograms::InitializeMappingValues(Int_t nPhiIndex, Int_t nRIndex, Int_t nBinsR, Double_t minRadius, Double_t maxRadius,Int_t nBinsPhi, Double_t minPhi, Double_t maxPhi){
-  // Initializing the valuse for the mapping
-       
-  fNPhiIndex = nPhiIndex;
-  if(nRIndex<=14){
-    fNRIndex   = nRIndex;
-  }else{
-    fNRIndex=14;
-  }
-
-  fNZIndex = 13;
-
-  //  fRBinLimits= new Double_t[8];   Kenneth: moved from pointer to fixed array
-  /*
-  fRBinLimits[0]=0.;
-  fRBinLimits[1]=13.;   //changed from 12 to 13: A. Marin 01.03.10
-  fRBinLimits[2]=21.;   //changed from 22 to 21: A. Marin 01.03.10 
-  fRBinLimits[3]=35.;
-  fRBinLimits[4]=55.;
-  fRBinLimits[5]=72.;
-  fRBinLimits[6]=90.;
-  fRBinLimits[7]=500.;
-  */
-
-  fRBinLimits[0]=0.;
-  fRBinLimits[1]=3.5;
-  fRBinLimits[2]=5.75;
-  fRBinLimits[3]=9.5;
-  fRBinLimits[4]=13.;
-  fRBinLimits[5]=21.;
-  fRBinLimits[6]=27.5;
-  fRBinLimits[7]=35.;
-  fRBinLimits[8]=42.;
-  fRBinLimits[9]=55.;
-  fRBinLimits[10]=72.;
-  fRBinLimits[11]=79.5; // change from 81.5 to 79.5 to have CE in 1 r bin 81.05
-  fRBinLimits[12]=90.;
-  fRBinLimits[13]=500.;
-
-
-
-  //  fZBinLimits= new Double_t[7]; Kenneth: moved from pointer to fixed array
-  fZBinLimits[0]=-500.;
-  fZBinLimits[1]=-200.;
-  fZBinLimits[2]=-100.;
-  fZBinLimits[3]=-50.;
-  fZBinLimits[4]=-30.;
-  fZBinLimits[5]=-15.;
-  fZBinLimits[6]= 0.;
-  fZBinLimits[7]= 15.;
-  fZBinLimits[8]= 30.;
-  fZBinLimits[9]= 50.;
-  fZBinLimits[10]=100.;
-  fZBinLimits[11]=200.;
-  fZBinLimits[12]=500.;
-
-
-  fMinRadius      = minRadius;
-  fMaxRadius      = maxRadius;
-  if(nBinsR>0 && nRIndex!=0){
-    fDeltaR       = (fMaxRadius - fMinRadius)/nRIndex;
-  }
-  fMinPhi         = minPhi;
-  fMaxPhi         = maxPhi;
-  if(nBinsPhi>0 && nPhiIndex!=0){
-    fDeltaPhi     = (fMaxPhi-fMinPhi)/nPhiIndex;
-  }
-}
-
-
-//mapping
-void AliGammaConversionHistograms::AddMappingHistograms(Int_t nPhiIndex, Int_t nRIndex,Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle, TString yAxisTitle){
-  // see header file for documentation
-
-  Double_t tmptogetridofwarning = firstX + lastX + nYBins + firstY + lastY;
-  if(tmptogetridofwarning < 0){
-    cout<<"Less than zero"<<endl;
-  }
-       
-  for(Int_t phi =0; phi<fNPhiIndex;phi++){
-               
-    for(Int_t r =0; r<fNRIndex;r++){
-                       
-      // setting axis to "" changes below
-      xAxisTitle="z [cm]";
-      yAxisTitle="#eta";
-         
-      //Creating the axis titles
-      //if(xAxisTitle.Length() == 0){
-       //xAxisTitle.Form("Phi %02d",phi);
-        //      }
-                       
-      //if(yAxisTitle.Length() == 0){
-       //yAxisTitle.Form("R %02d",phi);
-               // }
-                       
-      //MC
-      TString nameMC="";
-      nameMC.Form("MC_Conversion_Mapping_Phi%02d_R%02d",phi,r);
-      TString titleMC="";
-      titleMC.Form("Electron-Positron MC Mapping-Phi%02d-R%02d",phi,r);
-                       
-      //AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);
-                       
-      //ESD
-      TString nameESD="";
-      nameESD.Form("ESD_Conversion_Mapping_Phi%02d_R%02d",phi,r);
-      TString titleESD="";
-      titleESD.Form("Electron-Positron ESD Mapping-Phi%02d-R%02d",phi,r);
-                       
-      //AddHistogram(nameESD, titleESD, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);
-    }
-  }
-       
-       
-  for(Int_t phi =0; phi<=nPhiIndex;phi++){ 
-               
-    // setting axis to "" changes below
-     xAxisTitle="z [cm]";
-      yAxisTitle="#eta";
-   //Creating the axis titles
-    //if(xAxisTitle.Length() == 0){
-    //  xAxisTitle.Form("Phi %02d",phi);
-    //}
-    //if(yAxisTitle.Length() == 0){
-    //  yAxisTitle = "Counts";
-    //}
-               
-    //MC
-    TString nameMC="";
-    nameMC.Form("MC_Conversion_Mapping_Phi%02d",phi);
-    TString titleMC="";
-    titleMC.Form("Electron-Positron MC Mapping-Phi%02d",phi);
-               
-    //AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);
-               
-    //MC
-    TString nameESD="";
-    nameESD.Form("ESD_Conversion_Mapping_Phi%02d",phi);
-    TString titleESD="";
-    titleESD.Form("Electron-Positron ESD Mapping-Phi%02d",phi);
-               
-    // AddHistogram(nameESD, titleESD, nXBins, firstX, lastX,nYBins, firstY, lastY, xAxisTitle, yAxisTitle);
-  }
-       
-       
-  for(Int_t r =0; r<nRIndex;r++){
-               
-    // setting axis to "" changes below
-    xAxisTitle="#phi";
-    yAxisTitle="counts";
-    //Creating the axis titles
-    //if(xAxisTitle.Length() == 0){
-    //  xAxisTitle.Form("R %02d",r);
-    //}
-    //if(yAxisTitle.Length() == 0){
-    //  yAxisTitle = "Counts";
-    //}
-               
-    //MC
-    TString nameMC="";
-    nameMC.Form("MC_Conversion_Mapping_R%02d",r);
-    TString titleMC="";
-    titleMC.Form("Electron-Positron MC Mapping-R%02d",r);
-               
-    // AddHistogram(nameMC, titleMC, nXBins, firstX, lastX, nYBins, firstY, lastY, xAxisTitle, yAxisTitle);
-               
-    //ESD
-    TString nameESD="";
-    nameESD.Form("ESD_Conversion_Mapping_R%02d",r);
-    TString titleESD="";
-    titleESD.Form("Electron-Positron ESD Mapping-R%02d",r);
-               
-    //AddHistogram(nameESD, titleESD, nXBins, firstX, lastX,nYBins, firstY, lastY, xAxisTitle, yAxisTitle);
-               
-    //Mapping Phi in R
-    TString nameMCPhiInR="";
-    nameMCPhiInR.Form("MC_Conversion_Mapping_Phi_in_R_%02d",r);
-    TString titleMCPhiInR="";
-    titleMCPhiInR.Form("MC Mapping of Phi in R%02d",r);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-               
-
-    //Mapping Z in R
-    TString nameMCZInR="";
-    nameMCZInR.Form("MC_Conversion_Mapping_Z_in_R_%02d",r);
-    TString titleMCZInR="";
-    titleMCZInR.Form("MC Mapping of Z in R%02d",r);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCZInR, titleMCZInR, nXBins, -300, 300, xAxisTitle, yAxisTitle);
-
-
-   //Mapping Phi in R Middle Pt
-    TString nameMCMidPtPhiInR="";
-    nameMCMidPtPhiInR.Form("MC_Conversion_Mapping_MidPt_Phi_in_R_%02d",r);
-    TString titleMCMidPtPhiInR="";
-    titleMCMidPtPhiInR.Form("MC Mapping Middle Pt of Phi in R%02d",r);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCMidPtPhiInR, titleMCMidPtPhiInR, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-               
-
-    //Mapping Z in R Middle Pt
-    TString nameMCMidPtZInR="";
-    nameMCMidPtZInR.Form("MC_Conversion_Mapping_MidPt_Z_in_R_%02d",r);
-    TString titleMCMidPtZInR="";
-    titleMCMidPtZInR.Form("MC Mapping Middle Pt of Z in R%02d",r);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCMidPtZInR, titleMCMidPtZInR, nXBins, -300, 300, xAxisTitle, yAxisTitle);
-
-
-
-
-    //Mapping Phi in R
-    TString nameESDPhiInR="";
-    nameESDPhiInR.Form("ESD_Conversion_Mapping_Phi_in_R_%02d",r);
-    TString titleESDPhiInR="";
-    titleESDPhiInR.Form("ESD Mapping of Phi in R%02d",r);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-   //Mapping Z in R
-    TString nameESDZInR="";
-    nameESDZInR.Form("ESD_Conversion_Mapping_Z_in_R_%02d",r);
-    TString titleESDZInR="";
-    titleESDZInR.Form("ESD Mapping of Z in R%02d",r);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDZInR, titleESDZInR, nXBins, -300, 300, xAxisTitle, yAxisTitle);    
-
-    //Mapping Phi in R Middle Pt 
-    TString nameESDMidPtPhiInR="";
-    nameESDMidPtPhiInR.Form("ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",r);
-    TString titleESDMidPtPhiInR="";
-    titleESDMidPtPhiInR.Form("ESD Mapping Middle Pt of Phi in R%02d",r);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDMidPtPhiInR, titleESDMidPtPhiInR, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-   //Mapping Z in R Middle Pt
-    TString nameESDMidPtZInR="";
-    nameESDMidPtZInR.Form("ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",r);
-    TString titleESDMidPtZInR="";
-    titleESDMidPtZInR.Form("ESD Mapping Middle Pt of Z in R%02d",r);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDMidPtZInR, titleESDMidPtZInR, nXBins, -300, 300, xAxisTitle, yAxisTitle);    
-
-
-  }
-
-
-
-  for(Int_t z =0; z<fNZIndex;z++){
-    //Mapping Phi in Z
-    TString nameMCPhiInZ="";
-    nameMCPhiInZ.Form("MC_Conversion_Mapping_Phi_in_Z_%02d",z);
-    TString titleMCPhiInZ="";
-    titleMCPhiInZ.Form("MC Mapping of Phi in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCPhiInZ, titleMCPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-    //Mapping Phi in Z for FMD
-    TString nameMCFMDPhiInZ="";
-    nameMCFMDPhiInZ.Form("MC_Conversion_Mapping_FMD_Phi_in_Z_%02d",z);
-    TString titleMCFMDPhiInZ="";
-    titleMCFMDPhiInZ.Form("MC Mapping FMD of Phi in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCFMDPhiInZ, titleMCFMDPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-               
-    //Mapping Phi in Z for ITSTPC
-    TString nameMCITSTPCPhiInZ="";
-    nameMCITSTPCPhiInZ.Form("MC_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",z);
-    TString titleMCITSTPCPhiInZ="";
-    titleMCITSTPCPhiInZ.Form("MC Mapping ITSTPC of Phi in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCITSTPCPhiInZ, titleMCITSTPCPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-
-    //Mapping Phi in Z for ITSTPC2 
-    TString nameMCITSTPC2PhiInZ="";
-    nameMCITSTPC2PhiInZ.Form("MC_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",z);
-    TString titleMCITSTPC2PhiInZ="";
-    titleMCITSTPC2PhiInZ.Form("MC Mapping ITSTPC2 of Phi in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCITSTPC2PhiInZ, titleMCITSTPC2PhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-
-
-    //Mapping R in Z
-    TString nameMCRInZ="";
-    nameMCRInZ.Form("MC_Conversion_Mapping_R_in_Z_%02d",z);
-    TString titleMCRInZ="";
-    titleMCRInZ.Form("MC Mapping of R in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCRInZ, titleMCRInZ, nXBins, fMinRadius, fMaxRadius, xAxisTitle, yAxisTitle);
-
-   //Mapping Phi in Z Middle Pt
-    TString nameMCMidPtPhiInZ="";
-    nameMCMidPtPhiInZ.Form("MC_Conversion_Mapping_MidPt_Phi_in_Z_%02d",z);
-    TString titleMCMidPtPhiInZ="";
-    titleMCMidPtPhiInZ.Form("MC Mapping Middle Pt of Phi in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCMidPtPhiInZ, titleMCMidPtPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-               
-   //Mapping Phi in Z Middle Pt for FMD
-    TString nameMCMidPtFMDPhiInZ="";
-    nameMCMidPtFMDPhiInZ.Form("MC_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",z);
-    TString titleMCMidPtFMDPhiInZ="";
-    titleMCMidPtFMDPhiInZ.Form("MC Mapping Middle Pt of Phi in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCMidPtFMDPhiInZ, titleMCMidPtFMDPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);
-               
-
-
-    //Mapping R in Z Middle Pt
-    TString nameMCMidPtRInZ="";
-    nameMCMidPtRInZ.Form("MC_Conversion_Mapping_MidPt_R_in_Z_%02d",z);
-    TString titleMCMidPtRInZ="";
-    titleMCMidPtRInZ.Form("MC Mapping Middle Pt of R in Z%02d",z);
-    //    AddHistogram(nameMCPhiInR, titleMCPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);
-    AddHistogram(nameMCMidPtRInZ, titleMCMidPtRInZ, nXBins, fMinRadius, fMaxRadius, xAxisTitle, yAxisTitle);
-
-
-
-
-    //Mapping Phi in Z
-    TString nameESDPhiInZ="";
-    nameESDPhiInZ.Form("ESD_Conversion_Mapping_Phi_in_Z_%02d",z);
-    TString titleESDPhiInZ="";
-    titleESDPhiInZ.Form("ESD Mapping of Phi in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDPhiInZ, titleESDPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-
-    //Mapping Phi in Z for FMD
-    TString nameESDFMDPhiInZ="";
-    nameESDFMDPhiInZ.Form("ESD_Conversion_Mapping_FMD_Phi_in_Z_%02d",z);
-    TString titleESDFMDPhiInZ="";
-    titleESDFMDPhiInZ.Form("ESD Mapping FMD of Phi in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDFMDPhiInZ, titleESDFMDPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-    //Mapping Phi in Z for ITSTPC
-    TString nameESDITSTPCPhiInZ="";
-    nameESDITSTPCPhiInZ.Form("ESD_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",z);
-    TString titleESDITSTPCPhiInZ="";
-    titleESDITSTPCPhiInZ.Form("ESD Mapping ITSTPC of Phi in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDITSTPCPhiInZ, titleESDITSTPCPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-   //Mapping Phi in Z for ITSTPC2
-    TString nameESDITSTPC2PhiInZ="";
-    nameESDITSTPC2PhiInZ.Form("ESD_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",z);
-    TString titleESDITSTPC2PhiInZ="";
-    titleESDITSTPC2PhiInZ.Form("ESD Mapping ITSTPC2 of Phi in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDITSTPC2PhiInZ, titleESDITSTPC2PhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-
-   //Mapping R in Z
-    TString nameESDRInZ="";
-    nameESDRInZ.Form("ESD_Conversion_Mapping_R_in_Z_%02d",z);
-    TString titleESDRInZ="";
-    titleESDRInZ.Form("ESD Mapping of R in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDRInZ, titleESDRInZ, nXBins, fMinRadius, fMaxRadius, xAxisTitle, yAxisTitle);    
-
-
-   //Mapping Phi in Z Middle Pt
-    TString nameESDMidPtPhiInZ="";
-    nameESDMidPtPhiInZ.Form("ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",z);
-    TString titleESDMidPtPhiInZ="";
-    titleESDMidPtPhiInZ.Form("ESD Mapping Middle Ptof Phi in R%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDMidPtPhiInZ, titleESDMidPtPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-   //Mapping Phi in Z Middle Pt for FMD
-    TString nameESDMidPtFMDPhiInZ="";
-    nameESDMidPtFMDPhiInZ.Form("ESD_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",z);
-    TString titleESDMidPtFMDPhiInZ="";
-    titleESDMidPtFMDPhiInZ.Form("ESD Mapping Middle Pt FMD of Phi in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDMidPtFMDPhiInZ, titleESDMidPtFMDPhiInZ, nXBins, -TMath::Pi(), TMath::Pi(), xAxisTitle, yAxisTitle);    
-
-
-   //Mapping R in Z Middle Pt
-    TString nameESDMidPtRInZ="";
-    nameESDMidPtRInZ.Form("ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",z);
-    TString titleESDMidPtRInZ="";
-    titleESDMidPtRInZ.Form("ESD Mapping Middle Pt of R in Z%02d",z);
-    //    AddHistogram(nameESDPhiInR, titleESDPhiInR, nXBins, firstX, lastX, xAxisTitle, yAxisTitle);    
-    AddHistogram(nameESDMidPtRInZ, titleESDMidPtRInZ, nXBins, fMinRadius, fMaxRadius, xAxisTitle, yAxisTitle);    
-
-
-
-  }
-
-
-
-}
diff --git a/PWGGA/GammaConv/AliGammaConversionHistograms.h b/PWGGA/GammaConv/AliGammaConversionHistograms.h
deleted file mode 100644 (file)
index 2242fb9..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-#ifndef ALIGAMMACONVERSIONHISTOGRAMS_H
-#define ALIGAMMACONVERSIONHISTOGRAMS_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice     */
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class used to do analysis on conversion pairs
-//---------------------------------------------
-////////////////////////////////////////////////
-
-#include "TString.h"
-#include "Riostream.h"
-#include <vector>
-
-class TMap;
-class TList;
-class TH1F;
-class TH2F;
-class TH3F;
-
-class AliGammaConversionHistograms{
-
- public: 
-  
-  AliGammaConversionHistograms();                                                                  //constructor
-  AliGammaConversionHistograms(const AliGammaConversionHistograms & original);                     //copy constructor
-  AliGammaConversionHistograms & operator = (const AliGammaConversionHistograms & original);       //assignment operator
-  virtual ~AliGammaConversionHistograms();                                                         //virtual destructor
-  
-
-  //  TList * GetOutputContainer();
-  void GetOutputContainer(TList *fOutputContainer);
-  
-  Int_t GetRBin(Double_t radius) const;
-  Int_t GetPhiBin(Double_t phi) const;
-  Int_t GetZBin(Double_t radius) const;
-  void InitializeMappingValues(Int_t nPhiHistograms, Int_t nRHistograms, Int_t nBinsR, Double_t minRadius, Double_t maxRadius,Int_t nBinsPhi, Double_t minPhi, Double_t maxPhi);
-
-  void AddMappingHistograms(Int_t nPhiHistograms, Int_t nRHistograms,Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle="", TString yAxisTitle="");
-
-  /*
-   * Adds a TH1F histogram to the histogram map and create a key for it 
-   */
-  void AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX,Double_t lastX,TString xAxisTitle="", TString yAxisTitle="");
-
-  /*
-   * Adds a TH2F histogram to the histogram map and create a key for it 
-   */
-  void AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, TString xAxisTitle="", TString yAxisTitle="", Int_t logAxis =-1);
-
-  /*
-   * Adds a TH3F histogram to the histogram map and create a key for it 
-   */  
-  void AddHistogram(TString histogramName, TString histogramTitle, Int_t nXBins, Double_t firstX, Double_t lastX, Int_t nYBins, Double_t firstY, Double_t lastY, Int_t nZBins, Double_t firstZ, Double_t lastZ, TString xAxisTitle="", TString yAxisTitle="", TString zAxisTitle="", Int_t logAxis =-1);
-
-  /*
-   * Create a logx binning suitable for dEdx plots
-   */
-  Bool_t BinLogAxis(const char* name, Int_t dim);
-
-
-  /*
-   *  Adds a TH1F Table to the table map and create a key for it
-   */
-  void AddTable(TString tableName,TString tableTitle,Int_t nXBins, const char * axesLabel[]);
-    
- /*
-  *  Adds a TH2F Table    
-  */  
-       
-  void AddTable(TString tableName,TString tableTitle,Int_t nXBins, const char * axesXLabel[],Int_t nYBins, const char* axesYLabel[]);
-
-
-  /*
-  *  Adds a TH3F Table    
-  */  
-       
-  void AddTable(TString tableName,TString tableTitle,Int_t nXBins, const char * axesXLabel[],Int_t nYBins, const char* axesYLabel[],Int_t nZBins, const char* axesZLabel[]);
-
-  /*
-   * Fills a TH1F histogram with the given name with the given value 
-   */
-  void FillHistogram(TString histogramName, Double_t xValue) const;
-
-  /*
-   * Fills a TH2F histogram with the given name with the given value 
-   */
-  void FillHistogram(TString histogramName, Double_t xValue, Double_t yValue) const;
-
-  /*
-   * Fills a TH3F histogram with the given name with the given value 
-   */
-  void FillHistogram(TString histogramName, Double_t xValue, Double_t yValue, Double_t zValue) const;
-
-  /*
-   * Fills a TH1F histogram with the given name with the given integer array 
-   */
-  
-  void FillHistogram(TString histogramName, Float_t* xValue, Int_t nPoints) const;
-  
-  /*
-   * Fills a TH1F table with the given name with the given value
-   */                  
-  void FillTable(TString tableName, Double_t xValue) const;
-
-  /*  
-   *  Fills a TH2F table with the given name with the given value
-   */  
-  void FillTable(TString tableName, Double_t xValue, Double_t yValue) const;
-
-    /*  
-   *  Fills a TH3F table with the given name with the given value
-   */  
-  void FillTable(TString tableName, Double_t xValue, Double_t yValue, Double_t zValue) const;
-
-  /*
-   *Returns a pointer to the histogram associated with name.
-   */
-   TObject* GetValue(const TString& name);
-
-
- private:
-  TMap* fHistogramMap; // histogram map
-  
-
-
-  Int_t fNPhiIndex; //phi index
-  Int_t fNRIndex; //r index
-  Int_t fNZIndex; //z index
-  //  Double_t fRBinLimits[8]; // Limits of the radius bins
-  Double_t fRBinLimits[14]; // Limits of the radius bins
-  Double_t fZBinLimits[13]; // Limits of the Z bins
-  Double_t fMinRadius; //min radius cut
-  Double_t fMaxRadius; //max radius cut
-  Double_t fDeltaR; // delta r
-  Double_t fMinPhi; //min phi
-  Double_t fMaxPhi; // max phi
-  Double_t fDeltaPhi;//delta phi
-
-  TList * fMappingContainer; //mapping container
-  TList * fBackgroundContainer; // background container
-  TList * fDebugContainer; // debug container
-  TList * fResolutionContainer; //resolution container
-  TList * fMatchContainer; //match container
-  TList * fESDContainer;//esd container
-  TList * fMCContainer; // MC container
-  TList * fTableContainer; // table container
-  TList * fOtherContainer; // other container
-  TList * f3DContainer; // 3D container
-  TList * fHadContainer; // Hadronic Interactions container
-  ClassDef(AliGammaConversionHistograms,4)
-};
-
-
-#endif
-
-
-
index ef0c1f842da4a409b1bdd0799e8a01a99e96c878..35c0bcc8a1c23752fa76764a8c5e831679901184 100644 (file)
@@ -1,5 +1,5 @@
 #include "AliKFConversionPhoton.h"
-#include "AliV0Reader.h"
+// #include "AliV0Reader.h"
 #include "AliESDtrack.h"
 #include "AliESDpid.h"
 #include <iostream>
@@ -25,33 +25,33 @@ AliConversionPhotonBase()
 
 }
 
-AliKFConversionPhoton::AliKFConversionPhoton(AliV0Reader *fV0Reader) ://,AliESDEvent *fESDEvent) :
-AliKFParticle(*fV0Reader->GetMotherCandidateKFCombination()),
-AliConversionPhotonBase()
-
-{
-
-    fV0Index=fV0Reader->GetCurrentV0IndexNumber()-1;   //?? Checked and its correct
-
-   //Default constructor
-   fLabel[0] = fV0Reader->GetCurrentV0()->GetPindex();
-   fLabel[1] = fV0Reader->GetCurrentV0()->GetNindex();
-
-  SetArmenterosQtAlpha(fArmenteros,*fV0Reader->GetNegativeKFParticle(),*fV0Reader->GetPositiveKFParticle());
-
-  fConversionPoint[0]=fV0Reader->GetX();
-  fConversionPoint[1]=fV0Reader->GetY();
-  fConversionPoint[2]=fV0Reader->GetZ();
-
-  //Chi2
-
-  Double_t ndf=fV0Reader->GetMotherCandidateNDF();
-  if(ndf>0)fChi2perNDF=fV0Reader->GetMotherCandidateChi2()/ndf;
-
-
-  SetPsiPair(fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
-
-}
+// AliKFConversionPhoton::AliKFConversionPhoton(AliV0Reader *fV0Reader) ://,AliESDEvent *fESDEvent) :
+// AliKFParticle(*fV0Reader->GetMotherCandidateKFCombination()),
+// AliConversionPhotonBase()
+// 
+// {
+// 
+//     fV0Index=fV0Reader->GetCurrentV0IndexNumber()-1;   //?? Checked and its correct
+// 
+//    //Default constructor
+//    fLabel[0] = fV0Reader->GetCurrentV0()->GetPindex();
+//    fLabel[1] = fV0Reader->GetCurrentV0()->GetNindex();
+// 
+//   SetArmenterosQtAlpha(fArmenteros,*fV0Reader->GetNegativeKFParticle(),*fV0Reader->GetPositiveKFParticle());
+// 
+//   fConversionPoint[0]=fV0Reader->GetX();
+//   fConversionPoint[1]=fV0Reader->GetY();
+//   fConversionPoint[2]=fV0Reader->GetZ();
+// 
+//   //Chi2
+// 
+//   Double_t ndf=fV0Reader->GetMotherCandidateNDF();
+//   if(ndf>0)fChi2perNDF=fV0Reader->GetMotherCandidateChi2()/ndf;
+// 
+// 
+//   SetPsiPair(fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
+// 
+// }
                                                                
 AliKFConversionPhoton::AliKFConversionPhoton(const AliKFParticle &fCurrentNegativeKFParticle,const AliKFParticle &fCurrentPositiveKFParticle) :
 AliKFParticle(fCurrentNegativeKFParticle,fCurrentPositiveKFParticle),
index bc770e6155cdca983044a1d90c0f7ad7962d1240..5c01dee995ae9b82b60ce3676518a0f5a2af30bc 100644 (file)
 #include "TMath.h"
 #include "AliConversionPhotonBase.h"
 #include "AliKFParticle.h"
-#include "AliV0Reader.h"
+// #include "AliV0Reader.h"
 #include "AliESDEvent.h"
 #include "AliPID.h"
 #include "AliStack.h"
 #include "TParticle.h"
+#include "TF1.h"
+#include "TRandom3.h"
 
 class AliConversionPhotonBase;
 
@@ -29,7 +31,7 @@ class AliKFConversionPhoton : public AliKFParticle, public AliConversionPhotonBa
   //Constructors
   AliKFConversionPhoton();    
   AliKFConversionPhoton(AliKFParticle &kfparticle);
-  AliKFConversionPhoton(AliV0Reader *fV0Reader);
+//   AliKFConversionPhoton(AliV0Reader *fV0Reader);
   AliKFConversionPhoton(const AliKFParticle &fCurrentNegativeKFParticle,const AliKFParticle &fCurrentPositiveKFParticle);
 
   //Copy Constructor
diff --git a/PWGGA/GammaConv/AliV0Reader.cxx b/PWGGA/GammaConv/AliV0Reader.cxx
deleted file mode 100644 (file)
index 13c49f0..0000000
+++ /dev/null
@@ -1,2524 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                                                                                                                                                                                                                                             *
- * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                                                                                             *
- * Version 1.0                                                                                                                                                                                                                                         *
- *                                                                                                                                                                                                                                                                                             *
- * Permission to use, copy, modify and distribute this software and its         *
- * documentation strictly for non-commercial purposes is hereby granted         *
- * without fee, provided that the above copyright notice appears in all         *
- * copies and that both the copyright notice and this permission notice         *
- * appear in the supporting documentation. The authors make no claims           *
- * about the suitability of this software for any purpose. It is                                       *
- * provided "as is" without express or implied warranty.                                                                       *
- **************************************************************************/
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class used to do analysis on conversion pairs
-//---------------------------------------------
-////////////////////////////////////////////////
-
-// --- ROOT system ---
-#include <TMath.h>
-
-//---- ANALYSIS system ----
-#include "AliV0Reader.h"
-#include "AliAnalysisManager.h"
-#include "AliESDInputHandler.h"
-#include "AliPID.h"
-#include "AliESDtrack.h"
-#include "AliMCEvent.h"
-#include "AliKFVertex.h"
-#include "AliKFParticle.h"
-#include "AliStack.h"
-#include "AliMCEventHandler.h"
-#include "AliESDpid.h"
-#include "AliGammaConversionBGHandler.h"
-#include "AliESDtrackCuts.h"
-#include "TRandom3.h"
-#include "AliGenCocktailEventHeader.h"
-#include "TList.h"
-
-class iostream;
-class AliESDv0;
-class TFormula;
-class TRandom3;
-
-using namespace std;
-
-ClassImp(AliV0Reader)
-
-
-AliESDpid* AliV0Reader::fgESDpid = 0x0;
-
-AliV0Reader::AliV0Reader() :
-       TObject(),
-       fMCStack(NULL),
-       // fMCTruth(NULL),
-       fMCEvent(NULL),         // for CF
-       fChain(NULL),
-       // fESDHandler(NULL),
-       fESDEvent(NULL),
-       fCFManager(NULL),
-       //fESDpid(NULL),
-       fHistograms(NULL),
-       fCurrentV0IndexNumber(0),
-       fCurrentV0(NULL),
-       fCurrentNegativeKFParticle(NULL),
-       fCurrentPositiveKFParticle(NULL),
-       fCurrentMotherKFCandidate(NULL),
-       fCurrentNegativeESDTrack(NULL),
-       fCurrentPositiveESDTrack(NULL),
-       fNegativeTrackLorentzVector(NULL),
-       fPositiveTrackLorentzVector(NULL),
-       fMotherCandidateLorentzVector(NULL),
-       fCurrentXValue(0),
-       fCurrentYValue(0),
-       fCurrentZValue(0),
-       fPositiveTrackPID(0),
-       fNegativeTrackPID(0),
-       fNegativeMCParticle(NULL),
-       fPositiveMCParticle(NULL),
-       fMotherMCParticle(NULL),
-       fMotherCandidateKFMass(0),
-       fMotherCandidateKFWidth(0),
-       fUseKFParticle(kTRUE),
-       fUseESDTrack(kFALSE),
-       fDoMC(kFALSE),
-       fMaxVertexZ(100.),// 100 cm(from the 0)
-       fMaxR(10000),// 100 meter(outside of ALICE)
-       fMinR(0),// 100 meter(outside of ALICE)
-       fEtaCut(0.),
-       fEtaCutMin(-0.1),
-       fRapidityMesonCut(0.),
-       fPtCut(0.),
-       fSinglePtCut(0.),
-       fMaxZ(0.),
-       fMinClsTPC(0.),
-       fMinClsTPCToF(0.),
-       fLineCutZRSlope(0.),
-       fLineCutZValue(0.),
-       fLineCutZRSlopeMin(0.),
-       fLineCutZValueMin(0.),
-       fChi2CutConversion(0.),
-       fChi2CutMeson(0.),
-       fAlphaCutMeson(1.),
-       fAlphaMinCutMeson(0.),
-       fPIDProbabilityCutNegativeParticle(0),
-       fPIDProbabilityCutPositiveParticle(0),
-       fDodEdxSigmaCut(kFALSE),
-       fDoTOFsigmaCut(kFALSE), // RRnewTOF
-       fPIDnSigmaAboveElectronLine(100),
-       fPIDnSigmaBelowElectronLine(-100),
-       fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF
-       fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF
-       fPIDnSigmaAbovePionLine(-100),
-       fPIDnSigmaAbovePionLineHighPt(-100),
-       fPIDMinPnSigmaAbovePionLine(100), 
-       fPIDMaxPnSigmaAbovePionLine(100), 
-       fDoKaonRejectionLowP(kFALSE),
-       fDoProtonRejectionLowP(kFALSE),
-       fDoPionRejectionLowP(kFALSE),
-       fPIDnSigmaAtLowPAroundKaonLine(0),
-       fPIDnSigmaAtLowPAroundProtonLine(0),
-       fPIDnSigmaAtLowPAroundPionLine(0),
-       fPIDMinPKaonRejectionLowP(0),
-       fPIDMinPProtonRejectionLowP(0),
-       fPIDMinPPionRejectionLowP(0),
-       fDoQtGammaSelection(kFALSE),
-       fDoHighPtQtGammaSelection(kFALSE), // RRnew
-       fQtMax(100.),
-       fHighPtQtMax(100.), // RRnew
-       fPtBorderForQt(100.), // RRnew
-       fXVertexCut(0.),
-       fYVertexCut(0.),
-       fZVertexCut(0.),
-       fPsiPairCut(0.),
-       fCosinePointCut(0.),
-       fNSigmaMass(0.),
-       fUseImprovedVertex(kFALSE),
-       fUseOwnXYZCalculation(kFALSE),
-       fUseConstructGamma(kFALSE),
-       fDoCF(kFALSE),
-       fUseEtaMinCut(kFALSE),
-       fUseOnFlyV0Finder(kTRUE),
-       fUpdateV0AlreadyCalled(kFALSE),
-       fCurrentEventGoodV0s(NULL),
-       fV0Pindex(),
-       fV0Nindex(),
-//     fPreviousEventGoodV0s(),
-       fCalculateBackground(kFALSE),
-       fBGEventHandler(NULL),
-       fBGEventInitialized(kFALSE),
-       fEsdTrackCuts(NULL),
-       fNumberOfESDTracks(0),
-       fNEventsForBGCalculation(20),
-       fUseChargedTrackMultiplicityForBG(kTRUE),
-       fNumberOfGoodV0s(0),
-       fIsHeavyIon(0),
-       fUseCorrectedTPCClsInfo(kFALSE),
-       fUseMCPSmearing(kTRUE),
-       fPBremSmearing(1.),
-       fPSigSmearing(0.),
-       fPSigSmearingCte(0.),
-       fRandom(0),
-       fBrem(NULL),
-       fDoPhotonAsymmetryCut(0),
-       fdoESDQtCut(0),
-       fMinPPhotonAsymmetryCut(100.),
-       fMinPhotonAsymmetry(0.),
-        fExcludeBackgroundEventForGammaCorrection(0),
-        fNumberOfPrimerisFromHijingAndPythia(0)
-{
-       //fESDpid = new AliESDpid;      
-}
-
-
-AliV0Reader::AliV0Reader(const AliV0Reader & original) :
-       TObject(original),
-       fMCStack(original.fMCStack),
-       // fMCTruth(original.fMCTruth),
-       fMCEvent(original.fMCEvent),    // for CF
-       fChain(original.fChain),
-       //      fESDHandler(original.fESDHandler),
-       fESDEvent(original.fESDEvent),
-       fCFManager(original.fCFManager),
-       // fESDpid(original.fESDpid),
-       fHistograms(original.fHistograms),
-       fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
-       fCurrentV0(original.fCurrentV0),
-       fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
-       fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
-       fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
-       fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
-       fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
-       fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
-       fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
-       fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
-       fCurrentXValue(original.fCurrentXValue),
-       fCurrentYValue(original.fCurrentYValue),
-       fCurrentZValue(original.fCurrentZValue),
-       fPositiveTrackPID(original.fPositiveTrackPID),
-       fNegativeTrackPID(original.fNegativeTrackPID),
-       fNegativeMCParticle(original.fNegativeMCParticle),
-       fPositiveMCParticle(original.fPositiveMCParticle),
-       fMotherMCParticle(original.fMotherMCParticle),
-       fMotherCandidateKFMass(original.fMotherCandidateKFMass),
-       fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
-       fUseKFParticle(kTRUE),
-       fUseESDTrack(kFALSE),
-       fDoMC(kFALSE),
-       fMaxVertexZ(original.fMaxVertexZ),
-       fMaxR(original.fMaxR),
-       fMinR(original.fMinR),
-       fEtaCut(original.fEtaCut),
-       fEtaCutMin(original.fEtaCutMin),
-       fRapidityMesonCut(original.fRapidityMesonCut),
-       fPtCut(original.fPtCut),
-       fSinglePtCut(original.fSinglePtCut),
-       fMaxZ(original.fMaxZ),
-       fMinClsTPC(original.fMinClsTPC),
-       fMinClsTPCToF(original.fMinClsTPCToF),
-       fLineCutZRSlope(original.fLineCutZRSlope),
-       fLineCutZValue(original.fLineCutZValue),
-       fLineCutZRSlopeMin(original.fLineCutZRSlopeMin),
-       fLineCutZValueMin(original.fLineCutZValueMin),
-       fChi2CutConversion(original.fChi2CutConversion),
-       fChi2CutMeson(original.fChi2CutMeson),
-       fAlphaCutMeson(original.fAlphaCutMeson),
-       fAlphaMinCutMeson(original.fAlphaMinCutMeson),
-       fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
-       fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
-       fDodEdxSigmaCut(original.fDodEdxSigmaCut),
-       fDoTOFsigmaCut(original.fDoTOFsigmaCut), // RRnewTOF
-       fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
-       fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
-       fTofPIDnSigmaAboveElectronLine(original.fTofPIDnSigmaAboveElectronLine), // RRnewTOF
-       fTofPIDnSigmaBelowElectronLine(original.fTofPIDnSigmaBelowElectronLine), // RRnewTOF
-       fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine), 
-       fPIDnSigmaAbovePionLineHighPt(original.fPIDnSigmaAbovePionLineHighPt), 
-       fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine), 
-       fPIDMaxPnSigmaAbovePionLine(original.fPIDMaxPnSigmaAbovePionLine), 
-       fDoKaonRejectionLowP(original.fDoKaonRejectionLowP),
-       fDoProtonRejectionLowP(original.fDoProtonRejectionLowP),
-       fDoPionRejectionLowP(original.fDoPionRejectionLowP),
-       fPIDnSigmaAtLowPAroundKaonLine(original.fPIDnSigmaAtLowPAroundKaonLine),
-       fPIDnSigmaAtLowPAroundProtonLine(original.fPIDnSigmaAtLowPAroundProtonLine),
-       fPIDnSigmaAtLowPAroundPionLine(original.fPIDnSigmaAtLowPAroundPionLine),
-       fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP),
-       fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP),
-       fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP),
-       fDoQtGammaSelection(original.fDoQtGammaSelection),
-       fDoHighPtQtGammaSelection(original.fDoHighPtQtGammaSelection), // RRnew
-       fQtMax(original.fQtMax),
-       fHighPtQtMax(original.fHighPtQtMax), // RRnew
-       fPtBorderForQt(original.fPtBorderForQt), // RRnew
-       fXVertexCut(original.fXVertexCut),
-       fYVertexCut(original.fYVertexCut),
-       fZVertexCut(original.fZVertexCut),
-       fPsiPairCut(original.fPsiPairCut),
-       fCosinePointCut(original.fCosinePointCut),
-       fNSigmaMass(original.fNSigmaMass),
-       fUseImprovedVertex(original.fUseImprovedVertex),
-       fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
-       fUseConstructGamma(original.fUseConstructGamma),
-       fDoCF(original.fDoCF),
-       fUseEtaMinCut(original.fUseEtaMinCut),
-       fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
-       fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
-       fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
-       fV0Pindex(original.fV0Pindex),
-       fV0Nindex(original.fV0Nindex),
-       //      fPreviousEventGoodV0s(original.fPreviousEventGoodV0s),
-       fCalculateBackground(original.fCalculateBackground),
-       fBGEventHandler(original.fBGEventHandler),
-       fBGEventInitialized(original.fBGEventInitialized),
-       fEsdTrackCuts(original.fEsdTrackCuts),
-       fNumberOfESDTracks(original.fNumberOfESDTracks),
-       fNEventsForBGCalculation(original.fNEventsForBGCalculation),
-       fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG),
-       fNumberOfGoodV0s(original.fNumberOfGoodV0s),
-       fIsHeavyIon(original.fIsHeavyIon),
-       fUseCorrectedTPCClsInfo(original.fUseCorrectedTPCClsInfo),
-       fUseMCPSmearing(original.fUseMCPSmearing),
-       fPBremSmearing(original.fPBremSmearing),
-       fPSigSmearing(original.fPSigSmearing),
-       fPSigSmearingCte(original.fPSigSmearingCte),
-       fRandom(original.fRandom),
-       fBrem(original.fBrem),
-       fDoPhotonAsymmetryCut(original.fDoPhotonAsymmetryCut),
-       fdoESDQtCut(original.fdoESDQtCut),
-       fMinPPhotonAsymmetryCut(original.fMinPPhotonAsymmetryCut),
-       fMinPhotonAsymmetry(original.fMinPhotonAsymmetry),
-        fExcludeBackgroundEventForGammaCorrection(original.fExcludeBackgroundEventForGammaCorrection),
-        fNumberOfPrimerisFromHijingAndPythia(original.fNumberOfPrimerisFromHijingAndPythia)
-{
-       
-}
-
-
-AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
-{
-       // assignment operator
-       return *this;
-}
-AliV0Reader::~AliV0Reader()
-{
-       //      if(fESDpid){
-       // delete fESDpid;
-       //}
-}
-
-//____________________________________________________________________________
-void AliV0Reader::SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) {
-       // Connect the data pointers
-
-       SetInputEvent(esd);
-       SetMC(mc);
-
-}
-
-
-void AliV0Reader::Initialize(){
-       //see header file for documentation
-
-       fUpdateV0AlreadyCalled = kFALSE;        
-
-       /*
-       // Get the input handler from the manager
-       fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-       if(fESDHandler == NULL){
-               //print warning here
-       }
-
-       // Get pointer to esd event from input handler
-       fESDEvent = fESDHandler->GetEvent();
-       if(fESDEvent == NULL){
-               //print warning here
-       }
-
-       //Get pointer to MCTruth
-       fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
-       */
-
-
-
-       //      fMCTruth = mcH->MCEvent();
-       //      fMC = mcH->MCEvent();
-       // stack = fMC->Stack();
-
-
-       //if(fMCTruth == NULL){
-               //print warning here
-       // fDoMC = kFALSE;
-       //}
-
-       if(fMCEvent == NULL){
-               fDoMC = kFALSE;
-       }
-
-       //Get pointer to the mc stack
-       //      if(fMCTruth){
-       if(fMCEvent){
-               fMCStack = fMCEvent->Stack();
-               // if(fMCStack == NULL){
-               //      //print warning here
-               // }
-               // Better parameters for MonteCarlo from A. Kalweit 2010/01/8
-//              fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
-//                                                     1.75295e+01,
-//                                                     3.40030e-09,
-//                                                     1.96178e+00,
-//                                                     3.91720e+00);
-       }
-       else{
-               // Better parameters for data from A. Kalweit 2010/01/8
- //            fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
-//                                              2.63394e+01,
-//                                              5.04114e-11,
-//                                              2.12543e+00,
-//                                              4.88663e+00);
-       }
-       
-       // for CF
-       //Get pointer to the mc event
-       if(fDoCF && fDoMC){
-               //fMCEvent = fMCTruth->MCEvent();
-               if(fMCEvent == NULL){
-                       //print warning here
-                       fDoCF = kFALSE;
-               }       
-       }
-       
-       fUseEtaMinCut = kFALSE;
-       if ( fEtaCutMin != -0.1) {
-               fUseEtaMinCut = kTRUE;
-       }
-
-
-       AliKFParticle::SetField(fESDEvent->GetMagneticField());
-
-       //      fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0);
-       if(fCurrentEventGoodV0s == NULL){
-               fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0);
-       }
-
-       fV0Pindex.clear();
-       fV0Nindex.clear();
-
-//     if(gRandom != NULL){
-//             delete gRandom;
-//             gRandom= new TRandom3(0);
-//     }
-
-
-       if (fBrem == NULL){
-               fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
-               // tests done with 1.0e-14
-               fBrem->SetParameter(0,fPBremSmearing);
-               fBrem->SetNpx(100000);
-       }
-
-       if(fCalculateBackground == kTRUE){
-               if(fBGEventInitialized == kFALSE){
-
-                       Double_t *zBinLimitsArray = new Double_t[9];
-                       zBinLimitsArray[0] = -50.00;
-                       zBinLimitsArray[1] = -3.375;
-                       zBinLimitsArray[2] = -1.605;
-                       zBinLimitsArray[3] = -0.225;
-                       zBinLimitsArray[4] = 1.065;
-                       zBinLimitsArray[5] = 2.445;
-                       zBinLimitsArray[6] = 4.245;
-                       zBinLimitsArray[7] = 50.00;
-                       zBinLimitsArray[8] = 1000.00;
-                       
-                  Double_t *multiplicityBinLimitsArray = new Double_t[6];
-                       if(fUseChargedTrackMultiplicityForBG == kTRUE){
-                               multiplicityBinLimitsArray[0] = 0;
-                               multiplicityBinLimitsArray[1] = 8.5;
-                               multiplicityBinLimitsArray[2] = 16.5;
-                               multiplicityBinLimitsArray[3] = 27.5;
-                               multiplicityBinLimitsArray[4] = 41.5;
-                               multiplicityBinLimitsArray[5] = 100.;
-                               if(fIsHeavyIon){
-                                       multiplicityBinLimitsArray[0] = 0;
-                                       multiplicityBinLimitsArray[1] = 200.;
-                                       multiplicityBinLimitsArray[2] = 500.;
-                                       multiplicityBinLimitsArray[3] = 1000.;
-                                       multiplicityBinLimitsArray[4] = 1500.;
-                                       multiplicityBinLimitsArray[5] = 3000.;
-                               }
-                               fBGEventHandler = new AliGammaConversionBGHandler(9,6,fNEventsForBGCalculation);
-                       } else {
-                               multiplicityBinLimitsArray[0] = 2;
-                               multiplicityBinLimitsArray[1] = 3;
-                               multiplicityBinLimitsArray[2] = 4;
-                               multiplicityBinLimitsArray[3] = 5;
-                               multiplicityBinLimitsArray[4] = 9999;
-                               if(fIsHeavyIon){
-                                       multiplicityBinLimitsArray[0] = 2;
-                                       multiplicityBinLimitsArray[1] = 10;
-                                       multiplicityBinLimitsArray[2] = 30;
-                                       multiplicityBinLimitsArray[3] = 50;
-                                       multiplicityBinLimitsArray[4] = 9999;
-                               }
-
-                               fBGEventHandler = new AliGammaConversionBGHandler(9,5,fNEventsForBGCalculation);
-                       }
-
-
-                       
-                       /*
-                       // ---------------------------------
-                       Double_t *zBinLimitsArray = new Double_t[1];
-                       zBinLimitsArray[0] = 999999.00;
-
-                       Double_t *multiplicityBinLimitsArray= new Double_t[1];
-                       multiplicityBinLimitsArray[0] = 99999999.00;
-                       fBGEventHandler = new AliGammaConversionBGHandler(1,1,10);
-                       // ---------------------------------
-                       */
-                       fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray);
-                       fBGEventInitialized = kTRUE;
-               }
-       }
-        
-        if(fDoMC && fExcludeBackgroundEventForGammaCorrection){
-           fNumberOfPrimerisFromHijingAndPythia = GetNumberOfHijingPlusPythiaPrimeries(fExcludeBackgroundEventForGammaCorrection);
-        }
-}
-
-AliESDv0* AliV0Reader::GetV0(Int_t index){
-       //see header file for documentation
-       fCurrentV0 = fESDEvent->GetV0(index);
-       UpdateV0Information();
-       return fCurrentV0;
-}
-
-Int_t AliV0Reader::GetNumberOfContributorsVtx(){
-       // returns number of contributors to the vertex
-       if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
-               return fESDEvent->GetPrimaryVertexTracks()->GetNContributors();
-       }
-
-       if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
-               //              return 0;
-               //-AM test pi0s without SPD only vertex
-               if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
-                       return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
-
-               }
-               if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
-                       cout<<"number of contributors from bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
-                       return 0;
-               }
-       }
-       return 0;
-}
-
-Bool_t AliV0Reader::CheckForPrimaryVertex(){
-       //see headerfile for documentation
-       if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
-               return 1;
-       }
-       if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
-       // SPD vertex
-               if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
-                       // return 0;
-                       //-AM test pi0s without SPD only vertex
-                       //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
-                       return 1;
-               }
-               if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
-                       //                      cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
-                       return 0;
-               }
-       }
-       return 0;
-       //      return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
-}
-
-Bool_t AliV0Reader::CheckForPrimaryVertexZ(){
-       //see headerfile for documentation
-       if(TMath::Abs(fESDEvent->GetPrimaryVertex()->GetZ())<GetMaxVertexZ()){
-               return kTRUE;
-       }else{
-               return kFALSE;
-       }
-       return kTRUE;
-}
-
-
-Bool_t AliV0Reader::CheckV0FinderStatus(AliESDv0 *v0){
-       // see headerfile for documentation
-       if(fUseOnFlyV0Finder){
-               if(!v0->GetOnFlyStatus()){
-                       return kFALSE;
-               }
-       }
-       if(!fUseOnFlyV0Finder){
-               if(v0->GetOnFlyStatus()){
-                       return kFALSE;
-               }
-       }
-       return kTRUE;
-}
-
-
-
-
-Bool_t AliV0Reader::NextV0(){
-       //see header file for documentation
-       Bool_t iResult=kFALSE;
-       while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
-               fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
-
-               fUpdateV0AlreadyCalled=kFALSE;
-             
-               if(fHistograms != NULL){
-                       fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass());
-                       fHistograms->FillHistogram("ESD_AllV0s_Pt",GetMotherCandidatePt());
-               }
-               
-               // moved it up here so that the correction framework can access pt and eta information
-               if(UpdateV0Information() == kFALSE){
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-                
-                if(fDoMC && fExcludeBackgroundEventForGammaCorrection){ // Remove all V0s from BGEvent
-                   Bool_t isFromBGEvent = kFALSE;
-                   isFromBGEvent = IsParticleFromBGEvent(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
-                   if(isFromBGEvent){
-                      fHistograms->FillHistogram("ESD_CutMCBgEvent_InvMass",GetMotherCandidateMass());
-                      fHistograms->FillHistogram("ESD_CutMCBgEvent_Pt",GetMotherCandidatePt());
-                      fCurrentV0IndexNumber++;
-                      continue;
-                   }
-                   isFromBGEvent = IsParticleFromBGEvent(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
-                   if(isFromBGEvent){
-                      fHistograms->FillHistogram("ESD_CutMCBgEvent_InvMass",GetMotherCandidateMass());
-                      fHistograms->FillHistogram("ESD_CutMCBgEvent_Pt",GetMotherCandidatePt());
-                      fCurrentV0IndexNumber++;
-                      continue;
-                   }
-                }
-                
-
-
-               Double_t containerInput[3];
-               if(fDoCF){
-                       containerInput[0] = GetMotherCandidatePt();
-                       containerInput[1] = GetMotherCandidateEta();
-                       containerInput[2] = GetMotherCandidateMass();
-               }
-               /*
-               if(fDoCF){
-                       containerInput[0] = GetMotherCandidatePt();
-                       containerInput[1] = GetMotherCandidateEta();
-                       containerInput[2] = GetMotherCandidateMass();
-                       
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign);         // for CF       
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit);         // for CF       
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks);            // for CF       
-               }
-               */
-
-               //checks if on the fly mode is set
-               if ( !CheckV0FinderStatus(fCurrentV0) ){
-                       
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
-                                fHistograms->FillHistogram("ESD_CutGetOnFly_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly);         // for CF       
-               }
-
-               if(fHistograms != NULL){
-                       fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_InvMass",GetMotherCandidateMass());
-                        fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_Pt",GetMotherCandidatePt());
-               }
-               Double_t armenterosQtAlpha[2] = {0,0};
-               Double_t armenterosQtAlphaKF[2] = {0,0};
-               Double_t armenterosQtAlphaESD[2] = {0,0};
-               Double_t armenterosQtAlphaKFNew[2] = {0,0};
-               Double_t armenterosQtAlphaESDMC[2] = {0,0};
-               Double_t armenterosQtAlphaMC[2] = {0,0};
-
-               GetArmenterosQtAlpha(GetNegativeKFParticle(), // old KF way calculating Qt Alpha
-                                   GetPositiveKFParticle(), 
-                                   GetMotherCandidateKFCombination(),
-                                   armenterosQtAlphaKF);
-               GetArmenterosQtAlpha(fCurrentV0,armenterosQtAlphaESD); // ESD way calculating Qt Alpha
-               GetArmenterosQtAlpha(GetNegativeKFParticle(), // new KF way calculating Qt Alpha
-                                   GetPositiveKFParticle(), 
-                                   armenterosQtAlphaKFNew,fdoESDQtCut);
-
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinderKF_alfa_qt",armenterosQtAlphaKF[1],armenterosQtAlphaKF[0]);
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinderESD_alfa_qt",armenterosQtAlphaESD[1],armenterosQtAlphaESD[0]);
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinderKFNew_alfa_qt",armenterosQtAlphaKFNew[1],armenterosQtAlphaKFNew[0]);
-
-               if(fdoESDQtCut == 0){
-                  armenterosQtAlpha[0] = armenterosQtAlphaKF[0];
-                  armenterosQtAlpha[1] = armenterosQtAlphaKF[1];
-               }
-               else if(fdoESDQtCut == 1){
-                  armenterosQtAlpha[0] = armenterosQtAlphaESD[0];
-                  armenterosQtAlpha[1] = armenterosQtAlphaESD[1];
-               }
-
-               else if(fdoESDQtCut == 2 || fdoESDQtCut == 3){
-                   armenterosQtAlpha[0] = armenterosQtAlphaKFNew[0];
-                  armenterosQtAlpha[1] = armenterosQtAlphaKFNew[1];
-               }
-              
-               if(fCurrentNegativeESDTrack->Charge() == fCurrentPositiveESDTrack->Charge()){                                            // avoid like sign
-                       //      iResult=kFALSE;
-                       if(fHistograms != NULL ){
-                               fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
-                                fHistograms->FillHistogram("ESD_CutLikeSign_Pt",GetMotherCandidatePt());
-                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                               //      fUpdateV0AlreadyCalled = kTRUE;
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign);         // for CF       
-               }
-       
-               if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) || 
-                       !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
-                       //      if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) || 
-                       //                      !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
-                       //      iResult=kFALSE;
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
-                                fHistograms->FillHistogram("ESD_CutRefit_Pt",GetMotherCandidatePt());
-                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                               //fUpdateV0AlreadyCalled = kTRUE;
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit);         // for CF       
-               }
-       
-
-
-               if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 || 
-                       fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {                        
-                       //iResult=kFALSE;
-                       if(fHistograms != NULL ){
-                               fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutKink_Pt",GetMotherCandidatePt());
-                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                               //fUpdateV0AlreadyCalled = kTRUE;
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks);            // for CF       
-               }
-       
-               if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutR_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }       
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepR);                        // for CF
-               }
-               if(GetXYRadius()<fMinR){ // cuts on distance from collision point
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutMinR_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutMinR_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-                               
-               //if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ) { // cuts out regions where we do not reconstruct
-               if( GetXYRadius() <= ((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue)){
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutLine_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               } else if (fUseEtaMinCut &&  GetXYRadius() >= ((TMath::Abs(fCurrentZValue)*fLineCutZRSlopeMin)-fLineCutZValueMin )){ 
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutLine_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine);                     // for CF
-               }
-               
-               if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutZ_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ);                // for CF       
-               }
-
-               if(fUseKFParticle){
-                       if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut || TMath::Abs(fMotherCandidateLorentzVector->Eta())< fEtaCutMin){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutEta_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-
-                       if(TMath::Abs(fCurrentNegativeKFParticle->GetEta())> fEtaCut || TMath::Abs(fCurrentNegativeKFParticle->GetEta())< fEtaCutMin){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutEta_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-
-                       if(TMath::Abs(fCurrentPositiveKFParticle->GetEta())> fEtaCut || TMath::Abs(fCurrentPositiveKFParticle->GetEta())< fEtaCutMin){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutEta_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-               }
-
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_Pt_Qt",GetMotherCandidatePt(),armenterosQtAlpha[0]);
-
-               if(fDoMC){
-                       if ( HasSameMCMother() == kTRUE){ 
-                               GetArmenterosQtAlpha(fNegativeMCParticle, 
-                                       fPositiveMCParticle, 
-                                       fMotherMCParticle,
-                                       armenterosQtAlphaMC);
-                       }
-                       GetArmenterosQtAlpha(fNegativeMCParticle, 
-                               fPositiveMCParticle, 
-                               GetMotherCandidateKFCombination(),
-                               armenterosQtAlphaESDMC );
-               }
-
-                fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_goodtracks_alfa_qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-               if( fCurrentNegativeKFParticle->GetPt()> 0.150 &&       fCurrentPositiveKFParticle->GetPt()> 0.150){
-                       fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_minPt_GT_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-               }
-               if(fDoMC){
-                       fHistograms->FillHistogram("ESD_TrueConvAllV0s_ESDMother_Alpha_Qt",armenterosQtAlphaESDMC[1],armenterosQtAlphaESDMC[0]);
-                       if ( HasSameMCMother() == kTRUE){ 
-                               fHistograms->FillHistogram("ESD_TrueConvSameMother_ESDMother_Alpha_Qt",armenterosQtAlphaESDMC[1],armenterosQtAlphaESDMC[0]);
-                               fHistograms->FillHistogram("ESD_TrueConvSameMother_MCMother_Alpha_Qt",armenterosQtAlphaMC[1],armenterosQtAlphaMC[0]);
-                               if (fMotherMCParticle->GetPdgCode() == 22 ){
-                                       fHistograms->FillHistogram("ESD_TrueConvGamma_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                                       fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Qt",GetMotherCandidatePt(),armenterosQtAlpha[0]);      
-                               } else if ( fMotherMCParticle->GetPdgCode() == 310 ){
-                                       fHistograms->FillHistogram("ESD_TrueConvK0s_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               } else if ( fMotherMCParticle->GetPdgCode() == 113 ){
-                                       fHistograms->FillHistogram("ESD_TrueConvRho0_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               } else if ( fMotherMCParticle->GetPdgCode() == 333 ){
-                                       fHistograms->FillHistogram("ESD_TrueConvPhi_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               } else if ( (fMotherMCParticle->GetPdgCode() == 3122 || fMotherMCParticle->GetPdgCode() == -3122) ){
-                                       fHistograms->FillHistogram("ESD_TrueConvLambda_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               } else if ( (fMotherMCParticle->GetPdgCode() == 2114 || fMotherMCParticle->GetPdgCode() == -2114) ){
-                                       fHistograms->FillHistogram("ESD_TrueConvDelta_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               } else if ( (fMotherMCParticle->GetPdgCode() == 313 || 
-                                                               fMotherMCParticle->GetPdgCode() == 323 || 
-                                                               fMotherMCParticle->GetPdgCode() == -323 ) ){
-                                       fHistograms->FillHistogram("ESD_TrueConvKStar_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                               } else {
-                                       fHistograms->FillHistogram("ESD_TrueConvUnknown_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                                       fHistograms->FillHistogram("ESD_TrueConvUnknown_Qt_PDG",fMotherMCParticle->GetPdgCode());
-                               //      cout << "unidentfied mother: pdg-C mother " << fMotherMCParticle->GetPdgCode() << " daughters " << fNegativeMCParticle->GetPdgCode() << "\t" << fPositiveMCParticle->GetPdgCode() << endl;
-                               }
-                       }       else {
-                               fHistograms->FillHistogram("ESD_TrueConvComb_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
-                       }
-               }
-
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_E_dEdxP",fCurrentNegativeESDTrack->P(),fCurrentNegativeESDTrack->GetTPCsignal());
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_P_dEdxP",fCurrentPositiveESDTrack->P(),fCurrentPositiveESDTrack->GetTPCsignal());
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_E_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_P_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PiPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PiMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_KPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_KMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_PMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_MuPl_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kMuon));
-               fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_MuMi_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kMuon));
-               if(fDodEdxSigmaCut == kTRUE){
-                       if( fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
-                       fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
-                       fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
-                       fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
-                               //iResult=kFALSE;
-                               if(fHistograms != NULL ){
-                                       fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
-                                        fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_Pt",GetMotherCandidatePt());
-                                       // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                       // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                       //fUpdateV0AlreadyCalled = kTRUE;
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxElectronselection);                                                     // for CF
-                       }
-
-                       fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PiPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion));
-                       fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PiMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion));
-                       fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_MuPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kMuon));
-                       fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_MuMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kMuon));
-
-                       
-                       if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentPositiveESDTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
-                               if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
-                                       //              iResult=kFALSE;
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-                       
-                       if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentNegativeESDTrack->P()<fPIDMaxPnSigmaAbovePionLine){
-                               if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
-                                       //              iResult=kFALSE;
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-
-                       // High Pt
-                       if( fCurrentPositiveESDTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
-                               if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
-                                       //              iResult=kFALSE;
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-                       
-                       if( fCurrentNegativeESDTrack->P()>fPIDMaxPnSigmaAbovePionLine){
-                               if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
-                                       fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
-                       //              iResult=kFALSE;
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_Pt",GetMotherCandidatePt());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-
-
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxPionrejection);                                                         // for CF
-                       }
-
-               }
-
-               fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_KPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon));
-               fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_KMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
-               
-               if(fDoKaonRejectionLowP == kTRUE){
-                       if( fCurrentNegativeESDTrack->P()<fPIDMinPKaonRejectionLowP ){
-                               if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-                       if( fCurrentPositiveESDTrack->P()<fPIDMinPKaonRejectionLowP ){
-                               if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-               }
-
-               fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PPl_SigdEdxP",fCurrentPositiveESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton));
-               fHistograms->FillHistogram("ESD_ConvGammaBeforeCorresCut_PMi_SigdEdxP",fCurrentNegativeESDTrack->P(),fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon));
-               
-               if(fDoProtonRejectionLowP == kTRUE){
-                       if( fCurrentNegativeESDTrack->P()<fPIDMinPProtonRejectionLowP){
-                               if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-                       if( fCurrentPositiveESDTrack->P()<fPIDMinPProtonRejectionLowP ){
-                               if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-               }
-
-               if(fDoPionRejectionLowP == kTRUE){
-                       if( fCurrentNegativeESDTrack->P()<fPIDMinPPionRejectionLowP ){
-                               if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-                       if( fCurrentPositiveESDTrack->P()<fPIDMinPPionRejectionLowP ){
-                               if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-               }
-
-
-               Double_t psiPair  = -1;
-               psiPair = GetPsiPair(fCurrentV0);
-               
-                if(psiPair > fPsiPairCut){
-                   if(fHistograms != NULL ){
-                      fHistograms->FillHistogram("ESD_CutPsiPair_InvMass",GetMotherCandidateMass());
-                      fHistograms->FillHistogram("ESD_CutPsiPair_Pt",GetMotherCandidatePt());
-                      // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                      // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                      //       fUpdateV0AlreadyCalled = kTRUE;
-                   }
-                   
-                   fCurrentV0IndexNumber++;
-                   continue;
-                }
-               
-
-               Double_t cosineOfPointingAngle  = -1;
-                cosineOfPointingAngle = GetV0CosineOfPointingAngle(fCurrentXValue,fCurrentYValue,fCurrentZValue);
-                if(cosineOfPointingAngle < fCosinePointCut){
-                   if(fHistograms != NULL ){
-                       fHistograms->FillHistogram("ESD_CutCosinePoint_InvMass",GetMotherCandidateMass());
-                        fHistograms->FillHistogram("ESD_CutCosinePoint_Pt",GetMotherCandidatePt());
-                       // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                       // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                       //      fUpdateV0AlreadyCalled = kTRUE;
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-
-
-               if( fDoTOFsigmaCut == kTRUE ){ // RRnewTOF start ///////////////////////////////////////////////////////////////////////////// 
-                       Bool_t PosTrackNotTOFelec = kFALSE;
-                       Bool_t NegTrackNotTOFelec = kFALSE;
-                       if( (fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFmismatch) ){
-                               Double_t t0pos = fgESDpid->GetTOFResponse().GetStartTime(fCurrentPositiveESDTrack->P());
-                               Double_t fnSigmaPos = fgESDpid->NumberOfSigmasTOF(fCurrentPositiveESDTrack, AliPID::kElectron, t0pos);
-                               if( (fnSigmaPos>fTofPIDnSigmaAboveElectronLine) || (fnSigmaPos<fTofPIDnSigmaBelowElectronLine) ) PosTrackNotTOFelec = kTRUE;
-                       }
-                       if( (fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFpid) && !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFmismatch) ){
-                               Double_t t0neg = fgESDpid->GetTOFResponse().GetStartTime(fCurrentNegativeESDTrack->P());
-                               Double_t fnSigmaNeg = fgESDpid->NumberOfSigmasTOF(fCurrentNegativeESDTrack, AliPID::kElectron, t0neg);
-                               if( (fnSigmaNeg>fTofPIDnSigmaAboveElectronLine) || (fnSigmaNeg<fTofPIDnSigmaBelowElectronLine) ) NegTrackNotTOFelec = kTRUE;    
-                       }
-                       if( (PosTrackNotTOFelec==kTRUE) || (NegTrackNotTOFelec==kTRUE) ){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutTOFsigmaElec_InvMass",GetMotherCandidateMass());
-                                        fHistograms->FillHistogram("ESD_CutTOFsigmaElec_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-               } /////////////////////////////// RRnewTOF end ///////////////////////////////////////////////////////////////////////////////
-
-
-               // Gamma selection based on QT from Armenteros
-               if(fDoQtGammaSelection == kTRUE){ // RRnew start : apply different qT-cut above/below
-                       if(fDoHighPtQtGammaSelection){
-                               if(GetMotherCandidatePt() < fPtBorderForQt){
-                                       if(armenterosQtAlpha[0]>fQtMax){
-                                               if(fHistograms != NULL){
-                                                       fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
-                                                       fHistograms->FillHistogram("ESD_CutQt_Pt",GetMotherCandidatePt());
-                                               }
-                                               fCurrentV0IndexNumber++;
-                                               continue;
-                                       }
-                               } else {
-                                       if(armenterosQtAlpha[0]>fHighPtQtMax)   {
-                                               if(fHistograms != NULL){
-                                                       fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
-                                                        fHistograms->FillHistogram("ESD_CutQt_Pt",GetMotherCandidatePt());
-                                               }
-                                               fCurrentV0IndexNumber++;
-                                               continue;
-                                       }
-                               }
-                       } else {
-                               if(armenterosQtAlpha[0]>fQtMax){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutQt_Pt",GetMotherCandidatePt());
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-               }        // RRnew end
-
-               if(fDoPhotonAsymmetryCut == kTRUE){
-                       if( fNegativeTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
-                               Double_t trackNegAsy=0;
-                               if (fCurrentMotherKFCandidate->GetP()!=0.){
-                                       trackNegAsy= fNegativeTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
-                               }
-                               if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_Pt",GetMotherCandidatePt());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-
-                       if( fPositiveTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
-                               Double_t trackPosAsy=0;
-                               if (fCurrentMotherKFCandidate->GetP()!=0.){
-                                       trackPosAsy= fPositiveTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
-                               }
-                               if( trackPosAsy<fMinPhotonAsymmetry ||trackPosAsy>(1.- fMinPhotonAsymmetry)){
-                                       if(fHistograms != NULL){
-                                               fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
-                                                fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_Pt",GetMotherCandidatePt());
-                                               // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
-                                               // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
-                                               //fUpdateV0AlreadyCalled = kTRUE;
-                                       }
-                                       fCurrentV0IndexNumber++;
-                                       continue;
-                               }
-                       }
-               }
-               //checks if we have a prim vertex
-               //if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) { 
-               if(GetNumberOfContributorsVtx()<=0) { 
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutNContributors_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors);            // for CF       
-               }
-               
-               //Check the pid probability
-               if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutPIDProb_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID);                   // for CF
-               }
-               
-               
-               /* Moved further up so corr framework can work
-                        if(UpdateV0Information() == kFALSE){
-                        fCurrentV0IndexNumber++;
-                        continue;
-                        }
-               */
-               if(fCurrentNegativeESDTrack->GetNcls(1) < fMinClsTPC || fCurrentPositiveESDTrack->GetNcls(1) < fMinClsTPC ){
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutMinNClsTPC_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutMinNClsTPC_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-               if(fDoCF){
-                       fCFManager->GetParticleContainer()->Fill(containerInput,kStepMinClsTPC);                // for CF       
-               }
-               Double_t negclsToF = 0.;
-               if (!fUseCorrectedTPCClsInfo ){
-                       if(fCurrentNegativeESDTrack->GetTPCNclsF()!=0   ){
-                               negclsToF = (Double_t)fCurrentNegativeESDTrack->GetNcls(1)/(Double_t)fCurrentNegativeESDTrack->GetTPCNclsF();
-                       }
-               } else {
-                       negclsToF = fCurrentNegativeESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
-               }
-
-               Double_t posclsToF = 0.;
-               if (!fUseCorrectedTPCClsInfo ){
-                       if(fCurrentPositiveESDTrack->GetTPCNclsF()!=0   ){
-                               posclsToF = (Double_t)fCurrentPositiveESDTrack->GetNcls(1)/(Double_t)fCurrentPositiveESDTrack->GetTPCNclsF();
-                       }
-               }else{
-                       posclsToF = fCurrentPositiveESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
-               }
-
-               if( negclsToF < fMinClsTPCToF ||        posclsToF < fMinClsTPCToF ){
-                       if(fHistograms != NULL){
-                               fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_InvMass",GetMotherCandidateMass());
-                               fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_Pt",GetMotherCandidatePt());
-                       }
-                       fCurrentV0IndexNumber++;
-                       continue;
-               }
-
-
-
-               
-               if(fUseKFParticle){
-
-
-                       if( fCurrentNegativeKFParticle->GetPt()< fSinglePtCut ||        fCurrentPositiveKFParticle->GetPt()< fSinglePtCut){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutSinglePt_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutSinglePt_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepSinglePt);         // for CF       
-                       }
-
-
-                       if(fCurrentMotherKFCandidate->GetNDF()<=0){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutNDF_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF);              // for CF       
-                       }
-                       
-                       Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
-                       if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutChi2_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2);                     // for CF
-                       }
-               
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta);                      // for CF
-                       }
-                       
-                       if(fMotherCandidateLorentzVector->Pt()<fPtCut){
-                               if(fHistograms != NULL){
-                                       fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
-                                       fHistograms->FillHistogram("ESD_CutPt_Pt",GetMotherCandidatePt());
-                               }
-                               fCurrentV0IndexNumber++;
-                               continue;
-                       }
-                       if(fDoCF){
-                               fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt);                       // for CF
-                       }
-                       
-               }
-               else if(fUseESDTrack){
-                       //TODO
-               }
-
-               if(fHistograms != NULL){
-                       fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
-               }
-
-               //              fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
-
-               if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
-                       fCurrentMotherKFCandidate->E()=fCurrentMotherKFCandidate->GetP();
-               }
-
-               if(fDoMC&& fUseMCPSmearing>0){
-                       SmearKFParticle(fCurrentMotherKFCandidate);
-
-               }               
-
-               new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()])    AliKFParticle(*fCurrentMotherKFCandidate);
-               fV0Pindex.push_back(fCurrentV0->GetPindex());
-               fV0Nindex.push_back(fCurrentV0->GetNindex());
-
-               iResult=kTRUE;//means we have a v0 who survived all the cuts applied
-               
-               fNumberOfGoodV0s++;
-
-               fCurrentV0IndexNumber++;
-               
-               break;
-       }
-       return iResult; 
-}
-
-Bool_t AliV0Reader::UpdateV0Information(){
-       //see header file for documentation
-       
-       const AliExternalTrackParam *fCurrentExternalTrackParamPositive=GetExternalTrackParamP(fCurrentV0);
-       const AliExternalTrackParam *fCurrentExternalTrackParamNegative=GetExternalTrackParamN(fCurrentV0);
-
-       Bool_t iResult=kTRUE;                                           // for taking out not refitted, kinks and like sign tracks 
-       
-       Bool_t switchTracks = kFALSE;
-       
-       fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
-       fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
-
-
-       if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){      // switch wrong signed tracks
-               fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
-               fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
-               switchTracks = kTRUE;
-       }
-
-       
-       if(fCurrentNegativeKFParticle != NULL){
-           delete fCurrentNegativeKFParticle;
-       }
-       if(switchTracks == kFALSE){
-               fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
-       }
-       else{
-               fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
-       }
-       
-       if(fCurrentPositiveKFParticle != NULL){
-               delete fCurrentPositiveKFParticle;
-       }
-       if(switchTracks == kFALSE){
-               fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
-       }
-       else{
-               fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
-       }
-               
-       if(fCurrentMotherKFCandidate != NULL){
-               delete fCurrentMotherKFCandidate;
-       }
-
-       if(fUseConstructGamma==kTRUE){
-               fCurrentMotherKFCandidate = new AliKFParticle();//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
-               fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
-       }else{
-               fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
-               if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
-                       fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
-               }
-       }
-       if(fUseImprovedVertex == kTRUE){
-               AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
-               primaryVertexImproved+=*fCurrentMotherKFCandidate;
-               fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
-       }
-       
-       fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
-               
-       if(fNegativeTrackLorentzVector != NULL){
-               delete fNegativeTrackLorentzVector;
-       }
-       if(fUseKFParticle){
-               fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
-       }
-       else    { //if(fUseESDTrack){
-               fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
-       }
-       
-       if(fPositiveTrackLorentzVector != NULL){
-               delete fPositiveTrackLorentzVector;
-       }
-       if(fUseKFParticle){
-               fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
-       }
-       else    { // if(fUseESDTrack){  fPositiveTrackLorentzVector must be reinitialized, so assuming use ESD if not kfparticle Svein. 
-               fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
-       }
-       
-       if(fMotherCandidateLorentzVector != NULL){
-               delete fMotherCandidateLorentzVector;
-       }
-
-       fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
-       
-       if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
-               fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.); 
-       }
-               
-       
-       if(fDoMC == kTRUE){
-               fMotherMCParticle= NULL;
-               if(switchTracks == kFALSE){
-                       fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
-                       fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
-               }else{
-                       fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
-                       fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
-               }
-
-               if(fPositiveMCParticle->GetMother(0)>-1){
-                       fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
-               }
-       }
-
-
-
-       
-
-       // for CF
-//      Double_t containerInput[3];
-//      if(fDoCF){
-//              containerInput[0] = GetMotherCandidatePt();
-//              containerInput[1] = GetMotherCandidateEta();
-//              containerInput[2] = GetMotherCandidateMass();
-               
-//              fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign);                // for CF       
-//              fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit);                // for CF       
-//              fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks);           // for CF       
-//      }
-       
-
-       if(fUseOwnXYZCalculation == kFALSE){
-               if(fUseConstructGamma == kFALSE){
-                       fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
-               }else{
-                       fCurrentXValue=GetMotherCandidateKFCombination()->GetX();
-                       fCurrentYValue=GetMotherCandidateKFCombination()->GetY();
-                       fCurrentZValue=GetMotherCandidateKFCombination()->GetZ();
-               }
-       }
-       else{
-               Double_t convpos[3]={0,0,0};
-               GetConversionPoint(fCurrentExternalTrackParamPositive,fCurrentExternalTrackParamNegative,convpos);
-//             fCurrentMotherKF->SetConversionPoint(convpos);
-
-//             Double_t convpos[2];
-//             convpos[0]=0;
-//             convpos[1]=0;
-// 
-//             GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
-//             
-               fCurrentXValue = convpos[0];
-               fCurrentYValue = convpos[1];
-               fCurrentZValue = convpos[2];
-       }
-       fUpdateV0AlreadyCalled = kTRUE;
-
-       return iResult;
-}
-
-
-
-Bool_t AliV0Reader::HasSameMCMother(){
-       //see header file for documentation
-       
-       Bool_t iResult = kFALSE;
-       if(fDoMC == kTRUE){
-               if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
-                       if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
-       if(fMotherMCParticle){
-               iResult = kTRUE;
-       }
-               }
-       }
-       return iResult;
-}
-
-Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
-       //see header file for documentation
-       
-       Bool_t iResult=kFALSE;
-       
-       //      Double_t *posProbArray = new Double_t[10];
-       //      Double_t *negProbArray = new Double_t[10];
-       //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10 
-
-       Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
-       Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
-
-       AliESDtrack* negTrack   = GetNegativeESDTrack();
-       AliESDtrack* posTrack   = GetPositiveESDTrack();
-       //fESDEvent->GetTrack(fCurrentV0->GetNindex());
-               //fESDEvent->GetTrack(fCurrentV0->GetPindex());
-       //-AM for switchtracks==true the above is a bug
-
-       if(negProbArray && posProbArray){
-
-               negTrack->GetTPCpid(negProbArray);
-               posTrack->GetTPCpid(posProbArray);
-               
-               //      if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
-               if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
-                       iResult=kTRUE;
-               }
-       }
-       delete [] posProbArray;
-       delete [] negProbArray;
-       return iResult;
-}
-
-void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
-       // see header file for documentation
-
-       //Double_t *posProbArray = new Double_t[10];
-       // Double_t *negProbArray = new Double_t[10];
-       //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10 
-       Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
-       Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
-
-//      AliESDtrack* negTrack  = fESDEvent->GetTrack(fCurrentV0->GetNindex());
-//      AliESDtrack* posTrack  = fESDEvent->GetTrack(fCurrentV0->GetPindex());
-       //-AM for switchtracks the above is a bug
-       AliESDtrack* negTrack   = GetNegativeESDTrack();
-       AliESDtrack* posTrack   = GetPositiveESDTrack();
-
-       if(negProbArray && posProbArray){
-               negTrack->GetTPCpid(negProbArray);
-               posTrack->GetTPCpid(posProbArray);
-               
-               //      if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
-               negPIDProb = negProbArray[GetSpeciesIndex(-1)];
-               posPIDProb = posProbArray[GetSpeciesIndex(1)];
-       }
-       delete [] posProbArray;
-       delete [] negProbArray;
-}
-
-void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){
-       // see header file for documentation
-
-
-       Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
-       Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
-
-       // AliESDtrack* negTrack        = fESDEvent->GetTrack(fCurrentV0->GetNindex());
-       // AliESDtrack* posTrack        = fESDEvent->GetTrack(fCurrentV0->GetPindex());
-       //-AM for switchtracks the above is a bug
-
-       AliESDtrack* negTrack   = GetNegativeESDTrack();
-       AliESDtrack* posTrack   = GetPositiveESDTrack();
-
-       if(negProbArray && posProbArray){
-               negTrack->GetTPCpid(negProbArray);
-               posTrack->GetTPCpid(posProbArray);
-               
-               //      if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
-
-               negPIDProb = negProbArray[1]+negProbArray[2];
-               posPIDProb = posProbArray[1]+posProbArray[2];
-       }
-       delete [] posProbArray;
-       delete [] negProbArray;
-}
-
-void AliV0Reader::UpdateEventByEventData(){
-       //see header file for documentation
-       if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
-               if(fCalculateBackground){
-                       if(fUseChargedTrackMultiplicityForBG == kTRUE){
-       fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
-       //filling z and multiplicity histograms
-       fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
-       fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
-       fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
-                       }
-                       else{ // means we use #V0s for multiplicity
-       fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
-       //filling z and multiplicity histograms
-       fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
-       fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s);
-       fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
-                       }
-               }
-       }
-       fCurrentEventGoodV0s->Delete();
-       fCurrentV0IndexNumber=0;
-       fNumberOfESDTracks=0;
-
-       fV0Pindex.clear();
-       fV0Nindex.clear();
-       
-        delete fCurrentEventGoodV0s;
-        fCurrentEventGoodV0s = NULL;
-        delete fBrem;
-        fBrem = NULL;
-        delete fCurrentNegativeKFParticle;
-        fCurrentNegativeKFParticle = NULL;
-        delete fCurrentPositiveKFParticle;
-        fCurrentPositiveKFParticle = NULL;
-        delete fCurrentMotherKFCandidate;
-        fCurrentMotherKFCandidate = NULL;
-        delete fNegativeTrackLorentzVector;
-        fNegativeTrackLorentzVector = NULL;
-        delete fPositiveTrackLorentzVector;
-        fPositiveTrackLorentzVector = NULL;
-        delete fMotherCandidateLorentzVector;
-        fMotherCandidateLorentzVector = NULL;
-        
-        //     fBGEventHandler->PrintBGArray(); // for debugging
-}
-
-
-Double_t AliV0Reader::GetNegativeTrackPhi() const{
-       //see header file for documentation
-       
-       Double_t offset=0;
-       if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
-               offset = -2*TMath::Pi();
-       }
-       return fNegativeTrackLorentzVector->Phi()+offset;
-}
-
-Double_t AliV0Reader::GetPositiveTrackPhi() const{
-       //see header file for documentation
-       
-       Double_t offset=0;
-       if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
-               offset = -2*TMath::Pi();
-       }
-       return fPositiveTrackLorentzVector->Phi()+offset;
-}
-
-Double_t AliV0Reader::GetMotherCandidatePhi() const{
-       //see header file for documentation
-       
-       Double_t offset=0;
-       if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
-               offset = -2*TMath::Pi();
-       }
-       return fMotherCandidateLorentzVector->Phi()+offset;
-}
-
-
-Double_t AliV0Reader::GetMotherCandidateRapidity() const{
-       //see header file for documentation
-       
-       Double_t rapidity=0;
-       if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
-       else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
-       return rapidity;
-       
-}
-
-
-
-
-
-Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
-       //see header file for documentation
-       
-       Int_t iResult = 10; // Unknown particle
-       
-       if(chargeOfTrack==-1){ //negative track
-               switch(abs(fNegativeTrackPID)){
-               case 11:                         //electron
-                       iResult = 0;
-                       break;
-               case 13:                         //muon
-                       iResult = 1;
-                       break;
-               case 211:                       //pion
-                       iResult = 2;
-                       break;
-               case 321:                       //kaon
-                       iResult = 3;
-                       break;
-               case 2212:               //proton
-                       iResult = 4;
-                       break;
-               case 22:                         //photon
-                       iResult = 5;
-                       break;
-               case 111:                       //pi0
-                       iResult = 6;
-                       break;
-               case 2112:               //neutron
-                       iResult = 7;
-                       break;
-               case 311:                       //K0
-                       iResult = 8;
-                       break;
-                               
-                       //Put in here for kSPECIES::kEleCon     ????
-               }
-       }
-       else if(chargeOfTrack==1){ //positive track
-               switch(abs(fPositiveTrackPID)){
-               case 11:                         //electron
-                       iResult = 0;
-                       break;
-               case 13:                         //muon
-                       iResult = 1;
-                       break;
-               case 211:                       //pion
-                       iResult = 2;
-                       break;
-               case 321:                       //kaon
-                       iResult = 3;
-                       break;
-               case 2212:               //proton
-                       iResult = 4;
-                       break;
-               case 22:                         //photon
-                       iResult = 5;
-                       break;
-               case 111:                       //pi0
-                       iResult = 6;
-                       break;
-               case 2112:               //neutron
-                       iResult = 7;
-                       break;
-               case 311:                       //K0
-                       iResult = 8;
-                       break;
-                               
-                       //Put in here for kSPECIES::kEleCon     ????
-               }
-       }
-       else{
-               //Wrong parameter.. Print warning
-       }
-       return iResult;
-}
-
-//_____________________________________________________________________________________________________________________
-Bool_t AliV0Reader::GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]){
-       // see header file for documentation
-       
-       Double_t        helix[6];
-       track->GetHelixParameters(helix,b);
-       
-       Double_t xpos = helix[5];
-       Double_t ypos = helix[0];
-       Double_t radius = TMath::Abs(1./helix[4]);
-       Double_t phi = helix[2];
-
-       if(phi < 0){
-               phi = phi + 2*TMath::Pi();
-       }
-
-       phi -= TMath::Pi()/2.;
-       Double_t xpoint =       radius * TMath::Cos(phi);
-       Double_t ypoint =       radius * TMath::Sin(phi);
-
-       if(b<0){
-               if(charge > 0){
-                       xpoint = - xpoint;
-                       ypoint = - ypoint;
-               }
-
-               if(charge < 0){
-                       xpoint =        xpoint;
-                       ypoint =        ypoint;
-               }
-       }
-       if(b>0){
-               if(charge > 0){
-                       xpoint =        xpoint;
-                       ypoint =        ypoint;
-               }
-
-               if(charge < 0){
-                       xpoint = - xpoint;
-                       ypoint = - ypoint;
-               }
-       }
-       center[0] =     xpos + xpoint;
-       center[1] =     ypos + ypoint;
-
-       return 1;
-}
-
-//_________________________________________________________________________________________________________
-// Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){ 
-// // Bool_t AliV0Reader::GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]){
-//     // see header file for documentation
-//             
-//     Double_t pi = 3.14159265358979323846;
-//     
-//     Double_t        helix[6];
-//     track->GetHelixParameters(helix,b);
-//     
-//     Double_t xpos = helix[5];
-//     Double_t ypos = helix[0];
-//     Double_t radius = TMath::Abs(1./helix[4]);
-//     Double_t phi = helix[2];
-// 
-//     if(phi < 0){
-//             phi = phi + 2*pi;
-//     }
-// 
-//     phi -= pi/2.;
-//     Double_t xpoint =       radius * TMath::Cos(phi);
-//     Double_t ypoint =       radius * TMath::Sin(phi);
-// 
-//     if(b<0){
-//             if(charge > 0){
-//                     xpoint = - xpoint;
-//                     ypoint = - ypoint;
-//             }
-// 
-//             if(charge < 0){
-//                     xpoint =        xpoint;
-//                     ypoint =        ypoint;
-//             }
-//     }
-//     if(b>0){
-//             if(charge > 0){
-//                     xpoint =        xpoint;
-//                     ypoint =        ypoint;
-//             }
-// 
-//             if(charge < 0){
-//                     xpoint = - xpoint;
-//                     ypoint = - ypoint;
-//             }
-//     }
-//     center[0] =     xpos + xpoint;
-//     center[1] =     ypos + ypoint;
-// 
-//     return 1;
-// }
-
-//____________________________________________________________________________________________________________________________
-Bool_t AliV0Reader::GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3]){
-
-    if(!pparam||!nparam)return kFALSE;
-
-       Double_t helixcenterpos[2];
-       GetHelixCenter(pparam,GetMagneticField(),pparam->Charge(),helixcenterpos);
-
-       Double_t helixcenterneg[2];
-       GetHelixCenter(nparam,GetMagneticField(),nparam->Charge(),helixcenterneg);
-
-       Double_t helixpos[6];
-       pparam->GetHelixParameters(helixpos,GetMagneticField());
-       Double_t posradius = TMath::Abs(1./helixpos[4]);
-
-       Double_t helixneg[6];
-       nparam->GetHelixParameters(helixneg,GetMagneticField());
-       Double_t negradius = TMath::Abs(1./helixneg[4]);
-
-        // Calculate xy-position
-
-       Double_t xpos = helixcenterpos[0];
-       Double_t ypos = helixcenterpos[1];
-       Double_t xneg = helixcenterneg[0];
-       Double_t yneg = helixcenterneg[1];
-
-       convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
-       convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
-
-
-       // Calculate z-position
-
-       Double_t deltaXPos = convpos[0] -       xpos;
-       Double_t deltaYPos = convpos[1] -       ypos;
-
-       Double_t deltaXNeg = convpos[0] -       xneg;
-       Double_t deltaYNeg = convpos[1] -       yneg;
-
-       Double_t alphaPos =     TMath::Pi() + TMath::ATan2(-deltaYPos,-deltaXPos);
-       Double_t alphaNeg =     TMath::Pi() + TMath::ATan2(-deltaYNeg,-deltaXNeg);
-
-       Double_t vertexXNeg =   xneg +  TMath::Abs(negradius)*TMath::Cos(alphaNeg);
-       Double_t vertexYNeg =   yneg +  TMath::Abs(negradius)*TMath::Sin(alphaNeg);
-
-       Double_t vertexXPos =   xpos +  TMath::Abs(posradius)*TMath::Cos(alphaPos);
-       Double_t vertexYPos =   ypos +  TMath::Abs(posradius)*TMath::Sin(alphaPos);
-
-       Double_t b = fESDEvent->GetMagneticField();
-
-       AliExternalTrackParam p(*pparam);
-       AliExternalTrackParam n(*nparam);
-
-       TVector2 vertexPos(vertexXPos,vertexYPos);
-        TVector2 vertexNeg(vertexXNeg,vertexYNeg);
-
-       // Convert to local coordinate system
-       vertexPos=vertexPos.Rotate(-p.GetAlpha());
-        vertexNeg=vertexNeg.Rotate(-p.GetAlpha());
-
-        // Propagate Track Params to Vertex
-        p.PropagateTo(vertexPos.X(),b);
-        n.PropagateTo(vertexNeg.X(),b);
-
-       convpos[2] = (p.GetZ()*negradius+n.GetZ()*posradius)/(negradius+posradius);
-
-       return kTRUE;
-}
-// 
-// //__________________________________________________________________________________________________________
-Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
-       //see header file for documentation
-
-       Double_t helixcenterpos[2];
-       GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
-
-       Double_t helixcenterneg[2];
-       GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
-
-       Double_t        poshelix[6];
-       ptrack->GetHelixParameters(poshelix,b);
-       Double_t posradius = TMath::Abs(1./poshelix[4]);
-
-       Double_t        neghelix[6];
-       ntrack->GetHelixParameters(neghelix,b);
-       Double_t negradius = TMath::Abs(1./neghelix[4]);
-
-       Double_t xpos = helixcenterpos[0];
-       Double_t ypos = helixcenterpos[1];
-       Double_t xneg = helixcenterneg[0];
-       Double_t yneg = helixcenterneg[1];
-
-       convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
-       convpos[1] = (ypos*negradius+   yneg*posradius)/(negradius+posradius);
-
-       return 1;
-}
-// 
-// 
-// 
-Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
-       //see header file for documentation
-
-       Double_t        helixpos[6];
-       ptrack->GetHelixParameters(helixpos,b);
-
-       Double_t        helixneg[6];
-       ntrack->GetHelixParameters(helixneg,b);
-
-       Double_t negtrackradius =       TMath::Abs(1./helixneg[4]);
-       Double_t postrackradius =       TMath::Abs(1./helixpos[4]);
-
-       Double_t pi = 3.14159265358979323846;
-
-       Double_t convpos[2];
-       GetConvPosXY(ptrack,ntrack,b,convpos);
-
-        Double_t convposx = convpos[0];
-        Double_t convposy = convpos[1];
-
-        Double_t helixcenterpos[2];
-        GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
-
-        Double_t helixcenterneg[2];
-        GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
-
-        Double_t xpos = helixcenterpos[0];
-        Double_t ypos = helixcenterpos[1];
-        Double_t xneg = helixcenterneg[0];
-        Double_t yneg = helixcenterneg[1];
-
-        Double_t deltaXPos = convposx -        xpos;
-        Double_t deltaYPos = convposy -        ypos;
-
-        Double_t deltaXNeg = convposx -        xneg;
-        Double_t deltaYNeg = convposy -        yneg;
-
-        Double_t alphaPos =    pi + TMath::ATan2(-deltaYPos,-deltaXPos);
-        Double_t alphaNeg =    pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
-
-        Double_t vertexXNeg =  xneg +  TMath::Abs(negtrackradius)*
-        TMath::Cos(alphaNeg);
-        Double_t vertexYNeg =  yneg +  TMath::Abs(negtrackradius)*
-        TMath::Sin(alphaNeg);
-
-        Double_t vertexXPos =  xpos +  TMath::Abs(postrackradius)*
-        TMath::Cos(alphaPos);
-        Double_t vertexYPos =  ypos +  TMath::Abs(postrackradius)*
-        TMath::Sin(alphaPos);
-
-        Double_t x0neg =        helixneg[5];
-        Double_t y0neg =        helixneg[0];
-
-        Double_t x0pos =        helixpos[5];
-        Double_t y0pos =        helixpos[0];
-
-        Double_t dNeg = TMath::Sqrt((vertexXNeg -      x0neg)*(vertexXNeg - x0neg)
-                                                                                                                        +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
-
-        Double_t dPos = TMath::Sqrt((vertexXPos -      x0pos)*(vertexXPos - x0pos)
-                                                                                                                        +(vertexYPos - y0pos)*(vertexYPos - y0pos));
-
-        Double_t rNeg =        TMath::Sqrt(negtrackradius*negtrackradius -
-        dNeg*dNeg/4.);
-
-        Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
-        dPos*dPos/4.);
-
-        Double_t deltabetaNeg =        2*(pi +  TMath::ATan2(-dNeg/2.,-rNeg));
-        Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
-
-        Double_t deltaUNeg = negtrackradius*deltabetaNeg;
-        Double_t deltaUPos = postrackradius*deltabetaPos;
-
-        Double_t zphaseNeg = ntrack->GetZ() +  deltaUNeg * ntrack->GetTgl();
-        Double_t zphasePos = ptrack->GetZ() +  deltaUPos * ptrack->GetTgl();
-
-        Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);
-
-        return convposz;
-}
-// 
-AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/) const{
-       /*
-       if(fUseChargedTrackMultiplicityForBG == kTRUE){
-               return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
-       }
-       else{ // means we use #v0s as multiplicity
-               return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
-       }
-       */
-       return NULL;
-}
-
-Int_t AliV0Reader::CountESDTracks(){
-       // see header file for documentation
-       if(fNumberOfESDTracks == 0){ // count the good esd tracks
-               for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
-                       AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);                   
-                       if(!curTrack){
-       continue;
-                       }
-                       if(fEsdTrackCuts->AcceptTrack(curTrack) ){
-       fNumberOfESDTracks++;
-                       }
-               }
-       }
-
-       return fNumberOfESDTracks;
-}
-
-Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){
-       // see headerfile for documentation
-       Bool_t iResult=kFALSE;
-       //      cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
-       if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){
-               iResult=kTRUE;
-       }
-       return iResult;
-}
-
-Bool_t AliV0Reader::CheckIfEtaIsMother(Int_t label){
-       // see headerfile for documentation
-       Bool_t iResult=kFALSE;
-       //      cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
-       if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 221){
-               iResult=kTRUE;
-       }
-       return iResult;
-}
-
-
-
-
-Bool_t AliV0Reader::GetArmenterosQtAlpha(const AliKFParticle* negativeKFParticle, const AliKFParticle * positiveKFParticle, Double_t armenterosQtAlpha[2], Int_t kfProductionMethod){
-   
-   AliKFParticle PosParticle = *positiveKFParticle;
-   AliKFParticle NegParticle = *negativeKFParticle;
-   AliKFParticle Gamma;
-   if(kfProductionMethod < 3)
-      Gamma.ConstructGamma(PosParticle, NegParticle);
-   else if(kfProductionMethod == 3){
-      Gamma += PosParticle;
-      Gamma += NegParticle;
-   }
-   
-   Double_t VertexGamma[3] = {Gamma.GetX(), Gamma.GetY(), Gamma.GetZ()};
-   PosParticle.TransportToPoint(VertexGamma);
-   NegParticle.TransportToPoint(VertexGamma);
-   
-   AliKFParticle::GetArmenterosPodolanski(PosParticle, NegParticle, armenterosQtAlpha);
-   
-   return 1;
-}
-
-
-
-
-Bool_t AliV0Reader::GetArmenterosQtAlpha(const AliKFParticle* negativeKFParticle, const AliKFParticle * positiveKFParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlpha[2] ){
-       //see header file for documentation
-
-       TVector3 momentumVectorPositiveKF(positiveKFParticle->GetPx(),positiveKFParticle->GetPy(),positiveKFParticle->GetPz());
-       TVector3 momentumVectorNegativeKF(negativeKFParticle->GetPx(),negativeKFParticle->GetPy(),negativeKFParticle->GetPz());
-       TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
-
-       Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
-       Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
-       
-       Float_t alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-       
-
-       Float_t qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
-                       
-       armenterosQtAlpha[0]=qt;
-       armenterosQtAlpha[1]=alfa;
-
-       return 1;
-
-}
-
-Bool_t AliV0Reader::GetArmenterosQtAlpha(const AliESDv0* v0, Double_t armenterosQtAlpha[2])
-{      //see header file for documentation
-
-   Double_t mn[3] = {0,0,0};
-   Double_t mp[3] = {0,0,0};  
-   Double_t mm[3] = {0,0,0};  
-
-
-   Int_t pIndex = 0, nIndex = 0;
-   pIndex = v0->GetPindex();
-   nIndex = v0->GetNindex();
-
-   AliESDtrack* d[2];
-   d[0] = dynamic_cast<AliESDtrack*>(fESDEvent->GetTrack(pIndex));
-   d[1] = dynamic_cast<AliESDtrack*>(fESDEvent->GetTrack(nIndex));
-
-   Int_t sign[2];
-   sign[0] = (int)d[0]->GetSign();
-   sign[1] = (int)d[1]->GetSign();
-  
-   Bool_t correct = kFALSE;
-
-
-   if(-1 == sign[0] && 1 == sign[1]){
-      correct = kFALSE;
-   }
-   else{
-      correct = kTRUE;
-   }
-
-
-   if(correct){
-      v0->GetNPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
-      v0->GetPPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
-   }
-   else{
-      v0->GetPPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
-      v0->GetNPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
-   }
-   v0->GetPxPyPz(mm[0],mm[1],mm[2]); //reconstructed cartesian momentum components of mother
-
-   TVector3 vecN(mn[0],mn[1],mn[2]);
-   TVector3 vecP(mp[0],mp[1],mp[2]);
-   TVector3 vecM(mm[0],mm[1],mm[2]);
-  
-   Double_t thetaP = acos((vecP * vecM)/(vecP.Mag() * vecM.Mag()));
-   Double_t thetaN = acos((vecN * vecM)/(vecN.Mag() * vecM.Mag()));
-  
-   Double_t alfa = ((vecP.Mag())*cos(thetaP)-(vecN.Mag())*cos(thetaN))/
-      ((vecP.Mag())*cos(thetaP)+(vecN.Mag())*cos(thetaN)) ;
-   Double_t qt = vecP.Mag()*sin(thetaP);
-
-   armenterosQtAlpha[0]=qt;
-   armenterosQtAlpha[1]=alfa;
-   
-   return 1;
-
-}
-
-
-
-Bool_t AliV0Reader::GetArmenterosQtAlpha(const TParticle* negativeParticle, const TParticle * positiveParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlpha[2] ){
-       //see header file for documentation
-
-       TVector3 momentumVectorPositiveKF(positiveParticle->Px(),positiveParticle->Py(),positiveParticle->Pz());
-       TVector3 momentumVectorNegativeKF(negativeParticle->Px(),negativeParticle->Py(),negativeParticle->Pz());
-       TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
-
-       Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
-       Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
-       
-       Float_t alfa;
-       Float_t qt;
-       if ( positiveParticle->GetPdgCode() == 11 || positiveParticle->GetPdgCode() == 13 || positiveParticle->GetPdgCode() == 15){
-               alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
-       } else if ( negativeParticle->GetPdgCode() == -11 || negativeParticle->GetPdgCode() == -13 || negativeParticle->GetPdgCode() == -15){
-               alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
-       } else if (positiveParticle->GetPdgCode() < 0 && positiveParticle->GetPdgCode() != -11 && positiveParticle->GetPdgCode() != -13 && positiveParticle->GetPdgCode() != -15 ){
-               alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
-       } else {
-               alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
-       }
-               
-       armenterosQtAlpha[0]=qt;
-       armenterosQtAlpha[1]=alfa;
-       return 1;
-
-}
-
-Bool_t AliV0Reader::GetArmenterosQtAlpha(const TParticle* negativeParticle, const TParticle * positiveParticle, const TParticle * gammaCandidate, Double_t armenterosQtAlpha[2] ){
-       //see header file for documentation
-
-       TVector3 momentumVectorPositiveKF(positiveParticle->Px(),positiveParticle->Py(),positiveParticle->Pz());
-       TVector3 momentumVectorNegativeKF(negativeParticle->Px(),negativeParticle->Py(),negativeParticle->Pz());
-       TVector3 vecV0(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
-
-       Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
-       Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
-       
-       Float_t alfa;
-       Float_t qt;
-       if ( positiveParticle->GetPdgCode() == 11 || positiveParticle->GetPdgCode() == 13 || positiveParticle->GetPdgCode() == 15){
-               alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
-       } else if ( negativeParticle->GetPdgCode() == -11 || negativeParticle->GetPdgCode() == -13 || negativeParticle->GetPdgCode() == -15){
-               alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
-       } else if (positiveParticle->GetPdgCode() < 0 && positiveParticle->GetPdgCode() != -11 && positiveParticle->GetPdgCode() != -13 && positiveParticle->GetPdgCode() != -15 ){
-               alfa =((momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)-(momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorNegativeKF.Mag()*TMath::Sin(thetaV0neg);
-       } else {
-               alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
-               ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
-               qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
-       }
-                       
-       armenterosQtAlpha[0]=qt;
-       armenterosQtAlpha[1]=alfa;
-       return 1;
-
-}
-
-
-Int_t AliV0Reader::GetFirstTPCRow(Double_t radius){
-
-
-       Int_t firstTPCRow=0;
-       Double_t radiusI        =       84.8;
-       Double_t radiusO        = 134.6;
-       Double_t radiusOB = 198.;
-       Double_t rSizeI  = 0.75;
-       Double_t rSizeO  = 1.;
-       Double_t rSizeOB        = 1.5;
-       Int_t nClsI=63;
-       Int_t nClsIO=127;
-
-       if(radius <= radiusI){
-               return firstTPCRow;
-       }
-       if(radius>radiusI && radius<=radiusO){
-               firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
-       }
-       if(radius>radiusO && radius<=radiusOB){
-               firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
-       }
-
-       if(radius>radiusOB){
-               firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
-       }
-
-
-       return firstTPCRow;
-}
-void AliV0Reader::SmearKFParticle(AliKFParticle * kfParticle)
-{
-       Double_t facPBrem = 1.;
-       Double_t facPSig = 0.;
-
-       Double_t phi=0.;
-       Double_t theta=0.;
-       Double_t P=0.;
-
-       P=kfParticle->GetP();
-       phi=kfParticle->GetPhi();
-       if( kfParticle->GetP()!=0){
-               theta=acos( kfParticle->Pz()/ kfParticle->GetP());
-       }
-
-       if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){ 
-               facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
-       }
-       
-       if( fPBremSmearing != 1.){
-               if(fBrem!=NULL){
-                       facPBrem = fBrem->GetRandom();
-               }
-       }
-
-       kfParticle->Px() = facPBrem* (1+facPSig)* P*sin(theta)*cos(phi) ;
-       kfParticle->Py() = facPBrem* (1+facPSig)* P*sin(theta)*sin(phi) ;
-       kfParticle->Pz() = facPBrem* (1+facPSig)* P*cos(theta) ;
-       kfParticle->E() = kfParticle->GetP();
-}
-
-///________________________________________________________________________
-const AliExternalTrackParam *AliV0Reader::GetExternalTrackParam(AliESDv0 *v0,Int_t charge){
-
-    if(!(charge==1||charge==-1)){AliError("Charge not defined");return 0x0;}
-
-    // Int_t label;
-    // if(charge>0)label=0;
-    // else label=1;
-    // Check for sign flip
-
-    if(v0){
-       if(!v0->GetParamN()||!v0->GetParamP())return 0x0;
-       if(!GetTrack(v0->GetNindex())||!fESDEvent->GetTrack(v0->GetPindex()))return 0x0;
-       if((GetTrack(v0->GetPindex()))->Charge()==charge){
-//         fCurrentTrackLabels[label]=v0->GetPindex();
-           return v0->GetParamP();}
-       if((GetTrack(v0->GetNindex()))->Charge()==charge){
-//         fCurrentTrackLabels[label]=v0->GetNindex();
-           return v0->GetParamN();}
-    }
-    return 0x0;
-}
-
-///________________________________________________________________________
-AliVTrack *AliV0Reader::GetTrack(Int_t label){
-    if(fESDEvent){
-               return (AliESDtrack*)fESDEvent->GetTrack(label);
-    }
-//     if(fAODEvent)return (AliAODTrack*)GetAODTrack(label);
-       return 0x0;
-}
-
-Double_t AliV0Reader::GetV0CosineOfPointingAngle(Double_t V0PointX, Double_t V0PointY, Double_t V0PointZ){
-   // calculates the pointing angle of the recalculated V0 
-
-   Double_t momV0[3]; //momentum of the V0
-   fCurrentV0->GetPxPyPz(momV0[0],momV0[1],momV0[2]);
-
-   Double_t PosV0[3]; //Recalculated V0 Position vector
-  
-   PosV0[0] = V0PointX - fESDEvent->GetPrimaryVertex()->GetX();
-   PosV0[1] = V0PointY - fESDEvent->GetPrimaryVertex()->GetY();
-   PosV0[2] = V0PointZ - fESDEvent->GetPrimaryVertex()->GetZ();
-
-   Double_t momV02 = momV0[0]*momV0[0] + momV0[1]*momV0[1] + momV0[2]*momV0[2];
-   Double_t PosV02 = PosV0[0]*PosV0[0] + PosV0[1]*PosV0[1] + PosV0[2]*PosV0[2];
-
-   Double_t cosinePointingAngle = (PosV0[0]*momV0[0] +  PosV0[1]*momV0[1] + PosV0[2]*momV0[2] ) / TMath::Sqrt(momV02 * PosV02);
-   return cosinePointingAngle;
-}
-
-
-Double_t AliV0Reader::GetPsiPair(AliESDv0* v0)
-{
-   //
-   // Angle between daughter momentum plane and plane 
-   // 
-   Float_t magField = fESDEvent->GetMagneticField();
-
-   Double_t xyz[3] = {0.,0.,0.};
-   v0->GetXYZ(xyz[0],xyz[1],xyz[2]);
-     
-   Double_t mn[3] = {0,0,0};
-   Double_t mp[3] = {0,0,0};
-  
-   v0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
-   v0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter; 
-
-   Double_t deltat = 1.;
-   deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) -  TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));//difference of angles of the two daughter tracks with z-axis
-   Double_t radiussum = TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]) + 50;//radius to which tracks shall be propagated 
-   Double_t momPosProp[3] = {0,0,0};
-   Double_t momNegProp[3] = {0,0,0};
-    
-   AliExternalTrackParam nt = *(v0->GetParamN());
-   AliExternalTrackParam pt = *(v0->GetParamP());
-
-   Double_t psiPair = 4.;
-   if(nt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
-   
-   if(pt.PropagateTo(radiussum,magField) == 0) return psiPair; //propagate tracks to the outside -> Better Purity and Efficiency
-  
-   pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation
-   nt.GetPxPyPz(momNegProp);
-
-  Double_t pEle =
-     TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
-
-  Double_t pPos =
-     TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
-    
-  Double_t scalarproduct =
-     momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
-    
-  Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
-
-  psiPair =  TMath::Abs(TMath::ASin(deltat/chipair));  
-
-  return psiPair; 
-}
-
-Int_t AliV0Reader::GetNumberOfHijingPlusPythiaPrimeries(Int_t excludeHeaderType){
-   
-   // Calculate NPrimaries for LHC11a10b_*
-
-   Int_t nproduced = 0;
-   AliGenCocktailEventHeader *cHeader = dynamic_cast<AliGenCocktailEventHeader*>(fMCEvent->GenEventHeader());
-   if(cHeader){
-      TList *genHeaders = cHeader->GetHeaders();
-      AliGenEventHeader* gh = 0;
-      for(Int_t i = 0; i<genHeaders->GetEntries();i++){
-         gh = (AliGenEventHeader*)genHeaders->At(i);
-         TString GeneratorName = gh->GetName();
-        
-         if(GeneratorName.CompareTo("Hijing") == 0){
-            nproduced = nproduced + gh->NProduced();
-            //            cout<<i<<"   "<<GeneratorName<<"   "<<gh->NProduced()<<endl;
-         }
-         else if(GeneratorName.CompareTo("Pythia") == 0 && excludeHeaderType == 1){
-            nproduced = nproduced + gh->NProduced();
-            //            cout<<i<<"   "<<GeneratorName<<"   "<<gh->NProduced()<<endl;
-         }
-      }
-   }
-   if(!cHeader){
-      nproduced = fMCStack->GetNprimary();
-   }
-   
-   //  cout<<fMCStack->GetNprimary()-nproduced<<endl;
-
-   return nproduced;
-}
-
-
-Bool_t AliV0Reader::IsParticleFromBGEvent(Int_t index){
-
-   //Bool_t particleFromBG = kFALSE;
-  
-   if(index == -1) return kFALSE;
-   if(index > fNumberOfPrimerisFromHijingAndPythia && index < fMCStack->GetNprimary()){
-      //      cout<<fMCEvent->IsFromBGEvent(index)<<endl;
-      // cout<<index<<"   "<<fNumberOfPrimerisFromHijingAndPythia<<endl;
-      return kTRUE;
-   }
-   //  else cout<<"Passt Noch "<<index<<"   "<<fNumberOfPrimerisFromHijingAndPythia<<endl;
-   // cout<<fMCEvent->IsFromBGEvent(index)<<endl;
-   TParticle *BGParticle = fMCStack->Particle(index);
-   if(BGParticle->GetMother(0) > -1) return kFALSE;
-   //Int_t indexMother = fMCStack->Particle(index)->GetMother(0);
-   //particleFromBG = IsParticleFromBGEvent(indexMother);
-   
-   return kFALSE;
-}
diff --git a/PWGGA/GammaConv/AliV0Reader.h b/PWGGA/GammaConv/AliV0Reader.h
deleted file mode 100644 (file)
index b985456..0000000
+++ /dev/null
@@ -1,1134 +0,0 @@
-#ifndef ALIV0READER_H
-#define ALIV0READER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice     */
-
-////////////////////////////////////////////////
-//--------------------------------------------- 
-// Class used to do analysis on conversion pairs
-//---------------------------------------------
-////////////////////////////////////////////////
-
-// --- ROOT system ---
-#include "TObject.h" 
-#include "AliMCEvent.h"   // for CF
-#include "AliESDv0.h"
-#include "AliESDEvent.h"
-#include "AliKFParticle.h"
-#include "TParticle.h"
-#include "AliGammaConversionHistograms.h"
-#include <vector>
-#include "AliCFManager.h"
-#include "AliGammaConversionBGHandler.h"
-#include "AliESDpid.h"
-#include "TF1.h"
-#include "TRandom3.h"
-
-class TClonesArray; 
-class TFormula;
-class Riostream;
-class TChain;
-
-//--- AliRoot system ---
-
-class AliStack;
-class AliMCEvent;       // for CF
-class AliESDEvent; 
-class AliMCEventHandler;
-class AliESDInputHandler;
-class AliESDVertex;
-class AliLog;
-class TChain;
-class TChain;
-class AliCFManager;   // for CF
-class AliCFContainer;  // for CF
-//class AliESDpid; // for dEdx cut based on nSigma to particle lines 
-class AliESDtrackCuts; 
-class TF1;
-class TRandom3;
-
-class AliV0Reader : public TObject {
-       
-       public: 
-       
-       
-       // for CF
-       enum{
-               kStepGenerated = 0,
-               kStepReconstructable = 1, 
-               kStepGetOnFly = 2,
-               kStepLikeSign = 3,
-               kStepTPCRefit = 4,
-               kStepKinks = 5,
-               kStepdEdxElectronselection = 6,
-               kStepdEdxPionrejection = 7,
-               kStepNContributors = 8,
-               kStepTPCPID = 9,
-               kStepR = 10,
-               kStepLine = 11,
-               kStepZ = 12,
-               kStepMinClsTPC = 13,
-               kStepSinglePt= 14,  
-               kStepNDF = 15,
-               kStepChi2 = 16,
-               kStepEta = 17,
-               kStepPt = 18,
-               kStepTrueGamma = 19
-       };
-       
-       AliV0Reader();                                        //constructor
-       AliV0Reader(const AliV0Reader & g);                   //copy constructor
-       AliV0Reader & operator = (const AliV0Reader & g);     //assignment operator
-       //  virtual ~AliV0Reader() {;}                            //virtual destructor
-       virtual ~AliV0Reader();                            //virtual destructor
-       /*
-               *Initialize the reader
-               */
-       void Initialize();
-       void SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) ;
-
-
-       virtual void SetInputEvent(AliVEvent* const input)  {fESDEvent  = dynamic_cast<AliESDEvent*>(input);}
-       virtual void SetMC(AliMCEvent* const mc)            {fMCEvent = mc;}
-
-               
-       // for CF
-       void SetCFManager(AliCFManager * const io){fCFManager = io;};
-       AliCFManager *GetCFManager() const {return fCFManager;}
-               
-               
-               
-               
-       /*
-               * Returns  AliESDEvent
-               */                      
-       AliESDEvent* GetESDEvent() const{return fESDEvent;}     
-               
-       /*
-               *Returns the number of v0s in the event, no cuts applied.
-               */
-       Int_t GetNumberOfV0s() const{return fESDEvent->GetNumberOfV0s();}
-               
-       /*
-               *Returns the number of contributors to the vertex
-               */
-       //  Int_t GetNumberOfContributorsVtx() const{return fESDEvent->GetPrimaryVertex()->GetNContributors();}
-       Int_t GetNumberOfContributorsVtx();
-       
-       /*
-               * Check if there are any more good v0s left in the v0 stack
-               * if so, fCurrent v0 is set to this v0 and can be retrieved
-               * by GetCurrentV0 function.
-               * returns kFALSE if there is no more good v0s in the v0 stack
-               */
-       Bool_t NextV0();
-               
-       /*
-               * Returns the v0 at the given index, no checks are done on the v0. 
-               */
-       AliESDv0* GetV0(Int_t index);
-               
-       /*
-               * Returns the current v0
-               */
-       AliESDv0* GetCurrentV0() const{return fCurrentV0;}
-               
-       /*
-               * Returns the negative ESD track which belongs to fCurrentV0
-               */
-       //  AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}
-       AliESDtrack* GetNegativeESDTrack(){return fCurrentNegativeESDTrack;}
-               
-       /*
-               * Returns the positive ESD track which belongs to fCurrentV0
-               */
-       //  AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}
-       AliESDtrack* GetPositiveESDTrack(){return fCurrentPositiveESDTrack;}
-               
-       /*
-               * Returns the negative KF particle which belongs to fCurrentV0
-               */
-       AliKFParticle* GetNegativeKFParticle() const{return fCurrentNegativeKFParticle;}
-               
-       /*
-               * Returns the positive KF particle which belongs to fCurrentV0
-               */
-       AliKFParticle* GetPositiveKFParticle() const{return fCurrentPositiveKFParticle;}
-               
-       /*
-               * Returns the KFParticle object of the 2 tracks.
-               */
-       AliKFParticle* GetMotherCandidateKFCombination() const{return fCurrentMotherKFCandidate;}
-               
-       /*
-               * Checks the probablity that the PID of the particle is what we want it to be.
-               */
-       Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut);
-               
-       /*
-               * Checks if the PID of the two particles are within our cuts.
-               */
-       void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);
-
-       /*
-               * Checks if the PID of the two particles are within our cuts.
-               */
-       void GetPIDProbabilityMuonPion(Double_t &negPIDProb, Double_t &posPIDProb);
-               
-       /*
-               *Get the negative MC TParticle from the stack 
-               */
-       TParticle * GetNegativeMCParticle() const{return fNegativeMCParticle;}
-               
-       /*
-               *Get the positive MC TParticle from the stack 
-               */
-       TParticle * GetPositiveMCParticle() const{return fPositiveMCParticle;}
-               
-       /*
-               *Get the mother MC TParticle from the stack 
-               */
-       TParticle * GetMotherMCParticle() const{return fMotherMCParticle;}
-               
-       /*
-               * Flag to see if the v0 particles share the same mother
-               */
-       Bool_t HasSameMCMother();
-               
-               
-       /*
-               *Get the PID of the MC mother particle
-               */
-       Int_t GetMotherMCParticlePDGCode() const{return fMotherMCParticle->GetPdgCode();}
-               
-       /*
-               *Get the MC stack 
-               */
-       AliStack* GetMCStack() const{return fMCStack;}
-               
-               
-       /*
-               * Setup  AliMCEventHandler
-               */                      
-       //  AliMCEventHandler* GetMCTruth() const{return fMCTruth;}     // for CF
-               
-               
-       /*
-               *Get the MC stack 
-               */
-       AliMCEvent* GetMCEvent() const{return fMCEvent;}   // for CF
-               
-               
-       /*
-               *Get the magnetic field from the ESD event 
-               */
-       Double_t GetMagneticField() const{return fESDEvent->GetMagneticField();}
-               
-       /*
-               *Get the primary vertex from the esd event
-               */
-       const AliESDVertex *GetPrimaryVertex() const {return fESDEvent->GetPrimaryVertex();}
-
-       /*
-               Calculate cos Pointing angle with new coords
-        */
-       Double_t GetV0CosineOfPointingAngle(Double_t V0PointX, Double_t V0PointY, Double_t V0PointZ);
-
-       /*
-               * Set the PID of the negative track
-               */
-       void SetNegativeTrackPID(Int_t negTrackPID){fNegativeTrackPID=negTrackPID;}
-               
-       /*
-               * Set the PID of the positive track
-               */
-       void SetPositiveTrackPID(Int_t posTrackPID){fPositiveTrackPID=posTrackPID;}
-               
-       /*
-               * Set the flag to use the kfparticle class. Will also disable the use of esd tracks
-               */
-       void UseKFParticle(){fUseKFParticle = kTRUE; fUseESDTrack = kFALSE;}
-               
-       /*
-               *  Set the flag to use the esd track class. Will also disable the use of kf particles
-               */
-       void UseESDTrack(){fUseESDTrack = kTRUE; fUseKFParticle = kFALSE;}
-               
-       /*
-               *  Set the flag to use improved vertex or not
-               */
-       void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;}
-               
-       /*
-               * Return the number in the species array belonging to the negative or positive track pid.
-               */
-       Int_t GetSpeciesIndex(Int_t chargeOfTrack);
-               
-       /*
-               * Return the x coordinate of the v0
-               */
-       Double_t GetX() const{return fCurrentXValue;}
-               
-       /*
-               * Return the y coordinate of the v0
-               */
-       Double_t GetY() const{return fCurrentYValue;}
-               
-       /*
-               * Return the Z coordinate of the v0
-               */
-       Double_t GetZ() const{return fCurrentZValue;}
-               
-       /*
-               * Return the radius of the v0
-               */
-       Double_t GetXYRadius() const{return sqrt((Double_t)(fCurrentXValue*fCurrentXValue + fCurrentYValue*fCurrentYValue));}
-               
-       /*
-               * Get the opening angle between the two tracks
-               */
-       Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());}
-
-       /*
-               * Get the Cos Pointing angle between the two tracks
-               */
-       Double_t GetCosPointingAngle(){return fCurrentV0->GetV0CosineOfPointingAngle();}
-
-       /*
-        * Get the PsiPair angle between the two tracks
-        */
-       Double_t GetPsiPair(AliESDv0* v0);
-        /*
-         * Check If Particle is from BG Event
-         */
-        Bool_t IsParticleFromBGEvent(Int_t index);
-        /*
-         * GetNumberOfPrimariesFromHijingAndPythia
-         */
-        Int_t GetNumberOfHijingPlusPythiaPrimeries(Int_t excludeHeaderType);
-        Int_t GetPrimeriesFromHijingAndPythia(){return fNumberOfPrimerisFromHijingAndPythia;}
-       /*
-         * Get the DCA between the two tracks
-         */
-       Double_t GetDcaDaughters(){return fCurrentV0->GetDcaV0Daughters();}
-
-       /*
-               * Get the Normalized DCA between the two tracks
-               */
-       Double_t GetNormDcaDistDaughters(){return fCurrentV0->GetDcaV0Daughters()/fCurrentV0->GetDistSigma();}
-
-       /*
-               * Get the Likelihood for a Conversion
-               */
-       Double_t GetLikelihoodAP(){return fCurrentV0->GetLikelihoodAP(0,0);}
-                       
-       /*
-               * Gets the Energy of the negative track.
-               */
-       Double_t GetNegativeTrackEnergy() const{return fCurrentNegativeKFParticle->E();}
-               
-       /*
-               * Gets the Energy of the positive track.
-               */
-       Double_t GetPositiveTrackEnergy() const{return fCurrentPositiveKFParticle->E();}
-               
-       /*
-               * Gets the Energy of the mother candidate.
-               */
-       Double_t GetMotherCandidateEnergy() const{return fCurrentMotherKFCandidate->E();}
-               
-       /*
-               * Gets the Pt of the negative track.
-               */
-       Double_t GetNegativeTrackPt() const{return fNegativeTrackLorentzVector->Pt();}
-               
-       /*
-               * Gets the Pt of the positive track.
-               */
-       Double_t GetPositiveTrackPt() const{return fPositiveTrackLorentzVector->Pt();}
-               
-
-       /*
-               * Gets the Pt of the mother candidate.
-               */
-       Double_t GetMotherCandidatePt() const{return fMotherCandidateLorentzVector->Pt();}
-
-
-       /*
-               * Gets the P of the mother candidate.
-               */
-       Double_t GetMotherCandidateP() const{return fMotherCandidateLorentzVector->P();}
-               
-
-       /*
-               * Gets the Eta of the negative track.
-               */
-       Double_t GetNegativeTrackEta() const{return fNegativeTrackLorentzVector->Eta();}
-       /*
-               * Gets the Eta of the positive track.
-               */
-       Double_t GetPositiveTrackEta() const{return fPositiveTrackLorentzVector->Eta();}
-       /*
-               * Gets the Eta of the mother candidate.
-               */
-       Double_t GetMotherCandidateEta() const{return fMotherCandidateLorentzVector->Eta();}
-               
-       /*
-               * Gets the NDF of the mother candidate.
-               */
-       Double_t GetMotherCandidateNDF() const{return fCurrentMotherKFCandidate->GetNDF();}
-               
-       /*
-               * Gets the Chi2 of the mother candidate.
-               */
-       Double_t GetMotherCandidateChi2() const{return fCurrentMotherKFCandidate->GetChi2();}
-               
-       /*
-               * Gets the Mass of the mother candidate.
-               */
-       Double_t GetMotherCandidateMass() const{return fMotherCandidateKFMass;}
-               
-       /*
-               * Gets the Width of the mother candidate.
-               */
-       Double_t GetMotherCandidateWidth() const{return fMotherCandidateKFWidth;}
-               
-       /*
-               * Gets the Phi of the negative track.
-               */
-       Double_t GetNegativeTrackPhi() const;
-               
-       /*
-               * Gets the Phi of the positive track.
-               */
-       Double_t GetPositiveTrackPhi() const;
-               
-       /*
-               * Gets the Phi of the mother candidate.
-               */
-       Double_t GetMotherCandidatePhi() const;
-               
-       /*
-               * Gets the Rapidity of the mother candidate.
-               */
-       Double_t GetMotherCandidateRapidity() const;
-               
-
-       /*
-               * Gets the P of the negative track.
-               */
-       Double_t GetNegativeTrackP() const{return fNegativeTrackLorentzVector->P();}
-               
-       /*
-               * Gets the P of the positive track.
-               */
-       Double_t GetPositiveTrackP() const{return fPositiveTrackLorentzVector->P();}
-
-       /*
-               * Gets the dE/dx in the TPC of the negative track.
-               */
-       Double_t GetNegativeTrackTPCdEdx() const{return fCurrentNegativeESDTrack->GetTPCsignal();}
-               
-       /*
-               * Gets the dE/dx in the TPC of the positive track.
-               */
-       Double_t GetPositiveTrackTPCdEdx() const{return fCurrentPositiveESDTrack->GetTPCsignal();}
-
-       /*
-               * Gets the Number of the TPC clusters of the negative track.
-               */
-       Int_t GetNegativeTracknTPCClusters() const{return fCurrentNegativeESDTrack->GetNcls(1);}
-
-       /*
-               * Gets the Number of the TPC clusters of the positive track.
-               */
-       Int_t GetPositiveTracknTPCClusters() const{return fCurrentPositiveESDTrack->GetNcls(1);}
-
-       /*
-               * Get the TOFsignal for negative/positive track. RRnewTOF
-               */
-       Double_t GetNegativeTrackTOFsignal() const{return fCurrentNegativeESDTrack->GetTOFsignal();}
-       Double_t GetPositiveTrackTOFsignal() const{return fCurrentPositiveESDTrack->GetTOFsignal();}    
-
-       /*
-               * Gets the Number of the TPC findable clusters of the negative track.
-               */
-       Int_t GetNegativeTracknTPCFClusters() const{return fCurrentNegativeESDTrack->GetTPCNclsF();}
-
-       /*
-               * Gets the Number of the TPC findable clusters of the positive track.
-               */
-       Int_t GetPositiveTracknTPCFClusters() const{return fCurrentPositiveESDTrack->GetTPCNclsF();}
-
-       /*
-               * Gets the Number of the ITS clusters of the negative track.
-               */
-       Int_t GetNegativeTracknITSClusters() const{return fCurrentNegativeESDTrack->GetNcls(0);}
-
-       /*
-               * Gets the Number of the ITS clusters of the positive track.
-               */
-       Int_t GetPositiveTracknITSClusters() const{return fCurrentPositiveESDTrack->GetNcls(0);}
-
-       /*
-               * Gets the chi2 of the TPC  negative track.
-               */
-       Double_t GetNegativeTrackTPCchi2() const{return fCurrentNegativeESDTrack->GetTPCchi2();}
-
-       /*
-               * Gets the chi2 of the TPC  the positive track.
-               */
-       Double_t GetPositiveTrackTPCchi2() const{return fCurrentPositiveESDTrack->GetTPCchi2();}
-               
-       /*
-               * Update data which need to be updated every event.
-               */
-       void UpdateEventByEventData();
-
-       /*
-               * Gets the MaxRCut value.
-               */
-       Double_t GetMaxVertexZ() const{return fMaxVertexZ;}
-               
-       /*
-               * Gets the MaxRCut value.
-               */
-       Double_t GetMaxRCut() const{return fMaxR;}
-
-               /*
-               * Gets the MinRCut value.
-               */
-               Double_t GetMinRCut() const{return fMinR;}
-               
-       /*
-               * Gets the Eta cut value.
-               */
-       Double_t GetEtaCut() const{return fEtaCut;}
-
-       /*
-               * Gets the Eta cut value.
-               */
-       Double_t GetEtaCutMin() const{return fEtaCutMin;}
-
-       /*
-               * Gets the Rapidity Meson cut value.
-               */
-       Double_t GetRapidityMesonCut() const{return fRapidityMesonCut;}
-               
-       /*
-               * Gets the Pt cut value.
-               */
-       Double_t GetPtCut() const{return fPtCut;}
-       Double_t GetSinglePtCut() const{return fSinglePtCut;}   
-               
-       /*
-               * Gets the MaxZCut value.
-               */
-       Double_t GetMaxZCut() const{return fMaxZ;}
-               
-               
-       /*
-               * Gets the MinClsTPC value.
-               */
-       Double_t GetMinClsTPCCut() const{return fMinClsTPC;}
-               
-       /*
-               * Gets the MinClsTPC value.
-               */
-       Double_t GetMinClsTPCCutToF() const{return fMinClsTPCToF;}
-       
-       const AliExternalTrackParam *GetExternalTrackParam(AliESDv0 *v0,Int_t charge);
-       const AliExternalTrackParam *GetExternalTrackParamP(AliESDv0 *v0){return GetExternalTrackParam(v0,1);};
-       const AliExternalTrackParam *GetExternalTrackParamN(AliESDv0 *v0){return GetExternalTrackParam(v0,-1);};
-       
-       AliVTrack *GetTrack(Int_t label);
-
-       /*
-               * Gets the line cut values.
-               */
-       Double_t GetLineCutZRSlope() const{return fLineCutZRSlope;}
-       Double_t GetLineCutZRSlopeMin() const{return fLineCutZRSlopeMin;}
-       Double_t GetLineCutZValue() const{return fLineCutZValue;}
-       Double_t GetLineCutZValueMin() const{return fLineCutZValueMin;} 
-       /*
-               * Gets the Chi2 cut value for the conversions.
-               */
-       Double_t GetChi2CutConversion() const{return fChi2CutConversion;}
-               
-       /*
-               * Gets the Chi2 cut value for the mesons.
-               */
-       Double_t GetChi2CutMeson() const{return fChi2CutMeson;}
-               
-       /*
-               * Gets the alpha cut value for the mesons.
-               */
-       Double_t GetAlphaCutMeson() const{return fAlphaCutMeson;}
-
-       /*
-               * Gets the Minimum alpha cut value for the mesons.
-               */
-       Double_t GetAlphaMinCutMeson() const{return fAlphaMinCutMeson;}
-
-       Double_t GetPositiveTrackLength() const{return fCurrentPositiveESDTrack->GetIntegratedLength();}
-       Double_t GetNegativeTrackLength() const{return fCurrentNegativeESDTrack->GetIntegratedLength();}
-               
-       Double_t GetPositiveNTPCClusters() const{return fCurrentPositiveESDTrack->GetTPCNcls();}
-       Double_t GetNegativeNTPCClusters() const{return fCurrentNegativeESDTrack->GetTPCNcls();}
-               
-       /*
-         * Sets the MaxVertexZ value.
-         */
-       void SetMaxVertexZ(Double_t maxVertexZ){fMaxVertexZ=maxVertexZ;}
-
-       /*
-         * Sets the MaxRCut value.
-         */
-       void SetMaxRCut(Double_t maxR){fMaxR=maxR;}
-       /*      
-         * Sets the MinRCut value.
-         */
-       void SetMinRCut(Double_t minR){fMinR=minR;}
-
-       /*
-         * Sets the EtaCut value.
-         */
-       void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}
-
-       /*
-         * Sets the EtaCutMin value.
-         */
-       void SetEtaCutMin(Double_t etaCutMin){fEtaCutMin=etaCutMin;}
-
-
-       /*
-         * Sets the Rapidity Meson Cut value.
-         */
-       void SetRapidityMesonCut(Double_t RapidityMesonCut){fRapidityMesonCut=RapidityMesonCut;}
-               
-       /*
-         * Sets the PtCut value.
-         */
-       void SetPtCut(Double_t ptCut){fPtCut=ptCut;}
-               
-       /*
-         * Sets the PtCut value.
-         */
-       void SetSinglePtCut(Double_t singleptCut){fSinglePtCut=singleptCut;}
-               
-               
-       /*
-         * Sets the MaxZCut value.
-         */
-       void SetMaxZCut(Double_t maxZ){fMaxZ=maxZ;}
-               
-       /*
-         * Sets the MinClsTPC value.
-         */
-       void SetMinClsTPCCut(Double_t minClsTPC){fMinClsTPC=minClsTPC;}
-
-       /*
-         * Sets the MinClsTPC value.
-         */
-       void SetMinClsTPCCutToF(Double_t minClsTPCToF){fMinClsTPCToF=minClsTPCToF;}
-               
-
-       /*
-         * Sets the LineCut values.
-         */
-       void SetLineCutZRSlope(Double_t LineCutZRSlope){fLineCutZRSlope=LineCutZRSlope;}
-       void SetLineCutZValue(Double_t LineCutZValue){fLineCutZValue=LineCutZValue;}
-               
-       void SetLineCutZRSlopeMin(Double_t LineCutZRSlopeMin){fLineCutZRSlopeMin=LineCutZRSlopeMin;}
-       void SetLineCutZValueMin(Double_t LineCutZValueMin){fLineCutZValueMin=LineCutZValueMin;}
-                       
-       /*
-         * Sets the Chi2Cut value for conversions.
-         */
-       void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}
-               
-       /*
-         * Sets the Chi2Cut for the mesons.
-         */
-       void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}
-               
-       /*
-         * Sets the AlphaCut for the mesons.
-         */
-       void SetAlphaCutMeson(Double_t alpha){fAlphaCutMeson=alpha;}
-               
-
-       /*
-         * Sets the AlphaCut for the mesons.
-         */
-       void SetAlphaMinCutMeson(Double_t alpha){fAlphaMinCutMeson=alpha;}
-
-
-       /*
-         * Sets the XVertexCut value.
-         */
-       void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}
-               
-       /*
-         * Sets the YVertexCut value.
-         */
-       void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}
-               
-       /*
-         * Sets the ZVertexCut value.
-         */
-       void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;}
-               
-       /*
-         * Sets the PIDProbabilityCut value for track particles.
-         */
-       void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}
-               
-       /*
-         * Sets the PIDProbability cut value for the negative track.
-         */
-       void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}
-               
-       /*
-         * Sets the PIDProbability cut value for the positive track.
-         */
-       void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}
-
-       /*
-         * Sets the PIDnSigmaAboveElectron cut value for the tracks.
-         */
-       void SetPIDnSigmaAboveElectronLine(Double_t nSigmaAbove){fPIDnSigmaAboveElectronLine=nSigmaAbove;}
-       void SetTofPIDnSigmaAboveElectronLine(Double_t nTofSigmaAbove){fTofPIDnSigmaAboveElectronLine=nTofSigmaAbove;} // RRnewTOF
-               
-       /*
-         * Sets the PIDnSigmaBelowElectron cut value for the tracks.
-         */
-       void SetPIDnSigmaBelowElectronLine(Double_t nSigmaBelow){fPIDnSigmaBelowElectronLine=nSigmaBelow;}
-       void SetTofPIDnSigmaBelowElectronLine(Double_t nTofSigmaBelow){fTofPIDnSigmaBelowElectronLine=nTofSigmaBelow;} // RRnewTOF
-               
-       /*
-         * Sets the PIDnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDnSigmaAbovePionLine(Double_t nSigmaAbovePion){fPIDnSigmaAbovePionLine=nSigmaAbovePion;}
-
-       /*
-         * Sets the PIDnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDnSigmaAbovePionLineHighPt(Double_t nSigmaAbovePionHighPt){fPIDnSigmaAbovePionLineHighPt=nSigmaAbovePionHighPt;}
-
-       /*
-         * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDMinPnSigmaAbovePionLine(Double_t MinPnSigmaAbovePion){fPIDMinPnSigmaAbovePionLine=MinPnSigmaAbovePion;}
-
-       /*
-         * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDMaxPnSigmaAbovePionLine(Double_t MaxPnSigmaAbovePion){fPIDMaxPnSigmaAbovePionLine=MaxPnSigmaAbovePion;}
-
-       /*
-         * Sets the SigmaMassCut value.
-         */
-       void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}
-               
-       /*
-         * Sets the flag to enable/disable the usage of MC information. 
-         */
-       void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}
-
-       /*
-         * Sets the flag to enable/disable the usage of MC information. 
-         */
-       Bool_t GetDoMCTruth() const {return fDoMC;}
-               
-       /*
-         * Sets the flag to enable/disable the cut dedx N sigma 
-         */
-
-       void SetDodEdxSigmaCut( Bool_t dodEdxSigmaCut){fDodEdxSigmaCut=dodEdxSigmaCut;}
-       void SetDoTOFsigmaCut( Bool_t doTOFsigmaCut){fDoTOFsigmaCut=doTOFsigmaCut;} //RRnewTOF
-       void SetDoPhotonAsymmetryCut( Bool_t doPhotonAsymmetryCut){fDoPhotonAsymmetryCut=doPhotonAsymmetryCut;}
-       void SetUseESDQtCut(Int_t doESDQtCut){fdoESDQtCut=doESDQtCut;}
-
-       void SetMinPPhotonAsymmetryCut(Double_t minPPhotonAsymmetryCut){fMinPPhotonAsymmetryCut=minPPhotonAsymmetryCut;}
-       void SetMinPhotonAsymmetry(Double_t minPhotonAsymmetry){fMinPhotonAsymmetry=minPhotonAsymmetry;}
-       /*
-         * Sets the flag to enable/disable the cut dedx N sigma for Kaon Rejection at low p 
-         */
-       void SetDoKaonRejectionLowP( Bool_t doKaonRejectionLowP){fDoKaonRejectionLowP=doKaonRejectionLowP;}
-       /*
-         * Sets the flag to enable/disable the cut dedx N sigma for Proton Rejection at low p 
-         */
-       void SetDoProtonRejectionLowP( Bool_t doProtonRejectionLowP){fDoProtonRejectionLowP=doProtonRejectionLowP;}
-
-       /*
-         * Sets the flag to enable/disable the cut dedx N sigma for Pion Rejection at low p 
-         */
-       void SetDoPionRejectionLowP( Bool_t doPionRejectionLowP){fDoPionRejectionLowP=doPionRejectionLowP;}
-
-       /*
-         * Sets the PIDMinPnSigmaAroundKaon cut value for the tracks.
-         */
-       void SetPIDnSigmaAtLowPAroundKaonLine(Double_t nSigmaAtLowPAroundKaon){fPIDnSigmaAtLowPAroundKaonLine =nSigmaAtLowPAroundKaon;}
-
-       /*
-         * Sets the PIDMinPnSigmaAroundProton cut value for the tracks.
-         */
-       void SetPIDnSigmaAtLowPAroundProtonLine(Double_t nSigmaAtLowPAroundProton){fPIDnSigmaAtLowPAroundProtonLine =nSigmaAtLowPAroundProton;}
-
-       /*
-         * Sets the PIDMinPnSigmaAroundPion cut value for the tracks.
-         */
-       void SetPIDnSigmaAtLowPAroundPionLine(Double_t nSigmaAtLowPAroundPion){fPIDnSigmaAtLowPAroundPionLine =nSigmaAtLowPAroundPion;}
-
-       /*
-         * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDMinPKaonRejectionLowP(Double_t PIDMinPKaonRejectionLowP ){fPIDMinPKaonRejectionLowP=PIDMinPKaonRejectionLowP;}
-
-       /*
-         * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDMinPProtonRejectionLowP(Double_t PIDMinPProtonRejectionLowP ){fPIDMinPProtonRejectionLowP=PIDMinPProtonRejectionLowP;}
-       /*
-         * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
-         */
-       void SetPIDMinPPionRejectionLowP(Double_t PIDMinPPionRejectionLowP ){fPIDMinPPionRejectionLowP=PIDMinPPionRejectionLowP;}
-
-       /*
-         *Set if we want to use Gamma Selection based on Qt from Armenteros
-         */
-       void SetDoQtGammaSelection(Bool_t doQtGammaSelection){fDoQtGammaSelection=doQtGammaSelection;}
-       void SetDoHighPtQtGammaSelection(Bool_t doHighPtQtGammaSelection){fDoHighPtQtGammaSelection=doHighPtQtGammaSelection;} // RRnew
-       /*
-         * Sets the MaxQtCut value.
-         */
-       void SetQtMax(Double_t qtMax){fQtMax=qtMax;}
-       void SetHighPtQtMax(Double_t qtMaxHighPt){fHighPtQtMax=qtMaxHighPt;} // RRnew
-       void SetPtBorderForQt(Double_t ptBorderForQt){fPtBorderForQt=ptBorderForQt;} // RRnew
-
-       /*
-         * Updates the V0 information of the current V0.
-         */
-       Bool_t UpdateV0Information();
-               
-       /*
-         * Resets the V0 index.
-         */
-       void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}
-       
-
-       /*
-         * Returns number of good v0s in the event
-         */
-       Int_t GetNGoodV0s() const {return fNumberOfGoodV0s;}
-
-       /*
-         * Sets the histograms.
-         */
-       void SetHistograms(AliGammaConversionHistograms * const histograms){fHistograms=histograms;}
-               
-       /*
-         * Check for primary vertex.
-         */
-       Bool_t CheckForPrimaryVertex();
-               
-       /*
-         * Check for primary vertex Z.
-         */
-       Bool_t CheckForPrimaryVertexZ();
-
-       /*
-         * Gets a vector of good v0s.
-         */
-       TClonesArray* GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;}
-               
-       /*
-         * Gets the vector of previous events v0s (for bacground analysis)
-         */
-       AliGammaConversionKFVector* GetBGGoodV0s(Int_t event) const;
-       //  vector<AliKFParticle> GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;}
-
-       void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
-
-       void SetUseConstructGamma(Bool_t flag){fUseConstructGamma=flag;}
-
-       /*
-         * Excludes BG Events in HI Simulations e.g. in LHC10b_bis
-         */
-       void SetExcludeBackgroundEventForGammaCorrection(Int_t flag){fExcludeBackgroundEventForGammaCorrection=flag;}
-       /*
-         * Excludes BG Events in HI Simulations e.g. in LHC10b_bis
-         */
-        Int_t GetExcludeBackgroundEventForGammaCorrection(){return fExcludeBackgroundEventForGammaCorrection;}
-
-
-//     Bool_t GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]); 
-
-       Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]);
-       Bool_t GetConvPosXY(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b, Double_t convpos[2]);
-       Double_t GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b);
-       Bool_t GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3]);
-       
-       Bool_t GetArmenterosQtAlpha(const AliKFParticle * posKFparticle, const AliKFParticle * negKFparticle, const AliKFParticle * gamKFparticle,Double_t armenterosQtAlpha[2]);
-       Bool_t GetArmenterosQtAlpha(const TParticle * posKFparticle, const TParticle * negKFparticle, const AliKFParticle * gamKFparticle,Double_t armenterosQtAlpha[2]);
-       Bool_t GetArmenterosQtAlpha(const TParticle * posKFparticle, const TParticle * negKFparticle, const TParticle * gamKFparticle,Double_t armenterosQtAlpha[2]);
-       Bool_t GetArmenterosQtAlpha(const AliESDv0 * v0, Double_t armenterosQtAlpha[2]);
-       Int_t GetUseESDQtCut(){ return fdoESDQtCut;}
-        Bool_t GetArmenterosQtAlpha(const AliKFParticle * posKFparticle, const AliKFParticle * negKFparticle, Double_t armenterosQtAlpha[2], Int_t kfProductionMethod);
-       void SetDoCF(Bool_t flag){fDoCF = flag;}
-
-       Bool_t CheckV0FinderStatus(AliESDv0 *v0);
-
-
-       void SetOnFlyFlag(Bool_t flag){fUseOnFlyV0Finder = flag;}
-
-       void SetPsiPairCut(Double_t flag){fPsiPairCut = flag;}
-       Double_t GetPsiPairCut(){return fPsiPairCut;}
-       
-       void SetCosinePointCut(Double_t flag){fCosinePointCut = TMath::Cos(flag);}
-       Double_t GetCosinePointCut(){return fCosinePointCut;}
-       
-       Int_t GetNBGEvents(){return fBGEventHandler->GetNBGEvents();}
-
-       void SetCalculateBackground(Bool_t flag){fCalculateBackground=flag;}
-
-       AliGammaConversionBGHandler* GetBGHandler() const {return fBGEventHandler;}
-
-       Double_t GetVertexZ(){return fESDEvent->GetPrimaryVertex()->GetZ();}
-
-       Int_t GetMultiplicity(){return CountESDTracks();}
-
-       void SetESDtrackCuts(AliESDtrackCuts * const trackCuts){fEsdTrackCuts = trackCuts;}
-
-       void SetNEventsForBG(Int_t nev){fNEventsForBGCalculation = nev;}
-
-       Int_t CountESDTracks();
-
-       Int_t GetCurrentV0IndexNumber() const {return fCurrentV0IndexNumber;}
-
-       Bool_t CheckIfPi0IsMother(Int_t label);
-       Bool_t CheckIfEtaIsMother(Int_t label);
-
-       static void InitESDpid(Int_t type=0);
-       static void SetESDpid(AliESDpid * const pid) {fgESDpid=pid;}
-       static AliESDpid* GetESDpid() {return fgESDpid;}
-
-       void SetUseChargedTracksMultiplicityForBG(Bool_t flag){fUseChargedTrackMultiplicityForBG = flag;}
-       void SetIsHeavyIon(Int_t isHeavyIon) {fIsHeavyIon=isHeavyIon;}
-       Int_t GetIsHeavyIon() const { return fIsHeavyIon;}
-       
-       Int_t GetPindex(Int_t i) {return fV0Pindex.at(i);}
-       Int_t GetNindex(Int_t i) {return fV0Nindex.at(i);}
-
-       void ResetNGoodV0s(){fNumberOfGoodV0s=0;}
-       Int_t GetFirstTPCRow(Double_t radius);
-
-       void SetUseCorrectedTPCClsInfo(Bool_t flag){fUseCorrectedTPCClsInfo = flag;}
-       Bool_t GetUseCorrectedTPCClsInfo() const {return fUseCorrectedTPCClsInfo;}
-
-       void SetUseMCPSmearing(Int_t useMCPSmearing) {fUseMCPSmearing=useMCPSmearing;}
-       void SetPBremSmearing(Double_t pBremSmearing){fPBremSmearing=pBremSmearing;}
-       void SetPSigSmearing(Double_t pSigSmearing){fPSigSmearing=pSigSmearing;}
-       void SetPSigSmearingCte(Double_t pSigSmearingCte){fPSigSmearingCte=pSigSmearingCte;}
-       void SmearKFParticle(AliKFParticle * kfParticle);
-  
-       private:
-               AliStack * fMCStack;           // pointer to MonteCarlo particle stack 
-               //  AliMCEventHandler* fMCTruth;   // for CF    pointer to the MC object
-               AliMCEvent *fMCEvent;                   //  for CF      pointer to MC event
-               TChain * fChain;               // pointer to the TChain
-                       
-               //  AliESDInputHandler* fESDHandler;      //! pointer to esd object
-               AliESDEvent *fESDEvent;               //! pointer to esd object
-                       
-                       
-               // for CF
-               AliCFManager *fCFManager; // pointer to the cf manager
-               //  AliCFContainer *container;
-                       
-               // for dEdx cut based on nSigma to a particle line
-               //AliESDpid * fESDpid; // esd pid
-                       
-               AliGammaConversionHistograms *fHistograms; // pointer to histogram handling class
-                       
-               Int_t fCurrentV0IndexNumber;  // the current v0 index number
-               AliESDv0 * fCurrentV0;                //! pointer to the current v0
-               AliKFParticle * fCurrentNegativeKFParticle;  //! pointer to the negative KF particle
-               AliKFParticle * fCurrentPositiveKFParticle;  //! pointer to the positive KF particle
-               AliKFParticle * fCurrentMotherKFCandidate;   //! pointer to the positive KF particle
-                       
-               AliESDtrack * fCurrentNegativeESDTrack;      //! pointer to the negative ESD track
-               AliESDtrack * fCurrentPositiveESDTrack;      //! pointer to the positive ESD track
-                       
-               TLorentzVector * fNegativeTrackLorentzVector; //! pointer to the negative Track Lorentz Vector
-               TLorentzVector * fPositiveTrackLorentzVector; //! pointer to the positive Track Lorentz Vector
-               TLorentzVector * fMotherCandidateLorentzVector;   //! pointer to the mother candidate Track Lorentz Vector
-                       
-               Double_t fCurrentXValue;   // current x value
-               Double_t fCurrentYValue;   // current y value
-               Double_t fCurrentZValue;   // current z value
-                       
-               Int_t fPositiveTrackPID;   // positive track pid
-               Int_t fNegativeTrackPID;   // negative track pid
-                       
-               TParticle *fNegativeMCParticle;      //!
-               TParticle *fPositiveMCParticle;      //!
-               TParticle *fMotherMCParticle;        //!
-                       
-               Double_t fMotherCandidateKFMass;   // mass of mother candidate KF particle
-               Double_t fMotherCandidateKFWidth;  // width of mother candidate KF particle
-                       
-               Bool_t fUseKFParticle;   // flag 
-               Bool_t fUseESDTrack;     // flag 
-               Bool_t fDoMC;            // flag 
-
-               //Event Cuts
-               Double_t fMaxVertexZ; // max z vertex cut
-               //cuts
-               Double_t fMaxR; //r cut
-               Double_t fMinR; //r cut
-               Double_t fEtaCut; //eta cut
-               Double_t fEtaCutMin; //eta cut
-               Double_t fRapidityMesonCut; //rapidity for meson cut
-               Double_t fPtCut; // pt cut
-               Double_t fSinglePtCut; // pt cut for electron/positron
-               Double_t fMaxZ; //z cut
-               Double_t fMinClsTPC; // minimum clusters in the TPC
-               Double_t fMinClsTPCToF; // minimum clusters to findable clusters
-               Double_t fLineCutZRSlope; //linecut
-               Double_t fLineCutZValue; //linecut
-               Double_t fLineCutZRSlopeMin; //linecut
-               Double_t fLineCutZValueMin; //linecut
-               Double_t fChi2CutConversion; //chi2cut
-               Double_t fChi2CutMeson;  //chi2cut
-               Double_t fAlphaCutMeson;  //alphacut
-               Double_t fAlphaMinCutMeson;  //alphacut
-               Double_t fPIDProbabilityCutNegativeParticle; //pid cut
-               Double_t fPIDProbabilityCutPositiveParticle; //pid cut
-               Bool_t   fDodEdxSigmaCut; // flag to use the dEdxCut based on sigmas
-               Bool_t   fDoTOFsigmaCut; // flag to use TOF pid cut RRnewTOF
-               Double_t fPIDnSigmaAboveElectronLine; // sigma cut
-               Double_t fPIDnSigmaBelowElectronLine; // sigma cut
-               Double_t fTofPIDnSigmaAboveElectronLine; // sigma cut RRnewTOF
-               Double_t fTofPIDnSigmaBelowElectronLine; // sigma cut RRnewTOF 
-               Double_t fPIDnSigmaAbovePionLine;     // sigma cut
-               Double_t fPIDnSigmaAbovePionLineHighPt;     // sigma cut
-               Double_t fPIDMinPnSigmaAbovePionLine; // sigma cut
-               Double_t fPIDMaxPnSigmaAbovePionLine; // sigma cut
-               Double_t fDoKaonRejectionLowP;   // Kaon rejection at low p
-               Double_t fDoProtonRejectionLowP; // Proton rejection at low p
-               Double_t fDoPionRejectionLowP;   // Pion rejection at low p
-               Double_t fPIDnSigmaAtLowPAroundKaonLine; // sigma cut
-               Double_t fPIDnSigmaAtLowPAroundProtonLine; // sigma cut
-               Double_t fPIDnSigmaAtLowPAroundPionLine; // sigma cut
-               Double_t fPIDMinPKaonRejectionLowP; // Momentum limit to apply kaon rejection
-               Double_t fPIDMinPProtonRejectionLowP; // Momentum limit to apply proton rejection
-               Double_t fPIDMinPPionRejectionLowP; // Momentum limit to apply proton rejection
-               Bool_t   fDoQtGammaSelection; // Select gammas using qtMax
-               Bool_t   fDoHighPtQtGammaSelection; // RRnew Select gammas using qtMax for high pT
-               Double_t fQtMax; // Maximum Qt from Armenteros to select Gammas
-               Double_t fHighPtQtMax; // RRnew Maximum Qt for High pT from Armenteros to select Gammas
-               Double_t fPtBorderForQt; // RRnew 
-               Double_t fXVertexCut; //vertex cut
-               Double_t fYVertexCut; //vertex cut
-               Double_t fZVertexCut; // vertexcut
-               Double_t fPsiPairCut;
-               Double_t fCosinePointCut;
-               
-                       
-               Double_t fNSigmaMass; //nsigma cut
-                       
-               Bool_t fUseImprovedVertex; //flag
-
-               Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
-
-               Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
-
-               Bool_t fDoCF; //flag
-
-               Bool_t fUseEtaMinCut; //flag
-
-               Bool_t fUseOnFlyV0Finder; //flag
-
-               Bool_t fUpdateV0AlreadyCalled; //flag
-                       
-               TClonesArray* fCurrentEventGoodV0s; //vector of good v0s
-               
-               vector<Int_t> fV0Pindex; // index of positive track belonging to a V0
-               vector<Int_t> fV0Nindex; // index of positive track belonging to a V0
-               //  vector<AliKFParticle> fPreviousEventGoodV0s; // vector of good v0s from prevous events
-
-               Bool_t fCalculateBackground; //flag
-               AliGammaConversionBGHandler *fBGEventHandler; // background handler
-               Bool_t fBGEventInitialized; //flag
-                       
-               AliESDtrackCuts *fEsdTrackCuts; // track cuts
-               Int_t fNumberOfESDTracks; //track counter
-
-               static AliESDpid* fgESDpid;                 // ESD pid object
-
-               Int_t fNEventsForBGCalculation; // Number of events used for background calculation
-               
-               Bool_t fUseChargedTrackMultiplicityForBG; // flag
-               Int_t fNumberOfGoodV0s; // number of good V0s
-               Int_t fIsHeavyIon; // flag
-               Bool_t fUseCorrectedTPCClsInfo;
-               Int_t fUseMCPSmearing;
-               Double_t fPBremSmearing;
-               Double_t fPSigSmearing;
-               Double_t fPSigSmearingCte;
-               TRandom3 fRandom;
-               TF1 * fBrem;    
-               Bool_t   fDoPhotonAsymmetryCut; // flag to use the PhotonAsymetryCut
-               Int_t    fdoESDQtCut; // flag for ESD based Qt cut
-               Double_t fMinPPhotonAsymmetryCut;
-               Double_t fMinPhotonAsymmetry;
-                Int_t fExcludeBackgroundEventForGammaCorrection; // flag for excluding Gamma from BGEvent for
-                Int_t fNumberOfPrimerisFromHijingAndPythia; //Number Of Primaries from Hijing and Pythia for PbPb
-               ClassDef(AliV0Reader,22) // RRnewTOF
-};
-
-inline void AliV0Reader::InitESDpid(Int_t type)
-{
-  //
-  // initialize PID parameters
-  // type=0 is simulation
-  // type=1 is data
-
-       if (!fgESDpid) fgESDpid=new AliESDpid;
-       Double_t alephParameters[5];
-       // simulation
-       alephParameters[0] = 2.15898e+00/50.;
-       alephParameters[1] = 1.75295e+01;
-       alephParameters[2] = 3.40030e-09;
-       alephParameters[3] = 1.96178e+00;
-       alephParameters[4] = 3.91720e+00;
-       fgESDpid->GetTOFResponse().SetTimeResolution(80.);
-
-       // data
-       if (type==1){
-               alephParameters[0] = 0.0283086/0.97;
-               alephParameters[1] = 2.63394e+01;
-               alephParameters[2] = 5.04114e-11;
-               alephParameters[3] = 2.12543e+00;
-               alephParameters[4] = 4.88663e+00;
-               fgESDpid->GetTOFResponse().SetTimeResolution(130.);
-               fgESDpid->GetTPCResponse().SetMip(50.);
-       }
-
-       fgESDpid->GetTPCResponse().SetBetheBlochParameters(
-               alephParameters[0],alephParameters[1],alephParameters[2],
-               alephParameters[3],alephParameters[4]);
-
-       fgESDpid->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
-
-}
-
-#endif
-
-
-
-
-
-
index b89a902d35f0584e692ac2cc3ad71fa127d82b74..109d355307a17238fd77433cb3bb6ac1c9f82530 100644 (file)
@@ -1,9 +1,14 @@
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                       *
- * Authors: Svein Lindal, Daniel Lohner                                          *
- * Version 1.0                                                           *
- *                                                                       *
+ *                                                                                                                * 
+ * Authors: Svein Lindal, Daniel Lohner                                                          *
+ * Version 1.0                                                                                                 *
+ *                                                                                                                       *
+ *                                                                         *
+ * based on: on older version (see aliroot up to v5-04-42-AN)              *
+ *           AliV0Reader.cxx                                               *
+ *           Authors: Kathrin Koch, Kenneth Aamodt, Ana Marin              *
+ *                                                                         *
  * Permission to use, copy, modify and distribute this software and its          *
  * documentation strictly for non-commercial purposes is hereby granted          *
  * without fee, provided that the above copyright notice appears in all          *
 #include "AliESDv0.h"
 #include "AliAODEvent.h"
 #include "AliESDEvent.h"
-#include "AliKFParticle.h"
+#include "AliPID.h"
+#include "AliMCEvent.h"
+#include "AliStack.h"
+#include "AliMCEventHandler.h"
+#include "AliESDpid.h"
+#include "AliESDtrackCuts.h"
+#include "TRandom3.h"
+#include "AliGenCocktailEventHeader.h"
+#include "TList.h"
 #include "AliKFConversionPhoton.h"
 #include "AliAODConversionPhoton.h"
 #include "AliConversionPhotonBase.h"
@@ -39,7 +52,6 @@
 #include "AliPIDResponse.h"
 #include "TChain.h"
 #include "TFile.h"
-#include "AliStack.h"
 #include "TString.h"
 #include "TObjArray.h"
 
index c519a614fc93ce0c380197519aaa72e2cd8a5fde..4ba0a2e8ada76fcbad05d6d7e6e166d151ed9baf 100644 (file)
@@ -6,6 +6,16 @@
 #include "AliESDv0.h"
 #include "AliConversionCuts.h"
 #include "AliExternalTrackParam.h"
+#include "TObject.h" 
+#include "AliMCEvent.h"   // for CF
+#include "AliESDEvent.h"
+#include "AliKFParticle.h"
+#include "TParticle.h"
+#include <vector>
+#include "AliESDpid.h"
+#include "TF1.h"
+#include "TRandom3.h"
+
 
 class AliConversionPhotonBase;
 class TRandom3;
index afb02eb70330316faacf223707ac2afd0f3841a6..fac9321fd23af7b40428405a1404763d16eb0620 100644 (file)
@@ -26,12 +26,17 @@ void AddTask_GammaConvV1(TString trainConfig = "pp",   Bool_t isMC  = kFALSE){
       return 0;
    }
       
-   Bool_t IsHeavyIon=collisionSystem.Contains("Pb");
+   Int_t IsHeavyIon=0;
+   if (trainConfig.Contains("PbPb")) IsHeavyIon=1;
+   else if (trainConfig.Contains("pPb")) IsHeavyIon=2;
 
+   
 
    TString cutnumber = "";
-   if(IsHeavyIon){
+   if(IsHeavyIon == 1){
       cutnumber = "1000000002084001001500000";
+    } else if (IsHeavyIon==2){
+     cutnumber = "8000000002084001001500000";   
    } else{
       cutnumber = "0000000002084000002200000";
    }
@@ -40,7 +45,7 @@ void AddTask_GammaConvV1(TString trainConfig = "pp",   Bool_t isMC    = kFALSE){
    if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
       gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
       AddTaskPIDResponse();
-  
+   }
       
    //========= Add V0 Reader to  ANALYSIS manager =====
    AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
@@ -113,7 +118,7 @@ void AddTask_GammaConvV1(TString trainConfig = "pp",   Bool_t isMC  = kFALSE){
 
    }
    else if(trainConfig.Contains("pPb")){ //pA needs thighter rapidity cut y < 0.5
-      cutarray[0] = "1000000042092172023290000"; mesonCutArray[0] = "01024045000";  //standard cut Pi0 pPb 00-100
+      cutarray[ 0] = "8000000042092172023290000"; mesonCutArray[0] = "01024045000";  //standard cut Pi0 PbPb 00-100
    } else {
       cutarray[ 0] = "0000011002093663003800000"; mesonCutArray[0] = "01631031009";
    }