Hi
I’m trying to compare 2 histograms visually.
When drawing single histograms on a single canvas (or different canvases also) I have no problem.
However, if I try to do it in a loop (try to change histograms through the time) - there is a problem:
- I can’t close the canvas with ‘x’
- There is no ‘menu bar’
- I can’t zoom in / zoom out
- Basically, I can do nothing - there is just picture of histograms
I can change method and try not to use for and while loop, but is there a way to fix this?
Also, what is the reason for it?
Here is the example:
//Test histograms
TH1D *histMassive[2];
TH1D *h1 = new TH1D("h1", "Histo from a Gaussian", 100, -3, 3);
h1->FillRandom("gaus", 10000);
TH1D *h2 = new TH1D("h2", "Histo from a Gaussian", 100, -3, 3);
h2->FillRandom("gaus", 10000);
histMassive[0] = h1;
histMassive[1] = h2;
TCanvas *can1 = new TCanvas("canvas1");
can1->Divide(2, 1);
//--
for (int i = 0; i < 2; i++)
{
can1->cd(1);
histMassive[i]->Draw();
can1->Update();
TH1D *h = (TH1D *)histMassive[i]->Clone("hclone");
can1->cd(2);
int reb = 2;
while (true)
{
int stopInt = 0;
h->Rebin(reb);
h->Draw();
can1->Update();
cout << "Enter 0 if it's OK:";
cin >> stopInt;
if (!stopInt)
break;
h = (TH1D *)hADC[i]->Clone("hclone");
reb++;
}
}
_ROOT Version: 6.18/04
Platform: kubuntu 18.04
Compiler: vs code