Commit 1b8925de authored by Keerthi Nakkalil's avatar Keerthi Nakkalil
Browse files

Please do not get confused by the name of the file. The code performs a time...

Please do not get confused by the name of the file. The code performs a time walk fit to the data for one pixel
parent ed2053da
void caliberation (){
auto c=new TCanvas();
gStyle->SetOptFit(1);
TGraphErrors* graph = new TGraphErrors("125_125.txt","%lg %lg %lg","");
graph->SetTitle(" ");
graph->GetXaxis()->SetTitle("Voltage [mV]");
graph->GetYaxis()->SetTitle("Time difference [ns]");
graph->SetMarkerStyle(8);
graph->SetMarkerColor(4);
// graph->GetYaxis()->SetRangeUser(15.5,17.35);
TF1 *fitfuncTOA = new TF1("fitfuncTOA","(([0]/(x-[1]))+ [2])",25.0,700.0);
fitfuncTOA->SetParNames("curvature","asymtote","offset");
fitfuncTOA->SetParameter(0,600.0);
auto ymax = TMath::MaxElement(graph->GetN(),graph->GetY());
auto ttoa = graph->Eval(ymax);
// cout << ymax << " " << ttoa;
fitfuncTOA->SetParameter(1,ttoa);
auto dtoa = graph->Eval(688.35);
fitfuncTOA->SetParameter(2,dtoa);
fitfuncTOA->SetLineColor(kRed);
graph->Fit(fitfuncTOA,"R");
graph->Draw("AP");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment