Re: how to get mean of a variable in a Tree

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Thu, 8 Oct 2009 08:55:27 +0200


or a simpler and more general solution like

    tree.Draw("variable","some selection","goff");     double mean = TMath::Mean(tree.GetSelectedRows(),tree.GetV1());

Rene Brun

Arne Vandenbroucke wrote:
> Hi Luca,
>
> I would suggest this:
>
> TTree *data = ....
>
> data->Draw("variable>>his");
> TH1F *his = gDirectory->Get("his");
> his->GetRMS();
> his->GetMean();
> etc....
>
>
> Arne.
>
>
>
> On 10/07/2009 12:48 AM, Luca Grandi wrote:
>> Dear ROOT users,
>>
>> I am looking for a way to get mean, rms, min and max of a variable in
>> a tree once applied some cuts on the events. Apart from plotting the
>> distribution and extracting the info from the Stat box, is there a
>> different way to do it?
>> regards
>>
>> luca
>>
>
Received on Thu Oct 08 2009 - 08:55:04 CEST

This archive was generated by hypermail 2.2.0 : Thu Oct 08 2009 - 23:50:03 CEST