3d TH3 problems

Dears rooters,

I have a problem with 3d hisogram…
Basically I’m trying to plot 3 variables stored in a TTree in a root file.

What I do is to open the root file, import the tree, and print the variables in a histogram:

imported_tree= input_file.Get("p_incident_TOT")		
histo_tot= ROOT.TH2D("histo_tot","histo_tot",2000,0, 2000, 2000, -4910, 4775)		

This TH2 with 2 variables it works well, but if I try to do the same using 3 variables and so to use a TH3 It doesn’t works and I get error: Break segmentation…

If I don’t assigne the tree draw to the histogram, in this way:


this it work, i can save the canvas, but then i can not modify the hisogram…

Someone have any idea where am I wrong?

THanks a lot in advance!! :slight_smile:

Please post the actual script and error message. The information above is not enough to tell what could be the problem. Thanks.

It seems ok for me:

$ root
  | Welcome to ROOT 6.13/03                       http://root.cern.ch |
  |                                      (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                                |
  | From heads/master@v6-13-02-474-g5fe7001274, Apr 13 2018, 16:35:35 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'        |

root [0] auto h3 = new TH3F("h3","h3",10,0.,1.,10,0.,1.,10,0.,1.);
root [1] ntuple->Draw("px:py:pz>>h3");
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [2] 

ntuple is the ntuple created by $ROOTSYS/tutorials/hsimple.C

I tried with python and c++, the first solution doesn’t works, the second yes

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