1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //-----------------------------------------------------------------//
18 // Implementation of the TOF PID class //
19 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
21 //-----------------------------------------------------------------//
27 #include "AliTOFPIDResponse.h"
29 ClassImp(AliTOFPIDResponse)
31 TF1 *AliTOFPIDResponse::fTOFtailResponse = NULL; // function to generate a TOF tail
33 //_________________________________________________________________________
34 AliTOFPIDResponse::AliTOFPIDResponse():
36 fPmax(0), // zero at 0.5 GeV/c for pp
44 if(!fTOFtailResponse){
45 fTOFtailResponse = new TF1("fTOFtail","[0]*TMath::Exp(-(x-[1])*(x-[1])/2/[2]/[2])* (x < [1]+[3]*[2]) + (x > [1]+[3]*[2])*[0]*TMath::Exp(-(x-[1]-[3]*[2]*0.5)*[3]/[2] * 0.0111)*0.018",-1000,1000);
46 fTOFtailResponse->SetParameter(0,1);
47 fTOFtailResponse->SetParameter(1,-26);
48 fTOFtailResponse->SetParameter(2,1);
49 fTOFtailResponse->SetParameter(3,0.89);
50 fTOFtailResponse->SetNpx(10000);
58 //_________________________________________________________________________
59 AliTOFPIDResponse::AliTOFPIDResponse(Double_t *param):
61 fPmax(0), // zero at 0.5 GeV/c for pp
65 // The main constructor
69 //fPmax=TMath::Exp(-0.5*3*3)/fSigma; // ~3 sigma at 0.5 GeV/c for PbPb
76 if(!fTOFtailResponse){
77 fTOFtailResponse = new TF1("fTOFtail","[0]*TMath::Exp(-(x-[1])*(x-[1])/2/[2]/[2])* (x < [1]+[3]*[2]) + (x > [1]+[3]*[2])*[0]*TMath::Exp(-(x-[1]-[3]*[2]*0.5)*[3]/[2] * 0.0111)*0.018",-1000,1000);
78 fTOFtailResponse->SetParameter(0,1);
79 fTOFtailResponse->SetParameter(1,-26);
80 fTOFtailResponse->SetParameter(2,1);
81 fTOFtailResponse->SetParameter(3,0.89);
82 fTOFtailResponse->SetNpx(10000);
89 //_________________________________________________________________________
91 AliTOFPIDResponse::GetMismatchProbability(Double_t p, Double_t mass) const {
93 // Returns the probability of mismatching
94 // assuming 1/(p*beta)^2 scaling
96 const Double_t km=0.5; // "reference" momentum (GeV/c)
98 Double_t ref2=km*km*km*km/(km*km + mass*mass);// "reference" (p*beta)^2
99 Double_t p2beta2=p*p*p*p/(p*p + mass*mass);
101 return fPmax*ref2/p2beta2;
103 //_________________________________________________________________________
104 Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, Float_t mass) const {
106 // Return the expected sigma of the PID signal for the specified
108 // If the operation is not possible, return a negative value.
111 Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom; //mean relative pt resolution;
114 Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass));
116 Int_t index = GetMomBin(mom);
118 Double_t t0res = fT0resolution[index];
120 return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res);
123 //_________________________________________________________________________
124 Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, AliPID::EParticleType type) const {
126 // Return the expected sigma of the PID signal for the specified
128 // If the operation is not possible, return a negative value.
131 Double_t mass = AliPID::ParticleMassZ(type);
132 Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom; //mean relative pt resolution;
135 Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass));
137 Int_t index = GetMomBin(mom);
139 Double_t t0res = fT0resolution[index];
141 return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res);
144 //_________________________________________________________________________
145 Double_t AliTOFPIDResponse::GetExpectedSignal(const AliVTrack* track,AliPID::EParticleType type) const {
147 // Return the expected signal of the PID signal for the particle type
148 // If the operation is not possible, return a negative value.
151 track->GetIntegratedTimes(expt);
152 if (type<=AliPID::kProton) return expt[type];
154 Double_t p = track->P();
155 Double_t massZ = AliPID::ParticleMassZ(type);
156 return expt[0]/p*massZ*TMath::Sqrt(1.+p*p/massZ/massZ);
159 //_________________________________________________________________________
160 Int_t AliTOFPIDResponse::GetMomBin(Float_t p) const{
162 // Returns the momentum bin index
166 while(p > fPCutMin[i] && i < fNmomBins) i++;
171 //_________________________________________________________________________
172 void AliTOFPIDResponse::SetMomBoundary(){
174 // Set boundaries for momentum bins
189 //_________________________________________________________________________
190 Float_t AliTOFPIDResponse::GetStartTime(Float_t mom) const {
192 // Returns event_time value as estimated by TOF combinatorial algorithm
195 Int_t ibin = GetMomBin(mom);
196 return GetT0bin(ibin);
199 //_________________________________________________________________________
200 Float_t AliTOFPIDResponse::GetStartTimeRes(Float_t mom) const {
202 // Returns event_time resolution as estimated by TOF combinatorial algorithm
205 Int_t ibin = GetMomBin(mom);
206 return GetT0binRes(ibin);
209 //_________________________________________________________________________
210 Int_t AliTOFPIDResponse::GetStartTimeMask(Float_t mom) const {
212 // Returns event_time mask
215 Int_t ibin = GetMomBin(mom);
216 return GetT0binMask(ibin);
219 //_________________________________________________________________________
220 Double_t AliTOFPIDResponse::GetTailRandomValue() const // generate a random value to add a tail to TOF time (for MC analyses)
223 return fTOFtailResponse->GetRandom();