]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Corrections
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Jul 2012 09:01:56 +0000 (09:01 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Jul 2012 09:01:56 +0000 (09:01 +0000)
#95821
Pietro Antonioli

STEER/AOD/AliAODpidUtil.h

index 7fb92cf070ecbc020b4008c7c81d7d4e999abdbd..fb8f200dc4061e65f7a87bf6d77d11847ab474af 100644 (file)
@@ -14,6 +14,7 @@
 //-------------------------------------------------------
 #include <Rtypes.h>
 #include <TMatrixD.h>
+#include <AliLog.h>
 #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 @@ private:
 
 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
   }