[ROOT] TTree::Draw(), empty selections and canvas/histogram update

From: Walter F.J. Mueller (W.F.J.Mueller@gsi.de)
Date: Sun Apr 20 2003 - 19:40:01 MEST


Dear ROOTer's                           using 3.05/03

it seems the canvas isn't updated when TTree::Draw() is used with an
empty selection. This gives potentially confusing visual results.
Assume a tree has a variable 'num', than a session like

   file = new TFile("xxx.root");
   tree->Draw("num>>h(100,0.,50000.)");

produces some nice histogram. Now give as third command

   tree->Draw("num>>h","1==0");

This will not produce a display with a histogram with 0 entries as one
rightfully expects but just leaves the canvas unchanged. Now select
File->'Save as' and the canvas will update, you see the correct
histogram, and the correct histogram is also saved...

It seems that in general the canvas isn't updated when the selection
is empty (nor htemp in case no explicit histogram is filled). For my
taste this isn't correct and is a potential trap leading to wrong
conclusions when one tries different selections and one of them turns
out to be empty because cuts are so narrow that there is no event
matching it. If the selection is empty, an empty histogram is the
proper visualization of this fact.

                 Cheers and happy Easter,

                          Walter



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET