Subversion Repositories f9daq

Rev

Rev 54 | Details | Compare with Previous | Last modification | View Log | RSS feed

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