Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 50 → Rev 83

/sipmScan/examples/focus.C
50,16 → 50,17
canvas9->cd();
char hname[128];
int channel = map[chX][chY];
sprintf(hname, "hnhitsx%d", channel);
sprintf(hname, "hnhitsy%d", channel);
TH1F* h_laser = (TH1F*)rootfile->Get(hname);
h_laser->Draw();
h_laser->SetStats(1);
TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",parameter1,parameter2);
err->SetParameter(0,2500);
err->SetParameter(1, h_laser->GetMaximum());
//TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",parameter1,parameter2);
TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",h_laser->GetBinCenter(3), h_laser->GetBinCenter(h_laser->GetMaximumBin()));
err->SetParameter(0, h_laser->GetMinimum());
err->SetParameter(1, h_laser->GetMaximum() - h_laser->GetMinimum());
err->SetParameter(2, h_laser->GetBinCenter(h_laser->GetMaximumBin()));
err->SetParameter(3, 0.001);
err->SetParameter(3, 0.025);
h_laser->Fit(err,"qr");
h_laser->Fit(err,"lr");
double sigma = err->GetParameter(3);