2 ReadT0FillReference(Int_t run, Int_t year = 2010)
5 AliCDBManager *cdb = AliCDBManager::Instance();
6 cdb->SetDefaultStorage(Form("alien://folder=/alice/data/%d/Reference", year));
8 AliCDBEntry *cdbe = cdb->Get("TOF/Calib/T0Fill");
9 TH1F *hT0Fill = (TH1F *)cdbe->GetObject();
11 /* rebin until maximum bin has required minimum entries */
12 Int_t maxBin = hT0Fill->GetMaximumBin();
13 Float_t maxBinContent = hT0Fill->GetBinContent(maxBin);
14 Float_t binWidth = hT0Fill->GetBinWidth(maxBin);
15 while (maxBinContent < 400 && binWidth < 90.) {
17 maxBin = hT0Fill->GetMaximumBin();
18 maxBinContent = hT0Fill->GetBinContent(maxBin);
19 binWidth = hT0Fill->GetBinWidth(maxBin);
21 Float_t maxBinCenter = hT0Fill->GetBinCenter(maxBin);
23 /* rough fit of the edge */
24 TF1 *gaus = (TF1 *)gROOT->GetFunction("gaus");
25 gaus->SetParameter(1, maxBinCenter);
26 Float_t fitMin = maxBinCenter - 100.; /* fit from 0.1 ns before max */
27 Float_t fitMax = maxBinCenter + 100.; /* fit until 0.1 ns above max */
28 hT0Fill->Fit("gaus", "q0", "", fitMin, fitMax);
29 /* better fit of the edge */
31 for (Int_t istep = 0; istep < 10; istep++) {
32 mean = gaus->GetParameter(1);
33 sigma = gaus->GetParameter(2);
34 fitMin = mean - 1. * sigma;
35 fitMax = mean + 0.1 * sigma;
36 hT0Fill->Fit("gaus", "q", "", fitMin, fitMax);
39 mean = gaus->GetParameter(1);
40 sigma = gaus->GetParameter(2);
41 Float_t meane = gaus->GetParError(1);
42 Float_t sigmae = gaus->GetParError(2);
43 printf("edge fit: mean = %f +- %f ps\n", mean, meane);
44 printf("edge fit: sigma = %f +- %f ps\n", sigma, sigmae);