tree - Creating a histogram from a TTree -
I am trying to create a 1D histogram with a TTree that has only one variable.
TTRE * tree = new TTI ("tree", ""); Tree-> ReadFile ("occupancy dataset.", "Size"); TH1F * Occupation = New TH1F ("occupancy", "surcharge per dataset", 100, 0, 0.063) You can see above that I created the tree and filled it with data The given .txt file I then created the histogram with the number of cans, x_low , and x_high required. When I try to
occupancy-> Fill (tree); or
occupation-> Fill (size); I get an error, any suggestions?
The fill method of TH1 (TH1F is the daughter class) Does not take in form.
You have two options:
-
Fill them one by one in loops and histograms on tree entries
For example < By adding code> tree-> Columns ("MYTREE") and then
by addingP>>MYTREE.Ctoloop ()functionoccupation-> Fill (VARIABLENAME);Execute the resulting code in the loop.
-
Use this:
tree-> gt; ; Draw ("variableName>> HISTOGRAMNAME");
Comments
Post a Comment