#include "TGraph.h" #include #include double runR(double evalTime) { static TGraph *g = ((TGraph *)0); if (!g) { // "import" data from output/histogram304.txt g = new TGraph(); double x, y; std::ifstream fin("output/histogram304.txt"); while (fin >> y) { x = g->GetN() * 0.18 / 100.; g->SetPoint(g->GetN(), x, y); // "append" point } // std::cout << "... " << g->GetN() << " points found ..." << std::endl; g->Draw("AL*"); } double r = g->Eval(evalTime); return r; } void calcR(double t = 0.05) { // "time" for evaluation double rg = runR(t); std::cout << "t = " << t << " µs → r = " << rg << " mm" << std::endl; }