#include "TGraphErrors.h" #include "TCanvas.h" #include "TH1D.h" #include #include void Fit_PRD2020() { const Int_t n = 4; // number of data points Double_t x[n] ={0}; Double_t y[n]={0.0}; Double_t ex[n]={0.0}; Double_t ey[n]={0.0}; ifstream in("PRD_gate244_2020.txt"); // name of the input file Timewalk_60Co_Run11_gate344.dat if(!in) { cout << "Cannot open input file!!!" << endl; } if(in){ for(int i = 0; i> x[i] >> y[i] >> ey[i]; } in.close(); } for(int i = 0; iSetLineColor(kRed); fit->SetParameters(0.5, 1.0, 7.0, 7.0); //fit->SetParameters(75.0,82,83,83); p->Fit(fit, ""); p->SetName("Stopbranch"); p->SetTitle("Startbranch"); p->Draw(); fit->SetLineColor(kGreen); fit->SetParameters(75.0,82,83,83); p1->SetName("Startbranch"); p1->Fit(fit, ""); p1->Draw("same"); } }