Re: [ROOT] Automatic binning in tree->Draw()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Sep 19 2001 - 22:07:27 MEST


Hi Andrzej,

OK, I see the problem now. This is a precision problem due to the fact
that the class TPolyMarker uses single precision.
I have modified this class to use double precision for the storage
of the points. The fix is in CVS.

Rene Brun

On Wed, 19 Sep 2001, Andrzej Kupsc wrote:

> Hi Rene,
>    I am affraid that the problem is somewhat different. I understand that 
> I can of course define histogram myhist with desired binning. But in case
> of time it is however not always obvious what is the proper range.
> Therefore I am using automatical binning option for fast checking of time 
> dependencies...
> 
> The following script example.C illustrates my problem:
> 
> 
> {
>   UInt_t t0;
>   UInt_t fSize;
>   UInt_t fTime;
> 
>   TFile *f = new TFile("test.root","RECREATE");
>   TTree *T = new TTree("T","test");
>   t0=time(NULL);
>   T->Branch("Size",&fSize,"Size/i");
>   T->Branch("Time",&fTime,"Time/i");
>   fTime=t0;
>   
>   for(int i=0;i<1000;i++){
>     fTime++;
>     fSize=i/10;
>     T->Fill();
>   }
>   T->Write();
> }
> 
> 
> root [0] .x example.C   
> 
> //the following cases gives nice detailed dependence:
> root [2] T->Draw("Size:(Time-1000916452)")
> 
> // while equivalent? ones gives very rough  binning:
> root [4] T->Draw("Size:Time")             
> root [5] T->Draw("Size:Time-1000916")
> 
> 
> There is probably some roundout problem ....
> 
> 
> Best regards 
> Andrzej Kupsc
> 
> ---------------------------------------------------------------
> Address         : The Svedberg Laboratory,
>                   Uppsala University, Box 533, S-75121 Uppsala.
> Telephone       : +46-18-4713439
> Facsimile       : +46-18-4713833
> e-mail          : kupsc@unix.tsl.uu.se
> ---------------------------------------------------------------
> 
> On Wed, 19 Sep 2001, Rene Brun wrote:
> 
> > Hi Andrzej,
> > 
> > Currently, when a branch holds a variable of type integer, the histogram
> > created has an integer bin size.
> > However, the algorithm is not clever enough to recognize that Time-10008884
> > is also an integer. As soon as an expression is used, the bin size is
> > assumed to be a float.
> > 
> > You should create an histogram with the correct bin limits and bin size
> > before calling TTree::Draw, then do:
> > 
> >    tree->Draw("Time-10008884>>myhist");
> > 
> > Rene Brun
> > 
> > Andrzej Kupsc wrote:
> > > 
> > > Hi,
> > >   In a tree I have a branch with C-time (secs>1970):
> > > 
> > >   tree->Branch("Time",&Time,"Time/i");
> > > 
> > >   When I am plotting time vs other other variable say:
> > >   tree->Draw("x:Time")
> > >   The bins are much more coarse then in the case when time offset
> > >   was subtraced:
> > >   tree->Draw("x:(Time-1000883184)")
> > > 
> > >   There is not such big difference in automaticaly calculated bin
> > > size when one dimensional plot is requested:
> > >  tree->Draw("Time") vs tree->Draw("Time-1000883184")
> > > 
> > > I am using root 3.01/06 on RH7.0
> > > 
> > > Am I doing something wrong?
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET