4 #include "AliTOFT0v1.h"
5 #include "AliTOFT0maker.h"
6 #include "AliTOFcalibHisto.h"
10 ClassImp(AliTOFT0maker)
12 //____________________________________________________________________________
13 AliTOFT0maker::AliTOFT0maker(): fESDswitch(0), fTimeResolution(115), fT0sigma(1000)
15 fCalib = new AliTOFcalibHisto();
16 fCalib->LoadCalibPar();
18 if(AliPID::ParticleMass(0) == 0) new AliPID();
20 //____________________________________________________________________________
21 AliTOFT0maker::~AliTOFT0maker()
24 if(fCalib) delete fCalib;
26 //____________________________________________________________________________
27 Double_t* AliTOFT0maker::RemakePID(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){
30 AliTOFT0v1* t0maker=new AliTOFT0v1(esd);
31 t0maker->SetCalib(fCalib);
32 t0maker->SetTimeResolution(fTimeResolution*1e-12);
35 calcolot0=t0maker->DefineT0RawCorrection("all");
36 TakeTimeRawCorrection(esd);
38 else calcolot0=t0maker->DefineT0("all");
46 if(calcolot0[1] < 300){
47 fT0sigma=calcolot0[1];
48 T0Current=calcolot0[0];
53 Double_t w1 = 1./t0sigma/t0sigma;
54 Double_t w2 = 1./calcolot0[1]/calcolot0[1];
56 Double_t wtot = w1+w2;
58 T0Current = (w1*t0time + w2*calcolot0[0]) / wtot;
59 fT0sigma = TMath::Sqrt(1./wtot);
67 Int_t nrun = esd->GetRunNumber();
68 Double_t t0fill = GetT0Fill(nrun);
75 RemakeTOFpid(esd,T0Current);
79 //____________________________________________________________________________
80 void AliTOFT0maker::TakeTimeRawCorrection(AliESDEvent *esd){
81 Int_t ntracks = esd->GetNumberOfTracks();
84 AliESDtrack *t=esd->GetTrack(ntracks);
86 if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
88 Double_t time=t->GetTOFsignalRaw();
89 Double_t tot = t->GetTOFsignalToT();
90 Int_t chan = t->GetTOFCalChannel();
91 Double_t corr = fCalib->GetFullCorrection(chan,tot) - fCalib->GetCorrection(AliTOFcalibHisto::kTimeSlewingCorr,chan,0);
94 Int_t crate = Int_t(fCalib->GetCalibMap(AliTOFcalibHisto::kDDL,chan));
96 if(crate == 63 || crate == 62){
100 t->SetTOFsignal(time);
103 //____________________________________________________________________________
104 void AliTOFT0maker::RemakeTOFpid(AliESDEvent *esd,Float_t timezero){
106 pidESD.GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution));
107 pidESD.MakePID(esd,kFALSE,timezero);
110 //____________________________________________________________________________
111 Double_t AliTOFT0maker::GetT0Fill(Int_t nrun){
113 if(nrun==104065) t0= 1771614;
114 else if(nrun==104068) t0= 1771603;
115 else if(nrun==104070) t0= 1771594;
116 else if(nrun==104073) t0= 1771610;
117 else if(nrun==104080) t0= 1771305;
118 else if(nrun==104083) t0= 1771613;
119 else if(nrun==104157) t0= 1771665;
120 else if(nrun==104159) t0= 1771679;
121 else if(nrun==104160) t0= 1771633;
122 else if(nrun==104316) t0= 1764344;
123 else if(nrun==104320) t0= 1764342;
124 else if(nrun==104321) t0= 1764371;
125 else if(nrun==104439) t0= 1771750;
126 else if(nrun==104792) t0= 1771755;
127 else if(nrun==104793) t0= 1771762;
128 else if(nrun==104799) t0= 1771828;
129 else if(nrun==104800) t0= 1771788;
130 else if(nrun==104801) t0= 1771796;
131 else if(nrun==104802) t0= 1771775;
132 else if(nrun==104803) t0= 1771795;
133 else if(nrun==104824) t0= 1771751;
134 else if(nrun==104825) t0= 1771763;
135 else if(nrun==104845) t0= 1771792;
136 else if(nrun==104852) t0= 1771817;
137 else if(nrun==104864) t0= 1771825;
138 else if(nrun==104865) t0= 1771827;
139 else if(nrun==104867) t0= 1771841;
140 else if(nrun==104876) t0= 1771856;
141 else if(nrun==104878) t0= 1771847;
142 else if(nrun==104879) t0= 1771830;
143 else if(nrun==104892) t0= 1771837;
146 if(fESDswitch) t0 -= 487;