Empty histogram after TTree:Draw()


in my code (complex C++ program) I use in several places the TTree::Draw() calls. The strange thing is that sometimes the resulting histograms are empty, but the number of histogram entries is not (and I am absolutely sure about the hisogram range). The problem is difficult to reproduce (I failed to create a simple program which illustrates it), but if the problem is seen on some data and with some TTree cuts, it is reproducible. Exactly the same executable file may produce normal histograms on a different data (or with different TTree cuts).

I added a TTree::Scan() call (for the same expression which I used in TTree::Draw()) and it gives me non-empty values.

Did anyone observe such a behavior? What could be the reason?

I use ROOT 5.20/00, on Ubuntu Linux.

Thank you very much in advance,


Please, please send us a test setup if you have a way to reproduce the problem.
I cannot see how this could happen.


What do you mean by " test setup "?

I can create an executable on lxplus (+data file) and explain how I see the problem. Plus the source code…

On lxplus I use ROOT

try to run this shell script:
(Run it in a tmp directory, it produces many output files too.)

The program (less 1 min runtime) will produce a lot of printouts, please find the lines like this one:

main ERROR plot_SB: elist=790 name=“asym_vc_Ds_VC1P_fDPp” var=“spinZ[cell]beam_poldil[cell]*depol” weight="" entries=790 mean=0 RMS=0

They are easy to find, because I call TTree::Scan() immediately after the problem is detected.

The code which triggers the problem:
lines 93-106

The full code is quite big and complex (several libraries are involved). It is not easy to write a simple version which illustrates the problem…

And thanks for the investiagtion…

Hi Alexander,

In the broken cases, all the data for in the overflow bin.
(you can verify this by call myhist->Print(“all”) for example).

You will also notice that this seem to be the correct result.
For[code]main ERROR plot_SB: elist=702 name=“asym_vc_Ds_VC2P_fDPp” var=“spinZ[cell]beam_poldil[cell]*depol” weight="" entries=702 mean=0 RMS=0
main ERROR plot_SB: elist was: “(abs(lv[0].Mag()-1.8645)<0.05)&&((((1)&&(Ds_id&&Ds_zD&&Ds_cos&&common&&cut_dM))&&((1)&&(Ds_id&&Ds_zD&&Ds_cos&&common&&cut_dM)))&&(vc2&&spinP))”

  • Row * spinZ[cel *

  •   93 * 3.0434739 *
  •  117 * 9.7618281 *

The range your histo is -.5 to .5