Skip to content

[RF] Crash doing HistFactory Workspace combination #21066

@TomasDado

Description

@TomasDado

Check duplicate issues.

  • Checked for duplicates

Description

We see a very weird crash related to combining workspaces that indiviallu are both valid and give sensible results. The crash seems to be related to some histograms missing/being nullpointers, see the stack trace:

[#2] PROGRESS:HistFactory -- 
-----------------------------------------
    Entering combination
-----------------------------------------


 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  __internal_syscall_cancel (a1=63588, a2=140730114203688, a3=0, a4=0, a5=0, a6=0, nr=61) at ./nptl/cancellation.c:40
#1  __syscall_cancel (a1=63588, a2=a2
entry=140730114203688, a3=a3
entry=0, a4=a4
entry=0, a5=a5
entry=0, a6=a6
entry=0, nr=61) at ./nptl/cancellation.c:75
#2  0x00007c07e671c98f in __GI___wait4 (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffe48776028, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#3  0x00007c07e671c9db in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffe48776028, options=options
entry=0) at ./posix/waitpid.c:38
#4  0x00007c07e665c32d in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#5  0x00007c07e8126ce7 in TUnixSystem::Exec (this=0x5a2d403032f0, shellcmd=<optimized out>) at /home/tomas/ROOT_DEBUG/root_src/core/unix/src/TUnixSystem.cxx:2157
#6  TUnixSystem::StackTrace (this=0x5a2d403032f0) at /home/tomas/ROOT_DEBUG/root_src/core/unix/src/TUnixSystem.cxx:2448
#7  0x00007c07e8126668 in TUnixSystem::DispatchSignals (this=0x5a2d403032f0, sig=kSigSegmentationViolation) at /home/tomas/ROOT_DEBUG/root_src/core/unix/src/TUnixSystem.cxx:3668
#8  <signal handler called>
#9  0x00007c07e71bba94 in RooDataSet::loadValuesFromSlices (this=this
entry=0x7ffe4878b190, indexCat=..., slices=std::map with 8 elements = {...}, rangeName=rangeName
entry=0x0, cutVar=cutVar
entry=0x0, cutSpec=cutSpec
entry=0x0) at /home/tomas/ROOT_DEBUG/root_src/roofit/roofitcore/src/RooDataSet.cxx:1669
#10 0x00007c07e71ba718 in RooDataSet::RooDataSet (this=this
entry=0x7ffe4878b190, name=..., title=..., vars=..., arg1=..., arg2=..., arg3=..., arg4=..., arg5=..., arg6=..., arg7=..., arg8=...) at /home/tomas/ROOT_DEBUG/root_src/roofit/roofitcore/src/RooDataSet.cxx:463
#11 0x00007c07e596679c in RooStats::HistFactory::HistoToWorkspaceFactoryFast::MakeCombinedModel (this=this
entry=0x7ffe4878b680, ch_names=std::vector of length 8, capacity 8 = {...}, chs=std::vector of length 8, capacity 8 = {...}) at /home/tomas/ROOT_DEBUG/root_src/roofit/histfactory/src/HistoToWorkspaceFactoryFast.cxx:1556
#12 0x00007c07e5968b8e in RooStats::HistFactory::HistoToWorkspaceFactoryFast::MakeCombinedModel (measurement=..., config=...) at /home/tomas/ROOT_DEBUG/root_src/roofit/histfactory/src/HistoToWorkspaceFactoryFast.cxx:295
#13 0x00007c07e596903a in RooStats::HistFactory::HistoToWorkspaceFactoryFast::MakeCombinedModel (measurement=...) at /home/tomas/ROOT_DEBUG/root_src/roofit/histfactory/src/HistoToWorkspaceFactoryFast.cxx:253
#14 0x00007c07e86609fe in MultiFit::CombineWS (this=this
entry=0x5a2d41fe0470) at /home/tomas/TRExFitter/Root/MultiFit.cc:308
#15 0x00007c07e8661505 in MultiFit::SaveCombinedWS (this=this
entry=0x5a2d41fe0470) at /home/tomas/TRExFitter/Root/MultiFit.cc:340
#16 0x00005a2d0f43aa50 in FitExample (opt="mw", configFile="combined_Asimov.config", options="") at /home/tomas/TRExFitter/util/trex-fitter.cc:137
#17 0x00005a2d0f436d90 in main (argc=3, argv=0x7ffe4878c698) at /home/tomas/TRExFitter/util/trex-fitter.cc:703

Reproducer

void mwe() {
  TFile* rootFile1 = TFile::Open("asimov_scaled_2.946_combined_asimov_scaled_2.946_model.root","read");
  std::unique_ptr<RooStats::HistFactory::Measurement> meas(dynamic_cast<RooStats::HistFactory::Measurement*>(rootFile1-> Get("asimov_scaled_2.946")));

  TFile* rootFile2 = TFile::Open("multiclass1RCbinary0RC_PCBTforWZ_final_SysScaledLumi100tWZ_combined_multiclass1RCbinary0RC_PCBTforWZ_final_SysScaledLumi100tWZ_model.root","read");
  std::unique_ptr<RooStats::HistFactory::Measurement> meas2(dynamic_cast<RooStats::HistFactory::Measurement*>(rootFile2-> Get("multiclass1RCbinary0RC_PCBTforWZ_final_SysScaledLumi100tWZ")));

  auto channels = meas2->GetChannels();
  for (auto& channel : channels) {
      if (!meas->HasChannel(channel.GetName())) meas->AddChannel(channel);
  }
  RooStats::HistFactory::HistoToWorkspaceFactoryFast factory(*meas);
  std::unique_ptr<RooWorkspace> ws(factory.MakeCombinedModel(*meas));
}

Note the input workspaces are considered confidential, but they have been shared with @guitargeek.

ROOT version

ROOT Version: 6.39.01
Built for linuxx8664gcc on Jan 29 2026, 07:58:17
From heads/master@v6-39-01-856-gee341853130

Installation method

Built from source

Operating system

Ubuntu 25.10

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions