Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
291 f9daq 1
//#include "DrootHelper.cpp"
2
 
3
#include "TROOT.h"
4
#include "TStyle.h"
5
#include "TDirectory.h"
6
#include "TH1F.h"
7
#include "TH2F.h"
8
 
9
double fontsiz = 0.04;
10
 
11
int legmark[] = {kFullTriangleDown,kFullTriangleUp,kFullSquare,kFullTriangleDown,kFullTriangleUp,kFullSquare,kFullCircle,kOpenCircle,kPlus};
12
int legcol[] = {kBlack,kGray+1,kGray+2,kBlack,kGray+1,kGray+2,kBlack,40,6};
13
int legsty[] = {1,7,2,1,7,2,9,5,6};
14
 
15
void DrSetDrawStyle(double fntsz = 0.04) {
16
        // set draw style
17
        gStyle->SetOptStat("ne");
18
        gStyle->SetPalette(1, 0);
19
 
20
        gStyle->SetPaperSize(TStyle::kA4);
21
        gStyle->SetStatBorderSize(1);
22
        gStyle->SetFrameBorderMode(0);
23
        gStyle->SetFrameFillColor(0);
24
        gStyle->SetTitleFillColor(0);
25
        gStyle->SetCanvasBorderMode(0);
26
        gStyle->SetPadBorderMode(0);
27
        gStyle->SetPadColor(0);
28
        gStyle->SetCanvasColor(0);
29
        gStyle->SetStatColor(0);
30
        gStyle->SetOptFit(11);
31
        gStyle->SetPadRightMargin(0.1);
32
        gStyle->SetPadLeftMargin(0.08);
33
        gStyle->SetPadRightMargin(0.1);
34
        gStyle->SetPadLeftMargin(0.12);
35
 
36
        gStyle->SetPadTopMargin(0.11);
37
        gStyle->SetPadBottomMargin(0.16);
38
        gStyle->SetTitleOffset(1.2, "x");
39
        gStyle->SetLabelOffset(0.02, "x");
40
        //~ gStyle->SetPadLeftMargin(0.12);
41
        gStyle->SetPadLeftMargin(0.10);
42
        gStyle->SetTitleOffset(0.9, "y");
43
        gStyle->SetPadRightMargin(0.10);
44
 
45
        gStyle->SetTitleFontSize(0.07);
46
        gStyle->SetTitleBorderSize(0);
47
        gStyle->SetTitleX(0.4);
48
 
49
        fontsiz = fntsz;
50
        gStyle->SetStatFontSize(fontsiz+0.015);
51
        //hp1d->SetLabelSize(fontsiz, "xy");
52
        //hp1d->SetTitleSize(fontsiz, "xy");
53
}
54
 
55
TH1F *DrTH1F(TDirectory *drdir, char *drhname, char *drhtitle="")
56
{
57
        TH1F *drhp1d = NULL;
58
 
59
        drhp1d = (TH1F *)drdir->Get(drhname);
60
        drhp1d->SetTitle(drhtitle);
61
        drhp1d->SetLabelSize(fontsiz*0.8, "xy");
62
        drhp1d->SetTitleSize(fontsiz, "xy");
63
 
64
        return drhp1d;
65
}
66
 
67
TH2F *DrTH2F(TDirectory *drdir, char *drhname, char *drhtitle="")
68
{
69
        TH2F *drhp2d = NULL;
70
 
71
        drhp2d = (TH2F *)drdir->Get(drhname);
72
        drhp2d->SetTitle(drhtitle);
73
        drhp2d->SetLabelSize(fontsiz*0.8, "xyz");
74
        drhp2d->SetTitleSize(fontsiz, "xyz");
75
 
76
        return drhp2d;
77
}
78
 
79
void DrNull(double x0, double y0, double x1, double y1, char *drhtitle="", int ndiv=-1, double fontfrac=1.0)
80
{
81
        TH1F *drhp1d = new TH1F("",drhtitle,100, x0, x1);
82
 
83
        drhp1d->GetXaxis()->SetRangeUser(x0, x1);
84
        drhp1d->GetYaxis()->SetRangeUser(y0, y1);
85
        drhp1d->SetLabelSize(fontsiz*fontfrac*0.9, "xyz");
86
        drhp1d->SetTitleSize(fontsiz*fontfrac, "xyz");
87
        if(ndiv>0) (drhp1d->GetYaxis())->SetNdivisions(ndiv);
88
        drhp1d->DrawClone();
89
 
90
        delete drhp1d;
91
}
92