Subversion Repositories f9daq

Rev

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

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