Re: [ROOT] "Form" help needed

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Nov 06 2003 - 15:22:29 MET


Actually Form() accepts everything printf() accepts. It seems to be an
interpreter issue. Compiled the float version works fine, but
interpreted one needs to cast to double.

Masa, is this an issue with handling varargs in the interpreter. I see
this on Pentium.

Cheers, Fons.



On Thu, 2003-11-06 at 14:01, Rene Brun wrote:
> Hi Daan,
> 
> Form is a nice utility, but it accepts only int, double and chars, not float
> or shorts.
> In your case use a Double_t array or cast (Double_t)zs[0]
> 
> Rene Brun
> 
> daan wrote:
> > 
> > Hi,
> > 
> > I tried to do the following in a root script:
> > 
> > Float_t zs[4] = {-55, 105, 305, 525};
> > TCanvas canv;
> > n1f1->Draw("prob:t_phot",Form("z == %f && rho == 9 && phi > 1.3 && phi < 1.5",zs[0]),"");
> > 
> > The script opens a canvas, displays the date (thanks to SetOptDate()), but
> > does not display a plot of the ntuple "n1f1". The Form does not substitute
> > the %f with zs[0] and thus a plot cannot be drawn.
> > 
> > How can I use the Form() then in the selection part of the TNtuple::Draw()
> > method?
> > 
> > daan
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://www.rademakers.org/fons/      Fax:   +41 22 7679480



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