Re: TF1 saving

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 2 Feb 2010 18:02:50 +0100


Hi Jakub,

When you use the case "gaus", this is a special hardwired case for TF1 and fitting. Fitting is fast.
When you use a general expression with a string, the fitting ignores that this is in fact a gaussian formula and it goes to a more general case as in teh case of a C function.

In all cases, the TF1 object is stored at fNpx points, in your case 1000 points for case 2 and case 3.
For case 1 only 100 points (default value for fNpx) are stored, so your file temp1 is much smaller.
The solution is to decrease fNpx to a smaller value.

Currently there is no way to disable the storage of the fNpx points for the simple case "gaus". Simply reduce fNpx.

Rene Brun

Jakub Čermák wrote:
> Hi Rene,
> Thanks for your reply. I made very simple example illustrating my problem at http://regulus.utef.cvut.cz/~jcermak/my/example.c .
> It shows all 3 approaches I tried (predefined gaus, custom formula and custom C function) and writes them into files. I couldn't #include <time.h> (CInt said it can't find it), so there is no measurement, but it can be clearly seen that test2 is much slower then previous.
> Can you now see what I mean?
>
> And minor issue - why does the ROOT CInt crash after executing this script? This structure works at compiled code without problem.
>
> Best regards
>
> Jakub Čermák
> Institute of Experimental and Applied Physics
>
>
>> -----Original Message-----
>> From: Rene Brun [mailto:Rene.Brun_at_cern.ch]
>> Sent: Sunday, January 31, 2010 11:08 AM
>> To: Jakub Čermák
>> Cc: roottalk_at_cern.ch
>> Subject: Re: [ROOT] TF1 saving
>>
>> Could you send the shortest possible RUNNING script with a data file
>> containing your histogram and reproducing
>> the time and space problem?
>>
>> Rene Brun
>>
>> Jakub Čermák wrote:
>>
>>> Hi Rooters,
>>> I’ve lots of histograms with fitted functions, so started to care
>>>
>> about size of fitted functions (in the TFile) and speed of fitting.
>>
>>> When I use predefined function to fit, like gaus, the fitting is
>>>
>> quick and resulting TFile is relatively small. But I need to fit with
>> more complex function, so I tried standard C function. The fitting was
>> still quick, but the resulting TFile is now much bigger. Is it because
>> it doesn’t store the formula with params but directly the values of the
>> function, right? So it’s not a good solution for me.
>>
>>> So I rewrote the C function to string formula and I expected that it
>>>
>> would store just the formula and params, not „sampled“ function values.
>> But I was wrong, the file was as big as when I used C function. And the
>> fitting process was considerably slower than previous approaches.
>>
>>> So that’s my question – what’s the best solution to store histograms
>>>
>> fitted with custom function and keep the result file small and fitting
>> process quick?
>>
>>> It's quite big issue for me, because there are few hundred of
>>>
>> thousands fitted histograms.
>>
>>> The fitting function is [0]*TMath::Gaus(max(min([3], [1]), x), [1],
>>>
>> [2])
>>
>>> Thanks in advance for good ideas :)
>>>
>>> Best regards
>>>
>>> Jakub Čermák
>>>
>>>
>>>
>>>
>>>
>
>
>
Received on Tue Feb 02 2010 - 18:02:57 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 02 2010 - 23:50:02 CET