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 **************************************************************************/
17 /////////////////////////////////////////////////////////////////////////////
19 // This class contains the basic functions for the time zero //
20 // evaluation with TOF detecyor informations. //
22 /////////////////////////////////////////////////////////////////////////////
24 #include <Riostream.h>
27 #include "AliTOFT0v1.h"
28 #include "AliTOFT0maker.h"
29 #include "AliTOFcalibHisto.h"
31 #include "AliESDpid.h"
33 ClassImp(AliTOFT0maker)
35 //____________________________________________________________________________
36 AliTOFT0maker::AliTOFT0maker():
37 fCalib(new AliTOFcalibHisto()),
42 //fCalib = new AliTOFcalibHisto();
43 fCalib->LoadCalibPar();
45 if(AliPID::ParticleMass(0) == 0) new AliPID();
47 //____________________________________________________________________________
48 AliTOFT0maker::AliTOFT0maker(const AliTOFT0maker & t) :
51 fESDswitch(t.fESDswitch),
52 fTimeResolution(t.fTimeResolution),
57 //____________________________________________________________________________
58 AliTOFT0maker& AliTOFT0maker::operator=(const AliTOFT0maker &t)
67 fESDswitch = t.fESDswitch;
68 fTimeResolution = t.fTimeResolution;
69 fT0sigma = t.fT0sigma;
73 //____________________________________________________________________________
74 AliTOFT0maker::~AliTOFT0maker()
77 if(fCalib) delete fCalib;
79 //____________________________________________________________________________
80 Double_t* AliTOFT0maker::RemakePID(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){
82 // Remake TOF PID probabilities
85 Double_t calcolot0[3];
88 AliTOFT0v1* t0maker=new AliTOFT0v1(esd);
89 t0maker->SetCalib(fCalib);
90 t0maker->SetTimeResolution(fTimeResolution*1e-12);
93 t0tof=t0maker->DefineT0RawCorrection("all");
94 TakeTimeRawCorrection(esd);
96 else t0tof=t0maker->DefineT0("all");
98 Float_t lT0Current=0.;
101 Int_t nrun = esd->GetRunNumber();
102 Double_t t0fill = GetT0Fill(nrun);
104 calcolot0[0]=-1000*t0tof[0];
105 calcolot0[1]=1000*t0tof[1];
106 calcolot0[2] = t0fill;
108 if(calcolot0[1] < 150 && TMath::Abs(calcolot0[0] - t0fill) < 500){
109 fT0sigma=calcolot0[1];
110 lT0Current=calcolot0[0];
115 Double_t w1 = 1./t0sigma/t0sigma;
116 Double_t w2 = 1./calcolot0[1]/calcolot0[1];
118 Double_t wtot = w1+w2;
120 lT0Current = (w1*t0time + w2*calcolot0[0]) / wtot;
121 fT0sigma = TMath::Sqrt(1./wtot);
129 if(fT0sigma >= 1000){
133 calcolot0[0] = t0fill;
137 RemakeTOFpid(esd,lT0Current);
141 //____________________________________________________________________________
142 void AliTOFT0maker::TakeTimeRawCorrection(AliESDEvent * const esd){
144 // Take raw corrections for time measurements
147 Int_t ntracks = esd->GetNumberOfTracks();
150 AliESDtrack *t=esd->GetTrack(ntracks);
152 if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
154 Double_t time=t->GetTOFsignalRaw();
155 Double_t tot = t->GetTOFsignalToT();
156 Int_t chan = t->GetTOFCalChannel();
157 Double_t corr = fCalib->GetFullCorrection(chan,tot) - fCalib->GetCorrection(AliTOFcalibHisto::kTimeSlewingCorr,chan,0);
160 Int_t crate = Int_t(fCalib->GetCalibMap(AliTOFcalibHisto::kDDL,chan));
162 if(crate == 63 || crate == 62){
166 t->SetTOFsignal(time);
169 //____________________________________________________________________________
170 void AliTOFT0maker::RemakeTOFpid(AliESDEvent *esd,Float_t timezero){
172 // Recalculate TOF PID probabilities
176 pidESD.GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution));
177 pidESD.MakePID(esd,kFALSE,timezero);
180 //____________________________________________________________________________
181 Double_t AliTOFT0maker::GetT0Fill(Int_t nrun) const {
183 // Return T0 of filling
187 if(nrun==104065) t0= 1771614;
188 else if(nrun==104068) t0= 1771603;
189 else if(nrun==104070) t0= 1771594;
190 else if(nrun==104073) t0= 1771610;
191 else if(nrun==104080) t0= 1771305;
192 else if(nrun==104083) t0= 1771613;
193 else if(nrun==104157) t0= 1771665;
194 else if(nrun==104159) t0= 1771679;
195 else if(nrun==104160) t0= 1771633;
196 else if(nrun==104316) t0= 1764344;
197 else if(nrun==104320) t0= 1764342;
198 else if(nrun==104321) t0= 1764371;
199 else if(nrun==104439) t0= 1771750;
200 else if(nrun==104792) t0= 1771755;
201 else if(nrun==104793) t0= 1771762;
202 else if(nrun==104799) t0= 1771828;
203 else if(nrun==104800) t0= 1771788;
204 else if(nrun==104801) t0= 1771796;
205 else if(nrun==104802) t0= 1771775;
206 else if(nrun==104803) t0= 1771795;
207 else if(nrun==104824) t0= 1771751;
208 else if(nrun==104825) t0= 1771763;
209 else if(nrun==104845) t0= 1771792;
210 else if(nrun==104852) t0= 1771817;
211 else if(nrun==104864) t0= 1771825;
212 else if(nrun==104865) t0= 1771827;
213 else if(nrun==104867) t0= 1771841;
214 else if(nrun==104876) t0= 1771856;
215 else if(nrun==104878) t0= 1771847;
216 else if(nrun==104879) t0= 1771830;
217 else if(nrun==104892) t0= 1771837;
220 if(fESDswitch) t0 -= 487;