I’m a complete novice in ROOT and I apologize if the following query
happens to be a misplaced one.
I’m trying to read/calculate data points for three plots in one canvas.
(Actually, the data points are directly read from the inout file for one plot
and the data points for the other two are calculated therefrom.)
The data points in the input file are arranged in individual sets.
The plots do show up fine for the first set. Thereafter when I ask the
code to go back reading/calculating the data points for the next set,
the old plots, expectedly, vanish but the new plots do not display.
However, I have indicators to show that the data points
are being read and calculated for the subsequent sets as well
but the display shows only a blank canvas.
This continues through the subsequent sets of data points until
I opt out of reading another set and then the last read/calculated set
of plots show up.
The snippet of the code, in a schematic way, is included herewith.
readdata:
// READING/CALCULATING ONE SET OF DATA POINTS CORRESPONDING TO THREE PLOTS.
// DONE WITH READING/CALCULATING ONE SET OF DATA POINTS
//PLOTTING IN ROOT
TCanvas* draw_trace = new TCanvas("draw_trace","TRACE OF THE PULSE",200,10,600,400);
draw_trace->Divide(1,3);
TGraph* raw_trace = new TGraph(nlines,x,y);
TGraph* ff_trace = new TGraph(nlines1,xff,yff);
TGraph* cfd_trace = new TGraph(nlines2,xcfd,ycfd);
draw_trace->cd(2);
raw_trace -> SetMarkerStyle(7);
raw_trace -> SetMarkerSize(5.0);
raw_trace -> SetMarkerColor(4);
raw_trace -> Draw("AP");
draw_trace->cd(1);
ff_trace -> SetMarkerStyle(7);
ff_trace -> SetMarkerSize(5.0);
ff_trace -> SetMarkerColor(4);
ff_trace -> Draw("AP");
draw_trace->cd(3);
cfd_trace -> SetMarkerStyle(7);
cfd_trace -> SetMarkerSize(5.0);
cfd_trace -> SetMarkerColor(4);
cfd_trace -> Draw("AP");
gPad->Modified();
gPad->Update();
//ASKING THE USER IF ANOTHER SET OF DATA POINTS ARE TO BE READ/CALCULATED
printf("Do you want to read another trace ?\n"); scanf("%d", &optread);
if(optread == 1)
{
goto readdata;
}
//IF THE ANSWER IS IN AFFIRMATIVE, WE GO BACK TO READ THE NEXT SET OF DATA POINTS
I’m using ROOT Version 6.14/04.
I shall gratefully appreciate any guidance from this community.