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
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
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};
// 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);
+ }
}
}
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)
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
};
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;
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.
//
}
//_________________________________________________________________________
+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
#include "TObject.h"
#include "AliPID.h"
+#include "AliVParticle.h"
+#include "AliVTrack.h"
class AliTOFPIDParams;
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;