Project TH3 into TH2-COLZ-like plot


Root version: 5.10.00e

I have a tree with 3 variables A, B and C. So, I can do:


This gives me a TH3 histogram. In my case every combination of A and B gives exactly one value for C. What I really want to plot is a 2D histogram where the third variable © is given as a color. It should look like something similar to:

tree->Draw(“A:B”,"",“COLZ”, n, 0);

However, I don’t want the number of entries in A:B plotted as color (in my case it’s always one), but the value of C.

How can I do it? Is there also a possibility in doing that from the TreeViewer? I tried to play around with Project3D, but it didn’t seem to do anything (which means most likely that I don’t know what it should do).



tree->Draw("A:B","C","COLZ", n, 0);

Dear Rene

Thanks for the hint. However, this option gives me the number of entries in “C”. What I would like to plot is the value in “C”. In the meantime I found out that


is doing exactly what I want.


Hi Rene et al,

With the syntax you mention:
tree->Draw(“A:B”,“C”,“COLZ”, n, 0);

Is it possible to also cut on A or B? (Say “A<5&&B>10”)

Is it possible to control the granularity of the colz plot which is produced?


tree->Draw(“A:B”,"(A<5&&B>10)*C",“COLZ”, n, 0);
should do it.

Yes, book the 2D histo H2 with the binning you want before the draw command
and do:

tree->Draw(“A:B>H2”,"(A<5&&B>10)*C",“COLZ”, n, 0);

All this is explained the the TTree:Draw help.

Thanks couet! This solved my problem.