Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
I am making a program where a bunch of root graphs are displayed on the screen. The problem is, after they are created, I couldn’t find a way to close them through the executable itself. This is my code:
void functions::graph(vector<vector<double> > input) {
TApplication *myApp = new TApplication("myApp", 0, 0);
int nPoints = input[0].size();
vector<double> x(nPoints);
for (int i = 0; i < nPoints; i++) {
x[i] = i * 2.5e-9;
}
for (int j = 0; j < int(input.size()); j++) {
vector<double> y = input[j];
string canvasname = "c" + to_string(j);
TCanvas *c1 = new TCanvas(canvasname.c_str(), "Graph", 200, 10, 600, 400);
TGraph *graph = new TGraph(nPoints, &x[0], &y [0]);
graph->Draw("ACP");
c1->Draw();
myApp->Run();
}
}
Everything works fine until myApp->Run() part. It runs forever. I want the graph windows to terminate when a specific input is entered in the executable, “quit” for example . How do I achieve that?