# Draw mean of a tree in 2D histogram

Hi Rooters,

I have a tree containing 2 branches : A and mult.
When I type ,`t->Draw("mult:A")` , it draws all values of mult for all values A. I would to draw the mean value of mult for each A. How can I make that?

Thanks

need more explanations.
Are mult and A arrays for each entry?

Rene

Yes , A is A[2] but mult is an integer. There are one value of mult for each value of A.

there are one value mult and one array A per entry
Thanks

In this case I am a bit lost with your question. You can do something like

``` root > TH1F *hmean = new TH1F("hmean","",100,0,0); root > tree.Draw("mult>>hmean","","goff"); root > tree.Draw(Form("%g:A",hmean->GetMean())); ```
Rene

Ah, no sorry it does not work. I will try to explain better.
Imagine 4 entries :

the 1st:
A = 96 , 140
mult = 6

the 2nd:
A = 95 , 141
mult = 5

the 3rd:
A=96 , 140
mult = 8

the 4th:
A = 97 , 139
mult = 1

I would like to see the mean of mult depending on each value of A, so I would like a 1-D graph on which we can see A as X axis , and mult as Y axis.

So, I would like to see these points on the graph:
( 95 , 5 )
( 96 , 7 )
( 97 , 1 )
and
( 141 , 5 )
( 140 , 7 )
( 139 , 1 )

I hope you understand. please fell free to ask more explanations.

Thanks for your help

Oh ! why don’t you say the things clearly from the beginning?
You want to see a profile histogram (see class TProfile). Just do

``` root > tree.Draw("mult:A","","prof") ```
Rene

Ok that’s it.
Sorry not to have been clear earlier.

Thanks