Hello,
I’ve encountered a problem when trying to incorporate HybridCalculatorOriginal into my ROOT script. The script’s basic structure is a for loop that will select a region of my data set, fit a signal and background PDF to it, call HybridCalculatorOriginal to determine significance, and then move to another region of the data set to repeat the process. Specifically:
for(int i = 0; i<max; i++)
{
//Code before HCO: Set range of fit, create signal and background PDFs, fit, etc etc...
//HybridCalculatorOriginal
significance_HCO = 0;
RooExtendPdf bkg_ext_pdf("bkg_ext_pdf","",bkg,nbkg); //PDF for CLs testing
HybridCalculatorOriginal myHybridCalc(data, model, bkg_ext_pdf,0,0);
myHybridCalc.UseNuisance(false);
myHybridCalc.SetTestStatistic(1);
myHybridCalc.SetNumberOfToys(2000); //default is 1000
HybridResult* myHybridResult = myHybridCalc.GetHypoTest();
HybridPlot* myHybridPlot = myHybridResult->GetPlot("myHybridPlot","Results with H.C.O.",100); //Plot
TCanvas* canvas2 = new TCanvas("canvas2", "Second canvas", 1200, 1000);
canvas2->cd(1);
myHybridPlot->Draw();
canvas2->SaveAs(strip+TString("ecm_")+strip2+TString("A0mass_myHybridPlot.png"));
significance_HCO = myHybridResult->Significance();
cout<<"signal_events = "<<signal_events<<endl;
cout<<"significance_HCO = "<<significance_HCO<<endl;
//Code after HCO
}
The code compiles and it even runs for a few iterations, but then the program will crash with a segmentation violation. If I lower the value of the argument in SetNumberOfToys it will run for more iterations, but it will still crash. One other thing I’ve noticed: after the 0th iteration of the code, the messages from HybridCalculatorOriginal include a warning about a potential memory leak. I’ve included one of the later iterations (before a crash) below, and one of a crash following it.
Test statistics has been evaluated for data
HybridCalculatorOriginal: run 2000 toy-MC experiments
with test statistics index: 1
....... toy number 0 / 2000
....... toy number 500 / 2000
....... toy number 1000 / 2000
....... toy number 1500 / 2000
Warning in <TFile::Append>: Replacing existing TH1: SB_model (Potential memory leak).
Warning in <TFile::Append>: Replacing existing TH1: B_model (Potential memory leak).
signal_events = -5
significance_HCO = 0.239136
Test statistics has been evaluated for data
HybridCalculatorOriginal: run 2000 toy-MC experiments
with test statistics index: 1
....... toy number 0 / 2000
....... toy number 500 / 2000
....... toy number 1000 / 2000
....... toy number 1500 / 2000
*** Break *** segmentation violation
I’ve seen the same segmentation fault on two different machines, in cases where I run my code inside of the CINT, and in cases where I compile and run it from the shell. Any advice would be appreciated, and I’ll be happy to provide more information if that will help.
Thank you,
J. Rorie