]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskBFPsi.cxx
Exclude all particles with a mother index in MC mode, ExcludeResonancesInMC (only...
[u/mrichter/AliRoot.git] / PWGCF / EBYE / BalanceFunctions / AliAnalysisTaskBFPsi.cxx
index 9d7c2ad0944507f1d3b4bb28827c88b7b760cfcd..0f7b868f2b3e60af7c99ac253776531bfd2dc170 100755 (executable)
@@ -57,7 +57,7 @@ ClassImp(AliAnalysisTaskBFPsi)
 AliAnalysisTaskBFPsi::AliAnalysisTaskBFPsi(const char *name) 
 : AliAnalysisTaskSE(name),
   fDebugLevel(kFALSE),
-  fArrayMC(0), //+++++++++++++
+  fArrayMC(0),
   fBalance(0),
   fRunShuffling(kFALSE),
   fShuffledBalance(0),
@@ -104,8 +104,9 @@ AliAnalysisTaskBFPsi::AliAnalysisTaskBFPsi(const char *name)
   fHistProbTPCTOFvsPtbeforePID(NULL),
   fHistNSigmaTPCvsPtbeforePID(NULL), 
   fHistNSigmaTOFvsPtbeforePID(NULL), 
-  fHistBetaVsdEdXbeforePID(NULL), //+++++++ 
-  fHistNSigmaTPCTOFvsPtbeforePID(NULL), //++++++
+  fHistBetaVsdEdXbeforePID(NULL),
+  fHistNSigmaTPCTOFvsPtbeforePID(NULL),
+  fHistNSigmaTPCTOFPbefPID(NULL),
   fHistdEdxVsPTPCafterPID(NULL),
   fHistBetavsPTOFafterPID(NULL), 
   fHistProbTPCvsPtafterPID(NULL), 
@@ -113,12 +114,13 @@ AliAnalysisTaskBFPsi::AliAnalysisTaskBFPsi(const char *name)
   fHistProbTPCTOFvsPtafterPID(NULL),
   fHistNSigmaTPCvsPtafterPID(NULL), 
   fHistNSigmaTOFvsPtafterPID(NULL),  
-  fHistBetaVsdEdXafterPID(NULL), //+++++++ 
-  fHistNSigmaTPCTOFvsPtafterPID(NULL), //+++++++
-  fHistdEdxVsPTPCbeforePIDelectron(NULL), //+++++++
-  fHistNSigmaTPCvsPtbeforePIDelectron(NULL), //+++++++
-  fHistdEdxVsPTPCafterPIDelectron(NULL), //+++++++
-  fHistNSigmaTPCvsPtafterPIDelectron(NULL), //+++++++
+  fHistBetaVsdEdXafterPID(NULL), 
+  fHistNSigmaTPCTOFvsPtafterPID(NULL),
+  fHistNSigmaTPCTOFPafterPID(NULL),
+  fHistdEdxVsPTPCbeforePIDelectron(NULL),
+  fHistNSigmaTPCvsPtbeforePIDelectron(NULL),
+  fHistdEdxVsPTPCafterPIDelectron(NULL),
+  fHistNSigmaTPCvsPtafterPIDelectron(NULL),
   fCentralityArrayBinsForCorrections(kCENTRALITY),
   fCentralityWeights(0x0),
   fPIDResponse(0x0),
@@ -160,13 +162,14 @@ AliAnalysisTaskBFPsi::AliAnalysisTaskBFPsi(const char *name)
   fPtMin(0.3),
   fPtMax(1.5),
   fEtaMin(-0.8),
-  fEtaMax(-0.8),
+  fEtaMax(0.8),
   fPhiMin(0.),
   fPhiMax(360.),
   fDCAxyCut(-1),
   fDCAzCut(-1),
   fTPCchi2Cut(-1),
   fNClustersTPCCut(-1),
+  fTPCsharedCut(-1),
   fAcceptanceParameterization(0),
   fDifferentialV2(0),
   fUseFlowAfterBurner(kFALSE),
@@ -365,9 +368,9 @@ void AliAnalysisTaskBFPsi::UserCreateOutputObjects() {
   fList->Add(fHistRapidity);
   fHistPhi  = new TH2F("fHistPhi","#phi distribution;#phi (rad);Centrality percentile",200,0.0,2.*TMath::Pi(),220,-5,105);
   fList->Add(fHistPhi);
-  fHistEtaPhiPos  = new TH3F("fHistEtaPhiPos","#eta-#phi distribution (+);#eta;#phi (rad);Centrality percentile",80,-2,2,72,0.0,2.*TMath::Pi(),220,-5,105);                     
+  fHistEtaPhiPos  = new TH3F("fHistEtaPhiPos","#eta-#phi distribution (+);#eta;#phi (rad);Centrality percentile",40,-1.6,1.6,72,0.,2.*TMath::Pi(),220,-5,105);                          
   fList->Add(fHistEtaPhiPos);                   
-  fHistEtaPhiNeg  = new TH3F("fHistEtaPhiNeg","#eta-#phi distribution (-);#eta;#phi (rad);Centrality percentile",80,-2,2,72,0.0,2.*TMath::Pi(),220,-5,105);             
+  fHistEtaPhiNeg  = new TH3F("fHistEtaPhiNeg","#eta-#phi distribution (-);#eta;#phi (rad);Centrality percentile",40,-1.6,1.6,72,0.,2.*TMath::Pi(),220,-5,105);                  
   fList->Add(fHistEtaPhiNeg);
   fHistPhiBefore  = new TH2F("fHistPhiBefore","#phi distribution;#phi;Centrality percentile",200,0.,2*TMath::Pi(),220,-5,105);
   fList->Add(fHistPhiBefore);
@@ -515,6 +518,10 @@ void AliAnalysisTaskBFPsi::UserCreateOutputObjects() {
     if(centbins) delete [] centbins; 
     if(multbins) delete [] multbins; 
     if(vtxbins)  delete [] vtxbins; 
+    if(psibins)  delete [] psibins; 
+
+    // set minimum values for track depth, fraction, and number of events
+    fPoolMgr->SetTargetValues(fMixingTracks, 0.1, 5);
     
     // check pool manager
     if(!fPoolMgr){
@@ -545,18 +552,34 @@ void AliAnalysisTaskBFPsi::UserCreateOutputObjects() {
     fHistProbTPCTOFvsPtbeforePID =new TH2D ("ProbTPCTOFvsPtbefore","ProbTPCTOFvsPtbefore", 1000, -50, 50, 1000, 0, 2.0); 
     fHistListPIDQA->Add(fHistProbTPCTOFvsPtbeforePID);
     
-    fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, 0, 500); 
+    fHistNSigmaTPCvsPtbeforePID = new TH2D ("NSigmaTPCvsPtbefore","NSigmaTPCvsPtbefore", 1000, -10, 10, 1000, -25, 25); 
     fHistListPIDQA->Add(fHistNSigmaTPCvsPtbeforePID);
     
-    fHistNSigmaTOFvsPtbeforePID = new TH2D ("NSigmaTOFvsPtbefore","NSigmaTOFvsPtbefore", 1000, -10, 10, 1000, 0, 500); 
+    fHistNSigmaTOFvsPtbeforePID = new TH2D ("NSigmaTOFvsPtbefore","NSigmaTOFvsPtbefore", 1000, -10, 10, 1000, -25, 25); 
     fHistListPIDQA->Add(fHistNSigmaTOFvsPtbeforePID); 
 
     fHistBetaVsdEdXbeforePID = new TH2D ("BetaVsdEdXbefore","BetaVsdEdXbefore", 1000, 0., 1000, 1000, 0, 1.2); 
-    fHistListPIDQA->Add(fHistBetaVsdEdXbeforePID); //++++++++
+    fHistListPIDQA->Add(fHistBetaVsdEdXbeforePID);
     
-    fHistNSigmaTPCTOFvsPtbeforePID = new TH2D ("NSigmaTPCTOFvsPtbefore","NSigmaTPCTOFvsPtbefore", 1000, -10., 10., 1000, 0, 500); 
-    fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtbeforePID); //++++++++
+    fHistNSigmaTPCTOFvsPtbeforePID = new TH2D ("NSigmaTPCTOFvsPtbefore","NSigmaTPCTOFvsPtbefore", 1000, -10., 10., 1000, -25, 25); 
+    fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtbeforePID);
     
+    //+++++++++++++++++//
+    //p array
+    const Int_t pBins = 36;
+    Double_t nArrayP[pBins+1]={0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0, 15.0, 20.0};
+    //nSigma Array
+    const Int_t nSigmaBins = 250;
+    Double_t nArrayS[nSigmaBins+1];
+    for (Int_t i = 0; i <= nSigmaBins; i++){
+      nArrayS[i]=i-125; //i+1
+      //Printf("nS: %lf - i: %d", nSigmaArray[i], i);
+    }
+    fHistNSigmaTPCTOFPbefPID = new TH3D ("fHistNSigmaTPCTOFPbefPID","fHistNSigmaTPCTOFPbefPID;#sigma_{TPC};#sigma_{TOF};p_{T} (GeV/c)", nSigmaBins, nArrayS, nSigmaBins, nArrayS, pBins,nArrayP); 
+    fHistListPIDQA->Add(fHistNSigmaTPCTOFPbefPID); 
+    //++++++++++++++//
+
     fHistdEdxVsPTPCafterPID = new TH2D ("dEdxVsPTPCafter","dEdxVsPTPCafter", 1000, -10, 10, 1000, 0, 1000); 
     fHistListPIDQA->Add(fHistdEdxVsPTPCafterPID);
     
@@ -572,17 +595,20 @@ void AliAnalysisTaskBFPsi::UserCreateOutputObjects() {
     fHistProbTPCTOFvsPtafterPID =new TH2D ("ProbTPCTOFvsPtafter","ProbTPCTOFvsPtafter", 1000, -50, 50, 1000, 0, 2.0); 
     fHistListPIDQA->Add(fHistProbTPCTOFvsPtafterPID);
 
-    fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, 0, 500); 
+    fHistNSigmaTPCvsPtafterPID = new TH2D ("NSigmaTPCvsPtafter","NSigmaTPCvsPtafter", 1000, -10, 10, 1000, -25, 25); 
     fHistListPIDQA->Add(fHistNSigmaTPCvsPtafterPID);
     
-    fHistNSigmaTOFvsPtafterPID = new TH2D ("NSigmaTOFvsPtafter","NSigmaTOFvsPtafter", 1000, -10, 10, 1000, 0, 500); 
+    fHistNSigmaTOFvsPtafterPID = new TH2D ("NSigmaTOFvsPtafter","NSigmaTOFvsPtafter", 1000, -10, 10, 1000, -25, 25); 
     fHistListPIDQA->Add(fHistNSigmaTOFvsPtafterPID);
 
     fHistBetaVsdEdXafterPID = new TH2D ("BetaVsdEdXafter","BetaVsdEdXafter", 1000, 0., 1000, 1000, 0, 1.2); 
-    fHistListPIDQA->Add(fHistBetaVsdEdXafterPID); //++++++++
+    fHistListPIDQA->Add(fHistBetaVsdEdXafterPID);
 
-    fHistNSigmaTPCTOFvsPtafterPID = new TH2D ("NSigmaTPCTOFvsPtafter","NSigmaTPCTOFvsPtafter", 1000, -10., 10., 1000, 0, 500); 
-    fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtafterPID); //++++++++
+    fHistNSigmaTPCTOFvsPtafterPID = new TH2D ("NSigmaTPCTOFvsPtafter","NSigmaTPCTOFvsPtafter", 1000, -10., 10., 1000, -25, 25); 
+    fHistListPIDQA->Add(fHistNSigmaTPCTOFvsPtafterPID);
+
+    fHistNSigmaTPCTOFPafterPID = new TH3D ("fHistNSigmaTPCTOFPafterPID","fHistNSigmaTPCTOFPafterPID;#sigma_{TPC};#sigma_{TOF};p_{T} (GeV/c)", nSigmaBins, nArrayS, nSigmaBins, nArrayS, pBins,nArrayP); 
+    fHistListPIDQA->Add(fHistNSigmaTPCTOFPafterPID); //++++++++++++++
   }
 
   // for electron rejection only TPC nsigma histograms
@@ -745,7 +771,7 @@ void AliAnalysisTaskBFPsi::UserExec(Option_t *) {
        
        //pool->SetDebug(1);
 
-       if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5){ 
+       if (pool->IsReady()){ 
          
          
          Int_t nMix = pool->GetCurrentNEvents();
@@ -1403,16 +1429,19 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
        Double_t probTPCTOF[AliPID::kSPECIES]={0.};
        
        Double_t nSigma = 0.;
-       Double_t nSigmaTPC = 0.; //++++
-       Double_t nSigmaTOF = 0.; //++++
-       Double_t nSigmaTPCTOF = 0.; //++++
+       Double_t nSigmaTPC = 0.;
+       Double_t nSigmaTOF = 0.; 
+       Double_t nSigmaTPCTOF = 0.;
        UInt_t detUsedTPC = 0;
        UInt_t detUsedTOF = 0;
        UInt_t detUsedTPCTOF = 0;
        
-       nSigmaTPC = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)fParticleOfInterest));
-       nSigmaTOF = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(aodTrack,(AliPID::EParticleType)fParticleOfInterest));
+       nSigmaTPC = fPIDResponse->NumberOfSigmasTPC(aodTrack,(AliPID::EParticleType)fParticleOfInterest);
+       nSigmaTOF = fPIDResponse->NumberOfSigmasTOF(aodTrack,(AliPID::EParticleType)fParticleOfInterest);
        nSigmaTPCTOF = TMath::Sqrt(nSigmaTPC*nSigmaTPC + nSigmaTOF*nSigmaTOF);
+       if (nSigmaTOF == 999 ||  nSigmaTOF == -999){
+         nSigmaTPCTOF = nSigmaTPC;
+       }
 
        //Decide what detector configuration we want to use
        switch(fPidDetectorConfig) {
@@ -1445,67 +1474,69 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
        Double_t tofTime = -999., length = 999., tof = -999.;
        Double_t c = TMath::C()*1.E-9;// m/ns
        Double_t beta = -999.;
-       if ( (aodTrack->IsOn(AliAODTrack::kTOFin)) &&
-            (aodTrack->IsOn(AliAODTrack::kTIME))  ) { 
-         tofTime = aodTrack->GetTOFsignal();//in ps
-         length = aodTrack->GetIntegratedLength();
-         tof = tofTime*1E-3; // ns     
-         
-         if (tof <= 0) {
-           //Printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");
-           continue;
-         }
-         if (length <= 0){
-           //printf("WARNING: track with negative length found!Skipping this track for PID checks\n");
-           continue;
-         }
-         
-         length = length*0.01; // in meters
-         tof = tof*c;
-         beta = length/tof;
-         
-         fHistBetavsPTOFbeforePID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);
-         fHistProbTOFvsPtbeforePID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);
-         fHistNSigmaTOFvsPtbeforePID ->Fill(aodTrack->Pt(),nSigmaTOF);
-       }//TOF signal 
-       
-       fHistdEdxVsPTPCbeforePID -> Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
-       fHistProbTPCvsPtbeforePID -> Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]); 
-       fHistNSigmaTPCvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPC);
-       
-       fHistProbTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);
 
-       //combined TPC&TOF
-       fHistBetaVsdEdXbeforePID->Fill(aodTrack->GetTPCsignal(),beta); //+++++++++      
-       fHistNSigmaTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPCTOF);
-       Printf("NSIGMA: %lf - nSigmaTOF: %lf - nSigmaTPC: %lf - nSigmaTPCTOF: %lf",nSigma,nSigmaTOF,nSigmaTPC,nSigmaTPCTOF);
-       
-       //end of QA-before pid
-       
-       if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {
-         //Make the decision based on the n-sigma
-         if(fUsePIDnSigma) {
-           if(nSigma > fPIDNSigma) continue;  
+       Float_t probMis = fPIDResponse->GetTOFMismatchProbability(aodTrack);
+       if (probMis < 0.01) { //if u want to reduce mismatch using also TPC
+
+         if ((aodTrack->IsOn(AliAODTrack::kITSin)) &&  (aodTrack->IsOn(AliAODTrack::kTOFpid)) ) { //leonardo's analysis
            
-           fHistNSigmaTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTOF);
-           fHistNSigmaTPCvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPC);
-           fHistNSigmaTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPCTOF);
-         }
-         //Make the decision based on the bayesian
-         else if(fUsePIDPropabilities) {
-           if(fParticleOfInterest != TMath::LocMax(AliPID::kSPECIES,prob)) continue;
-           if (prob[fParticleOfInterest] < fMinAcceptedPIDProbability) continue;      
+           tofTime = aodTrack->GetTOFsignal();//in ps
+           length = aodTrack->GetIntegratedLength();
+           tof = tofTime*1E-3; // ns                 
+           if (tof <= 0) {
+             //Printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");
+             continue;
+           }
+           if (length <= 0){
+             //printf("WARNING: track with negative length found!Skipping this track for PID checks\n");
+             continue;
+           }         
+           length = length*0.01; // in meters
+           tof = tof*c;
+           beta = length/tof;
+           
+           fHistBetavsPTOFbeforePID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);
+           fHistProbTOFvsPtbeforePID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);
+           fHistNSigmaTOFvsPtbeforePID ->Fill(aodTrack->Pt(),nSigmaTOF);
+         }//TOF signal 
          
-           fHistProbTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);
-           fHistProbTPCvsPtafterPID ->Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]); 
-           fHistProbTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);
+         fHistdEdxVsPTPCbeforePID -> Fill(aodTrack->GetTPCmomentum()*aodTrack->Charge(),aodTrack->GetTPCsignal()); //aodTrack->P()*aodTrack->Charge()
+         fHistProbTPCvsPtbeforePID -> Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]); 
+         fHistNSigmaTPCvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPC);        
+         fHistProbTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);
          
-         }
+         //combined TPC&TOF
+         fHistBetaVsdEdXbeforePID->Fill(aodTrack->GetTPCsignal(),beta);        
+         fHistNSigmaTPCTOFvsPtbeforePID -> Fill(aodTrack->Pt(),nSigmaTPCTOF);
+         fHistNSigmaTPCTOFPbefPID ->Fill(nSigmaTPC,nSigmaTOF,aodTrack->P()); //++++++++++++++
+         //Printf("NSIGMA: %lf - nSigmaTOF: %lf - nSigmaTPC: %lf - nSigmaTPCTOF: %lf",nSigma,nSigmaTOF,nSigmaTPC,nSigmaTPCTOF); 
+         //end of QA-before pid
+         
+         if ((detUsedTPC != 0)||(detUsedTOF != 0)||(detUsedTPCTOF != 0)) {
+           //Make the decision based on the n-sigma
+           if(fUsePIDnSigma) {
+             if(nSigma > fPIDNSigma || nSigma < -fPIDNSigma) continue;  
+             
+             fHistNSigmaTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTOF);
+             fHistNSigmaTPCvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPC);
+             fHistNSigmaTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),nSigmaTPCTOF);
+             fHistNSigmaTPCTOFPafterPID ->Fill(nSigmaTPC,nSigmaTOF,aodTrack->P());  //++++++++++++++
+           }
+           //Make the decision based on the bayesian
+           else if(fUsePIDPropabilities) {
+             if(fParticleOfInterest != TMath::LocMax(AliPID::kSPECIES,prob)) continue;
+             if (prob[fParticleOfInterest] < fMinAcceptedPIDProbability) continue;      
+             
+             fHistProbTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTOF[fParticleOfInterest]);
+             fHistProbTPCvsPtafterPID ->Fill(aodTrack->Pt(),probTPC[fParticleOfInterest]); 
+             fHistProbTPCTOFvsPtafterPID ->Fill(aodTrack->Pt(),probTPCTOF[fParticleOfInterest]);
+           }      
            
-         //Fill QA after the PID
-         fHistBetavsPTOFafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);
-         fHistdEdxVsPTPCafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
-         fHistBetaVsdEdXafterPID->Fill(aodTrack->GetTPCsignal(),beta); //+++++++++      
+           //Fill QA after the PID
+           fHistBetavsPTOFafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),beta);
+           fHistdEdxVsPTPCafterPID ->Fill(aodTrack->P()*aodTrack->Charge(),aodTrack->GetTPCsignal());
+           fHistBetaVsdEdXafterPID ->Fill(aodTrack->GetTPCsignal(),beta);
+         }
        }
       }
       //===========================PID===============================//
@@ -1534,6 +1565,11 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
       if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){
        continue;
       }
+
+      // Extra cut on shared clusters
+      if( fTPCsharedCut != -1 && aodTrack->GetTPCnclsS() > fTPCsharedCut){
+       continue;
+      }
       
       // fill QA histograms
       fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());
@@ -1557,70 +1593,34 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
     }//track loop
   }// AOD analysis
 
+
   // nano AODs
   else if(gAnalysisLevel == "AODnano") { // not fully supported yet (PID missing)
     // Loop over tracks in event
     
     for (Int_t iTracks = 0; iTracks < event->GetNumberOfTracks(); iTracks++) {
-      AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(event->GetTrack(iTracks));
+      AliVTrack* aodTrack = dynamic_cast<AliVTrack *>(event->GetTrack(iTracks));
       if (!aodTrack) {
        AliError(Form("Could not receive track %d", iTracks));
        continue;
       }
       
-      // AOD track cuts
-      
-      // For ESD Filter Information: ANALYSIS/macros/AddTaskESDfilter.C
-      // take only TPC only tracks 
-      //fHistTrackStats->Fill(aodTrack->GetFilterMap());
-      for(Int_t iTrackBit = 0; iTrackBit < 16; iTrackBit++){
-       fHistTrackStats->Fill(iTrackBit,aodTrack->TestFilterBit(1<<iTrackBit));
-      }
-
-      if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;
-
-
-      // additional check on kPrimary flag
-      if(fCheckPrimaryFlagAOD){
-       if(aodTrack->GetType() != AliAODTrack::kPrimary)
-         continue;
-      }
-
+      // AOD track cuts (not needed)
+      //if(!aodTrack->TestFilterBit(fnAODtrackCutBit)) continue;
      
       vCharge = aodTrack->Charge();
       vEta    = aodTrack->Eta();
-      vY      = aodTrack->Y();
+      vY      = -999.;
       vPhi    = aodTrack->Phi();// * TMath::RadToDeg();
       vPt     = aodTrack->Pt();
-      
-
-      Float_t dcaXY = aodTrack->DCA();      // this is the DCA from global track (not exactly what is cut on)
-      Float_t dcaZ  = aodTrack->ZAtDCA();   // this is the DCA from global track (not exactly what is cut on)
-      
+           
       
       // Kinematics cuts from ESD track cuts
       if( vPt < fPtMin || vPt > fPtMax)      continue;
       if( vEta < fEtaMin || vEta > fEtaMax)  continue;
       
-      // Extra DCA cuts (for systematic studies [!= -1])
-      if( fDCAxyCut != -1 && fDCAzCut != -1){
-       if(TMath::Sqrt((dcaXY*dcaXY)/(fDCAxyCut*fDCAxyCut)+(dcaZ*dcaZ)/(fDCAzCut*fDCAzCut)) > 1 ){
-         continue;  // 2D cut
-       }
-      }
-      
-      // Extra TPC cuts (for systematic studies [!= -1])
-      if( fTPCchi2Cut != -1 && aodTrack->Chi2perNDF() > fTPCchi2Cut){
-       continue;
-      }
-      if( fNClustersTPCCut != -1 && aodTrack->GetTPCNcls() < fNClustersTPCCut){
-       continue;
-      }
-      
+       
       // fill QA histograms
-      fHistClus->Fill(aodTrack->GetITSNcls(),aodTrack->GetTPCNcls());
-      fHistDCA->Fill(dcaZ,dcaXY);
-      fHistChi2->Fill(aodTrack->Chi2perNDF(),gCentrality);
       fHistPt->Fill(vPt,gCentrality);
       fHistEta->Fill(vEta,gCentrality);
       fHistRapidity->Fill(vY,gCentrality);
@@ -1854,6 +1854,11 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
        continue;
       }
 
+     // Extra cut on shared clusters
+      if( fTPCsharedCut != -1 && aodTrack->GetTPCnclsS() > fTPCsharedCut){
+       continue;
+      }
+
       //Exclude resonances
       if(fExcludeResonancesInMC) {
        
@@ -2173,33 +2178,35 @@ TObjArray* AliAnalysisTaskBFPsi::GetAcceptedTracks(AliVEvent *event, Double_t gC
          
          Bool_t kExcludeParticle = kFALSE;
          Int_t gMotherIndex = particle->GetFirstMother();
+
          if(gMotherIndex != -1) {
-           AliMCParticle* motherTrack = dynamic_cast<AliMCParticle *>(event->GetTrack(gMotherIndex));
-           if(motherTrack) {
-             TParticle *motherParticle = motherTrack->Particle();
-             if(motherParticle) {
-               Int_t pdgCodeOfMother = motherParticle->GetPdgCode();
-               //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {
-               if(pdgCodeOfMother == 113  // rho0
-                  || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
-                  // || pdgCodeOfMother == 221  // eta
-                  // || pdgCodeOfMother == 331  // eta'
-                  // || pdgCodeOfMother == 223  // omega
-                  // || pdgCodeOfMother == 333  // phi
-                  || pdgCodeOfMother == 311  || pdgCodeOfMother == -311 // K0
-                  // || pdgCodeOfMother == 313  || pdgCodeOfMother == -313 // K0*
-                  // || pdgCodeOfMother == 323  || pdgCodeOfMother == -323 // K+*
-                  || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
-                  || pdgCodeOfMother == 111  // pi0 Dalitz
-                  ) {
-                 kExcludeParticle = kTRUE;
-               }
-             }
-           }
+           // AliMCParticle* motherTrack = dynamic_cast<AliMCParticle *>(event->GetTrack(gMotherIndex));
+           // if(motherTrack) {
+           //   TParticle *motherParticle = motherTrack->Particle();
+           //   if(motherParticle) {
+           //  Int_t pdgCodeOfMother = motherParticle->GetPdgCode();
+           //  //if((pdgCodeOfMother == 113)||(pdgCodeOfMother == 213)||(pdgCodeOfMother == 221)||(pdgCodeOfMother == 223)||(pdgCodeOfMother == 331)||(pdgCodeOfMother == 333)) {
+           //  if(pdgCodeOfMother == 113  // rho0
+           //     || pdgCodeOfMother == 213 || pdgCodeOfMother == -213 // rho+
+           //     // || pdgCodeOfMother == 221  // eta
+           //     // || pdgCodeOfMother == 331  // eta'
+           //     // || pdgCodeOfMother == 223  // omega
+           //     // || pdgCodeOfMother == 333  // phi
+           //     || pdgCodeOfMother == 311  || pdgCodeOfMother == -311 // K0
+           //     // || pdgCodeOfMother == 313  || pdgCodeOfMother == -313 // K0*
+           //     // || pdgCodeOfMother == 323  || pdgCodeOfMother == -323 // K+*
+           //     || pdgCodeOfMother == 3122 || pdgCodeOfMother == -3122 // Lambda
+           //     || pdgCodeOfMother == 111  // pi0 Dalitz
+           //     ) {
+           kExcludeParticle = kTRUE;
+           //  }
+           //        }
+           //}
          }
          
          //Exclude from the analysis decay products of rho0, rho+, eta, eta' and phi
          if(kExcludeParticle) continue;
+
        }
 
        //Exclude electrons with PDG