Run algo on data.
Upper limit of fitting.
289 gErrorIgnoreLevel = 3001;
291 B2INFO(
"Start to calibrate");
292 gSystem->Exec(
"mkdir -p Sigma_Fit_Err");
294 TF1* func =
new TF1(
"func",
"[0]/(x*x + [1])+[2]* x+[3]+[4]*exp([5]*(x-[6])*(x-[6]))", 0, 1.);
295 TH1F* hprob =
new TH1F(
"h1",
"", 20, 0, 1);
299 for (
int i = 0; i < 56; ++i) {
300 for (
int lr = 0; lr < 2; ++lr) {
301 for (
int al = 0; al <
m_nalpha; ++al) {
302 for (
int th = 0; th <
m_ntheta; ++th) {
308 B2DEBUG(199,
"xmax for fitting: " << upFit);
310 func->SetParameters(5E-6, 0.007, 1E-4, 1E-5, 0.00008, -30, intp6);
311 func->SetParLimits(0, 1E-7, 1E-4);
312 func->SetParLimits(1, 0.00001, 0.02);
313 func->SetParLimits(2, 1E-6, 0.0005);
314 func->SetParLimits(3, 1E-8, 0.0005);
315 func->SetParLimits(4, 0., 0.001);
316 func->SetParLimits(5, -40, 0.);
317 func->SetParLimits(6, intp6 - 0.5, intp6 + 0.3);
318 B2DEBUG(199,
"FITTING for layer: " << i <<
"lr: " << lr <<
" ial" << al <<
" ith:" << th);
319 B2DEBUG(199,
"Fit flag before fit:" <<
m_fitflag[i][lr][al][th]);
322 for (
int j = 0; j < 10; j++) {
324 B2DEBUG(199,
"loop: " << j);
325 B2DEBUG(199,
"Int p6: " << intp6);
326 B2DEBUG(199,
"Number of Point: " <<
gfit[i][lr][al][th]->GetN());
327 Int_t stat =
gfit[i][lr][al][th]->Fit(
"func",
"MQE",
"", 0.05, upFit);
328 B2DEBUG(199,
"stat of fit" << stat);
329 std::string Fit_status = gMinuit->fCstatu.Data();
330 B2DEBUG(199,
"FIT STATUS: " << Fit_status);
332 if (Fit_status ==
"OK" ||
333 Fit_status ==
"SUCCESSFUL" ||
334 Fit_status ==
"CALL LIMIT" ||
335 Fit_status ==
"PROBLEMS") {
336 if (fabs(func->Eval(0.3)) > 0.00035 || func->Eval(0.3) < 0) {
337 func->SetParameters(5E-6, 0.007, 1E-4, 1E-7, 0.0007, -30, intp6 + 0.05 * j);
341 B2DEBUG(199,
"Prob of fit: " << func->GetProb());
347 func->SetParameters(5E-6, 0.007, 1E-4, 1E-7, 0.0007, -30, intp6 + 0.05 * j);
350 TCanvas* c1 =
new TCanvas(
"c1",
"", 600, 600);
351 gfit[i][lr][al][th]->Draw();
352 c1->SaveAs(Form(
"Sigma_Fit_Err/%d_%d_al%d_th%d_%s.png", i, lr, al, th, Fit_status.c_str()));
353 B2WARNING(
"Fit error: " << i <<
" " << lr <<
" " << al <<
" " << th);
358 B2DEBUG(199,
"ProbFit: Lay_lr_al_th: " << i <<
" " << lr <<
" " << al <<
" " << th << func->GetProb());
359 hprob->Fill(func->GetProb());
360 func->GetParameters(
sigma_new[i][lr][al][th]);
virtual void storeHisto()
store histogram
int m_nalpha
number of alpha bins
int m_fitflag[56][2][Max_nalpha][Max_ntheta]
Fit flag; 1:OK ; 0:error.
virtual void createHisto()
create histogram
TGraphErrors * gfit[56][2][18][7]
sigma*sigma graph for fit
double getUpperBoundaryForFit(TGraphErrors *graph)
search max point at boundary region
int m_ntheta
number of theta bins
virtual void write()
save calibration, in text file or db
double sigma_new[56][2][18][7][8]
new sigma prameters.