Minuit2 too verbose

Dear all,

I have tried to mute Minuit2 messages: I perform minimization on ~1e+9 objects and in this particular case having Minuit2 throwing me output is too space consuming and I cannot proceed with work normally.

I tried using

ROOT::Minuit2::Minuit2Minimizer min (ROOT::Minuit2::kCombined);
min.SetPrintLevel(0);
gErrorIgnoreLevel = 1001;

which does not mute outputs completely. Actually a lot of it still goes by. I also tried setting print level to ‘-1’, which did not help. I have found this report: https://sft.its.cern.ch/jira/browse/ROOT-4943; the guy in charge of this bug, however, did not get the appropriate information and, naturally, just set it to “Resolved”.

So … here is the sample from the messages I am getting, and would prefer to have omitted: http://pastebin.com/FW42zuHx.

I am using ROOT 6.02/05, built for linuxx8664gcc (I am running it on the lxplus).

I would greatly appreciate any suggestions on how I can get rid of these messages without having to modify source code.

Hi,

The message you are getting is from running MINOS in TMInuit (the old version of Minut). Unfortunately this message cannot be turn it off with the print level.

If you are using Minuit2 you should be able to turn off this king of messages

Best Regards

Lorenzo

Yes, I am using Minuit2 as you can see in the code snippet. How do I turn them off?

Yes I see the code snippet but not the full code!
And the message you are getting are not from Minuit2

Lorenzo

I am running the minimizer in these functions:

void estimateClusterParameters (std::vector<int> amps, double* sigma, double* mu){
    TF1* gaussian = new TF1 ("f1", "gaus", 0, 30);
    TH1I* cluster = new TH1I ("tmp", "tmp", 30, 0, 30);
    for (size_t q = 0; q<30; q++) cluster->SetBinContent (q, amps[q]);
    gaussian->SetParameter (1, cluster->GetMean());
    gaussian->SetParameter (1, cluster->GetRMS());

    cluster->Fit ("f1", "Q0 RME");
    if (mu)    *mu    = gaussian->GetParameter(1);
    if (sigma) *sigma = gaussian->GetParameter(2);
    delete gaussian; delete cluster;
}

double clusterWidth (const double* params){
    double toReturn = -1;
    bool badCluster, partialSuccess;
    std::vector<int> amps (30, 0);
    for (size_t q=0; q<30;q++)
        amps[q]=params[q+2];

    amps = crossTalkInversion_new (amps, params[0], params[1], &badCluster, &partialSuccess);
    if (partialSuccess) return toReturn;
    estimateClusterParameters (amps, &toReturn, NULL);
    return toReturn;
}
void findLeakConstants (std::vector<int> amps, double* x1, double* x2){
    if (amps.size() < 2) return;
    ROOT::Minuit2::Minuit2Minimizer min (ROOT::Minuit2::kCombined);
    gErrorIgnoreLevel = 1001;
    min.SetPrintLevel(0);
    min.SetMaxFunctionCalls (9999);
    min.SetMaxIterations (9999);
    min.SetTolerance (0.001);

    ROOT::Math::Functor toMinimize (&clusterWidth, 32);
    min.SetFunction (toMinimize);
    min.SetLimitedVariable (0, "x1", 0.10, 0.0002, 0.05, 0.2);
    min.SetLimitedVariable (1, "x2", 0.04, 0.0002, 0.01, 0.1);
    for (size_t i = 2; i < 32; i++){
        char name[16]; sprintf (name, "Strip%lu", i-2);
        min.SetFixedVariable (i, name, i-2<amps.size()?amps[i-2]:0);
    }

    min.Minimize();
    *x1 = min.X()[0];
    *x2 = min.X()[1];
}

I see now that these messages could come from me fitting the gaussian :blush:, how do I disable those? Something like TMinuit::Command(“SET NOWarning”)?

Hi,

Yes they come from running MINOS in the Gaussian fit. Why are you using the option “E” and also “M” ?
Just do

cluster->Fit (“f1”, “Q0”);

Lorenzo

Thank you very much! That did suppress the messages. But, suppose I want to keep options “RME” (not in this particular case, but let’s say I really need the fit to be as precise as possible, to extract some calibration constants). What do I do in that case?

Cheers,
Joze

EDIT: Sorry, I checked and I see now that “M” and “E” options enable MINOS, so I see now why those messages popped up :blush:. Thanks!

Hi,

You can do before calling TH1::Fit:

ROOT::Math::MinimizerOptions::SetDefaultMinimizer(“Minuit2”)

which will use only MInuit2 so this messages will not appear

Cheers

Lorenzo