Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

//#include "DrootHelper.cpp"

#include "TROOT.h"
#include "TStyle.h"
#include "TDirectory.h"
#include "TH1F.h"
#include "TH2F.h"

double fontsiz = 0.04;

int legmark[] = {kFullTriangleDown,kFullTriangleUp,kFullSquare,kFullTriangleDown,kFullTriangleUp,kFullSquare,kFullCircle,kOpenCircle,kPlus};
int legcol[] = {kBlack,kGray+1,kGray+2,kBlack,kGray+1,kGray+2,kBlack,40,6};
int legsty[] = {1,7,2,1,7,2,9,5,6};

void DrSetDrawStyle(double fntsz = 0.04) {
        // set draw style
        gStyle->SetOptStat("ne");
        gStyle->SetPalette(1, 0);
       
        gStyle->SetPaperSize(TStyle::kA4);
        gStyle->SetStatBorderSize(1);
        gStyle->SetFrameBorderMode(0);
        gStyle->SetFrameFillColor(0);
        gStyle->SetTitleFillColor(0);
        gStyle->SetCanvasBorderMode(0);
        gStyle->SetPadBorderMode(0);
        gStyle->SetPadColor(0);
        gStyle->SetCanvasColor(0);
        gStyle->SetStatColor(0);
        gStyle->SetOptFit(11);
        gStyle->SetPadRightMargin(0.1);
        gStyle->SetPadLeftMargin(0.08);
        gStyle->SetPadRightMargin(0.1);
        gStyle->SetPadLeftMargin(0.12);
       
        gStyle->SetPadTopMargin(0.11);
        gStyle->SetPadBottomMargin(0.16);
        gStyle->SetTitleOffset(1.2, "x");
        gStyle->SetLabelOffset(0.02, "x");
        //~ gStyle->SetPadLeftMargin(0.12);
        gStyle->SetPadLeftMargin(0.10);
        gStyle->SetTitleOffset(0.9, "y");
        gStyle->SetPadRightMargin(0.10);
       
        gStyle->SetTitleFontSize(0.07);
        gStyle->SetTitleBorderSize(0);
        gStyle->SetTitleX(0.4);
       
        fontsiz = fntsz;
        gStyle->SetStatFontSize(fontsiz+0.015);
        //hp1d->SetLabelSize(fontsiz, "xy");
        //hp1d->SetTitleSize(fontsiz, "xy");
}

TH1F *DrTH1F(TDirectory *drdir, char *drhname, char *drhtitle="")
{
        TH1F *drhp1d = NULL;
       
        drhp1d = (TH1F *)drdir->Get(drhname);
        drhp1d->SetTitle(drhtitle);
        drhp1d->SetLabelSize(fontsiz*0.8, "xy");
        drhp1d->SetTitleSize(fontsiz, "xy");
       
        return drhp1d;
}

TH2F *DrTH2F(TDirectory *drdir, char *drhname, char *drhtitle="")
{
        TH2F *drhp2d = NULL;
       
        drhp2d = (TH2F *)drdir->Get(drhname);
        drhp2d->SetTitle(drhtitle);
        drhp2d->SetLabelSize(fontsiz*0.8, "xyz");
        drhp2d->SetTitleSize(fontsiz, "xyz");
       
        return drhp2d;
}

void DrNull(double x0, double y0, double x1, double y1, char *drhtitle="", int ndiv=-1, double fontfrac=1.0)
{
        TH1F *drhp1d = new TH1F("",drhtitle,100, x0, x1);
       
        drhp1d->GetXaxis()->SetRangeUser(x0, x1);
        drhp1d->GetYaxis()->SetRangeUser(y0, y1);
        drhp1d->SetLabelSize(fontsiz*fontfrac*0.9, "xyz");
        drhp1d->SetTitleSize(fontsiz*fontfrac, "xyz");
        if(ndiv>0) (drhp1d->GetYaxis())->SetNdivisions(ndiv);
        drhp1d->DrawClone();
       
        delete drhp1d;
}