Hello!
I’m running the root version 5.22 with VC++ 9.0. In my code I have the function openAnalyzeModule_man that creates an object of my class RadialMeasurement2 and calls RadialMeasurement2::plotRadDev which will do a plot using a TCanvas and TMultigraph object.
When the plot (canvas) is closed by the user I want the program to continue at the point from whil openAnalyzeModule_man was called. Unfortunately, the complete program terminates if i click on “Quit ROOT” in the File menu of the canvas.
I searched in the RootTalk archive and found the solution using TApplication::Run(kTRUE) but this doesn’t work, too.
Do you have a solution for my problem?
Thanks a lot!
Nicholas
The important parts of the source code:
[code]void openAnalyzeModule_man(CStr fileL, CStr fileR, double combAngle, double deltaR, double relXPos, double tableAngle, CStr fileStats, double limits)
{
TApplication AppAuswertung(“Wire Measurement”, NULL, NULL);
RadialMeasurement2 current_measurement (fileL, fileR, tableAngle * PI / 180.0, combAngle * PI / 180.0, deltaR);
if (current_measurement.isAllOk()) {
current_measurement.justDoItUsingBoth(relXPos);
if (fileStats!="") current_measurement.saveStatistics(fileStats, 0, 0, 0);
current_measurement.plotRadDev(limits);
}
else cout << "\nError! Module could not be analyzed.\n";
AppAuswertung.Run(kTRUE);
}[/code]
[code]void RadialMeasurement2::plotRadDev(double limits)
{
double wireNo [200], e_y [200], e_z [200];
// initialise some arrays for the root plot
for (int i=0; i<noWires; i++) {
e_y[i]=0;
e_z[i]=0;
wireNo[i]=(double) i;
}
TCanvas * canvas = new TCanvas("canvas","Radial Deviation",200,10,700,500);
TMultiGraph *mg = new TMultiGraph();
canvas->SetFillColor(10);
canvas->SetGrid();
canvas->GetFrame()->SetFillColor(10);
canvas->GetFrame()->SetBorderSize(10);
TGraphErrors *gr_data = new TGraphErrors(noWires,wireNo,radDev,e_y,e_z);
gr_data->SetMarkerColor(4);
gr_data->SetMarkerStyle(2);
mg->Add(gr_data);
mg->Draw("AP");
TAxis * x_axis = mg->GetXaxis();
TAxis * y_axis = mg->GetYaxis();
mg->SetMinimum (-limits);
mg->SetMaximum (limits);
x_axis->SetTitle("Wire No.");
y_axis->SetTitle("Radial Deviation [mm]");
x_axis->CenterTitle();
y_axis->CenterTitle();
mg->Draw("AP");
}[/code]