Hi Stephen, The problem is not to generate a temporary TF1 object, but to initialize the corresponding parameters. The fitting algorithm requires parameters to be initialized. Only very basic functions such as gaus, polxx, expo, landau can determine automatically the initial values. Rene Brun Stephen Bailey wrote: > > Hi Kevin. > > To use combinations of predefined functions, you have to > first create a function that is that combo, and then fit > using that function: > > TF1* f1 = new TF1("f1", "gaus(0)+expo(3)"); > f1->SetParameters(1, 2, 3, 4, 5); // or some reasonable start values > h1->Fit("f1"); // NB: h1->Fit("gaus(0)+expo(3)") won't work > > To the ROOT developers: I know this seems to be a trivial > amount of typing to achieve combo fits, but easy and quick > fitting using different combinations of functions is something > I miss from the old PAW / MinFit days. If syntax like > > h1->Fit("gaus(0)+expo(3)+(3*x-1)"); > > could be added, it would be a nice feature to have. Perhaps > if the string isn't recognized as a function name, you could > attempt to parse it and create a temporary function (similar > to how TTree::Draw() creates a temporary histogram) and fit > using that function. > > Happy fitting, > > Stephen > > On Tue, 27 Jun 2000, Kevin M. Rhodes wrote: > > > I'm trying to fit an histogram with a simple addition of two root-defined > > functions, by doing gaus+expo. Is there something special that I need to > > do to get this to work? > > > > > > Kevin Rhodes > > UW Madison > > Amanda Project > >
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET