TWiki> CMS Web>NewPhysics>SusySearch>HUSUSYRoot (revision 2)EditAttach

How to use Root:


http://root.cern.ch/

"How to" page:
http://root.cern.ch/drupal/content/howtos
User's guide:
http://root.cern.ch/drupal/content/users-guide
Reference guide:
http://root.cern.ch/drupal/content/reference-guide

Run it:

root -l

Open a file:

TFile *_file0 = TFile::Open("..... .root")

File browser:
TBrowser < name >
List the directories:

.ls
< directory name >.cd()

Print the tree:

< ntuplename >.Print()

Scan the tree:

< ntuplename >.Scan("< name of a Branch >.< name of a leaf >")

Make a new histogram:

TH1F * = new TH1F ("name","",#ofXaxis,#ofYaxis,#ofBins);

Make a new canvas:

TCanvas *c1=new TCanvas ("name","",1);

Draw a histogram:

name of the tree in the file.Draw("name of a Branch.name of a leaf")

2D histogram:
name of the tree in the file.Draw("name of a Branch1.name of a leaf1:name of a Branch2.name of a leaf2")

histogram with cut criteria:
_name of the tree in the file.Draw("name of a Branch1.name of a leaf1,name of a Branch2.name of a leaf2 cut criteria")_

draw two histogram in one canvas:
< name of the tree in the file>.Draw(".")

.Draw(". ","","SAME")
e.g.:
tree.Draw("pelectron_1.tight: pelectron_1.loose ","pelectron_1.tight>-1")

Open an AOD file in root:

gSystem->Load("libFWCoreFWLite");
AutoLibraryLoader::enable();
TFile *_file0 = TFile::Open("rfio:/castor/cern.ch/user/........ .root")
TBrowser b

TChain:

Chain.C:
#include

void Chain(){
TChain tree("stopAnaMod/tree");
tree.AddFile("stopAnaNtuple_noselection_Chowder_00.root");
tree.Draw("event");
}

Save a histogram to .eps:

TCanvas *=new TCanvas ("","",1);

.Draw(".")

c1->SaveAs(".eps");

Usage of MakeClass :

-- AnitaKapusi - 29 Jun 2009

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2009-06-29 - AnitaKapusi
 
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback