Re: weight in TH1F from Tree

From: Jean-Eric Campagne <campagne_at_lal.in2p3.fr>
Date: Fri, 20 May 2005 12:52:02 +0200


Thanks Rene.

May I suggest you to put on the manual, the very simple TTree creation following lines
  TTree T2("t2","Flux Opt Pi-");  

T2.ReadFile("sploptiminus130.dat","sene/F:snue:snumu:snutau:sanue:sanumu:sanutau"); you have suggested to me in one of your previous mails. I know many people that this kind of things will help very much... The examples described in the manual are a little bit urgly and desperate some well PAW experienced people...

Best W.
J.E

--On vendredi 20 mai 2005 12:26 +0200 Rene Brun <brun_at_pcroot.cern.ch> wrote:

> 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
>> ........................................................................
>> ...
>>
>>

...........................................................................
.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:52:12 MEST

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