How to draw histogram of 2D array by TTree::Draw()


Dear experts

How can I draw the 2D histogram of a 2D array a[m][n], where the x axis is m and y axis is a (value)?

For example if I have a[300][20] I should have a 2D histogram where x axis range is 0 ~ 299.

I know I can write a simple for loop to do this, I just want to know if TTree::Draw() can do it in just one line code.


Deleted my previous post as I had skipped the fact that you are reading a 2D array from the tree. I don’t think TTree::Draw() can do what you want (except perhaps with some wizardry :slight_smile: ). There may be a way with RDataFrame, but I’ll leave that to an expert.