Subversion Repositories f9daq

Rev

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

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