I have a root file with a tree. I need to write a macro to access the histogram from the tree.
Opening the root file in the terminal and using the command
tree.Draw(“leafname”)
gives me the histogram.
But I need to write a macro and access the histogram.
double xmin = ???? ;// should be defined
double xmax = ???? ; // should be defined
int nbins = ???; // should be defined
TH1F *myhist = new TH1F("myhist", "myhist", nbins, xmin, xmax);
So can I obtain those values from the command line. Like when I use the command line and open the root file and draw the histogram using tree.Draw(“leafname”) command.
Okay so I have some doubts. In the first picture when I do .ls, there are two trees. current cycle and backup cycle. I don’t understand why.
And I find two different histograms with different number of entries by viewing it in TBrowser l.
But using the macro and finding the histogram it gives me 10000 entries (c1.png).