Rajat, You forgot to draw the function. See the NEW LINE in your code below The TF1 internal histogram is only created when the function is drawn. You can do directly: TF1* identity = new TF1("identity", "1", 0., 10.); identity->Draw(); Rene Brun On Fri, 5 Jul 2002, Rajat Bhatnagar wrote: > Hi, > > I'm trying to use the TH1::GetHistogram() method to get a histogram fitted > to a certain formula. Using the simplest case I could think of, I tried > > root [0] TF1* identity = new TF1("identity", "1", 0., 10.); > root [1] TCanvas c_new; identity->Draw(); //<==============NEW LINE > root [2] TH1F* idH = (TH1F*) identity->GetHistogram(); > root [3] idH->Draw(); > Error: illegal pointer to class object idH 0x0 136 > FILE:/tmp/fileAGKUbL_cint LINE:1 > *** Interpreter error recovered *** > > but got the error above. Any suggestions on what to do? > > Also, I noticed that if a TCanvas does not already exist, there is a > segmentation violation. Does anyone have thoughts on how to work around > this? > > Thanks, > Raj Bhatnagar > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET