Re: help

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Sat, 03 Mar 2007 13:19:58 +0100


Hi Sunil,

use bins with variable width, as documented in the part "Fix or variable bin size" here: http://root.cern.ch/root/html/TH1F.html#TH1F:description For your case, you could do

Double_t binEdges[] = {-1001., -101., 0., 20., 40., 60., 80., 100., 120., 140., 160., 180., 200.};
TH1F* h1 = new TH1F("h1", "histogram", 12, binEdges); The reason why I chose -1001. instead of -1000 is floating point precision: if you put the bin border at -1000. values that you expect to be -1000. but are -1000.001 due to limited precision might not end up in the bin.

Cheers, Axel.

suneel_at_puhep.res.in wrote:
> Hi all,
> I do not know whether I am at a right place for my problem.This
> problem is related to C++. I am hardly having any experience with
> C++.
> I am making one histogram which has some appreciable entries at -1000,few
> entries at -100 and a distribution between 0 to 200.I want to declare that
> histogram like [ TH1F* h1 = new TH1F("h1","histogram",300,-50,250)] and
> want the entries at -1000 to appear at -40 and entries at -100 to appear
> at -20 and keep the distribution as it is.
> Can anybody suggest me a way of doing.It will indeed be a very great help.
> Thanks a lot in advance.
> Sunil
>
>
Received on Sat Mar 03 2007 - 13:20:15 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 05 2007 - 17:50:01 CET