* provided "as is" without express or implied warranty. *
**************************************************************************/
-//-----------------------------------------------------------------
-// Implementation of the TOF PID class
-// Very naive one... Should be made better by the detector experts...
-// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
-//-----------------------------------------------------------------
-#include "TFile.h"
-#include "TTree.h"
-#include "TClonesArray.h"
-#include "TError.h"
+//-----------------------------------------------------------------//
+// //
+// Implementation of the TOF PID class //
+// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
+// //
+//-----------------------------------------------------------------//
-#include "AliTOFpidESD.h"
-#include "AliESD.h"
-#include "AliESDtrack.h"
-#include "AliTOFdigit.h"
-#include "AliTOFGeometry.h"
-#include <Riostream.h>
+#include "TMath.h"
+#include "AliLog.h"
-#include <stdlib.h>
+#include "AliESDtrack.h"
+#include "AliESDEvent.h"
+#include "AliTOFpidESD.h"
ClassImp(AliTOFpidESD)
//_________________________________________________________________________
-AliTOFpidESD::AliTOFpidESD(Double_t *param) {
+ AliTOFpidESD::AliTOFpidESD():
+ fN(-1),
+ fEventN(-1),
+ fSigma(0),
+ fRange(0)
+{
+}
+//_________________________________________________________________________
+AliTOFpidESD::AliTOFpidESD(Double_t *param):
+ fN(0),
+ fEventN(0),
+ fSigma(0),
+ fRange(0)
+ {
//
// The main constructor
//
- fN=0; fEventN=0;
-
fSigma=param[0];
fRange=param[1];
}
//_________________________________________________________________________
-Int_t AliTOFpidESD::MakePID(AliESD *event)
+Int_t AliTOFpidESD::MakePID(AliESDEvent *event, Double_t timeZero)
{
//
// This function calculates the "detector response" PID probabilities
// Just for a bare hint...
- static const Double_t kMasses[]={
- 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
- };
+ AliDebug(1,Form("TOF PID Parameters: Sigma (ps)= %f, Range= %f",fSigma,fRange));
+ AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n");
+ Int_t ntrk=event->GetNumberOfTracks();
+ AliESDtrack **tracks=new AliESDtrack*[ntrk];
+
+ Int_t i;
+ for (i=0; i<ntrk; i++) {
+ AliESDtrack *t=event->GetTrack(i);
+ tracks[i]=t;
+ }
+
+ for (i=0; i<ntrk; i++) {
+ AliESDtrack *t=tracks[i];
+ if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
+ if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue;
+ Double_t tof=t->GetTOFsignal()-timeZero;
+ Double_t time[10]; t->GetIntegratedTimes(time);
+ Double_t p[10];
+ Double_t mom=t->GetP();
+ for (Int_t j=0; j<AliPID::kSPECIES; j++) {
+ Double_t mass=AliPID::ParticleMass(j);
+ Double_t dpp=0.01; //mean relative pt resolution;
+ if (mom>0.5) dpp=0.01*mom;
+ Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));
+ sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma);
+ if (TMath::Abs(tof-time[j]) > fRange*sigma) {
+ p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
+ continue;
+ }
+ p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
+ }
+ t->SetTOFpid(p);
+ }
+
+ delete[] tracks;
+
+ return 0;
+}
+
+//_________________________________________________________________________
+Int_t AliTOFpidESD::MakePID(AliESDEvent *event)
+{
+ //
+ // This function calculates the "detector response" PID probabilities
+ // Just for a bare hint...
- Int_t nPID=0;
Int_t ntrk=event->GetNumberOfTracks();
AliESDtrack **tracks=new AliESDtrack*[ntrk];
Double_t time[10]; t->GetIntegratedTimes(time);
Double_t p[10];
Double_t mom=t->GetP();
- nPID++;
- for (Int_t j=0; j<AliESDtrack::kSPECIES; j++) {
- Double_t mass=kMasses[j];
+ for (Int_t j=0; j<AliPID::kSPECIES; j++) {
+ Double_t mass=AliPID::ParticleMass(j);
Double_t dpp=0.01; //mean relative pt resolution;
if (mom>0.5) dpp=0.01*mom;
Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));