4 #include "AliTOFT0v1.h"
5 #include "AliTOFT0maker.h"
6 #include "AliTOFcalibHisto.h"
9 #include "AliTOFpidESD.h"
11 ClassImp(AliTOFT0maker)
13 //____________________________________________________________________________
14 AliTOFT0maker::AliTOFT0maker(): fESDswitch(0), fTimeResolution(115), fT0sigma(1000)
16 fCalib = new AliTOFcalibHisto();
17 fCalib->LoadCalibPar();
19 if(AliPID::ParticleMass(0) == 0) new AliPID();
21 //____________________________________________________________________________
22 AliTOFT0maker::~AliTOFT0maker()
25 if(fCalib) delete fCalib;
27 //____________________________________________________________________________
28 Double_t* AliTOFT0maker::RemakePID(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){
31 AliTOFT0v1* t0maker=new AliTOFT0v1(esd);
32 t0maker->SetCalib(fCalib);
33 t0maker->SetTimeResolution(fTimeResolution*1e-12);
36 calcolot0=t0maker->DefineT0RawCorrection("all");
37 TakeTimeRawCorrection(esd);
39 else calcolot0=t0maker->DefineT0("all");
47 if(calcolot0[1] < 300){
48 fT0sigma=calcolot0[1];
49 T0Current=calcolot0[0];
54 Double_t w1 = 1./t0sigma/t0sigma;
55 Double_t w2 = 1./calcolot0[1]/calcolot0[1];
57 Double_t wtot = w1+w2;
59 T0Current = (w1*t0time + w2*calcolot0[0]) / wtot;
60 fT0sigma = TMath::Sqrt(1./wtot);
68 Int_t nrun = esd->GetRunNumber();
69 Double_t t0fill = GetT0Fill(nrun);
76 RemakeTOFpid(esd,T0Current);
80 //____________________________________________________________________________
81 void AliTOFT0maker::TakeTimeRawCorrection(AliESDEvent *esd){
82 Int_t ntracks = esd->GetNumberOfTracks();
85 AliESDtrack *t=esd->GetTrack(ntracks);
87 if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
89 Double_t time=t->GetTOFsignalRaw();
90 Double_t tot = t->GetTOFsignalToT();
91 Int_t chan = t->GetTOFCalChannel();
92 Double_t corr = fCalib->GetFullCorrection(chan,tot) - fCalib->GetCorrection(AliTOFcalibHisto::kTimeSlewingCorr,chan,0);
95 Int_t crate = Int_t(fCalib->GetCalibMap(AliTOFcalibHisto::kDDL,chan));
97 if(crate == 63 || crate == 62){
101 t->SetTOFsignal(time);
104 //____________________________________________________________________________
105 void AliTOFT0maker::RemakeTOFpid(AliESDEvent *esd,Float_t timezero){
108 param[0]=TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution);
112 AliTOFpidESD* pidTOF=new AliTOFpidESD(param);
113 pidTOF->MakePID(esd,timezero);
115 AliESDpid* pidESD = new AliESDpid();
116 pidESD->MakePID(esd);
119 //____________________________________________________________________________
120 Double_t AliTOFT0maker::GetT0Fill(Int_t nrun){
122 if(nrun==104065) t0= 1771614;
123 else if(nrun==104068) t0= 1771603;
124 else if(nrun==104070) t0= 1771594;
125 else if(nrun==104073) t0= 1771610;
126 else if(nrun==104080) t0= 1771305;
127 else if(nrun==104083) t0= 1771613;
128 else if(nrun==104157) t0= 1771665;
129 else if(nrun==104159) t0= 1771679;
130 else if(nrun==104160) t0= 1771633;
131 else if(nrun==104316) t0= 1764344;
132 else if(nrun==104320) t0= 1764342;
133 else if(nrun==104321) t0= 1764371;
134 else if(nrun==104439) t0= 1771750;
135 else if(nrun==104792) t0= 1771755;
136 else if(nrun==104793) t0= 1771762;
137 else if(nrun==104799) t0= 1771828;
138 else if(nrun==104800) t0= 1771788;
139 else if(nrun==104801) t0= 1771796;
140 else if(nrun==104802) t0= 1771775;
141 else if(nrun==104803) t0= 1771795;
142 else if(nrun==104824) t0= 1771751;
143 else if(nrun==104825) t0= 1771763;
144 else if(nrun==104845) t0= 1771792;
145 else if(nrun==104852) t0= 1771817;
146 else if(nrun==104864) t0= 1771825;
147 else if(nrun==104865) t0= 1771827;
148 else if(nrun==104867) t0= 1771841;
149 else if(nrun==104876) t0= 1771856;
150 else if(nrun==104878) t0= 1771847;
151 else if(nrun==104879) t0= 1771830;
152 else if(nrun==104892) t0= 1771837;
155 if(fESDswitch) t0 -= 487;