Subversion Repositories f9daq

Rev

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