this example works, but if I substitute the name of my root file and histogram name, I get the same “illegal pointer” error. My root file and hist. are valid names, since the macro recognizes both of them.
As far as I can see, there are no typos in the lines where I use my histogram. Not sure what else I can check.
You must add
c1->Update();
after drawing your histogram and before accessing the “stats” box.
The “stats” box is only produced when the histogram is effecivlely paint
in the pad. gPad->Update() forces painting.