Possibility to apply a cut on kaon PID in the 3 prong filtering
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliRDHFCuts.cxx
index c4c7ab7..734f35a 100644 (file)
@@ -370,32 +370,10 @@ Bool_t AliRDHFCuts::IsEventSelectedForCentrFlattening(Float_t centvalue){
 
 }
 //---------------------------------------------------------------------------
-Bool_t AliRDHFCuts::IsEventSelected(AliVEvent *event) {
-  //
-  // Event selection
-  // 
-  //if(fTriggerMask && event->GetTriggerMask()!=fTriggerMask) return kFALSE;
-
-
+void AliRDHFCuts::SetupPID(AliVEvent *event) {
+  // Set the PID response object in the AliAODPidHF
+  // in case of old PID sets the TPC dE/dx BB parameterization
 
-  fWhyRejection=0;
-  fEvRejectionBits=0;
-  Bool_t accept=kTRUE;
-
-  if(fRecomputePrimVertex){
-    Bool_t vertOK= RecomputePrimaryVertex((AliAODEvent*)event);
-    if(!vertOK){
-      fWhyRejection=6;
-      return kFALSE;
-    }
-  }
-
-  // check if it's MC
-  Bool_t isMC=kFALSE;
-  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
-  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
-
-  // settings for the TPC dE/dx BB parameterization
   if(fPidHF){
     if(fPidHF->GetPidResponse()==0x0){
       AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -403,8 +381,13 @@ Bool_t AliRDHFCuts::IsEventSelected(AliVEvent *event) {
       AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
       fPidHF->SetPidResponse(pidResp);
     }
-      if(fPidHF->GetUseCombined()) fPidHF->SetUpCombinedPID();
+    if(fPidHF->GetUseCombined()) fPidHF->SetUpCombinedPID();
     if(fPidHF->GetOldPid()) {
+
+      Bool_t isMC=kFALSE;
+      TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+      if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
+
       // pp, from LHC10d onwards
       if((event->GetRunNumber()>121693 && event->GetRunNumber()<136851) ||
         event->GetRunNumber()>139517) fPidHF->SetOnePad(kTRUE);
@@ -425,7 +408,35 @@ Bool_t AliRDHFCuts::IsEventSelected(AliVEvent *event) {
       if(fPidHF->GetPidResponse()==0x0) AliFatal("AliPIDResponse object not set");
     }
   }
+}
+//---------------------------------------------------------------------------
+Bool_t AliRDHFCuts::IsEventSelected(AliVEvent *event) {
+  //
+  // Event selection
+  // 
+  //if(fTriggerMask && event->GetTriggerMask()!=fTriggerMask) return kFALSE;
+
+
+
+  fWhyRejection=0;
+  fEvRejectionBits=0;
+  Bool_t accept=kTRUE;
+
+  if(fRecomputePrimVertex){
+    Bool_t vertOK= RecomputePrimaryVertex((AliAODEvent*)event);
+    if(!vertOK){
+      fWhyRejection=6;
+      return kFALSE;
+    }
+  }
+
+  // check if it's MC
+  Bool_t isMC=kFALSE;
+  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
+
 
+  SetupPID(event);
 
   // trigger class
   TString firedTriggerClasses=((AliAODEvent*)event)->GetFiredTriggerClasses();