Re: Q: how to get entry in a bin (TH1*)

From: Mario Kadastik <mario.kadastik_at_cern.ch>
Date: Mon, 30 Apr 2007 15:01:46 +0300


I don't think this is possible at all as the histogram only keeps the bin info and not the modifications (correct me if I'm wrong, but this is how I have understood the object).

Mario

On Apr 30, 2007, at 2:59 PM, Junichi Tanaka wrote:

> Hi Mario,
>
> I know that we can get 0.3 in binx=3 in your example.
> My question is how to get 2 in binx=3.
> (How many did we call "Fill()" for a bin?)
>
> Junichi
>
> 2007/4/30, Mario Kadastik <mario.kadastik_at_cern.ch>:
>> Erm, I don't quite understand the problem. Here is a sample root
>> session:
>>
>> root [0] TH1D *t = new TH1D("t","tt",5,0,5);
>> root [1] t->Fill(1,0.1)
>> (Int_t)2
>> root [2] t->Fill(2,0.1);
>> root [3] t->Fill(2,0.2);
>> root [4] t->GetBinContent(1)
>> (const Double_t)0.00000000000000000e+00
>> root [5] t->GetBinContent(2)
>> (const Double_t)1.00000000000000006e-01
>> root [6] t->GetBinContent(3)
>> (const Double_t)3.00000000000000044e-01
>> root [7] t->GetBinContent(4)
>> (const Double_t)0.00000000000000000e+00
>>
>> Mario
>>
>> On Apr 30, 2007, at 2:18 PM, Junichi Tanaka wrote:
>>
>> > Dear all,
>> >
>> > I fill events with a weight, which depends on events, in a TH1D.
>> > In this case, how do I get entry of a bin?
>> > For example, 3 events are filled in a bin with 0.1, 0.1 and 0.2.
>> > By using GetBinContent(i), we can get 0.4 but I don't know how to
>> > get 3.
>> > Is it possible?
>> >
>> > best regards,
>> > Junichi Tanaka
>> >
>>
>>
>
>
> --
> Junichi TANAKA (Junichi.Tanaka_at_cern.ch)
> TEL : +41-22-767-4245 (74245 at CERN)
> ROOM : B188-5-004
> A27100, CERN CH-1211, Geneva 23, Switzerland
Received on Mon Apr 30 2007 - 14:01:51 CEST

This archive was generated by hypermail 2.2.0 : Mon Apr 30 2007 - 17:50:01 CEST