]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added TPCTOF Nsigma cut in flow package
authorfnoferin <fnoferin@cern.ch>
Fri, 6 Jun 2014 10:15:39 +0000 (12:15 +0200)
committerfnoferin <fnoferin@cern.ch>
Fri, 6 Jun 2014 10:15:39 +0000 (12:15 +0200)
PWG/FLOW/Tasks/AliFlowTrackCuts.cxx
PWG/FLOW/Tasks/AliFlowTrackCuts.h

index a1ffaa2f69b73b84ce0ebc4a255045cd878a5e58..9f97bf236a002625e1d608a65335ffcec051189b 100644 (file)
@@ -68,6 +68,8 @@
 #include "AliKFParticle.h"
 #include "AliESDVZERO.h"
 #include "AliFlowCommonConstants.h"
+#include "AliAnalysisManager.h"
+#include "AliPIDResponse.h"
 
 ClassImp(AliFlowTrackCuts)
 
@@ -157,7 +159,9 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fCurrCentr(0.0),
   fVZEROgainEqualization(NULL),
   fApplyRecentering(kFALSE),
-  fVZEROgainEqualizationPerRing(kFALSE)
+  fVZEROgainEqualizationPerRing(kFALSE),
+  fPIDResponse(NULL),
+  fNsigmaCut2(9)
 {
   //io constructor 
   SetPriors(); //init arrays
@@ -262,7 +266,9 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fCurrCentr(0.0),
   fVZEROgainEqualization(NULL),
   fApplyRecentering(kFALSE),
-  fVZEROgainEqualizationPerRing(kFALSE)
+  fVZEROgainEqualizationPerRing(kFALSE),
+  fPIDResponse(NULL),
+  fNsigmaCut2(9)
 {
   //constructor 
   SetTitle("AliFlowTrackCuts");
@@ -369,7 +375,9 @@ AliFlowTrackCuts::AliFlowTrackCuts(const AliFlowTrackCuts& that):
   fCurrCentr(0.0),
   fVZEROgainEqualization(NULL),
   fApplyRecentering(that.fApplyRecentering),
-  fVZEROgainEqualizationPerRing(that.fVZEROgainEqualizationPerRing)
+  fVZEROgainEqualizationPerRing(that.fVZEROgainEqualizationPerRing),
+  fPIDResponse(that.fPIDResponse),
+  fNsigmaCut2(that.fNsigmaCut2)
 {
   //copy constructor
   printf(" \n\n claling copy ctor \n\n" );
@@ -513,6 +521,9 @@ AliFlowTrackCuts& AliFlowTrackCuts::operator=(const AliFlowTrackCuts& that)
   }
   for(Int_t i(0); i < 8; i++) fUseVZERORing[i] = that.fUseVZERORing[i];
 
+  fPIDResponse = that.fPIDResponse;
+  fNsigmaCut2 = that.fNsigmaCut2;
+
   return *this;
 }
 
@@ -536,6 +547,13 @@ void AliFlowTrackCuts::SetEvent(AliVEvent* event, AliMCEvent* mcEvent)
   fEvent=event;
   fMCevent=mcEvent;
 
+  // Get PID response
+  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+  if(man){
+    AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+    if(inputHandler) fPIDResponse=inputHandler->GetPIDResponse();
+  }
+
   //do the magic for ESD
   AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(event);
   AliAODEvent* myAOD = dynamic_cast<AliAODEvent*>(event);
@@ -2557,6 +2575,9 @@ Bool_t AliFlowTrackCuts::PassesAODpidCut(const AliAODTrack* track )
   case kTPCbayesian:
       if (!PassesTPCbayesianCut(track)) pass=kFALSE;
       break;
+  case kTPCTOFNsigma:
+      if (!PassesTPCTOFNsigmaCut(track)) pass = kFALSE;
+      break;
   default:
     return kTRUE;
     break;
@@ -3462,8 +3483,22 @@ Bool_t AliFlowTrackCuts::PassesTPCTOFNsigmaCut(const AliAODTrack* track)
     // do a simple combined cut on the n sigma from tpc and tof
     // with information of the pid response object (needs pid response task)
     // stub, not implemented yet
+    if(!fPIDResponse) return kFALSE;
     if(!track) return kFALSE;
-    return kFALSE;
+
+    // check TOF status
+    if ((track->GetStatus()&AliVTrack::kTOFout)==0) return kFALSE;
+    if ((track->GetStatus()&AliVTrack::kTIME)==0) return kFALSE;
+
+    // check TPC status
+    if(track->GetTPCsignal() < 10) return kFALSE;
+
+    Float_t nsigmaTPC = fPIDResponse->NumberOfSigmas(AliPIDResponse::kTPC,track,fParticleID);
+    Float_t nsigmaTOF = fPIDResponse->NumberOfSigmas(AliPIDResponse::kTOF,track,fParticleID);
+
+    Float_t nsigma2 = nsigmaTPC*nsigmaTPC + nsigmaTOF*nsigmaTOF;
+
+    return (nsigma2 < fNsigmaCut2);
 
 }
 //-----------------------------------------------------------------------------
@@ -3472,8 +3507,22 @@ Bool_t AliFlowTrackCuts::PassesTPCTOFNsigmaCut(const AliESDtrack* track)
     // do a simple combined cut on the n sigma from tpc and tof
     // with information of the pid response object (needs pid response task)
     // stub, not implemented yet
+    if(!fPIDResponse) return kFALSE;
     if(!track) return kFALSE;
-    return kFALSE;
+
+    // check TOF status
+    if ((track->GetStatus()&AliVTrack::kTOFout)==0) return kFALSE;
+    if ((track->GetStatus()&AliVTrack::kTIME)==0) return kFALSE;
+
+    // check TPC status
+    if(track->GetTPCsignal() < 10) return kFALSE;
+
+    Float_t nsigmaTPC = fPIDResponse->NumberOfSigmas(AliPIDResponse::kTPC,track,fParticleID);
+    Float_t nsigmaTOF = fPIDResponse->NumberOfSigmas(AliPIDResponse::kTOF,track,fParticleID);
+
+    Float_t nsigma2 = nsigmaTPC*nsigmaTPC + nsigmaTOF*nsigmaTOF;
+
+    return (nsigma2 < fNsigmaCut2);
 
 }
 
index 4e4d48ee99a2437b85b4cdaac6f2e6b258b0fc2d..4c0f8e98213aedefe4de59c95be0319393a220b0 100644 (file)
@@ -37,6 +37,7 @@ class AliFlowBayesianPID;
 class AliESDkink;
 class AliESDv0;
 class AliESDVZERO;
+class AliPIDResponse;
 
 class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
@@ -293,6 +294,9 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   }
   Bool_t GetUseVZERORing(Int_t i) const {return fUseVZERORing[i];}
 
+  void SetNumberOfSigmas(Float_t val) {fNsigmaCut2 = val*val;};
+  Float_t GetNumberOfSigmas() const {return TMath::Sqrt(fNsigmaCut2);};
+
  protected:
   //AliFlowTrack* MakeFlowTrackSPDtracklet() const;
   //AliFlowTrack* MakeFlowTrackPMDtrack() const;
@@ -421,7 +425,10 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Bool_t fUseVZERORing[8];      // kTRUE means the ring is included
   static const Int_t fgkNumberOfVZEROtracks=64; //number of VZERO channels
 
-  ClassDef(AliFlowTrackCuts,13)
+  AliPIDResponse *fPIDResponse;            //! Pid reponse to manage Nsigma cuts
+  Float_t fNsigmaCut2;                     // Number of sigma^2 (cut value) for TPC+TOF nsigma cut
+
+  ClassDef(AliFlowTrackCuts,14)
 };
 
 #endif