Dear root users,
The simplest way to histogram data from a tree is TTree::Draw.
But I'd like to
create histograms and then fill them with the leaves of a tree. I tried
with the following macro:
{
// create an empty root file first
TFile f("filename.root","new");
// create a histogram and fill it from a tree
TH1F *ne = new TH1F("ne", "Num electrons",80,0,20);
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
Int_t NELE; //define the type of NELE (the name of a leave
in the tree)
ne->Fill(NELE); //fill data from a tree to a histogram
ne->Write(); //write the histogram into the empty root
file
created
}
However, the above commands give me the wrong histogram with only one
entry (supposed to be 1000 entries) when I open the histogram with
TBrowser.
So is there any suggestion?
Thnaks in advance!
tcli
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET