TH2F bidi_h("bidi_h","2D Histo;Gaussian Vals;Exp. Vals",
30,-5,5, // X axis
30,0,10); // Y axis
TRandom3 rgen;
for (int i=0;i<500000;i++) {bidi_h.Fill(rgen.Gaus(0,2),10-rgen.Exp(4),.1);}
auto c=new TCanvas("Canvas","Canvas",800,800);
c->Divide(2,2);
c->cd(1);bidi_h.DrawClone("Cont1");
The output of this is not as expected.
The “bidi_h.DrawClone(“Cont1”);” seems to be executed before the “c->Divide(2,2);” although the Divide is entered one line before. Alternatively it is possible that “c->cd(1);” could be executed after “bidi_h.DrawClone(“Cont1”);”.
This strange behavior doesn’t occur if I use:
c->cd(1);
bidi_h.DrawClone(“Cont1”);
instead of:
c->cd(1);bidi_h.DrawClone(“Cont1”);
This strange behavior also doesn’t occur if I use “Draw” instead of “DrawClone”.
Why does ROOT behave this way? Why seems the line before being executed after the next line?