[ROOT] to Lesley

From: Michael Wiesmann (wiesmann@e18.physik.tu-muenchen.de)
Date: Tue Aug 05 2003 - 10:22:18 MEST


Dear Lesly!

As you have some many questions in one go, it might be interessting
for your to have a look at the (really good) manual, which can be
found on http://root.cern.ch/root/RootDoc.html.

Additionally there are some tutorials installed on your system: just
copy $ROOTSYS/tutorials some where to your homedirectory and start
root. It will print some help message.

BTW, please write a subject to your mail next time, have a look at
http://root.cern.ch/root/roottalk/RoottalkRules.html for more infos.


> {
 > // 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)

You have to loop the tree somewhere here:

for (int i=0; i<fChain.GetEntries();i++){

  fChain->GetEntry(i);



>     ne->Fill(NELE);    //fill data from a tree to a histogram


}


>     ne->Write();       //write the histogram into the empty root
 > file
 > created
 > 
 > }





Greets
Michael






> 
 > 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