Re: How to fill 2D from Ntuple?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 03 1999 - 08:50:27 MET


William Love wrote:
> 
>    Root experts (Valery gave up)
> 
>    I am trying to dump two 2D arrays  from an ntuple to two TH2F's so I
>  can subtract them.  The arrays are 56X29 so I predefine the output arrays
> 
>   TH2F hv6("hv6","fooey",56,-0.5,55.5,29,-0.5,28.5)
> 
>   I then try to fill the array with
> 
>  ntb->Draw("index:irad>>hv6","bzme*(index<29 && iphi==9)","lego")
> 
>  If I inspect hv6 beforehand it is 56X29  as expected.  After the fill
>  the array is 40X40 with the consequent mismatch of the binning and
>  the data.  What am I doing wrong?  I have the results of hv6.Dump()
>  both before and after the Draw if you want to look at them.
> 
>                                               Bill Love

Hi Bill,
A workaround is to draw the TH2F with the option "lego" before
calling TTree::Draw and then use the option "same" in Draw.
  TH2F hv6("hv6",....);
  hv6.Draw("lego");
  ntb->Draw("index:irad>>hv6","...","legosame")

I will adapt the algorithm to be automatic.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET