Underneath is a macro that opens a TBrowser and defines some useful functions. It can be run using root myMacro.C or with a predefined function

function TBrowse { root -l "$@" ~/macros/myMacro.C; }

Run the function in the command line with TBrowse analysis.root. To open all root files in the current directory: TBrowse *.root, even quicker: TBrowse *t.

myMacro.C
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();
}