I am facing an issue while working with ROOT, specifically when trying to write a large TH3S histogram to a TFile. Here’s the scenario:
- I have successfully created a TH3S histogram with a size of 1200x1200x240 bins.
- I can fill this histogram without any issues using the
Fill()
function. - However, when I attempt to add weights to the histogram based on my analysis, I encounter difficulties in writing the histogram to a TFile. The error message is:
Fatal in <TBufferFile::AutoExpand>: Request to expand to a negative size, likely due to an integer overflow: 0xa6b8fe40 for a max of 0x7ffffffe.
aborting
- What could be causing the issue when adding weights to the TH3S histogram that prevents it from being written to a TFile?
- Are there any limitations or constraints related to the use of weights with large histograms in ROOT?
A sample code snippet that reproduces the issue I am encountering in an interactive mode:
root [0] TH3S* th3ssample=new TH3S("th", "th", 1200,-15, 15, 1200, -15, 15, 240, -3, 3 )
(TH3S *) 0x7fe2faa3b000
root [1] th3ssample->Fill(1, 3, 46)
(int) -1
root [2] TFile* outputFile = TFile::Open("test.root", "RECREATE")
(TFile *) 0x7fe3028b45b0
root [3] th3ssample->Write()
(int) 3052471
root [4] th3ssample->Fill(1, 3, 46, 0.3)
(int) -1
root [5] th3ssample->Write()
*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::WriteFastArray(void*, TClass const*, int, TMemberStreamer*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] int TStreamerInfo::WriteBufferAux<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TStreamerInfoActions::GenericWriteAction(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::WriteClassBuffer(TClass const*, void*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libCore.so] TStreamerBase::WriteBuffer(TBuffer&, char*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] int TStreamerInfo::WriteBufferAux<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TStreamerInfoActions::GenericWriteAction(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::WriteClassBuffer(TClass const*, void*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libCore.so] TStreamerBase::WriteBuffer(TBuffer&, char*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] int TStreamerInfo::WriteBufferAux<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TStreamerInfoActions::GenericWriteAction(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TBufferFile::WriteClassBuffer(TClass const*, void*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TKey::TKey(TObject const*, char const*, int, TDirectory*) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TFile::CreateKey(TDirectory*, TObject const*, char const*, int) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/lib/root/libRIO.so] TDirectoryFile::WriteTObject(TObject const*, char const*, char const*, int) (no debug info)
[/usr/local/Cellar/root/6.26.06_2/l```