Changes for #95543: request to commit to trunk: TOF code supporting PID for light...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Jun 2012 12:17:05 +0000 (12:17 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Jun 2012 12:17:05 +0000 (12:17 +0000)
STEER/AOD/AliAODpidUtil.h
STEER/ESD/AliESDpid.h
STEER/STEERBase/AliPID.cxx
STEER/STEERBase/AliPID.h
STEER/STEERBase/AliPIDResponse.cxx
STEER/STEERBase/AliTOFPIDResponse.cxx
STEER/STEERBase/AliTOFPIDResponse.h

index 3b66e9d..d3fcbc3 100644 (file)
@@ -47,23 +47,25 @@ private:
 
 inline Float_t AliAODpidUtil::NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type) const {
   AliAODTrack *track=(AliAODTrack*)vtrack;
-  Double_t times[AliPID::kSPECIES];
-  Double_t sigmaTOFPid[AliPID::kSPECIES];
+  Double_t sigTOF;
   AliAODPid *pidObj = track->GetDetPid();
   if (!pidObj) return -999.;
   Double_t tofTime=pidObj->GetTOFsignal();
-  pidObj->GetIntegratedTimes(times);
-  pidObj->GetTOFpidResolution(sigmaTOFPid);
+  Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
   AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
-  if (event) {
-    AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
-    if (tofH) { 
-      sigmaTOFPid[type]=fTOFResponse.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type)); //fTOFResponse is set in InitialiseEvent
-      tofTime -= fTOFResponse.GetStartTime(vtrack->P());
-    } 
+  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);
+      sigTOF=sigmaTOFPid[type];
+    } else return -998.;  // light nuclei cannot be supported on old AOD because we don't have timeZero resolution
   }
-  if (sigmaTOFPid[type]>0) return (tofTime - times[type])/sigmaTOFPid[type];
-  else return (tofTime - times[type])/fTOFResponse.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type));
+  if (sigTOF>0) return (tofTime - expTime)/sigTOF;
+  else return -997.;
 }
 
 #endif
index 52a8d03..0dcaa9e 100644 (file)
@@ -52,9 +52,11 @@ private:
 
 inline Float_t AliESDpid::NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type, const Float_t /*timeZeroTOF*/) const {
   AliESDtrack *track=(AliESDtrack*)vtrack;
-  Double_t times[AliPID::kSPECIES];
-  track->GetIntegratedTimes(times);
-  return (track->GetTOFsignal() - fTOFResponse.GetStartTime(track->GetP()) - times[type])/fTOFResponse.GetExpectedSigma(track->GetP(),times[type],AliPID::ParticleMass(type));
+  //  Double_t times[AliPID::kSPECIES];
+  // track->GetIntegratedTimes(times);
+  Double_t expTime = fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
+  //  return (track->GetTOFsignal() - fTOFResponse.GetStartTime(track->GetP()) - times[type])/fTOFResponse.GetExpectedSigma(track->GetP(),times[type],AliPID::ParticleMass(type));
+  return (track->GetTOFsignal() - fTOFResponse.GetStartTime(track->GetP()) - expTime)/fTOFResponse.GetExpectedSigma(track->GetP(),expTime,AliPID::ParticleMassZ(type));
 }
 
 #endif
index 99eeed2..7c5b261 100644 (file)
@@ -142,6 +142,26 @@ const Int_t AliPID::fgkParticleCode[AliPID::kSPECIESN+AliPID::kSPECIESLN+1] = {
   0.00000        // unknown
   */
 };
+/*const*/ Float_t AliPID::fgkParticleMassZ[AliPID::kSPECIESN+AliPID::kSPECIESLN+1] = {
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+  /*
+  M(kElectron),  // electron
+  M(kMuon), // muon
+  M(kPion),    // pion
+  M(kKaon),     // kaon
+  M(kProton),    // proton
+  M(kPhoton),     // photon
+  M(kPi0),       // pi0
+  M(kNeutron),   // neutron
+  M(kKaon0),        // kaon0
+  M(kEleCon),     // electron conversion
+  M(kDeuteron), // deuteron
+  M(kTriton),   // triton
+  M(kHe3)/2,      // he3
+  M(kAlpha)/2,    // alpha
+  0.00000        // unknown
+  */
+};
 
 Double_t AliPID::fgPrior[kSPECIESN] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
@@ -243,8 +263,11 @@ void AliPID::Init()
   // Initialise only once... 
   if(!fgkParticleMass[0]) {
     AliPDG::AddParticlesToPdgDataBase();
-    for (Int_t i = 0; i < kSPECIESN + kSPECIESLN; i++) 
+    for (Int_t i = 0; i < kSPECIESN + kSPECIESLN; i++) {
       fgkParticleMass[i] = M(i);
+      if (i == kHe3 || i == kAlpha) fgkParticleMassZ[i] = M(i)/2.;
+      else fgkParticleMassZ[i]=M(i);
+    }
   }
 }
 
index 39cb73a..e254412 100644 (file)
@@ -44,6 +44,10 @@ class AliPID : public TObject {
      if(!fgkParticleMass[0]) Init(); 
      return fgkParticleMass[iType];
   }
+  static Float_t       ParticleMassZ(Int_t iType) {
+     if(!fgkParticleMass[0]) Init(); 
+     return fgkParticleMassZ[iType];
+  }
   static const char*   ParticleName(Int_t iType) 
     {return fgkParticleName[iType];};
   static const char*   ParticleShortName(Int_t iType) 
@@ -86,12 +90,13 @@ class AliPID : public TObject {
   static Double_t      fgPrior[kSPECIESN];         // a priori probabilities
 
   static /*const*/ Float_t fgkParticleMass[kSPECIESN+kSPECIESLN+1]; // particle masses
+  static /*const*/ Float_t fgkParticleMassZ[kSPECIESN+kSPECIESLN+1]; // particle masses/charge
   static const char*   fgkParticleName[kSPECIESN+kSPECIESLN+1]; // particle names
   static const char*   fgkParticleShortName[kSPECIESN+kSPECIESLN+1]; // particle names
   static const char*   fgkParticleLatexName[kSPECIESN+kSPECIESLN+1]; // particle names
   static const Int_t   fgkParticleCode[kSPECIESN+kSPECIESLN+1]; // particle codes
 
-  ClassDef(AliPID, 2)    // particle id probability densities
+  ClassDef(AliPID, 3)    // particle id probability densities
 };
 
 
index 65f91c6..511475d 100644 (file)
@@ -418,17 +418,19 @@ AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeTOFProbability  (const AliV
   Double_t time[AliPID::kSPECIESN];
   track->GetIntegratedTimes(time);
   
-  Double_t sigma[AliPID::kSPECIES];
-  for (Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++) {
-    sigma[iPart] = fTOFResponse.GetExpectedSigma(track->P(),time[iPart],AliPID::ParticleMass(iPart));
-  }
+  //  Double_t sigma[AliPID::kSPECIES];
+  // for (Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++) {
+  //    sigma[iPart] = fTOFResponse.GetExpectedSigma(track->P(),time[iPart],AliPID::ParticleMass(iPart));
+  //  }
   
   Bool_t mismatch = kTRUE/*, heavy = kTRUE*/;
   for (Int_t j=0; j<AliPID::kSPECIES; j++) {
     AliPID::EParticleType type=AliPID::EParticleType(j);
     Double_t nsigmas=NumberOfSigmasTOF(track,type) + meanCorrFactor;
 
-    Double_t sig = sigma[j];
+    //    Double_t sig = sigma[j];
+    Double_t expTime = fTOFResponse.GetExpectedSignal(track,type);
+    Double_t sig = fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type));
     if (TMath::Abs(nsigmas) > (fRange+2)) {
       if(nsigmas < fTOFtail)
        p[j] = TMath::Exp(-0.5*(fRange+2)*(fRange+2))/sig;
index f962070..cc32e09 100644 (file)
@@ -82,7 +82,7 @@ AliTOFPIDResponse::GetMismatchProbability(Double_t p, Double_t mass) const {
 Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, Float_t mass) const {
   //
   // Return the expected sigma of the PID signal for the specified
-  // particle type.
+  // particle mass/Z.
   // If the operation is not possible, return a negative value.
   //
 
@@ -99,6 +99,42 @@ Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, Float_t
 
 }
 //_________________________________________________________________________
+Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, AliPID::EParticleType  type) const {
+  //
+  // Return the expected sigma of the PID signal for the specified
+  // particle type.
+  // If the operation is not possible, return a negative value.
+  //
+  
+  Double_t mass = AliPID::ParticleMassZ(type);
+  Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom;      //mean relative pt resolution;
+
+  Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass));
+  
+  Int_t index = GetMomBin(mom);
+
+  Double_t t0res = fT0resolution[index];
+
+  return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res);
+
+}
+//_________________________________________________________________________
+Double_t AliTOFPIDResponse::GetExpectedSignal(const AliVTrack* track,AliPID::EParticleType type) const {
+  //
+  // Return the expected signal of the PID signal for the particle type
+  // If the operation is not possible, return a negative value.
+  //
+  Double_t expt[5];
+  track->GetIntegratedTimes(expt);
+  if (type<=AliPID::kProton) return expt[type];
+  else {
+    Double_t p = track->P();
+    Double_t massZ = AliPID::ParticleMassZ(type);
+    return expt[0]/p*massZ*TMath::Sqrt(1.+p*p/massZ/massZ);
+  }
+}
+//_________________________________________________________________________
 Int_t AliTOFPIDResponse::GetMomBin(Float_t p) const{
   //
   // Returns the momentum bin index
index 1f79361..4648cb6 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "TObject.h"
 #include "AliPID.h"
+#include "AliVParticle.h"
+#include "AliVTrack.h"
 
 class AliTOFPIDParams;
 
@@ -28,8 +30,9 @@ public:
   void     SetMaxMismatchProbability(Double_t p) {fPmax=p;}
   Double_t GetMaxMismatchProbability() const {return fPmax;}
 
-  Double_t GetExpectedSigma(Float_t mom, Float_t tof, Float_t mass) const;
-
+  Double_t GetExpectedSigma(Float_t mom, Float_t tof, Float_t massZ) const;
+  Double_t GetExpectedSigma(Float_t mom, Float_t tof, AliPID::EParticleType type) const;
+  Double_t GetExpectedSignal(const AliVTrack *track, AliPID::EParticleType type) const;
 
   Double_t GetMismatchProbability(Double_t p,Double_t mass) const;