29 h1 = (TH1*) gROOT->FindObjectAny(hname);
31 TAxis* xaxis = h1->GetXaxis();
32 Double_t Ymin = xaxis->GetXmin();
33 Double_t Ymax = xaxis->GetXmax();
34 TF1* f1 =
new TF1(
"YBox",
f1_xboxe, Ymin, Ymax, 6);
35 Double_t yini = (h1->GetMaximum() + h1->GetMinimum()) * 0.5;
36 Double_t dLini = Ymax * 0.8;
39 f1->SetParLimits(1, dLini, dLini);
41 f1->SetParameters(yini, dLini, 2., -1., 0., 0.);
42 f1->SetParLimits(2, 0.2, 3.);
43 f1->SetParLimits(3, -3., 3.);
44 h1->Fit(
"YBox",
"SQM");
48 res[9] = f1->GetChisquare();
50 for (
int i = 0; i < 6; i++) {
51 res[i] = f1->GetParameter(i);
52 err[i] = f1->GetParError(i);
55 cout <<
"YBox Fit of " << hname <<
" ended with chi2 = " << res[9]
56 << Form(
", strip length %7.2f +/- %5.2f, position resolution %7.2f "
57 "+/- %5.2f at y_cen = %7.2f +/- %5.2f",
58 2. * res[1], 2. * err[1], res[2], err[2], res[3], err[3])