I am new to ROOT.
I have a root file called “test1.root” in which there is a tree called “A”. Under “A” there are some leaves. I would like to use information from 2 leaves called “P” and “D” to build a 2D histogram with a log scale color bar.
You can do something like this, using for example the hsimple.root file generated when running the tutorial $ROOTSYS/tutorials/hsimple.C
auto f = TFile::Open("hsimple.root");
auto ntuple = (TTree*) f->Get("ntuple");
auto h2 = new TH2F("h2","My histogram",100,1,0,100,1,0);
ntuple->Draw("px:py >> h2");
gPad->SetLogz(true);
h2->Draw("COLZ");
auto f = TFile::Open("hsimple.root");
auto ntuple = (TTree*) f->Get("ntuple");
auto h2 = new TH2F("h2","My histogram",100,1,0,100,1,0);
ntuple->Draw("px:py >> h2", "", "goff");
h2->Draw("COLZ");
gPad->SetLogz();