After your statement m_hist->Fit(FunName,"L"); add canvas->Modified(); canvas->Update(); where canvas is the pointer to your current canvas. The "stats" box is only produced when painting the histogram. Rene run On Sat, 17 Apr 2004, Datao Gong wrote: > Hi,Rooters, > I want to fit histogram with likelihood mode. So i need to access the > likelihood value and put it in the status box. > So write this piece of code in my scripts: > ... > m_hist->Fit(FunName,"L"); //fit with likelihood mode > TVirtualFitter *fitter = TVirtualFitter::Fitter(m_hist); > Double_t amin,edm,errdef; > Int_t nvpar,nparx; > fitter->GetStats(amin,edm,errdef,nvpar,nparx); //get 2*(log likelihood) > > // get status box > TPaveStats *st = > (TPaveStats*)m_hist->GetListOfFunctions()->FindObject("stats"); > > Char_t strll[100]; > sprintf(strll,"-2LogLL:%f",amin); > TLine *l = st->AddLine(0,0,0,0); > l->SetLineWidth(1); > st->AddText(strll); //add text to status box. > ... > > But i found the pointer st is null pointer. Why? How could i fix the > problem? > > Thanks > > Gong Datao > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET