Re: proj ntuple into predefined histogram

Dirk Meier (Dirk.Meier@cern.ch)
Tue, 18 Aug 1998 22:34:17 +0200 (METDST)


On Tue, 18 Aug 1998, Stephen Bailey wrote:

>
> Hi.
>
> I'm trying to project an ntuple into a histogram which I
> defined so that I can control the number of bins used.
> e.g.
>
> TH1F h1 = new TH1F("blat", "quat", 20, 4.5, 6);
> ntuple->Draw("m>>+h1", "(4.5<m)&&(m<6.0)");
> h1->Draw();
>
> I also tryed m>>h1, but the ntuple->Draw command always
> picks its own choice for number of bins and h1 always
> seems to remain empty. If I don't predefine h1 then it
> gets created and properly filled but I don't have control
> over the number of bins.
>
> Is there a way to do this easily (i.e. without looping
> trough the ntuple and filling the histogram event by event)?
>
> Thanks.
>
> Stephen Bailey
>
>
>
>
>

Stephen,

it works with the following:

TH1F h1 = new TH1F("blat", "quat", 20, 4.5, 6);
ntuple->Draw("m>>blat"); // no limits necessary any more, use +
//when you fill more events into blat
h1->Draw(); // also blat->Draw() draws h1

Dirk