This is an old revision of the document!
Macro that opens a TBrowser
and defines some functions. It can be run using root myMacro.C
Or use this predefined function to quickly open root files in the root
's 'TBrowser'
function TBrowse { root -l "$@" ~/macros/myMacro.C; }
Run the function like TBrowse analysis.root
or to open all root files: TBrowse *.root
, even quicker: TBrowse *t
.
TBrowser a; void myMacro(){ std::cout << "Hello World!" << std::endl; } void norm(TH1* hist){ hist->Scale(1./hist->Integral()); hist->Draw(); } void range(TH1* hist, double xmin, double xmax){ hist->GetXaxis()->SetRangeUser(xmin,xmax); hist->Draw(); } double meanRange(TH1* hist, double xmin, double xmax){ hist->GetXaxis()->SetRangeUser(xmin,xmax); return hist->GetMean(1); } double integrate(TH1* hist, double xmin, double xmax){ hist->GetXaxis()->SetRangeUser(xmin,xmax); return hist->Integral(); }