Protection against missing PID response object
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Jun 2012 23:00:26 +0000 (23:00 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Jun 2012 23:00:26 +0000 (23:00 +0000)
PWGHF/vertexingHF/AliRDHFCuts.cxx

index b098066..65941ce 100644 (file)
@@ -284,30 +284,33 @@ Bool_t AliRDHFCuts::IsEventSelected(AliVEvent *event) {
   if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
 
   // settings for the TPC dE/dx BB parameterization
-  if(fPidHF && fPidHF->GetOldPid()) {
-    // pp, from LHC10d onwards
-    if((event->GetRunNumber()>121693 && event->GetRunNumber()<136851) ||
-       event->GetRunNumber()>139517) fPidHF->SetOnePad(kTRUE);
-    // pp, 2011 low energy run
-    if((event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860)){
-      fPidHF->SetppLowEn2011(kTRUE);
-      fPidHF->SetOnePad(kFALSE);
+  if(fPidHF){
+    if(fPidHF->GetPidResponse()==0x0){
+      AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+      AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
+      AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
+      fPidHF->SetPidResponse(pidResp);
+    }
+    if(fPidHF->GetOldPid()) {
+      // pp, from LHC10d onwards
+      if((event->GetRunNumber()>121693 && event->GetRunNumber()<136851) ||
+        event->GetRunNumber()>139517) fPidHF->SetOnePad(kTRUE);
+      // pp, 2011 low energy run
+      if((event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860)){
+       fPidHF->SetppLowEn2011(kTRUE);
+       fPidHF->SetOnePad(kFALSE);
+      }
+      // PbPb LHC10h
+      if(event->GetRunNumber()>=136851 && event->GetRunNumber()<=139517) fPidHF->SetPbPb(kTRUE);
+      // MC
+      if(isMC) fPidHF->SetMC(kTRUE);
+      if(isMC && (event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860))
+       fPidHF->SetMClowenpp2011(kTRUE);
+      fPidHF->SetBetheBloch();
+    }else{
+      // check that AliPIDResponse object was properly set in case of using OADB
+      if(fPidHF->GetPidResponse()==0x0) AliFatal("AliPIDResponse object not set");
     }
-    // PbPb LHC10h
-    if(event->GetRunNumber()>=136851 && event->GetRunNumber()<=139517) fPidHF->SetPbPb(kTRUE);
-    // MC
-    if(isMC) fPidHF->SetMC(kTRUE);
-    if(isMC && (event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860))
-      fPidHF->SetMClowenpp2011(kTRUE);
-    fPidHF->SetBetheBloch();
-  } 
-  else if(fPidHF && !fPidHF->GetOldPid()) {
-   if(fPidHF->GetPidResponse()==0x0){
-    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-    AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
-    AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
-    fPidHF->SetPidResponse(pidResp);
-   }
   }