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

From: Mario Kadastik <mario.kadastik_at_cern.ch>
Date: Mon, 30 Apr 2007 14:47:13 +0300


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
>
Received on Mon Apr 30 2007 - 13:47:21 CEST

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