Hi Hermine, I was unable to reproduce for problem with ROOT from the CVS repository on linux. However, I noted that you have: hLandauPart->DrawCopy(); hLandauPart->Fit("myfunc","R"); You should note that this attaches the fitted function to the original histogram and NOT to the copy created by DrawCopy. An alternative would be: TH1F* copy = (TH1F*) hLandauPart->DrawClone(); // DrawClone is more general than DrawCopy. copy->Fit("myfunc","R"); To understand better your original problem, could send a stack trace of the problem (i.e. gdb root.exe ... run ... .x tryFit.C) Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Hermine Woehri Sent: Tuesday, March 05, 2002 8:09 AM To: roottalk@cern.ch Cc: rene.brun@cern.ch Subject: [ROOT] Seg. Viol. after fitting Hello, I try to read a histogram from a ROOT-File, which I plot and further would like to fit with a self-defined function. I attached this small macro, since after successfully fitting (the fitting parameters are printed onto the console) it crashes due to a Segmentation Violation. However, I have observed, if I do the following steps, I do not have any problems: If I comment the last line, where the fit is performed: // hLandauPart->Fit("myfunc","R"); and run the program, which simply plots the histogram and then RERUN the macro, this time with the last line uncommented, then I succeed to also fit the histogram. So, what can I do in order to run the macro only once? Thank you in advance, Hermine
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:44 MET