I would like to see if there is a correlation between two variables (which are stored in a TTree tree).
The first thing to come to mind is to draw them both on a 2D scatter plot (tree->Draw("var1:var2")),
but it is not very intuitive to see any correlations that way.
Is there a more natural way to check between variables correlations?
The brute force way is to simply draw var1 with var2 cuts, for example
tree->Draw("var1" , "0.2 < var2 < 0.4")
and
tree->Draw("var1" , "0.4 < var2 < 0.6")
and so on
And if that really is the best way to check correlations, is there any built in function or a library to do so? or at least something that would make it easier?
the final goal is to plot all of the var1 plots (with different ranges for var2), on the same graph (normalized).
Alternatively, check out a log-scale scatter plot, and profile histograms, which you can create by supplying the “prof” option to TTree::Draw (otherwise, it’s just like making a scatter plot). I find these sometimes help in quickly spotting correlations.
Thank you pcanal, but I managed to solve the problem by avoiding histogram and changing the tree->Draw directly.
For anyone who could use it, here’s what I did