Bug corrected.
[u/mrichter/AliRoot.git] / STEER / AliTOFPIDResponse.cxx
CommitLineData
10d100d4 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16//-----------------------------------------------------------------//
17// //
18// Implementation of the TOF PID class //
19// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
20// //
21//-----------------------------------------------------------------//
22
23#include "TMath.h"
24#include "AliLog.h"
25
26#include "AliTOFPIDResponse.h"
27
28ClassImp(AliTOFPIDResponse)
29
30//_________________________________________________________________________
31AliTOFPIDResponse::AliTOFPIDResponse():
32 fSigma(0),
33 fPmax(0), // zero at 0.5 GeV/c for pp
34 fTime0(0)
35{
6c68754e 36 // Reset T0 info
37 ResetT0info();
38 SetMomBoundary();
10d100d4 39}
40//_________________________________________________________________________
41AliTOFPIDResponse::AliTOFPIDResponse(Double_t *param):
42 fSigma(param[0]),
43 fPmax(0), // zero at 0.5 GeV/c for pp
44 fTime0(0)
45{
46 //
47 // The main constructor
48 //
49 //
50
51 //fPmax=TMath::Exp(-0.5*3*3)/fSigma; // ~3 sigma at 0.5 GeV/c for PbPb
6c68754e 52
53 // Reset T0 info
54 ResetT0info();
55 SetMomBoundary();
10d100d4 56}
57//_________________________________________________________________________
58Double_t
59AliTOFPIDResponse::GetMismatchProbability(Double_t p, Double_t mass) const {
60 //
61 // Returns the probability of mismatching
62 // assuming 1/(p*beta)^2 scaling
63 //
64 const Double_t km=0.5; // "reference" momentum (GeV/c)
65
66 Double_t ref2=km*km*km*km/(km*km + mass*mass);// "reference" (p*beta)^2
67 Double_t p2beta2=p*p*p*p/(p*p + mass*mass);
68
69 return fPmax*ref2/p2beta2;
70}
71//_________________________________________________________________________
72Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, Float_t mass) const {
73 //
74 // Return the expected sigma of the PID signal for the specified
75 // particle type.
76 // If the operation is not possible, return a negative value.
77 //
78
6c68754e 79 Double_t dpp=0.018*mass/mom; //mean relative pt resolution;
10d100d4 80
81
82 Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass));
6c68754e 83
84 Int_t index = GetMomBin(mom);
85
86 Double_t t0res = fT0resolution[index];
87
88 return TMath::Sqrt(sigma*sigma + 50.0*50.0/mom/mom + fSigma*fSigma + t0res*t0res);
10d100d4 89
10d100d4 90}
6c68754e 91//_________________________________________________________________________
92Int_t AliTOFPIDResponse::GetMomBin(Float_t p) const{
f858b00e 93 //
94 // Returns the momentum bin index
95 //
96
6c68754e 97 Int_t i=0;
98 while(p > fPCutMin[i] && i < fNmomBins) i++;
99 if(i > 0) i--;
10d100d4 100
6c68754e 101 return i;
102}
103//_________________________________________________________________________
104void AliTOFPIDResponse::SetMomBoundary(){
f858b00e 105 //
106 // Set boundaries for momentum bins
107 //
108
6c68754e 109 fPCutMin[0] = 0.3;
110 fPCutMin[1] = 0.5;
111 fPCutMin[2] = 0.6;
112 fPCutMin[3] = 0.7;
113 fPCutMin[4] = 0.8;
114 fPCutMin[5] = 0.9;
115 fPCutMin[6] = 1;
116 fPCutMin[7] = 1.2;
117 fPCutMin[8] = 1.5;
118 fPCutMin[9] = 2;
119 fPCutMin[10] = 3;
120}
f858b00e 121//_________________________________________________________________________
122Float_t AliTOFPIDResponse::GetStartTime(Float_t mom) {
123 //
124 // Returns event_time value as estimated by TOF combinatorial algorithm
125 //
126
127 Int_t ibin = GetMomBin(mom);
128 return GetT0bin(ibin);
129
130}
131//_________________________________________________________________________
132Float_t AliTOFPIDResponse::GetStartTimeRes(Float_t mom) {
133 //
134 // Returns event_time resolution as estimated by TOF combinatorial algorithm
135 //
136
137 Int_t ibin = GetMomBin(mom);
138 return GetT0binRes(ibin);
139
140}