]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/GammaConv/AliConversionMesonCuts.cxx
Added LHC11h_pass2 calibration
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliConversionMesonCuts.cxx
index 24a0f6a99f1594793d9c91ec663cb0ee4b3eed69..d5996efe685ccf1f2fa1d017b9137c8ebe1ae3d7 100644 (file)
@@ -14,7 +14,7 @@
  **************************************************************************/
 
 ////////////////////////////////////////////////
-//--------------------------------------------- 
+//---------------------------------------------
 // Class handling all kinds of selection cuts for
 // Gamma Conversion analysis
 //---------------------------------------------
 #include "AliESDEvent.h"
 #include "AliCentrality.h"
 #include "TList.h"
+#include "TPDGCode.h"
+#include "TDatabasePDG.h"
+#include "AliAODMCParticle.h"
+
 class iostream;
 
 using namespace std;
@@ -47,17 +51,20 @@ 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
+   "SelectionWindow", //7
+   "SharedElectronCuts", //8
+   "RejectToCloseV0s", //9
+   "UseMCPSmearing", //10
+   "DcaGammaGamma", //11
+   "DcaRPrimVtx", //12
+   "DcaZPrimVtx" //13
 };
 
 
@@ -67,7 +74,8 @@ AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *titl
    fHistograms(NULL),
    fMesonKind(0),
    fMaxR(200),
-   fChi2CutMeson(1000),
+   fSelectionLow(0.08),
+   fSelectionHigh(0.145),
    fAlphaMinCutMeson(0),
    fAlphaCutMeson(1),
    fRapidityCutMeson(1),
@@ -87,16 +95,28 @@ AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *titl
    fPSigSmearingCte(0),
    fBrem(NULL),
    fRandom(0),
+   fFAlphaCut(0),
+   fAlphaPtDepCut(kFALSE),
+   fElectronLabelArraySize(500),
    fElectronLabelArray(NULL),
+   fDCAGammaGammaCut(1000),
+   fDCAZMesonPrimVtxCut(1000),
+   fDCARMesonPrimVtxCut(1000),
    fBackgroundHandler(0),
    fCutString(NULL),
    hMesonCuts(NULL),
-   hMesonBGCuts(NULL)
-   
+   hMesonBGCuts(NULL),
+   hDCAGammaGammaMesonBefore(NULL),
+   hDCAZMesonPrimVtxBefore(NULL),
+   hDCARMesonPrimVtxBefore(NULL),
+   hDCAGammaGammaMesonAfter(NULL),
+   hDCAZMesonPrimVtxAfter(NULL),
+   hDCARMesonPrimVtxAfter(NULL)
+
 {
    for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
    fCutString=new TObjString((GetCutNumber()).Data());
-   fElectronLabelArray = new Int_t[500];
+   fElectronLabelArray = new Int_t[fElectronLabelArraySize];
    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
@@ -106,6 +126,60 @@ AliConversionMesonCuts::AliConversionMesonCuts(const char *name,const char *titl
 
 }
 
+//________________________________________________________________________
+AliConversionMesonCuts::AliConversionMesonCuts(const AliConversionMesonCuts &ref) :
+   AliAnalysisCuts(ref),
+   fHistograms(NULL),
+   fMesonKind(ref.fMesonKind),
+   fMaxR(ref.fMaxR),
+   fSelectionLow(ref.fSelectionLow),
+   fSelectionHigh(ref.fSelectionHigh),
+   fAlphaMinCutMeson(ref.fAlphaMinCutMeson),
+   fAlphaCutMeson(ref.fAlphaCutMeson),
+   fRapidityCutMeson(ref.fRapidityCutMeson),
+   fUseRotationMethodInBG(ref.fUseRotationMethodInBG),
+   fDoBG(ref.fDoBG),
+   fdoBGProbability(ref.fdoBGProbability),
+   fUseTrackMultiplicityForBG(ref.fUseTrackMultiplicityForBG),
+   fnDegreeRotationPMForBG(ref.fnDegreeRotationPMForBG),
+   fNumberOfBGEvents(ref. fNumberOfBGEvents),
+   fOpeningAngle(ref.fOpeningAngle),
+   fDoToCloseV0sCut(ref.fDoToCloseV0sCut),
+   fminV0Dist(ref.fminV0Dist),
+   fDoSharedElecCut(ref.fDoSharedElecCut),
+   fUseMCPSmearing(ref.fUseMCPSmearing),
+   fPBremSmearing(ref.fPBremSmearing),
+   fPSigSmearing(ref.fPSigSmearing),
+   fPSigSmearingCte(ref.fPSigSmearingCte),
+   fBrem(NULL),
+   fRandom(ref.fRandom),
+   fFAlphaCut(NULL),
+   fAlphaPtDepCut(ref.fAlphaPtDepCut),
+   fElectronLabelArraySize(ref.fElectronLabelArraySize),
+   fElectronLabelArray(NULL),
+   fDCAGammaGammaCut(ref.fDCAGammaGammaCut),
+   fDCAZMesonPrimVtxCut(ref.fDCAZMesonPrimVtxCut),
+   fDCARMesonPrimVtxCut(ref.fDCARMesonPrimVtxCut),
+   fBackgroundHandler(ref.fBackgroundHandler),
+   fCutString(NULL),
+   hMesonCuts(NULL),
+   hMesonBGCuts(NULL),
+   hDCAGammaGammaMesonBefore(NULL),
+   hDCAZMesonPrimVtxBefore(NULL),
+   hDCARMesonPrimVtxBefore(NULL),
+   hDCAGammaGammaMesonAfter(NULL),
+   hDCAZMesonPrimVtxAfter(NULL),
+   hDCARMesonPrimVtxAfter(NULL)
+{
+   // Copy Constructor
+   for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
+   fCutString=new TObjString((GetCutNumber()).Data());
+   fElectronLabelArray = new Int_t[fElectronLabelArraySize];
+   if (fBrem == NULL)fBrem = (TF1*)ref.fBrem->Clone("fBrem");
+   // Histograms are not copied, if you need them, call InitCutHistograms
+}
+
+
 //________________________________________________________________________
 AliConversionMesonCuts::~AliConversionMesonCuts() {
    // Destructor
@@ -125,9 +199,10 @@ AliConversionMesonCuts::~AliConversionMesonCuts() {
 }
 
 //________________________________________________________________________
-void AliConversionMesonCuts::InitCutHistograms(TString name){
+void AliConversionMesonCuts::InitCutHistograms(TString name, Bool_t additionalHists){
 
    // Initialize Cut Histograms for QA (only initialized and filled if function is called)
+   TH1::AddDirectory(kFALSE);
 
    if(fHistograms != NULL){
       delete fHistograms;
@@ -135,56 +210,86 @@ void AliConversionMesonCuts::InitCutHistograms(TString name){
    }
    if(fHistograms==NULL){
       fHistograms=new TList();
+      fHistograms->SetOwner(kTRUE);
       if(name=="")fHistograms->SetName(Form("ConvMesonCuts_%s",GetCutNumber().Data()));
       else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
    }
 
    // Meson Cuts
-   hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",10,-0.5,9.5);
+   hMesonCuts=new TH1F(Form("MesonCuts %s",GetCutNumber().Data()),"MesonCuts",13,-0.5,12.5);
    hMesonCuts->GetXaxis()->SetBinLabel(1,"in");
    hMesonCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
    hMesonCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
    hMesonCuts->GetXaxis()->SetBinLabel(4,"opening angle");
    hMesonCuts->GetXaxis()->SetBinLabel(5,"alpha max");
    hMesonCuts->GetXaxis()->SetBinLabel(6,"alpha min");
-   hMesonCuts->GetXaxis()->SetBinLabel(7,"out");
+   hMesonCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
+   hMesonCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
+   hMesonCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
+   hMesonCuts->GetXaxis()->SetBinLabel(10,"out");
    fHistograms->Add(hMesonCuts);
 
-   hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",10,-0.5,9.5);
+   hMesonBGCuts=new TH1F(Form("MesonBGCuts %s",GetCutNumber().Data()),"MesonBGCuts",13,-0.5,12.5);
    hMesonBGCuts->GetXaxis()->SetBinLabel(1,"in");
    hMesonBGCuts->GetXaxis()->SetBinLabel(2,"undef rapidity");
    hMesonBGCuts->GetXaxis()->SetBinLabel(3,"rapidity cut");
    hMesonBGCuts->GetXaxis()->SetBinLabel(4,"opening angle");
    hMesonBGCuts->GetXaxis()->SetBinLabel(5,"alpha max");
    hMesonBGCuts->GetXaxis()->SetBinLabel(6,"alpha min");
-   hMesonBGCuts->GetXaxis()->SetBinLabel(7,"out");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(7,"dca gamma gamma");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(8,"dca R prim Vtx");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(9,"dca Z prim Vtx");
+   hMesonBGCuts->GetXaxis()->SetBinLabel(10,"out");
+
    fHistograms->Add(hMesonBGCuts);
-}
 
+   if (additionalHists){
+      hDCAGammaGammaMesonBefore=new TH1F(Form("DCAGammaGammaMeson Before %s",GetCutNumber().Data()),"DCAGammaGammaMeson Before",200,0,10);
+      fHistograms->Add(hDCAGammaGammaMesonBefore);
+
+      hDCARMesonPrimVtxBefore=new TH1F(Form("DCARMesonPrimVtx Before %s",GetCutNumber().Data()),"DCARMesonPrimVtx Before",200,0,10);
+      fHistograms->Add(hDCARMesonPrimVtxBefore);
+
+      hDCAZMesonPrimVtxBefore=new TH1F(Form("DCAZMesonPrimVtx Before %s",GetCutNumber().Data()),"DCAZMesonPrimVtx Before",401,-10,10);
+      fHistograms->Add(hDCAZMesonPrimVtxBefore);
+
+   }
+
+   hDCAGammaGammaMesonAfter=new TH1F(Form("DCAGammaGammaMeson After %s",GetCutNumber().Data()),"DCAGammaGammaMeson After",200,0,10);
+   fHistograms->Add(hDCAGammaGammaMesonAfter);
+
+   hDCAZMesonPrimVtxAfter=new TH2F(Form("InvMassDCAZMesonPrimVtx After %s",GetCutNumber().Data()),"InvMassDCAZMesonPrimVtx After",800,0,0.8,401,-10,10);
+   fHistograms->Add(hDCAZMesonPrimVtxAfter);
+
+   hDCARMesonPrimVtxAfter=new TH1F(Form("DCARMesonPrimVtx After %s",GetCutNumber().Data()),"DCARMesonPrimVtx After",200,0,10);
+   fHistograms->Add(hDCARMesonPrimVtxAfter);
+
+   TH1::AddDirectory(kTRUE);
+}
 
 //________________________________________________________________________
-Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack){
+Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *fMCStack, Double_t fRapidityShift){
    // Returns true for all pions within acceptance cuts for decay into 2 photons
    // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
-   
+
    if(!fMCStack)return kFALSE;
-   
-   if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){                   
+
+   if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
       if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
-      
+
       Double_t rapidity = 10.;
       if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
-         rapidity=8.;
+         rapidity=8.-fRapidityShift;
       } else{
-         rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())));
-      }        
-      
+         rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+      }
+
       // Rapidity Cut
       if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
-      
+
       // Select only -> 2y decay channel
       if(fMCMother->GetNDaughters()!=2)return kFALSE;
-      
+
       for(Int_t i=0;i<2;i++){
          TParticle *MDaughter=fMCStack->Particle(fMCMother->GetDaughter(i));
          // Is Daughter a Photon?
@@ -198,62 +303,287 @@ Bool_t AliConversionMesonCuts::MesonIsSelectedMC(TParticle *fMCMother,AliStack *
    }
    return kFALSE;
 }
+//________________________________________________________________________
+Bool_t AliConversionMesonCuts::MesonIsSelectedAODMC(AliAODMCParticle *MCMother,TClonesArray *AODMCArray, Double_t fRapidityShift){
+   // Returns true for all pions within acceptance cuts for decay into 2 photons
+   // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
+
+   if(!AODMCArray)return kFALSE;
+
+   if(MCMother->GetPdgCode()==111 || MCMother->GetPdgCode()==221){
+      Double_t rMeson = sqrt( (MCMother->Xv()*MCMother->Xv()) + (MCMother->Yv()*MCMother->Yv()) ) ;
+      if(rMeson>fMaxR) return kFALSE; // cuts on distance from collision point
+
+      Double_t rapidity = 10.;
+      if(MCMother->E() - MCMother->Pz() == 0 || MCMother->E() + MCMother->Pz() == 0){
+         rapidity=8.-fRapidityShift;
+      } else{
+         rapidity = 0.5*(TMath::Log((MCMother->E()+MCMother->Pz()) / (MCMother->E()-MCMother->Pz())))-fRapidityShift;
+      }
+
+      // Rapidity Cut
+      if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
+
+      // Select only -> 2y decay channel
+      if(MCMother->GetNDaughters()!=2)return kFALSE;
+
+      for(Int_t i=0;i<2;i++){
+         AliAODMCParticle *MDaughter=static_cast<AliAODMCParticle*>(AODMCArray->At(MCMother->GetDaughter(i)));
+         // Is Daughter a Photon?
+         if(MDaughter->GetPdgCode()!=22)return kFALSE;
+         // Is Photon in Acceptance?
+         //   if(bMCDaughtersInAcceptance){
+         //    if(!PhotonIsSelectedMC(MDaughter,fMCStack)){return kFALSE;}
+         //   }
+      }
+      return kTRUE;
+   }
+   return kFALSE;
+}
 
 //________________________________________________________________________
-Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack){
+Bool_t AliConversionMesonCuts::MesonIsSelectedMCDalitz(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelelectron, Int_t &labelpositron, Int_t &labelgamma, Double_t fRapidityShift){
+
    // Returns true for all pions within acceptance cuts for decay into 2 photons
    // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
 
-   if(!fMCStack)return kFALSE;
+   if( !fMCStack )return kFALSE;
+
+   if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
+
+   if(  fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
+
+   Double_t rapidity = 10.;
+
+   if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
+      rapidity=8.-fRapidityShift;
+   }
+   else{
+      rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+   }
+
+   // Rapidity Cut
+   if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
+
+   // Select only -> Dalitz decay channel
+   if( fMCMother->GetNDaughters() != 3 )return kFALSE;
+
+   TParticle *positron = 0x0;
+   TParticle *electron = 0x0;
+   TParticle    *gamma = 0x0;
+
+   for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
+
+      TParticle* temp = (TParticle*)fMCStack->Particle( index );
+
+      switch( temp->GetPdgCode() ) {
+      case ::kPositron:
+         positron      =  temp;
+         labelpositron = index;
+         break;
+      case ::kElectron:
+         electron      =  temp;
+         labelelectron = index;
+         break;
+      case ::kGamma:
+         gamma         =  temp;
+         labelgamma    = index;
+         break;
+      }
+   }
+
+   if( positron && electron && gamma) return kTRUE;
+   return kFALSE;
+}
+
+//________________________________________________________________________
+Bool_t AliConversionMesonCuts::MesonIsSelectedMCEtaPiPlPiMiGamma(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelNegPion, Int_t &labelPosPion, Int_t &labelGamma, Double_t fRapidityShift){
+
+       // Returns true for all pions within acceptance cuts for decay into 2 photons
+       // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
+
+       if( !fMCStack )return kFALSE;
+
+       if( fMCMother->GetPdgCode() != 221 ) return kFALSE;
+
+       if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
+
+       Double_t rapidity = 10.;
+
+       if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
+               rapidity=8.-fRapidityShift;
+       }
+       else{
+               rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+       }
+
+       // Rapidity Cut
+       if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
+
+       // Select only -> Dalitz decay channel
+       if( fMCMother->GetNDaughters() != 3 )return kFALSE;
+
+       TParticle *posPion = 0x0;
+       TParticle *negPion = 0x0;
+       TParticle    *gamma = 0x0;
+
+       for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
+
+               TParticle* temp = (TParticle*)fMCStack->Particle( index );
+
+               switch( temp->GetPdgCode() ) {
+               case 211:
+                       posPion      =  temp;
+                       labelPosPion = index;
+                       break;
+               case -211:
+                       negPion      =  temp;
+                       labelNegPion = index;
+                       break;
+               case ::kGamma:
+                       gamma         =  temp;
+                       labelGamma    = index;
+                       break;
+               }
+       }
+
+       if( posPion && negPion && gamma) return kTRUE;
+       return kFALSE;
+}
+
+//________________________________________________________________________
+Bool_t AliConversionMesonCuts::MesonIsSelectedMCPiPlPiMiPiZero(TParticle *fMCMother,AliStack *fMCStack, Int_t &labelNegPion, Int_t &labelPosPion, Int_t &labelNeutPion, Double_t fRapidityShift){
+
+       // Returns true for all pions within acceptance cuts for decay into 2 photons
+       // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
+
+       if( !fMCStack )return kFALSE;
+
+       if( !(fMCMother->GetPdgCode() == 221 || fMCMother->GetPdgCode() == 223) ) return kFALSE;
        
-   if(fMCMother->GetPdgCode()==111 || fMCMother->GetPdgCode()==221){
+       if( fMCMother->R()>fMaxR ) return kFALSE; // cuts on distance from collision point
+
+       Double_t rapidity = 10.;
+
+       if( fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0 ){
+               rapidity=8.-fRapidityShift;
+       }
+       else{
+               rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+       }
+
+       // Rapidity Cut
+       if( abs(rapidity) > fRapidityCutMeson )return kFALSE;
+
+       // Select only -> pi+ pi- pi0
+       if( fMCMother->GetNDaughters() != 3 )return kFALSE;
+
+       TParticle *posPion = 0x0;
+       TParticle *negPion = 0x0;
+       TParticle *neutPion = 0x0;
+
+//     cout << "\n"<< fMCMother->GetPdgCode() << "\n" << endl;
+       for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
                
+               TParticle* temp = (TParticle*)fMCStack->Particle( index );
+//             cout << temp->GetPdgCode() << endl;
+               switch( temp->GetPdgCode() ) {
+               case 211:
+                       posPion      =  temp;
+                       labelPosPion = index;
+                       break;
+               case -211:
+                       negPion      =  temp;
+                       labelNegPion = index;
+                       break;
+               case 111:
+                       neutPion         =  temp;
+                       labelNeutPion    = index;
+                       break;
+               }
+       }
+
+       if( posPion && negPion && neutPion ) return kTRUE;
+       return kFALSE;
+}
+
+
+//________________________________________________________________________
+Bool_t AliConversionMesonCuts::MesonIsSelectedMCChiC(TParticle *fMCMother,AliStack *fMCStack,Int_t & labelelectronChiC, Int_t & labelpositronChiC, Int_t & labelgammaChiC, Double_t fRapidityShift){
+   // Returns true for all ChiC within acceptance cuts for decay into JPsi + gamma -> e+ + e- + gamma
+   // If bMCDaughtersInAcceptance is selected, it requires in addition that both daughter photons are within acceptance cuts
+
+   if(!fMCStack)return kFALSE;
+   // if(fMCMother->GetPdgCode()==20443 ){
+   //   return kFALSE;
+   // }
+   if(fMCMother->GetPdgCode()==10441 || fMCMother->GetPdgCode()==10443 || fMCMother->GetPdgCode()==445 ){
       if(fMCMother->R()>fMaxR) return kFALSE; // cuts on distance from collision point
 
       Double_t rapidity = 10.;
       if(fMCMother->Energy() - fMCMother->Pz() == 0 || fMCMother->Energy() + fMCMother->Pz() == 0){
-         rapidity=8.;
+         rapidity=8.-fRapidityShift;
       }
       else{
-         rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())));
-      }        
-               
+         rapidity = 0.5*(TMath::Log((fMCMother->Energy()+fMCMother->Pz()) / (fMCMother->Energy()-fMCMother->Pz())))-fRapidityShift;
+      }
+
       // Rapidity Cut
       if(abs(rapidity)>fRapidityCutMeson)return kFALSE;
 
-      // Select only -> Dalitz decay channel
-      if(fMCMother->GetNDaughters()!=3)return kFALSE;
+      // Select only -> ChiC radiative (JPsi+gamma) decay channel
+      if(fMCMother->GetNDaughters()!=2)return kFALSE;
+
+      TParticle *jpsi  = 0x0;
+      TParticle *gamma         = 0x0;
+      TParticle *positron = 0x0;
+      TParticle *electron = 0x0;
 
-      Int_t daughterPDGs[3] = {0,0,0};
-      Int_t index = 0;
+      Int_t labeljpsiChiC = -1;
 
-      //                iParticle->GetFirstDaughter(); idxPi0 <= iParticle->GetLastDaughter()
+      for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
 
-      for(Int_t i=fMCMother->GetFirstDaughter(); i<= fMCMother->GetLastDaughter();i++){
-         TParticle *MDaughter=fMCStack->Particle(i);
-         // Is Daughter a Photon or an electron?
-         daughterPDGs[index]=MDaughter->GetPdgCode();
-         index++;
+         TParticle* temp = (TParticle*)fMCStack->Particle( index );
+
+         switch( temp->GetPdgCode() ) {
+         case 443:
+            jpsi =  temp;
+            labeljpsiChiC = index;
+            break;
+         case 22:
+            gamma    =  temp;
+            labelgammaChiC = index;
+            break;
+         }
       }
-      for (Int_t j=0;j<2;j++){
-
-         for (Int_t i=0;i<2;i++){
-            if (daughterPDGs[i] > daughterPDGs[i+1]){
-               Int_t interMed = daughterPDGs[i] ; 
-               daughterPDGs[i] = daughterPDGs[i+1];
-               daughterPDGs[i+1] = interMed;
-            }
+
+      if ( !jpsi || ! gamma) return kFALSE;
+      if(jpsi->GetNDaughters()!=2)return kFALSE;
+
+
+      for(Int_t index= jpsi->GetFirstDaughter();index<= jpsi->GetLastDaughter();index++){
+         TParticle* temp = (TParticle*)fMCStack->Particle( index );
+         switch( temp->GetPdgCode() ) {
+         case -11:
+            electron =  temp;
+            labelelectronChiC = index;
+            break;
+         case 11:
+            positron =  temp;
+            labelpositronChiC = index;
+            break;
          }
       }
-      if (daughterPDGs[0] == -11 && daughterPDGs[1] == 11 && daughterPDGs[2] == 22) return kTRUE;
+      if( !electron || !positron) return kFALSE;
+      if( positron && electron && gamma) return kTRUE;
    }
    return kFALSE;
 }
 
-
 ///________________________________________________________________________
-Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal)
+Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_t IsSignal, Double_t fRapidityShift)
 {
+
    // Selection of reconstructed Meson candidates
    // Use flag IsSignal in order to fill Fill different
    // histograms for Signal and Background
@@ -271,13 +601,15 @@ Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_
    if((pi0->E()+pi0->Pz())/(pi0->E()-pi0->Pz())<=0){
       if(hist)hist->Fill(cutIndex);
       cutIndex++;
+//       cout << "undefined rapidity" << endl;
       return kFALSE;
    }
    else{
       // PseudoRapidity Cut --> But we cut on Rapidity !!!
       cutIndex++;
-      if(abs(pi0->Rapidity())>fRapidityCutMeson){
+      if(abs(pi0->Rapidity()-fRapidityShift)>fRapidityCutMeson){
          if(hist)hist->Fill(cutIndex);
+//              cout << abs(pi0->Rapidity()-fRapidityShift) << ">" << fRapidityCutMeson << endl;
          return kFALSE;
       }
    }
@@ -286,13 +618,21 @@ Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_
    // Opening Angle Cut
    //fOpeningAngle=2*TMath::ATan(0.134/pi0->P());// physical minimum opening angle
    if( pi0->GetOpeningAngle() < fOpeningAngle){
+//       cout << pi0->GetOpeningAngle() << "<" << fOpeningAngle << endl; 
       if(hist)hist->Fill(cutIndex);
       return kFALSE;
    }
    cutIndex++;
 
+   if ( fAlphaPtDepCut == kTRUE ) {
+       fAlphaCutMeson = fFAlphaCut->Eval( pi0->Pt() );
+   }
+   
+   
    // Alpha Max Cut
    if(pi0->GetAlpha()>fAlphaCutMeson){
+//        cout << pi0->GetAlpha() << ">" << fAlphaCutMeson << endl; 
       if(hist)hist->Fill(cutIndex);
       return kFALSE;
    }
@@ -300,11 +640,44 @@ Bool_t AliConversionMesonCuts::MesonIsSelected(AliAODConversionMother *pi0,Bool_
 
    // Alpha Min Cut
    if(pi0->GetAlpha()<fAlphaMinCutMeson){
+//       cout << pi0->GetAlpha() << "<" << fAlphaMinCutMeson << endl; 
       if(hist)hist->Fill(cutIndex);
       return kFALSE;
    }
    cutIndex++;
 
+   if (hDCAGammaGammaMesonBefore)hDCAGammaGammaMesonBefore->Fill(pi0->GetDCABetweenPhotons());
+   if (hDCARMesonPrimVtxBefore)hDCARMesonPrimVtxBefore->Fill(pi0->GetDCARMotherPrimVtx());
+
+   if (pi0->GetDCABetweenPhotons() > fDCAGammaGammaCut){
+//       cout << pi0->GetDCABetweenPhotons() << ">" << fDCAGammaGammaCut << endl; 
+      if(hist)hist->Fill(cutIndex);
+      return kFALSE;
+   }
+   cutIndex++;
+
+   if (pi0->GetDCARMotherPrimVtx() > fDCARMesonPrimVtxCut){
+//        cout << pi0->GetDCARMotherPrimVtx() << ">" << fDCARMesonPrimVtxCut << endl; 
+      if(hist)hist->Fill(cutIndex);
+      return kFALSE;
+   }
+   cutIndex++;
+
+
+   if (hDCAZMesonPrimVtxBefore)hDCAZMesonPrimVtxBefore->Fill(pi0->GetDCAZMotherPrimVtx());
+
+   if (abs(pi0->GetDCAZMotherPrimVtx()) > fDCAZMesonPrimVtxCut){
+//       cout << pi0->GetDCAZMotherPrimVtx() << ">" << fDCAZMesonPrimVtxCut << endl; 
+      if(hist)hist->Fill(cutIndex);
+      return kFALSE;
+   }
+   cutIndex++;
+
+
+   if (hDCAGammaGammaMesonAfter)hDCAGammaGammaMesonAfter->Fill(pi0->GetDCABetweenPhotons());
+   if (hDCARMesonPrimVtxAfter)hDCARMesonPrimVtxAfter->Fill(pi0->GetDCARMotherPrimVtx());
+   if (hDCAZMesonPrimVtxAfter)hDCAZMesonPrimVtxAfter->Fill(pi0->M(),pi0->GetDCAZMotherPrimVtx());
+
    if(hist)hist->Fill(cutIndex);
    return kTRUE;
 }
@@ -317,13 +690,10 @@ Bool_t AliConversionMesonCuts::UpdateCutString() {
    ///Update the cut string (if it has been created yet)
 
    if(fCutString && fCutString->GetString().Length() == kNCuts) {
-      //         cout << "Updating cut id in spot number " << cutID << " to " << value << endl;
       fCutString->SetString(GetCutNumber());
    } else {
-      //         cout << "fCutString not yet initialized, will not be updated" << endl;
       return kFALSE;
    }
-   //   cout << fCutString->GetString().Data() << endl;
    return kTRUE;
 }
 
@@ -339,7 +709,7 @@ Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysi
       AliError("Cut selection contains characters");
       return kFALSE;
    }
-       
+
    const char *cutSelection = analysisCutSelection.Data();
 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
    for(Int_t ii=0;ii<kNCuts;ii++){
@@ -351,7 +721,7 @@ Bool_t AliConversionMesonCuts::InitializeCutsFromCutString(const TString analysi
       if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
    }
 
-   //PrintCuts();
+   PrintCutsWithValues();
    return kTRUE;
 }
 ///________________________________________________________________________
@@ -366,9 +736,9 @@ Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
          UpdateCutString();
          return kTRUE;
       } else return kFALSE;
-   case kchi2MesonCut:
-      if( SetChi2MesonCut(value)) {
-         fCuts[kchi2MesonCut] = value;
+   case kSelectionCut:
+      if( SetSelectionWindowCut(value)) {
+         fCuts[kSelectionCut] = value;
          UpdateCutString();
          return kTRUE;
       } else return kFALSE;
@@ -431,15 +801,33 @@ Bool_t AliConversionMesonCuts::SetCut(cutIds cutID, const Int_t value) {
          UpdateCutString();
          return kTRUE;
       } else return kFALSE;
+   case kDcaGammaGamma:
+      if( SetDCAGammaGammaCut(value)) {
+         fCuts[kDcaGammaGamma] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
+   case kDcaZPrimVtx:
+      if( SetDCAZMesonPrimVtxCut(value)) {
+         fCuts[kDcaZPrimVtx] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
+   case kDcaRPrimVtx:
+      if( SetDCARMesonPrimVtxCut(value)) {
+         fCuts[kDcaRPrimVtx] = value;
+         UpdateCutString();
+         return kTRUE;
+      } else return kFALSE;
 
    case kNCuts:
       cout << "Error:: Cut id out of range"<< endl;
       return kFALSE;
    }
-  
+
    cout << "Error:: Cut id " << cutID << " not recognized "<< endl;
    return kFALSE;
-  
+
 }
 
 
@@ -451,6 +839,38 @@ void AliConversionMesonCuts::PrintCuts() {
    }
 }
 
+///________________________________________________________________________
+void AliConversionMesonCuts::PrintCutsWithValues() {
+   // Print out current Cut Selection with values
+       printf("\nMeson cutnumber \n");
+       for(Int_t ic = 0; ic < kNCuts; ic++) {
+               printf("%d",fCuts[ic]);
+       }
+       printf("\n\n");
+       
+       printf("Meson cuts \n");
+       printf("\t |y| < %3.2f \n", fRapidityCutMeson);
+       printf("\t theta_{open} < %3.2f\n", fOpeningAngle);
+       if (!fAlphaPtDepCut) printf("\t %3.2f < alpha < %3.2f\n", fAlphaMinCutMeson, fAlphaCutMeson);
+       printf("\t dca_{gamma,gamma} > %3.2f\n", fDCAGammaGammaCut);
+       printf("\t dca_{R, prim Vtx} > %3.2f\n", fDCARMesonPrimVtxCut); 
+       printf("\t dca_{Z, prim Vtx} > %3.2f\n\n", fDCAZMesonPrimVtxCut); 
+       printf("\t Meson selection window for further analysis %3.3f > M_{gamma,gamma} > %3.3f\n\n", fSelectionLow, fSelectionHigh); 
+       
+        printf("Meson BG settings \n");
+        if (!fDoBG){
+               if (!fUseRotationMethodInBG  & !fUseTrackMultiplicityForBG) printf("\t BG scheme: mixing V0 mult \n");
+               if (!fUseRotationMethodInBG  & fUseTrackMultiplicityForBG) printf("\t BG scheme: mixing track mult \n");
+               if (fUseRotationMethodInBG )printf("\t BG scheme: rotation \n");
+               if (fdoBGProbability) printf("\t -> use BG probability \n");
+               if (fBackgroundHandler) printf("\t -> use new BG handler \n");
+               printf("\t depth of pool: %d\n", fNumberOfBGEvents);
+               if (fUseRotationMethodInBG )printf("\t degree's for BG rotation: %d\n", fnDegreeRotationPMForBG);
+        }
+        
+}
+
+
 ///________________________________________________________________________
 Bool_t AliConversionMesonCuts::SetMesonKind(Int_t mesonKind){
    // Set Cut
@@ -482,7 +902,7 @@ Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
       fMaxR = 180.;
       break;
    case 3:
-      fMaxR = 70.;                     
+      fMaxR = 70.;
       break;
    case 4:
       fMaxR = 70.;
@@ -502,29 +922,40 @@ Bool_t AliConversionMesonCuts::SetRCut(Int_t rCut){
 }
 
 ///________________________________________________________________________
-Bool_t AliConversionMesonCuts::SetChi2MesonCut(Int_t chi2MesonCut){
+Bool_t AliConversionMesonCuts::SetSelectionWindowCut(Int_t selectionCut){
    // Set Cut
-   switch(chi2MesonCut){
-   case 0:  // 100.
-      fChi2CutMeson = 100.;
-      break;
-   case 1:  // 50.
-      fChi2CutMeson = 50.;
-      break;
-   case 2:  // 30.
-      fChi2CutMeson = 30.;
-      break;
+   switch(selectionCut){
+   case 0:  
+      fSelectionLow = 0.08;
+         fSelectionHigh = 0.145;
+      break;
+   case 1:  
+      fSelectionLow = 0.1;
+         fSelectionHigh = 0.145;
+      break;
+   case 2:  
+         fSelectionLow = 0.11;
+         fSelectionHigh = 0.145;
+         break;
    case 3:
-      fChi2CutMeson = 200.;
+         fSelectionLow = 0.12;
+         fSelectionHigh = 0.145;
       break;
    case 4:
-      fChi2CutMeson = 500.;
+         fSelectionLow = 0.1;
+         fSelectionHigh = 0.15;
       break;
    case 5:
-      fChi2CutMeson = 1000.;
+         fSelectionLow = 0.11;
+         fSelectionHigh = 0.15;
       break;
+   case 6:
+         fSelectionLow = 0.12;
+         fSelectionHigh = 0.15;
+      break;
+         
    default:
-      cout<<"Warning: Chi2MesonCut not defined "<<chi2MesonCut<<endl;
+      cout<<"Warning: SelectionCut not defined "<<selectionCut<<endl;
       return kFALSE;
    }
    return kTRUE;
@@ -538,42 +969,64 @@ Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
    case 0:     // 0- 0.7
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 0.7;
-      break;
-   case 1:     // 0-0.5
-      fAlphaMinCutMeson         = 0.0;
-      fAlphaCutMeson    = 0.5;
-      break;
-   case 2:     // 0.5-1
-      fAlphaMinCutMeson         = 0.5;
-      fAlphaCutMeson    = 1.;
+      fAlphaPtDepCut = kFALSE;
+      break;
+   case 1:     // Updated 31 October 2013 before 0.0 - 0.5
+      if( fFAlphaCut ) delete fFAlphaCut;
+      fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
+      fFAlphaCut->SetParameter(0,0.7);
+      fFAlphaCut->SetParameter(1,1.2);
+      fAlphaMinCutMeson         =  0.0;
+      fAlphaCutMeson    = -1.0;
+      fAlphaPtDepCut = kTRUE;
+      break;
+   case 2:     // Updated 31 October 2013 before 0.5-1  
+      if( fFAlphaCut ) delete fFAlphaCut;
+      fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
+      fFAlphaCut->SetParameter(0,0.8);
+      fFAlphaCut->SetParameter(1,1.2);
+      fAlphaMinCutMeson         =  0.0;
+      fAlphaCutMeson    = -1.0;
+      fAlphaPtDepCut = kTRUE;
       break;
    case 3:     // 0.0-1
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 1.;
+      fAlphaPtDepCut = kFALSE;
       break;
    case 4:     // 0-0.65
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 0.65;
+      fAlphaPtDepCut = kFALSE;
       break;
    case 5:     // 0-0.75
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 0.75;
+      fAlphaPtDepCut = kFALSE;
       break;
    case 6:     // 0-0.8
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 0.8;
+      fAlphaPtDepCut = kFALSE;
       break;
    case 7:     // 0.0-0.85
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 0.85;
+      fAlphaPtDepCut = kFALSE;
       break;
    case 8:     // 0.0-0.6
       fAlphaMinCutMeson         = 0.0;
       fAlphaCutMeson    = 0.6;
+      fAlphaPtDepCut = kFALSE;
       break;
-   case 9:     // 0.0-0.3
-      fAlphaMinCutMeson         = 0.0;
-      fAlphaCutMeson    = 0.3;
+   case 9: // Updated 11 November 2013 before 0.0 - 0.3
+      if( fFAlphaCut ) delete fFAlphaCut;
+      fFAlphaCut= new TF1("fFAlphaCut","[0]*tanh([1]*x)",0.,100.);
+      fFAlphaCut->SetParameter(0,0.65);
+      fFAlphaCut->SetParameter(1,1.2);
+      fAlphaMinCutMeson  =  0.0;
+      fAlphaCutMeson     = -1.0;
+      fAlphaPtDepCut = kTRUE;
       break;
    default:
       cout<<"Warning: AlphaMesonCut not defined "<<alphaMesonCut<<endl;
@@ -583,11 +1036,11 @@ Bool_t AliConversionMesonCuts::SetAlphaMesonCut(Int_t alphaMesonCut)
 }
 
 ///________________________________________________________________________
-Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){ 
+Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
    // Set Cut
    switch(RapidityMesonCut){
-   case 0:  //
-      fRapidityCutMeson   = 0.9;
+   case 0:  // changed from 0.9 to 1.35
+      fRapidityCutMeson   = 1.35;
       break;
    case 1:  //
       fRapidityCutMeson   = 0.8;
@@ -607,7 +1060,15 @@ Bool_t AliConversionMesonCuts::SetRapidityMesonCut(Int_t RapidityMesonCut){
    case 6:  //
       fRapidityCutMeson   = 0.75;
       break;
-
+   case 7:  //
+      fRapidityCutMeson   = 0.3;
+      break;
+   case 8:  //changed, before 0.35
+      fRapidityCutMeson   = 0.25;
+      break;
+   case 9:  //
+      fRapidityCutMeson   = 0.4;
+      break;
    default:
       cout<<"Warning: RapidityMesonCut not defined "<<RapidityMesonCut<<endl;
       return kFALSE;
@@ -746,7 +1207,7 @@ Bool_t AliConversionMesonCuts::SetSharedElectronCut(Int_t sharedElec) {
       cout<<"Warning: Shared Electron Cut not defined "<<sharedElec<<endl;
       return kFALSE;
    }
-       
+
    return kTRUE;
 }
 
@@ -848,6 +1309,132 @@ Bool_t AliConversionMesonCuts::SetMCPSmearing(Int_t useMCPSmearing)
    }
    return kTRUE;
 }
+
+
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetDCAGammaGammaCut(Int_t DCAGammaGamma){
+   // Set Cut
+   switch(DCAGammaGamma){
+   case 0:  //
+      fDCAGammaGammaCut   = 1000;
+      break;
+   case 1:  //
+      fDCAGammaGammaCut   = 10;
+      break;
+   case 2:  //
+      fDCAGammaGammaCut   = 5;
+      break;
+   case 3:  //
+      fDCAGammaGammaCut   = 4;
+      break;
+   case 4:  //
+      fDCAGammaGammaCut   = 3;
+      break;
+   case 5:  //
+      fDCAGammaGammaCut   = 2.5;
+      break;
+   case 6:  //
+      fDCAGammaGammaCut   = 2;
+      break;
+   case 7:  //
+      fDCAGammaGammaCut   = 1.5;
+      break;
+   case 8:  //
+      fDCAGammaGammaCut   = 1;
+      break;
+   case 9:  //
+      fDCAGammaGammaCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCAGammaGamma not defined "<<DCAGammaGamma<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetDCAZMesonPrimVtxCut(Int_t DCAZMesonPrimVtx){
+   // Set Cut
+   switch(DCAZMesonPrimVtx){
+   case 0:  //
+      fDCAZMesonPrimVtxCut   = 1000;
+      break;
+   case 1:  //
+      fDCAZMesonPrimVtxCut   = 10;
+      break;
+   case 2:  //
+      fDCAZMesonPrimVtxCut   = 5;
+      break;
+   case 3:  //
+      fDCAZMesonPrimVtxCut   = 4;
+      break;
+   case 4:  //
+      fDCAZMesonPrimVtxCut   = 3;
+      break;
+   case 5:  //
+      fDCAZMesonPrimVtxCut   = 2.5;
+      break;
+   case 6:  //
+      fDCAZMesonPrimVtxCut   = 2;
+      break;
+   case 7:  //
+      fDCAZMesonPrimVtxCut   = 1.5;
+      break;
+   case 8:  //
+      fDCAZMesonPrimVtxCut   = 1;
+      break;
+   case 9:  //
+      fDCAZMesonPrimVtxCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCAZMesonPrimVtx not defined "<<DCAZMesonPrimVtx<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+///________________________________________________________________________
+Bool_t AliConversionMesonCuts::SetDCARMesonPrimVtxCut(Int_t DCARMesonPrimVtx){
+   // Set Cut
+   switch(DCARMesonPrimVtx){
+   case 0:  //
+      fDCARMesonPrimVtxCut   = 1000;
+      break;
+   case 1:  //
+      fDCARMesonPrimVtxCut   = 10;
+      break;
+   case 2:  //
+      fDCARMesonPrimVtxCut   = 5;
+      break;
+   case 3:  //
+      fDCARMesonPrimVtxCut   = 4;
+      break;
+   case 4:  //
+      fDCARMesonPrimVtxCut   = 3;
+      break;
+   case 5:  //
+      fDCARMesonPrimVtxCut   = 2.5;
+      break;
+   case 6:  //
+      fDCARMesonPrimVtxCut   = 2;
+      break;
+   case 7:  //
+      fDCARMesonPrimVtxCut   = 1.5;
+      break;
+   case 8:  //
+      fDCARMesonPrimVtxCut   = 1;
+      break;
+   case 9:  //
+      fDCARMesonPrimVtxCut   = 0.5;
+      break;
+   default:
+      cout<<"Warning: DCARMesonPrimVtx not defined "<<DCARMesonPrimVtx<<endl;
+      return kFALSE;
+   }
+   return kTRUE;
+}
+
+
 ///________________________________________________________________________
 TString AliConversionMesonCuts::GetCutNumber(){
    // returns TString with current cut number
@@ -860,10 +1447,10 @@ TString AliConversionMesonCuts::GetCutNumber(){
 
 ///________________________________________________________________________
 void AliConversionMesonCuts::FillElectonLabelArray(AliAODConversionPhoton* photon, Int_t nV0){
-       
+
    Int_t posLabel = photon->GetTrackLabelPositive();
    Int_t negLabel = photon->GetTrackLabelNegative();
-       
+
    fElectronLabelArray[nV0*2] = posLabel;
    fElectronLabelArray[(nV0*2)+1] = negLabel;
 }
@@ -897,7 +1484,7 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
       Double_t posCompX = photonComp->GetConversionX();
       Double_t posCompY = photonComp->GetConversionY();
       Double_t posCompZ = photonComp->GetConversionZ();
-               
+
       Double_t dist = pow((posX - posCompX),2)+pow((posY - posCompY),2)+pow((posZ - posCompZ),2);
 
       if(dist < fminV0Dist*fminV0Dist){
@@ -905,7 +1492,7 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
          else {
             return kFALSE;}
       }
-               
+
    }
    return kTRUE;
 }
@@ -913,6 +1500,8 @@ Bool_t AliConversionMesonCuts::RejectToCloseV0s(AliAODConversionPhoton* photon,
 ///________________________________________________________________________
 void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
 {
+
+   if (photon==NULL) return;
    Double_t facPBrem = 1.;
    Double_t facPSig = 0.;
 
@@ -920,17 +1509,17 @@ void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
    Double_t theta=0.;
    Double_t P=0.;
 
-   
+
    P=photon->P();
    phi=photon->Phi();
    if( photon->P()!=0){
       theta=acos( photon->Pz()/ photon->P());
    }
 
-   if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){ 
+   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();
@@ -942,3 +1531,89 @@ void AliConversionMesonCuts::SmearParticle(AliAODConversionPhoton* photon)
    photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
    photon->SetE(photon->P());
 }
+///________________________________________________________________________
+void AliConversionMesonCuts::SmearVirtualPhoton(AliAODConversionPhoton* photon)
+{
+
+   if (photon==NULL) return;
+   Double_t facPBrem = 1.;
+   Double_t facPSig = 0.;
+
+   Double_t phi=0.;
+   Double_t theta=0.;
+   Double_t P=0.;
+
+
+   P=photon->P();
+   phi=photon->Phi();
+   if( photon->P()!=0){
+      theta=acos( photon->Pz()/ photon->P());
+   }
+
+   if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
+      facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
+   }
+
+   if( fPBremSmearing != 1.){
+      if(fBrem!=NULL){
+         facPBrem = fBrem->GetRandom();
+      }
+   }
+
+   photon->SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
+   photon->SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
+   photon->SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
+   
+}
+///________________________________________________________________________
+TLorentzVector AliConversionMesonCuts::SmearElectron(TLorentzVector particle)
+{
+
+   //if (particle==0) return;
+   Double_t facPBrem = 1.;
+   Double_t facPSig = 0.;
+
+   Double_t phi=0.;
+   Double_t theta=0.;
+   Double_t P=0.;
+
+
+   P=particle.P();
+   
+   
+   phi=particle.Phi();
+   if (phi < 0.) phi += 2. * TMath::Pi();
+   
+   if( particle.P()!=0){
+      theta=acos( particle.Pz()/ particle.P());
+   }
+
+   
+   Double_t fPSigSmearingHalf    =  fPSigSmearing  / 2.0;  //The parameter was set for gammas with 2 particles and here we have just one electron
+   Double_t sqrtfPSigSmearingCteHalf =  fPSigSmearingCte / 2.0 ;  //The parameter was set for gammas with 2 particles and here we have just one electron
+
+   
+   
+   if( fPSigSmearingHalf != 0. || sqrtfPSigSmearingCteHalf!=0. ){
+      facPSig = TMath::Sqrt(sqrtfPSigSmearingCteHalf*sqrtfPSigSmearingCteHalf+fPSigSmearingHalf*fPSigSmearingHalf*P*P)*fRandom.Gaus(0.,1.);
+   }
+
+   if( fPBremSmearing != 1.){
+      if(fBrem!=NULL){
+         facPBrem = fBrem->GetRandom();
+      }
+   }
+   
+   TLorentzVector SmearedParticle;
+   
+   SmearedParticle.SetXYZM( facPBrem* (1+facPSig)* P*sin(theta)*cos(phi) , facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)  , 
+                         facPBrem* (1+facPSig)* P*cos(theta) , TDatabasePDG::Instance()->GetParticle(  ::kElectron   )->Mass()) ;
+   
+   //particle.SetPx(facPBrem* (1+facPSig)* P*sin(theta)*cos(phi)) ;
+   //particle.SetPy(facPBrem* (1+facPSig)* P*sin(theta)*sin(phi)) ;
+   //particle.SetPz(facPBrem* (1+facPSig)* P*cos(theta)) ;
+   
+   return SmearedParticle;
+   
+}
+