Subversion Repositories f9daq

Rev

Rev 47 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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