(no subject)

From: tcli (tcli@ic.sunysb.edu)
Date: Mon Aug 04 2003 - 19:32:45 MEST


Dear root users,
        The simplest way to read 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 by reading 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?

Also, if I have created such histograms, how can I add, subtracte or
multipy different histograms?

Thnaks a million!

Lesley



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET