TFitter getting stuck

Hello Root experts,

I am trying to run a code with TFitter but the code is getting stuck. I mean that it runs for iteration and freezez. I can see on the screen some thing like this

Processing fit.C…
Integral for ttbar unscaled 5165.38
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 frac0 5.00000e-01 1.00000e-02 no limits
2 frac1 5.00000e-01 1.00000e-02 no limits


** 1 **SET LIMIT 1 0 1


PARAMETER 1 LIMITS SET TO 0 1


** 2 **SET ERRDEF 0.5



** 3 **MINIMIZE


FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4.

After IFlag=4 the coding is not moving ahead. I would also like to mention that there is a scale factor in the code which is causing this. Because when I run the code with out the scale factor there is no problem . A minimal example is attached. Please help.
fit.C (1.86 KB)

Root experts please help :frowning:

Hi,

Probably the minimization requires some time. You should maybe try with an higher print level for Minuit to see exactly what is happening.
I cannot say more, I would need the root files for running your script

Cheers

Lorenzo

Hi ,

Thank you very much for your reply. You can find the input root files at /afs/cern.ch/work/a/asircar/public/FitRootFiles.

Please let me know if you need anything else.

Anirvan

HI,

We don’t have the permission to read the files. Please change it or attach them in the forum

Regards

Lorenzo

Hi ,

I have attached the files. Please have a look at it. Thank you for the help

Anirvan
MetcontrolFit.root (5.12 KB)
DataNonQcd.root (31.8 KB)
T1_Mc_NonQCD.root (41.3 KB)
bkgBaseline.root (39.7 KB)

Hi,

Thank you for the files. I could reproduce the problem. TFractionFitter is stuck in an infinite loop. We will investigate and provide a fix soon.

Best Regards

Lorenzo

Hi,

Thanks for the reply. Let me know when it is fixed. Any idea how long will it take?

Anirvan

Hi,

I think the problem is coming from the fact that one of your input MC histogram has bins with negative content.
You cannot use such histograms with the TFractionFitter, which assumes histogram with Poisson bin content

Best Regards

Lorenzo

Hi Lorenzo,

I inspected the root files and found that the one which I scale does not have negative values. If I remove the scale factor then it perfectly works fine. Also upto a certain scale factor value for example 9 this works. But when I put 10 and onwards the code gets stuck. Any clues whats happening in this case. Thank you.

Anirvan

Hi,

You should not apply scale factors. If you need to, you should putvthem as weights using TFractionFitter:SetWeight, see root.cern.ch/root/htmldoc/TFract … :SetWeight

Lorenzo

Hi Lorenzo,

When I do the SetWeight() it really does not alter the results as compared to when no weights are applied. But when scaling factor is applied the result drastically improves.

Anirvan

HI,

I would need your updated files to look again into this. But, as I said, your input should not be scaled, but it should contain the Poisson counts you get from your MC. If you need to apply a different scaling, bin by bin, you can call SetWeight. The correct overall scaling factor is instead taking into account when fitting the MC to the data and it does not need to be applied to the histograms.

Lorenzo

Hi Lorenzo,

I used the same files that I have attached in the previous reply. I also tried using SetWeight. My scaling factor previously was 28, so I used the same value for SetWeight also. You can also give a try. If you need the updated code I can send you.

Anirvan

Hi,
Your older files were wrong, because one MC sample had negative content

Lorenzo