Hi Rene,
On Thursday 10 June 2010 02:07 AM, Rene Brun wrote:
> Do
>
> METStack->Draw();
> gPad->Update();
> TPaveStats *statbox_stack = (TPaveStats*)
> METStack->GetHistogram()->FindObject("stats");
>
I tried what you suggested, I still see the same error. I tried compiling my macro, again the same problem. I adapted the example $ROOTSYS/tutorials/hist/hstack.C to illustrate what I am observing. I see a segfault (with the compiled macro) whenever I try to access the TPaveStats pointer.
I have attached the adapted example. I am using ROOT v5.27/02 on 2.6.33.5-112.fc13.x86_64.
Thanks in advance.
> 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
>>
>
-- Suvayu Open source is the future. It sets us free.Received on Thu Jun 10 2010 - 12:02:24 CEST
- text/x-c++src attachment: histStack.C
This archive was generated by hypermail 2.2.0 : Fri Jun 11 2010 - 05:50:01 CEST