Drawing TH3 Objects

Hi,

I’m looking for an overview of the options for Draw-ing 3-dimensional histograms (TH3 class objects). So far I know of the following possibilities :

  • b[/b] : draws a 3d scatter plot
  • “box” : draws a box for each bin in the 3d histogram, with the box volume proportional to the bin content
  • “iso” : makes some sort of weighted average of the bin content for the complete histogram and draws a Gouraud shaded surface at bins containing this average content

Are there any other options available ?

What I would like to do, is the following. I have a 3D matrix containing the results of a Monte Carlo simulation which calculates the particle production in a 3D volume which is divided in a number of cells/bins. As a first step I would like to show the volume for which the bin content is above a certain threshhold. For this purpose, the “iso” option basically gets the job done. It does, however, clearly show the boundaries of the individual bins, so it would be nice if I could customize this option in some way to make the surface ‘smoother’. Any suggestions ?

What would be just perfect for the next step, is if there were something like a 3D contour plot, with a separate surface for different bin contents, either selectable (basically the same thing as changing the threshhold in the case mentioned earlier) of with differently coloured 3D “wire surfaces”, comparable with what you get when you draw a TF3 object. Is anything like this available or anything that comes close ? Or does anyone have any other suggestions ?

Thanks !

Yes these 3 options are the only ones available.

The iso can not be tuned by the ROOT user. May be a small example showing what you get would help to understand how this option should be impoved ?

I guess, for the future, a real 3D visualisation using OpenGL would surely be the best way to go.

Ok, thank you.

The following example should give you a pretty good idea about what I mean :

{
  TH3C * volume = new TH3C("Volume","Neutron production volume",
			   100,-50,50,100,-50,50,100,-50,50);
  TCanvas * canvas = new TCanvas("Canvas","Neutron production volume",600,600);
  float x,y,z;
  
  for(x=-50;x<50;x+=1)
    for(y=-50;y<50;y+=1)
      for(z=-50;z<50;z+=1)
	if((x*x+y*y+.3*z*z)<500)
	  volume->Fill(x,y,z,1);

  canvas->Draw();
  volume->Draw("iso"); 
}

The resulting surface shows some structures and ‘ripples’ corresponding to the boundaries of the individual bins. It would be great if there was some way to make the surface somewhat ‘smoother’.

In the ‘perfect world’ there would be some option for drawing 3D histograms, which draws 3D contours corresponding to cells with the same bin content, something like what one gets with

TF3 fun("surface","x*x+y*y+.3*z*z-CONST",-50,50,-50,50,-50,50)

where one would get f.i. 10 nested wireframe surfaces corresponding to different values of CONST in the above TF3 and with different colors for each value of CONST.

There is no way to make it smoother. The algorithm works that way. What you get with TF3 is working with analytical functions (or C++ function) not with histos.

[quote]Yes these 3 options are the only ones available.

The iso can not be tuned by the ROOT user. May a small example showing what you get would help to understand how this option should be impoved ?

I guess, for the future, a real 3D visualisation using OpenGL would surely be the best way to go.[/quote]

I know this is an old thread, but I found it while searching for a current problem I am haivng. I was trying to do a 3D scatter plot, but with some sort of color shading indicating the approximate density of the cloud. I finally managed to TRICK ROOT into doing this by using the 4D TTree->Draw() method that Mr. Brun suggested in this post:

http://root.cern.ch/phpBB2/viewtopic.php?t=1113&highlight=th3&sid=caaa42cce4374634598c334e2db2e48f

The result is a cloud with a rainbow-color scheme indicating the density of the points. Not perfect, but not bad either. It is, however, a memory hog of a method, and a more elegant approach would be appreciated if such exists.

Here is a result:


example.C (4.47 KB)

And your reply is still appreciated. Thanks !