re: question about SetNormfactor in THStack

From: Zhijun Liang <Zhijun.Liang_at_cern.ch>
Date: Tue, 17 Oct 2006 16:54:45 +0200


Dear Rene:
great,TH1::Scale is working well with THStack . thank you very much
best regards
Liang

-----Original Message-----
From: Rene Brun [mailto:Rene.Brun_at_cern.ch] Sent: 2006-10-17 (ÐÇÆÚ¶þ) 16:44
To: Zhijun Liang
Cc: roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] question about SetNormfactor in THStack  

SetNormFactor will not work for a THStack. The function stores one parameter in the object to normalize the histogram at drawing time. It cannot cope with the case of multiple normalization factors. Instead you should use TH1::Scale. This function will recompute the bin contents according the specified scale factor. It will be ok with a THStack.

Rene Brun

On
Tue,
17 Oct 2006, Zhijun Liang wrote:

> dear rooters:
> I have question about how to normalize 1D histograms and then add them to THStack,
> could you help me?
> here is my code :
> {
> TH1F *h1=new TH1F("h1","h1",50,-6,6);
> TH1F *h2=new TH1F("h2","h2",50,-6,6);
> h1->FillRandom("gaus",1000);
> h2->FillRandom("gaus",1000);
> h1->SetNormFactor(10);
> h2->SetNormFactor(10);
> THStack *hs=new THStack("hs","hs");
> hs->Add(h1);
> hs->Add(h2);
> hs->Draw();
> }
>
> I found that the THStack object failed to be normalized,
> do you know how to solve it ?
> manys thanks in advance.
> best regards
> liang
>
Received on Tue Oct 17 2006 - 16:56:24 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET