I would like to know how to see at the end of a compiled program TH1F I filled.
I created a TCanvas, my TH1F…
When I draw it at the end of my program nothing appears, but my TH1F exists (it was written in a file).
Here are the main part of the code where I draw my TH1F.
I attached the complete code if you need it…
sprintf(canvasname,“Energy spectrum of the Detector %d”,detectnbr);
c1 = new TCanvas(“c1”,canvasname,200,10,900,700);
…
spectrum = new TH1F(spectrumname,title,maxch,0,maxch);
…
for(…)
{
spectrum->Fill(floor(alea)+((hit->nrj)/cpr)*a+b);
}
…
// Drawing of the spectrum
c1->cd(1);
spectrum -> Draw();
[i] I just tried it… but it changed nothing
gPad->Modified();
gPad->Update();
This is quite a solution except that while the TCanvas is used the application is blocked… What I want to have is like in the root interpreter: as long as you don’t leave root your TCanvas live but your macro can reach its end and stop: your TCanvas will remain…
either you go into theApp.Run() to show your canvas for as long as you like, or you exit the application. You cannot exit the application and keep the canvas on the screen.