Re: weight in TH1F from Tree

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Fri, 20 May 2005 12:26:18 +0200 (MEST)


Hi Jean-Eric,

When you need to include a C++ variable in one of the expressions of TTree::Draw use the Form function (defined in TString) eg

const double SCALE = 0.3464e-12/1.e-6;
T3.Draw("sene>>h222(501,0.01604,2.00396)",

    Form("snumu*%g*(sene<1.5)",SCALE));

Rene Brun

On
Fri, 20 May 2005,
Jean-Eric Campagne wrote:

> Dear developpers,
>
> Imagine that I have a simple tree (T3) with "sene" and "snumu" as variable. I
> would like to produce a 1D histo with "sene" weighted by "snumu". Up to now
> there is no problem.
> Now, I would like to rescale the weight with a SCALE factor, I have tried
>
> const double SCALE = 0.3464e-12/1.e-6; //To rescale Old Flux format to Opti
> Flux
> T3.Draw("sene>>h222(501,0.01604,2.00396)","snumu*SCALE*(sene<1.5)");
>
> But ROOT give me this error message:
>
> *ERROR 30 :
> Bad numerical expression : "SCALE"
>
> what can I do?
>
> NB: I have not done snumu%sene has I would like to impose the binning via the
> histo definition...
>
>
> ...........................................................................
> .LAL - IN2P3 - CNRS
> .LAL - B.P 34 - 91898 Orsay Cedex - France
> .Piece 108
> .Tel +33 (0)1 64 46 84 29
> .Fax +33 (0)1 64 46 83 97
> ...........................................................................
>
>
Received on Fri May 20 2005 - 12:26:23 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:08 MET