GetFitInfo returning Null Pointer

Hi,

I am doing a simple hypothesis test using the frequentistCalculator.

I am throwing toys and I am interested in the information of each toy. So I am making use of the EnabledDetailedOutput on my test statistic.

This is basically what I have done:

    FrequentistCalculator *  fc  = new FrequentistCalculator(*data, *sbModel, *bModel);
    fc->SetToys(5000,5000);


    // create the test statistics
    ProfileLikelihoodTestStat profll(*sbModel->GetPdf());
    profll.EnableDetailedOutput();

    // use one-sided profile likelihood
    profll.SetOneSidedDiscovery(true);

    // configure  ToyMCSampler and set the test statistics
    ToyMCSampler *toymcs = (ToyMCSampler*)fc->GetTestStatSampler();
    toymcs->SetTestStatistic(&profll);

    if (!sbModel->GetPdf()->canBeExtended())
        toymcs->SetNEventsPerToy(1);

    HypoTestResult * r = fc->GetHypoTest();


    RooDataSet * altData  = r->GetAltDetailedOutput();

    altData->Print();

    RooDataSet *fitInfo = r->GetFitInfo();

    if(!fitInfo)
        std::cout<<"FIT INFO returned null....."<<std::endl;
    else
        fitInfo->Print();

For some reason the RooDataSet from the r->GetFitInfo() is just a null pointer. The GetAltDetailedOutput is fine and I get results from that with no problem. Is there a particular order I should be calling this function? Any suggestions would be much appreciated!

Thanks!
Rob

To provide some more info…

After doing a bit more reading and looking through some source code I realised you have to specify the saving of fit info on the calculator as well as the test statistic.

So just after initializing the frequentistCalculator I did the following:

FrequentistCalculator *  fc  = new FrequentistCalculator(*data, *sbModel, *bModel);
fc->StoreFitInfo(true);

After fetching the fitinfo from the HypoTestResult and looping through it so print the fitted yield I see there is only 1 entry. While the dataset returned by the GetAltDetailedOutput() method returns a dataset that has the same number of entries as the number of toys.

My question I guess is then am I expecting the fitResult dataset to have just a single entry? I thought this dataset should contain the fit result for every single toy that was thrown?

Thanks!
Rob

Hi Rob,

we will come back to you soon with an answer.

Best,
Danilo

Hi Rob,

This is correct. The fit result information is the one on the observed data and not the toys, therefore it is normal that only one entry exists.
The normal detail output contains instead all the information of the toys fitting (best fitted parameter values, minNLL, fit status, etc…).

Best Regards

Lorenzo