Re: Stat boxes for a THStack

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Thu, 10 Jun 2010 11:07:18 +0200


Do

METStack->Draw();
gPad->Update();
TPaveStats *statbox_stack = (TPaveStats*) METStack->GetHistogram()->FindObject("stats");

Rene Brun

Suvayu Ali wrote:
> Hi ROOT users,
>
> I was trying to use stacked histograms to represent contribution from
> various background processes in my analysis. So far I have been able
> to manage the stat boxes for the individual histograms in the stack.
> But how do I display a stat box for the final histogram represented by
> the entire histogram stack?
>
> I tried things like,
>
>> THStack *METStack = new THStack("METStack", "Stack testing");
>> METStack->Add(my_hist1,"hist");
>> // ... add some more histograms
>> METStack->Draw();
>> TPaveStats *statbox_stack = (TPaveStats*)
>> METStack->GetHistogram()->FindObject("stats");
>
> But as I had expected, it returns a null-pointer. I presume it is
> because the stat box is not created until we actually draw the histogram?
>
> Any ideas how to access it? TIA
>
Received on Thu Jun 10 2010 - 11:07:24 CEST

This archive was generated by hypermail 2.2.0 : Mon Jun 14 2010 - 17:50:01 CEST