https://savannah.cern.ch/bugs/?95821
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Jul 2012 12:47:39 +0000 (12:47 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Jul 2012 12:47:39 +0000 (12:47 +0000)
Pietro Antonioli

STEER/AOD/AliAODpidUtil.h

index d3fcbc3..7fb92cf 100644 (file)
@@ -53,11 +53,14 @@ inline Float_t AliAODpidUtil::NumberOfSigmasTOF(const AliVParticle *vtrack, AliP
   Double_t tofTime=pidObj->GetTOFsignal();
   Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
   AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
-  AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
-  if (tofH) { // new AOD
-    sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent
-    tofTime -= fTOFResponse.GetStartTime(vtrack->P());
-  } else { // old AOD
+  if (event) {  // protection
+    AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
+    if (tofH) { // new AOD
+      sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent
+      tofTime -= fTOFResponse.GetStartTime(vtrack->P());
+    } 
+  }
+  else { // old AOD
     if (type <= AliPID::kProton) {
       Double_t sigmaTOFPid[AliPID::kSPECIES];
       pidObj->GetTOFpidResolution(sigmaTOFPid);