Taking the event time from the TOF response itself (A. De Caro)
[u/mrichter/AliRoot.git] / STEER / AliESDpid.h
CommitLineData
8c6a71ab 1#ifndef ALIESDPID_H
2#define ALIESDPID_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
4f679a16 6/* $Id$ */
7
8c6a71ab 8//-------------------------------------------------------
9// Combined PID class
4f679a16 10// for the Event Summary Data class
8c6a71ab 11// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
12//-------------------------------------------------------
13#include <Rtypes.h>
10d100d4 14#include "AliESDtrack.h" // Needed for inline functions
15#include "AliTPCPIDResponse.h"
16#include "AliITSPIDResponse.h"
17#include "AliTOFPIDResponse.h"
b439f460 18#include "AliTRDPIDResponse.h"
10d100d4 19//#include "HMPID/AliHMPID.h"
20//#include "TRD/AliTRDpidESD.h"
8c6a71ab 21
af885e0f 22class AliESDEvent;
8c6a71ab 23
24class AliESDpid {
25public:
7170298c 26 AliESDpid(): fRange(5.), fRangeTOFMismatch(5.), fITSPIDmethod(kITSTruncMean), fTPCResponse(), fITSResponse(), fTOFResponse(), fTRDResponse(){;}
44ce6bbe 27 virtual ~AliESDpid() {}
f858b00e 28 Int_t MakePID(AliESDEvent *event, Bool_t TPCOnly = kFALSE, Float_t timeZeroTOF=9999) const;
10d100d4 29 void MakeTPCPID(AliESDtrack *track) const;
30 void MakeITSPID(AliESDtrack *track) const;
f858b00e 31 void MakeTOFPID(AliESDtrack *track, Float_t /*timeZeroTOF*/) const;
32 Bool_t CheckTOFMatching(AliESDtrack *track) const;
10d100d4 33 // void MakeHMPIDPID(AliESDtrack *track);
b439f460 34 void MakeTRDPID(AliESDtrack *track) const;
10d100d4 35 void CombinePID(AliESDtrack *track) const;
7ef60110 36
37 enum ITSPIDmethod { kITSTruncMean, kITSLikelihood };
38 void SetITSPIDmethod(ITSPIDmethod pmeth) { fITSPIDmethod = pmeth; }
39
10d100d4 40 Float_t NumberOfSigmasTPC(const AliESDtrack *track, AliPID::EParticleType type) const;
f858b00e 41 Float_t NumberOfSigmasTOF(const AliESDtrack *track, AliPID::EParticleType type, const Float_t timeZeroTOF) const;
10d100d4 42 Float_t NumberOfSigmasITS(const AliESDtrack *track, AliPID::EParticleType type) const;
43
44 AliITSPIDResponse &GetITSResponse() {return fITSResponse;}
45 AliTPCPIDResponse &GetTPCResponse() {return fTPCResponse;}
46 AliTOFPIDResponse &GetTOFResponse() {return fTOFResponse;}
b439f460 47 AliTRDPIDResponse &GetTRDResponse() {return fTRDResponse;}
10d100d4 48
f858b00e 49 enum EStartTimeType_t {kFILL_T0,kTOF_T0, kT0_T0, kBest_T0};
50 void SetTOFResponse(AliESDEvent *event,EStartTimeType_t option);
10d100d4 51
7170298c 52 void SetNMaxSigmaTOFTPCMismatch(Float_t range) {fRangeTOFMismatch=range;}
53 Float_t GetNMaxSigmaTOFTPCMismatch() const {return fRangeTOFMismatch;}
54
8c6a71ab 55private:
10d100d4 56 Float_t fRange; // nSigma max in likelihood
7170298c 57 Float_t fRangeTOFMismatch; // nSigma max for TOF matching with TPC
10d100d4 58 ITSPIDmethod fITSPIDmethod; // 0 = trunc mean; 1 = likelihood
59 AliTPCPIDResponse fTPCResponse;
60 AliITSPIDResponse fITSResponse;
61 AliTOFPIDResponse fTOFResponse;
62 // AliHMPIDPIDResponse fHMPIDResponse;
b439f460 63 AliTRDPIDResponse fTRDResponse;
10d100d4 64
7170298c 65 ClassDef(AliESDpid,5) // PID calculation class
8c6a71ab 66};
67
10d100d4 68inline Float_t AliESDpid::NumberOfSigmasTPC(const AliESDtrack *track, AliPID::EParticleType type) const {
69 Double_t mom = track->GetP();
ff945ab9 70 const AliExternalTrackParam *in = track->GetInnerParam();
10d100d4 71 if (in)
72 mom = in->GetP();
73 return fTPCResponse.GetNumberOfSigmas(mom,track->GetTPCsignal(),track->GetTPCsignalN(),type);
74}
75
2150d133 76inline Float_t AliESDpid::NumberOfSigmasTOF(const AliESDtrack *track, AliPID::EParticleType type, const Float_t /*timeZeroTOF*/) const {
10d100d4 77 Double_t times[AliPID::kSPECIES];
78 track->GetIntegratedTimes(times);
2150d133 79 return (track->GetTOFsignal() - fTOFResponse.GetStartTime(track->GetP()) - times[type])/fTOFResponse.GetExpectedSigma(track->GetP(),times[type],AliPID::ParticleMass(type));
10d100d4 80}
81
82inline Float_t AliESDpid::NumberOfSigmasITS(const AliESDtrack *track, AliPID::EParticleType type) const {
15e979c9 83 ULong_t trStatus=track->GetStatus();
84 Float_t dEdx=track->GetITSsignal();
85 UChar_t clumap=track->GetITSClusterMap();
86 Int_t nPointsForPid=0;
87 for(Int_t i=2; i<6; i++){
88 if(clumap&(1<<i)) ++nPointsForPid;
89 }
99daa709 90 Float_t mom=track->P();
91 Bool_t isSA=kTRUE;
92 if(trStatus&AliESDtrack::kTPCin) isSA=kFALSE;
93 return fITSResponse.GetNumberOfSigmas(mom,dEdx,type,nPointsForPid,isSA);
10d100d4 94}
8c6a71ab 95#endif
96
97