Subversion Repositories f9daq

Rev

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

//##########################################################################################
#include "TGaxis.h"

void RTSetStyle(TStyle *style)
{
        style->SetStatBorderSize(1);
        style->SetFrameBorderMode(0);
        style->SetCanvasBorderMode(0);
        style->SetPadBorderMode(0);
        style->SetPadColor(0);
        style->SetCanvasColor(0);
        style->SetHistFillColor(18);
        style->SetStatColor(0);
        style->SetPalette(1, 0);
       
        style->SetMarkerStyle(kFullDotLarge);
        //style->SetMarkerSize(7);
       
        style->SetOptStat("e");
        style->SetOptFit(1);
       
        style->SetPadTopMargin(0.12);
        style->SetPadBottomMargin(0.12);
        style->SetPadLeftMargin(0.12);
        style->SetPadRightMargin(0.12);
       
        style->SetTitleOffset(1.3, "y");
        style->SetPalette(1, 0);
       
        style->SetPaperSize(TStyle::kA4);
       
        TGaxis::SetMaxDigits(4);
}
//##########################################################################################
RTCanvas::RTCanvas()
{
        RTCanvas((char*)"can", (char*)" ", 0, 0, 640, 480);
}
//------------------------------------------------------------------------------------------
RTCanvas::RTCanvas(char *w_title, char *c_title, int x_min, int y_min, int x_size, int y_size)
{
        can = (TCanvas*)gROOT->FindObject(w_title);
        if(!can) can = new TCanvas(w_title, w_title, x_min, y_min, x_size, y_size);
        else can->cd(0);
       
        title = new TPaveLabel(0.01,0.96,0.81,0.99, c_title, "NDC");
        title->Draw();
       
        TDatime now;
        date = new TPaveLabel(0.83,0.96,0.99,0.99, now.AsString(), "NDC");
        date->Draw();
       
        pad = new TPad("Graphs","Graphs",0.005,0.005,0.996,0.95);
        pad->Draw();
        pad->cd(0);      
}
//------------------------------------------------------------------------------------------
void RTCanvas::Divide(int nx, int ny)
{
        pad->Divide(nx, ny, 0.003, 0.005);
}
//------------------------------------------------------------------------------------------
void RTCanvas::Divide(int np)
{
        if( np==2 )              pad->Divide(1, 2, 0.003, 0.005);
        else if( 2<np && np<=4 ) pad->Divide(2, 2, 0.003, 0.005);
  else if( 4<np && np<=6 ) pad->Divide(2, 3, 0.003, 0.005);
  else if( 6<np && np<=8 ) pad->Divide(2, 4, 0.003, 0.005);
  else if( np==9 )         pad->Divide(3, 3, 0.003, 0.005);
  else if( 9<np && np<=12) pad->Divide(3, 4, 0.003, 0.005);
  else if(12<np && np<=16) pad->Divide(4, 4, 0.003, 0.005);
  else if(16<np && np<=25) pad->Divide(5, 5, 0.003, 0.005);
  else if(25<np && np<=32) pad->Divide(4, 8, 0.003, 0.005);
}
//------------------------------------------------------------------------------------------
TPad* RTCanvas::cd(int i)
{
        return (TPad*)(pad->cd(i));
}
//------------------------------------------------------------------------------------------
void RTCanvas::SaveAs(const char *filename)
{
        can->SaveAs(filename);
}
//------------------------------------------------------------------------------------------
void RTCanvas::Update()
{
        can->Update();
}
//##########################################################################################