JG ROOT Tools libraries  version 5.0 - august 2014
RBaseFunctions.cpp File Reference
#include "RBaseFunctions.hh"
#include <TStyle.h>

Functions

string RFileExt (const string &name)
 
string RFileBaseName (const string &name)
 
string RFileDirName (const string &name)
 
string RSetFileExt (const string &name, const string &ext)
 
Color_t RGetColor (const string &color_str, Color_t default_val)
 
string RColorString (Color_t c, Color_t c_max)
 
void RSetPaletteZero (const Double_t vmin, const Double_t vmax, const Double_t vctr, const Int_t ncol, const Double_t *rgb_min, const Double_t *rgb_max, const Double_t *rgb_ctr)
 
void RSetPaletteZero (const TH1 *hptr, const Double_t vctr, const Int_t ncol, const Double_t *rgb_min, const Double_t *rgb_max, const Double_t *rgb_ctr)
 
void RSetPaletteZero (const Double_t vmin, const Double_t vmax, const Double_t vctr, const Int_t ncol, const Int_t col_min, const Int_t col_max, const Int_t col_ctr)
 
void RSetPaletteZero (const TH1 *hptr, const Double_t vctr, const Int_t ncol, const Int_t col_min, const Int_t col_max, const Int_t col_ctr)
 

Variables

const char * rExportFileTypes []
 ! File types for graphics exports More...
 
const char * rTextFileTypes []
 ! File types for text files More...
 
const char * rRootFileTypes []
 ! File types for ROOT files More...
 
const char * rFitFileTypes []
 ! File types for fit results More...
 

Detailed Description

Source file for general purpose functions and global variables.

Function Documentation

string RFileExt ( const string &  name)

Function returning file name extansion.

Parameters
namefile name

Referenced by RAnimSequence3D::CreateSequences(), and RSetFileExt().

string RFileBaseName ( const string &  name)

Function returning base file name, without directory and without extansion.

Parameters
namefile name

Referenced by RAnimSequence3D::CreateSequences().

string RFileDirName ( const string &  name)

Function returning the file directory from the file name.

Parameters
namefile name
string RSetFileExt ( const string &  name,
const string &  ext 
)

Function that sets a selected extansio to a file name. If the file name does not already have an extansion, it is added.

Parameters
namebase name
extextansion

References RFileExt().

Referenced by RGFitDisplayer::ExportPlot(), RGFitBase1D::GuiWriteFct(), RGFitBase2D::GuiWriteFct(), and RGTextMessageRequester::SaveButtonClicked().

Color_t RGetColor ( const string &  color_str,
Color_t  default_val 
)

Read a ROOT color code in a string, either as an integer color code, either as a #RRGGBB code, where RR, GG and BB are the hexadecimal values for color components.

Parameters
color_strinput string
default_valdefault value in case of error

Referenced by RString::ReadColor(), and RString::ReadSubColor().

string RColorString ( Color_t  c,
Color_t  c_max 
)

Write a ROOT color definition in a string. The color is written as a ROOT color number if the color number is lower than c_max, else it is written as its components: #RRGGBB.

Parameters
ccolor number
c_maxmaximum color number for color codes, after which #RRGGBB is written
void RSetPaletteZero ( const Double_t  vmin,
const Double_t  vmax,
const Double_t  vctr,
const Int_t  ncol,
const Double_t *  rgb_min,
const Double_t *  rgb_max,
const Double_t *  rgb_ctr 
)

Function that defines a color palette, from a central color to colors defined for lowest and highest values.

For example, for an histogram with values ranging from -1 to +1, using default values, the functions creates a palette ranging from blue to white for values between -1 and 0, and from white to red for values ranging from 0 to 1.

Colors are defined with RGB values.

Parameters
vminlower value (histograme scale)
vmaxupper value (histograme scale)
vctrcentral value
ncolnumber of colors for the palette
rgb_minRGB color at lower value
rgb_maxRGB color at upper value
rgb_ctrRGB color at central value

Referenced by RFitBase2D::DrawDifResult(), and RSetPaletteZero().

void RSetPaletteZero ( const TH1 *  hptr,
const Double_t  vctr,
const Int_t  ncol,
const Double_t *  rgb_min,
const Double_t *  rgb_max,
const Double_t *  rgb_ctr 
)

Function that defines a color palette, from a central color to colors defined for lowest and highest values.

For example, for an histogram with values ranging from -1 to +1, using default values, the functions creates a palette ranging from blue to white for values between -1 and 0, and from white to red for values ranging from 0 to 1.

Colors are defined with RGB values.

Parameters
hptrhistogram from whiwh lower and upper values are taken
vctrcentral value
ncolnumber of colors for the palette
rgb_minRGB color at lower value
rgb_maxRGB color at upper value
rgb_ctrRGB color at central value

References RSetPaletteZero().

void RSetPaletteZero ( const Double_t  vmin,
const Double_t  vmax,
const Double_t  vctr,
const Int_t  ncol,
const Int_t  col_min,
const Int_t  col_max,
const Int_t  col_ctr 
)

Function that defines a color palette, from a central color to colors defined for lowest and highest values.

For example, for an histogram with values ranging from -1 to +1, using default values, the functions creates a palette ranging from blue to white for values between -1 and 0, and from white to red for values ranging from 0 to 1.

Colors are defined with RGB values.

Parameters
vminlower value (histograme scale)
vmaxupper value (histograme scale)
vctrcentral value
ncolnumber of colors for the palette
col_mincolor number for lower value
col_maxcolor number for upper value
col_ctrcolor number for central value

References RSetPaletteZero().

void RSetPaletteZero ( const TH1 *  hptr,
const Double_t  vctr,
const Int_t  ncol,
const Int_t  col_min,
const Int_t  col_max,
const Int_t  col_ctr 
)

Function that defines a color palette, from a central color to colors defined for lowest and highest values.

For example, for an histogram with values ranging from -1 to +1, using default values, the functions creates a palette ranging from blue to white for values between -1 and 0, and from white to red for values ranging from 0 to 1.

Colors are defined with RGB values.

Parameters
hptrhistogram from whiwh lower and upper values are taken
vctrcentral value
ncolnumber of colors for the palette
col_mincolor number for lower value
col_maxcolor number for upper value
col_ctrcolor number for central value

References RSetPaletteZero().

Variable Documentation

const char* rExportFileTypes[]
Initial value:
=
{
"PS files", "*.ps",
"EPS files", "*.eps",
"GIF files", "*.gif",
"C++ files", "*.C",
"Root files", "*.root",
"All files", "*",
0, 0
}

Referenced by RGHistoTools::ExportPad(), and RGFitDisplayer::ExportPlot().

const char* rTextFileTypes[]
Initial value:
=
{
"Text files", "*.txt",
"All files", "*",
0, 0
}

Referenced by RGFitBase1D::GuiWriteParam(), RGFitBase2D::GuiWriteParam(), and RGTextMessageRequester::SaveButtonClicked().

const char* rRootFileTypes[]
Initial value:
=
{
"ROOT files", "*.root",
"All files", "*",
0, 0
}

Referenced by RGFitBase1D::GuiWriteFct(), RGFitBase2D::GuiWriteFct(), and RGHistoTools::HistoFileBrowseButton().

const char* rFitFileTypes[]
Initial value:
=
{
"Fit result files", "*.fit",
"All files", "*",
0, 0
}

Referenced by RGFitBase1D::GuiLoadFitData(), RGFitBase2D::GuiLoadFitData(), RGFitBase1D::GuiSaveFitData(), and RGFitBase2D::GuiSaveFitData().