#include "include/RTUtil.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->SetPadTopMargin(0.10);
 
        style->SetPadBottomMargin(0.10);
 
        style->SetPadLeftMargin(0.10);
 
        style->SetPadRightMargin(0.12);
 
        
 
        style->SetTitleOffset(1.3, "y");
 
}
 
//##########################################################################################
 
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);
 
}
 
//------------------------------------------------------------------------------------------
 
TPad* RTCanvas::cd(int i)
 
{
 
        return (TPad*)(pad->cd(i));
 
}
 
//------------------------------------------------------------------------------------------
 
void RTCanvas::SaveAs(const char *filename)
 
{
 
        can->SaveAs(filename);
 
}
 
//##########################################################################################