# Re: histo stat when saved from a TTree

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Wed, 25 May 2005 11:19:31 +0200 (MEST)

Jean-eric,

I think that you should try to make a liitle effort to read the documentation about TTree::Draw and in particular the points with the selection variable (smunu in your example)

The result of the selection expression is used as a weight when filling the histogram. The histogram is not filled if the result of the expression is null.
If you simply want to see the entries, eg for which smunu>0, you should call

tree.draw("var","smunu>0")
In this case the weight is either 0 or 1. As explained in teh doc, you can have variants of the above, eg

tree.draw("var","smunu*(var2<0 && var3>0") In this case the resulting weight will be

smunu if the expression var2<0 && var3> 0 is true     0 otherwise (and the entry is not histogramed).

When filling histograms with weights, you must understand that this affects the mean value and the rms.

On Wed, 25
May
2005, Jean-Eric Campagne wrote:

> Hello
>
> --On mercredi 25 mai 2005 10:42 +0200 Rene Brun <brun_at_pcroot.cern.ch> wrote:
>
>> Jean-Eric
>>
>> The answer to your question depends on the values of "smunu".
>> if smunu==0 the entry is not histogrammed.
>
> So you mean it is not counted as an entry? This is not very kind in the case
> as smunu is a flux value or efficiency or what ever with 0 as a meaning...
>
>>
>> For the mean value, the result depend on teh number of under/overflows
>
> If there is no underflow neither overflow what would be the result?
>
> J.E
>>
>> Rene
>>
>> On Wed, 25 May 2005, Jean-Eric Campagne wrote:
>>
>>> Dear developpers,
>>>
>>> If I am creating a TH1F histo (here h2) from the following TTree
>>>
>>>
>>> numu:sanutau"); T2.Draw("sene>>h2(501,0.0,10.04)","snumu");
>>>
>>> (nb: T2 has 501 entries as I have checked from T2.Print())
>>>
>>> What is the content of #entries of h2 and the result of the mean/sigma
>>> value?
>>>
>>> Cheers
>>> Jean-Eric
>>>
>>> ........................................................................
>>> ... .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 Wed May 25 2005 - 11:19:36 MEST

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