Adding TH3 histograms

Hi,

I’m trying to add several 3d histograms with identical binning (they are in different files). The usual Add() way of going about this doesn’t seem to work for 3d histograms. Any way around this?

Thanks,
Jahred

*** Break *** segmentation violation
Generating stack trace…
0x42029188 in from /cdf/code/cdfsoft/products/root/v4_00_08gGCC_3_4_3/Linux+2.4/bin/root.exe
0x40a9e323 in TH1::Add(TH1 const*, double) at hist/src/TH1.cxx:794 from /cdf/code/cdfsoft/products/root/v4_00_08gGCC_3_4_3/Linux+2.4/lib/libHist.so

Could you post 2 small files with TH3s?
I cannot reproduce this problem.

Rene

I can post files, but the problem seems easy to reproduce without files:

CINT/ROOT C/C++ Interpreter version 5.15.138, May 23 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
Using Erik’s settings
root [0] TH1F h1(“h1”,“h1”,100,0,100)
root [1] TH1F h1_2(“h1_2”,“h1_2”,100,0,100)
root [2] h1->Fill(3)
(Int_t)4
root [3] h1_2->Fill(34)
(Int_t)35
root [4] h1_3 = h1+h1_2
(class TH1F)149219760
root [5] TH3F h3(“h3”,“h3”,10,0,10,10,0,10,10,0,10)
root [6] TH3F h3_2(“h3_2”,“h3_2”,10,0,10,10,0,10,10,0,10)
root [7] h3->Fill(6,6,6)
(Int_t)1099
root [8] h3_2->Fill(9,9,9)
(Int_t)1570
root [9] h3_3 = h3+h3_2

*** Break *** segmentation violation
Generating stack trace…
ttopvh_v2.root (578 KB)

Just in case, here are 2 files with many 3d histograms that I want to combine.
ttopdh_v2.root (592 KB)
ttopvh_v2.root (578 KB)

I have no problems adding your files or executing your small session.
I tested it with versions 4.04 and 5.04, but I have no way to test
with the old version 4.00/08g that you seem to use.

Rene

Hmmm. It still doesn’t work for me. No matter - I took this opportunity to rewrite my code to create ntuples instead of histograms, which probably was the better way to go, anyway.

Thanks,
Jahred