TPaveStats

From: chiara zampolli <Chiara.Zampolli_at_bo.infn.it>
Date: Thu, 22 Dec 2005 10:31:24 +0000


Dear rooters,

   I am trying to retrieve the statistics box from an histogram, but with no success. I am doing that in a macro, which reads:

    cTimeCorr->cd(j+1);
    //gStyle->SetOptFit(111);
    hTimeCorr->Draw();

    cout << " ------------------------------------" << endl;
    cout << " ------------------ STATS ------------------" << endl;
    cout << " ------------------------------------" << endl;
    TPaveStats *sta =
(TPaveStats*)hTimeCorr->GetListOfFunctions()->FindObject("stats");

    cout << " sta = " << sta << endl;
    cout << " sta = " << endl;

and the output says that sta=0 (and it is astonishing also the fact that this is written only in case the "nonsense" line

    cout << " sta = " << endl;

is present (btw, the histo is drawn in a correct way). Another strange thing is that when trying to do the same in a root session, everything works:

    root [1] TH1F * h1 = new TH1F("h1","h1",10,0,10)
    root [2] for (Int_t i=1;i<=10;i++) h1->SetBinContent(i,i+3);
    root [3] h1->Fit("pol1")

    Fitting results:
    Parameters:
    NO.             VALUE           ERROR
    0       3.500000        1.474989
    1       1.000000        0.304998

    (Int_t)0
    root [4] h1->Draw()
    root [5] TPaveStats *sta =
(TPaveStats*)h1->GetListOfFunctions()->FindObject("$

    root [6] cout << " sta = " << sta << endl;      sta = 0xa1a5a08
    root [7]

Perhaps I miss something... Could you help me? Thank you in advance,
Best Regards and Merry Christmas,

         chiara Received on Thu Dec 22 2005 - 10:31:17 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:14 MET