Function ownership


I have a macro that calls a fitting routine many times. The routine creates a bunch of functions with new (so that I have access to the parameters after the fit). I will typically use 3-4 functions to fit a histogram, and return a pointer to the “total” function back to the macro. I do not really understand who owns the functions. Do they belong to the histogram? Do I need to make sure I delete them at the end of each call, or does ROOT take care of that?

Since it’s not always clear to me what a high-level vs low-level object is (if it’s not explicitly mentioned in Ch.8 of the User’s Guid), is there a command in the ROOT session that can show me this?



TF1 functions are automatically registered to gROOT->GetListOfFunctions().
A TF1 object can be added to several lists. When you delete an object
it is automatically removed from all possible lists known to ROOT.
Note that only one function with a given "name"can be registered
to gROOT->GetListOfFunctions().