Getting Error while using TPaveStats

Hello all,

I am using TPaveStats for getting more than one stat box. I wrote the program to plot histogram in compareQuantities.C (attached) and running this from another file Compare_Mad_Phantom.C (attached) but when I plot first histogram there was no error but as I am trying to get 2 histogram at once I am getting error saying:
Error: illegal pointer to class object statsbox1 0x0 2189 compareQuantities.C:56:
*** Interpreter error recovered ***

Also I am facing one more problem at the end of program compareQuantities.C, I am using Draw() function but instead of Draw() when I used DrawNormalized() then 2nd Stat box disappears.

Please suggest what I am doing wrong.

Compare_Mad_Phantom.C (881 Bytes)
compareQuantities.C (2.69 KB)


Note that the “TH1::DrawNormalized” method creates and then draws a normalized COPY of your histogram. See this old post for a complete example how to deal with the “stats” box in such cases.


The macros cannot be run (the root data file is missing) could you add the missing file?

Cheers, Bertrand.

Thanks Coyote. Now its working. :smiley:

Hello @bellenot, Now problem solved. Thanks.