Subversion Repositories f9daq

Rev

Rev 38 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
29 f9daq 1
//##########################################################################################
40 f9daq 2
#include "TGaxis.h"
3
 
29 f9daq 4
void RTSetStyle(TStyle *style)
5
{
6
        style->SetStatBorderSize(1);
7
        style->SetFrameBorderMode(0);
8
        style->SetCanvasBorderMode(0);
9
        style->SetPadBorderMode(0);
10
        style->SetPadColor(0);
11
        style->SetCanvasColor(0);
12
        style->SetHistFillColor(18);
13
        style->SetStatColor(0);
14
        style->SetPalette(1, 0);
15
 
38 f9daq 16
        style->SetMarkerStyle(kFullDotLarge);
17
        //style->SetMarkerSize(7);
29 f9daq 18
 
40 f9daq 19
        style->SetOptStat("e");
20
        style->SetOptFit(1);
38 f9daq 21
 
40 f9daq 22
        style->SetPadTopMargin(0.12);
23
        style->SetPadBottomMargin(0.12);
24
        style->SetPadLeftMargin(0.12);
25
        style->SetPadRightMargin(0.12);
38 f9daq 26
 
29 f9daq 27
        style->SetTitleOffset(1.3, "y");
40 f9daq 28
        style->SetPalette(1, 0);
38 f9daq 29
 
40 f9daq 30
        style->SetPaperSize(TStyle::kA4);
31
 
32
        TGaxis::SetMaxDigits(4);
29 f9daq 33
}
34
//##########################################################################################
35
RTCanvas::RTCanvas()
36
{
37
        RTCanvas((char*)"can", (char*)" ", 0, 0, 640, 480);
38
}
39
//------------------------------------------------------------------------------------------
40
RTCanvas::RTCanvas(char *w_title, char *c_title, int x_min, int y_min, int x_size, int y_size)
41
{
42
        can = (TCanvas*)gROOT->FindObject(w_title);
43
        if(!can) can = new TCanvas(w_title, w_title, x_min, y_min, x_size, y_size);
44
        else can->cd(0);
45
 
46
        title = new TPaveLabel(0.01,0.96,0.81,0.99, c_title, "NDC");
47
        title->Draw();
48
 
49
        TDatime now;
50
        date = new TPaveLabel(0.83,0.96,0.99,0.99, now.AsString(), "NDC");
51
        date->Draw();
52
 
53
        pad = new TPad("Graphs","Graphs",0.005,0.005,0.996,0.95);
54
        pad->Draw();
55
        pad->cd(0);      
56
}
57
//------------------------------------------------------------------------------------------
58
void RTCanvas::Divide(int nx, int ny)
59
{
60
        pad->Divide(nx, ny, 0.003, 0.005);
61
}
62
//------------------------------------------------------------------------------------------
63
void RTCanvas::Divide(int np)
64
{
65
        if( np==2 )              pad->Divide(1, 2, 0.003, 0.005);
66
        else if( 2<np && np<=4 ) pad->Divide(2, 2, 0.003, 0.005);
67
  else if( 4<np && np<=6 ) pad->Divide(2, 3, 0.003, 0.005);
68
  else if( 6<np && np<=8 ) pad->Divide(2, 4, 0.003, 0.005);
69
  else if( np==9 )         pad->Divide(3, 3, 0.003, 0.005);
70
  else if( 9<np && np<=12) pad->Divide(3, 4, 0.003, 0.005);
71
  else if(12<np && np<=16) pad->Divide(4, 4, 0.003, 0.005);
72
  else if(16<np && np<=25) pad->Divide(5, 5, 0.003, 0.005);
73
  else if(25<np && np<=32) pad->Divide(4, 8, 0.003, 0.005);
74
}
75
//------------------------------------------------------------------------------------------
76
TPad* RTCanvas::cd(int i)
77
{
78
        return (TPad*)(pad->cd(i));
79
}
80
//------------------------------------------------------------------------------------------
81
void RTCanvas::SaveAs(const char *filename)
82
{
83
        can->SaveAs(filename);
84
}
85
//------------------------------------------------------------------------------------------
86
void RTCanvas::Update()
87
{
88
        can->Update();
89
}
90
//##########################################################################################
91
 
92
 
93