From 9f170ca725005beb3929df7d55ca9fb7c85a539e Mon Sep 17 00:00:00 2001 From: morsch Date: Tue, 3 Jul 2012 09:03:58 +0000 Subject: [PATCH] update from trunk --- STEER/AOD/AliAODpidUtil.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/STEER/AOD/AliAODpidUtil.h b/STEER/AOD/AliAODpidUtil.h index 7fb92cf070e..fb8f200dc40 100644 --- a/STEER/AOD/AliAODpidUtil.h +++ b/STEER/AOD/AliAODpidUtil.h @@ -14,6 +14,7 @@ //------------------------------------------------------- #include #include +#include #include "AliAODEvent.h" // Needed for inline functions #include "AliAODTrack.h" // Needed for inline functions #include "AliAODPid.h" // Needed for inline functions @@ -47,23 +48,28 @@ class AliAODpidUtil : public AliPIDResponse { inline Float_t AliAODpidUtil::NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type) const { AliAODTrack *track=(AliAODTrack*)vtrack; + Bool_t oldAod=kTRUE; Double_t sigTOF; AliAODPid *pidObj = track->GetDetPid(); if (!pidObj) return -999.; Double_t tofTime=pidObj->GetTOFsignal(); Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type); + Double_t sigmaTOFPid[AliPID::kSPECIES]; + pidObj->GetTOFpidResolution(sigmaTOFPid); AliAODEvent *event=(AliAODEvent*)track->GetAODEvent(); - if (event) { // protection + if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer 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()); + if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD + sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent + tofTime -= fTOFResponse.GetStartTime(vtrack->P()); + oldAod=kFALSE; } + } else { + AliError("pointer to AliAODEvent not found, please call GetTrack to set it"); + return -996.; } - else { // old AOD + if (oldAod) { // old AOD if (type <= AliPID::kProton) { - Double_t sigmaTOFPid[AliPID::kSPECIES]; - pidObj->GetTOFpidResolution(sigmaTOFPid); sigTOF=sigmaTOFPid[type]; } else return -998.; // light nuclei cannot be supported on old AOD because we don't have timeZero resolution }