Error from RooStats (via Rint::HandleTermInput()) on ROOT 6.26/02 on macOS 12

Hello,

I am seeing a (weird) error when running a very basic RooFit/RooStats program on my macbook (macOS 12.3.1 (21E258), Xcode 13.3.1 (13E500a), ROOT 6.26/02 installed via HomeBrew). In attachment you can find the file to reproduce the error, but in a nutshell when I try to compute a significance using the RooStats FrequentistCalculator by issuing this command:

HypoTestResult *fqResult = fc.GetHypoTest();

I get a error saying:

Error in TRint::HandleTermInput(): std::length_error caught: allocator::allocate(size_t n) ‘n’ exceeds maximum supported size

The very same macro runs fine on lxplus, with the same or a different version of ROOT.

I already tried to use a different version of ROOT on my laptop, either by compiling it from source or via Docker, the error is always there, thus I suspect something with the macOS C++ implementation? I did not try yet to install a different version of gcc and recompile ROOT with it, but it might be the next attempt unless somebody has a better idea.

Thanks!

M.

HggGausExpModelHypoTest.C (2.7 KB)
HggGausExpModel.root (19.9 KB)

Maybe @jonas or @moneta can take a look

In the meanwhile I managed to make some more tests.

Using different Docker images I found that the issue seems to be there on root 6.26 and 6.25, while the code runs fine on 6.24/02 from root:6.24.06-ubuntu20.04. At this point I cannot say anymore whether this is a specific problem with macOS or with the room version, I’ll try to check 6.26 on lxplus or compile 6.24 on my mac.

P.S. I’ll probably edit the thread title for clarity

With ROOT master on MacOs 12.3.1 I get the flowing screen output and graphics:

 % root HggGausExpModelHypoTest.C
   ------------------------------------------------------------------
  | Welcome to ROOT 6.27/01                        https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on May 05 2022, 06:07:47                      |
  | From heads/master@v6-25-02-1179-g35e27dd865                      |
  | With Apple clang version 13.1.6 (clang-1316.0.21.2.3)            |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

root [0] 
Processing HggGausExpModelHypoTest.C...
[#0] PROGRESS:Eval -- AsymptoticCalculator::Initialize....
[#0] PROGRESS:Eval -- AsymptoticCalculator::Initialize - Find  best unconditional NLL on observed data
AsymptoticCalculator::EvaluateNLL  ........ using Minuit / Migrad with strategy  1 and tolerance 1
 **********
 **    1 **SET PRINT           0
 **********
 **********
 **    2 **SET NOGRAD
 **********
 PARAMETER DEFINITIONS:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 a           -2.75240e-02  2.29596e-03   -2.00000e-01 -2.00000e-03
     2 nbkg         1.01761e+03  3.44983e+01    0.00000e+00  1.00000e+06
     3 nsig         0.00000e+00  1.59683e+01    0.00000e+00  1.00000e+06
 MINUIT WARNING IN PARAM DEF
 ============== STARTING VALUE IS AT LIMIT.
 MINUIT WARNING IN PARAMETR
 ============== VARIABLE3 IS AT ITS LOWER ALLOWED LIMIT.
 MINUIT WARNING IN PARAMETR
 ============== VARIABLE3 BROUGHT BACK INSIDE LIMITS.
 **********
 **    3 **SET ERR         0.5
 **********
 **********
 **    4 **SET PRINT           0
 **********
 **********
 **    5 **SET STR           1
 **********
 **********
 **    6 **MIGRAD        1500           1
 **********
 MINUIT WARNING IN MIGrad    
 ============== VARIABLE3 IS AT ITS LOWER ALLOWED LIMIT.
 MIGRAD MINIMIZATION HAS CONVERGED.
 MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
 FCN=-2410.84 FROM MIGRAD    STATUS=CONVERGED      54 CALLS          55 TOTAL
                     EDM=1.2235e-06    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  a           -2.75185e-02   2.29604e-03   1.16713e-03   2.97960e-02
   2  nbkg         1.01758e+03   3.44948e+01   3.48316e-05   3.74344e-01
   3  nsig         8.24297e+01   1.59669e+01   5.62369e-05   1.18818e-01
                               ERR DEF= 0.5
AsymptoticCalculator::EvaluateNLL -  value = -2410.84   fit time : Real time 0:00:00, CP time 0.060
[#0] PROGRESS:Eval -- Best fitted POI value = 82.4297 +/- 15.9669
[#0] PROGRESS:Eval -- AsymptoticCalculator: Building Asimov data Set
[#1] INFO:InputArguments -- AsymptoticCalculator: Asimov data will be generated using fitted nuisance parameter values
MakeAsimov: Setting poi nsig to a constant value = 50
MakeAsimov: doing a conditional fit for finding best nuisance values 
 **********
 **    1 **SET PRINT           0
 **********
 **********
 **    2 **SET NOGRAD
 **********
 PARAMETER DEFINITIONS:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 a           -2.75185e-02  2.29604e-03   -2.00000e-01 -2.00000e-03
     2 nbkg         1.01758e+03  3.44948e+01    0.00000e+00  1.00000e+06
 **********
 **    3 **SET ERR         0.5
 **********
 **********
 **    4 **SET PRINT           0
 **********
 **********
 **    5 **SET STR           1
 **********
 **********
 **    6 **MIGRAD        1000           1
 **********
 MIGRAD MINIMIZATION HAS CONVERGED.
 MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
 FCN=-2408.59 FROM MIGRAD    STATUS=CONVERGED      26 CALLS          27 TOTAL
                     EDM=3.13606e-08    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  a           -2.81034e-02   2.25619e-03   1.14211e-03  -4.92701e-03
   2  nbkg         1.04270e+03   3.29711e+01   3.46202e-05  -6.26573e-02
                               ERR DEF= 0.5
fit time Real time 0:00:00, CP time 0.010
RooDataSet::AsimovData[mgg,weight:binWeightAsimov] = 100 entries (1092.69 weighted)
Generated Asimov data for observables RooArgSet:: = (mgg)
[#0] PROGRESS:Eval -- AsymptoticCalculator::Initialize Find  best conditional NLL on ASIMOV data set for given alt POI ( nsig ) = 50
AsymptoticCalculator::EvaluateNLL  ........ using Minuit / Migrad with strategy  1 and tolerance 1
 **********
 **    7 **SET PRINT           0
 **********
 **********
 **    8 **SET NOGRAD
 **********
 PARAMETER DEFINITIONS:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 a           -2.81034e-02  2.25619e-03   -2.00000e-01 -2.00000e-03
     2 nbkg         1.04270e+03  3.29711e+01    0.00000e+00  1.00000e+06
 **********
 **    9 **SET ERR         0.5
 **********
 **********
 **   10 **SET PRINT           0
 **********
 **********
 **   11 **SET STR           1
 **********
 **********
 **   12 **MIGRAD        1000           1
 **********
 MIGRAD MINIMIZATION HAS CONVERGED.
 MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
 FCN=-2376.3 FROM MIGRAD    STATUS=CONVERGED      23 CALLS          24 TOTAL
                     EDM=5.64078e-10    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  a           -2.81003e-02   2.25525e-03   1.13355e-03   4.45230e-04
   2  nbkg         1.04269e+03   3.28811e+01   3.42965e-05   1.82481e-02
                               ERR DEF= 0.5
AsymptoticCalculator::EvaluateNLL -  value = -2376.3 for poi fixed at = 50      fit time : Real time 0:00:00, CP time 0.000
[#1] INFO:InputArguments -- AsymptotiCalculator: Minimum of POI is 0 corresponds to null  snapshot   - default configuration is  one-sided discovery formulae  

[#1] INFO:Eval -- AsymptoticCalculator::GetHypoTest: - perform  an hypothesis test for  POI ( nsig ) = 0
[#0] PROGRESS:Eval -- AsymptoticCalculator::GetHypoTest -  Find  best conditional NLL on OBSERVED data set ..... 
AsymptoticCalculator::EvaluateNLL  ........ using Minuit / Migrad with strategy  1 and tolerance 1
 **********
 **   13 **SET PRINT           0
 **********
 **********
 **   14 **SET NOGRAD
 **********
 PARAMETER DEFINITIONS:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 a           -2.75185e-02  2.29604e-03   -2.00000e-01 -2.00000e-03
     2 nbkg         1.01758e+03  3.44948e+01    0.00000e+00  1.00000e+06
 **********
 **   15 **SET ERR         0.5
 **********
 **********
 **   16 **SET PRINT           0
 **********
 **********
 **   17 **SET STR           1
 **********
 **********
 **   18 **MIGRAD        1000           1
 **********
 MIGRAD MINIMIZATION HAS CONVERGED.
 MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
 FCN=-2393.69 FROM MIGRAD    STATUS=CONVERGED      24 CALLS          25 TOTAL
                     EDM=8.65385e-06    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  a           -2.93212e-02   2.20037e-03   1.08722e-03   9.02411e-02
   2  nbkg         1.09999e+03   3.31659e+01   3.37938e-05  -4.42273e-01
                               ERR DEF= 0.5
AsymptoticCalculator::EvaluateNLL -  value = -2393.69 for poi fixed at = 0      fit time : Real time 0:00:00, CP time 0.000
[#0] PROGRESS:Eval --    OBSERVED DATA :  qmu   = 34.3113 condNLL = -2393.69 uncond -2410.84
[#0] PROGRESS:Eval -- AsymptoticCalculator::GetHypoTest -- Find  best conditional NLL on ASIMOV data set .... 
AsymptoticCalculator::EvaluateNLL  ........ using Minuit / Migrad with strategy  1 and tolerance 1
 **********
 **   19 **SET PRINT           0
 **********
 **********
 **   20 **SET NOGRAD
 **********
 PARAMETER DEFINITIONS:
    NO.   NAME         VALUE      STEP SIZE      LIMITS
     1 a           -2.93212e-02  2.20037e-03   -2.00000e-01 -2.00000e-03
     2 nbkg         1.09999e+03  3.31659e+01    0.00000e+00  1.00000e+06
 **********
 **   21 **SET ERR         0.5
 **********
 **********
 **   22 **SET PRINT           0
 **********
 **********
 **   23 **SET STR           1
 **********
 **********
 **   24 **MIGRAD        1000           1
 **********
 MIGRAD MINIMIZATION HAS CONVERGED.
 MIGRAD WILL VERIFY CONVERGENCE AND ERROR MATRIX.
 FCN=-2369.44 FROM MIGRAD    STATUS=CONVERGED      21 CALLS          22 TOTAL
                     EDM=1.90963e-07    STRATEGY= 1      ERROR MATRIX ACCURATE 
  EXT PARAMETER                                   STEP         FIRST   
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
   1  a           -2.91513e-02   2.20630e-03   1.08553e-03  -7.45528e-03
   2  nbkg         1.09268e+03   3.30556e+01   3.36911e-05  -3.63969e-01
                               ERR DEF= 0.5
AsymptoticCalculator::EvaluateNLL -  value = -2369.44 for poi fixed at = 0      fit time : Real time 0:00:00, CP time 0.000
[#0] PROGRESS:Eval --    ASIMOV data qmu_A = 13.7215 condNLL = -2369.44 uncond -2376.3
[#0] PROGRESS:Eval -- poi = 0 qmu = 34.3113 qmu_A = 13.7215 sigma = 0  CLsplusb = 2.34821e-09 CLb = 0.0156463 CLs = 6.66306e+06

Results HypoTestAsymptotic_result: 
 - Null p-value = 2.34821e-09
 - Significance = 5.85759
 - CL_b: 2.34821e-09
 - CL_s+b: 0.0156463
 - CL_s: 6.66306e+06

*** FrequentistCalculator ***


=== Using the following for B Model ===
Observables:             RooArgSet:: = (mgg)
Parameters of Interest:  RooArgSet:: = (nsig)
Nuisance Parameters:     RooArgSet:: = (a,nbkg)
PDF:                     RooAddPdf::model[ nsig * sig_pdf + nbkg * bkg_pdf ] = 0.0377212/1
Snapshot:                
  1) 0x7fe00100e470 RooRealVar:: nsig = 0 +/- 15.9683  L(0 - 1e+06)  "nsig"


=== Using the following for S+B Model ===
Observables:             RooArgSet:: = (mgg)
Parameters of Interest:  RooArgSet:: = (nsig)
Nuisance Parameters:     RooArgSet:: = (a,nbkg)
PDF:                     RooAddPdf::model[ nsig * sig_pdf + nbkg * bkg_pdf ] = 0.0377212/1
Snapshot:                
  1) 0x7fe00100e470 RooRealVar:: nsig = 50 +/- 15.9683  L(0 - 1e+06)  "nsig"

[#0] PROGRESS:Generation -- Test Statistic on data: 17.1557
[#1] INFO:InputArguments -- Profiling conditional MLEs for Null.
[#1] INFO:InputArguments -- Using a ToyMCSampler. Now configuring for Null.
    ----> Doing a re-scan first
[#0] PROGRESS:Generation -- generated toys: 500 / 2000
[#0] PROGRESS:Generation -- generated toys: 1000 / 2000
    ----> Doing a re-scan first
[#0] PROGRESS:Generation -- generated toys: 1500 / 2000
[#1] INFO:InputArguments -- Profiling conditional MLEs for Alt.
[#1] INFO:InputArguments -- Using a ToyMCSampler. Now configuring for Alt.

Results HypoTestCalculator_result: 
 - Null p-value = 0 +/- 0
 - Significance = inf +/- nan sigma
 - Number of Alt toys: 500
 - Number of Null toys: 2000
 - Test statistic evaluated on data: 17.1557
 - CL_b: 0 +/- 0
 - CL_s+b: 0.014 +/- 0.00525433
 - CL_s: Error: Cannot compute CLs because CLb = 0. Returning CLs = -1
-1 +/- -1
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [1] 

I see an error at the end. Is it what you are talking about ?

Thanks for checking!

No, with root 6.26/02 I never enter the toy trowing process that will ultimately generates that plot. I’m now building 6.24 to see whether it works on that version as it does on lxplus…

M.

Hello, I have a feeling this could be related:

In Centos7 container on gitlab-ci I get vector length related error as well.

I managed to compile ROOT 6.24 on my mac, and using it I can now run the above example without problems, so the issue seems indeed related to ROOT 6.26.

I can confirm I can reproduce the crash in 6,26 patches but it works fine in the ROOT master,
we will investigate which patch we need to back port to fix this issue

Lorenzo

Hi @marcodelmastro,

the crash is caused by a forward incompatibility with the updated RooSetProxy and RooListProxy classes in ROOT 6.28. The workspace you are providing must have been created with ROOT master, as it contains the new class versions.

In general, we don’t guarantee forward compatibility in RooFit, but in this case it’s easy to fix so we can do it. I opened a PR for this:

It’s merged already, to with the upcoming 6.26.04 patch release things will work again for you.

I hope that’s a good solution, in the meantime avoid to open workspaces created with ROOT master in existing ROOT releases :slight_smile:

Cheers,
Jonas

Hello @jonas, thanks for looking into this!

I’m happy with the solution, and for now I can work with 6.24, but for the record: the workspace was created with ROOT 6.26/02, and the crash was first seen by using the same version to read it back.

Ciao, M.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.