ROOTTools
Loading...
Searching...
No Matches
ROOTTools Namespace Reference

Namespaces

namespace  ThrObjHolder

Classes

class  GUIFit
 class GUIFit that can be used for providing GUI for improving the approximations of form "foreground + background" by tweaking the background More...
class  CheckFileForNan
 class CheckFileForNan can be used to check if the file contains objects with Nan values More...
class  ThrObj
 Class ThrObj can be used to simplify the work with TThreadedObject histograms in multithreaded applications. More...

Functions

template<typename T>
void DrawFrame (T *hist, const std::string &title, const std::string &xTitle, const std::string &yTitle, const double xTitleOffset=1., const double yTitleOffset=1.5, const double xTitleSize=0.05, const double yTitleSize=0.05, const bool drawOppositeAxis=true, const bool drawContents=true)
void DrawFrame (const double xMin, const double yMin, const double xMax, const double yMax, const std::string &title, const std::string &xTitle, const std::string &yTitle, const double xTitleOffset=1., const double yTitleOffset=1.5, const double xTitleSize=0.05, const double yTitleSize=0.05, const bool drawOppositeAxis=true)
void PrintCanvas (TCanvas *canv, const std::string &outputFileNameNoExt, const bool printPng=true, const bool printPdf=true, const bool compressPdf=true, const bool parallelCompression=true)
 Saves TCanvas in .pdf format and additionaly in .png format if specified. Also makes canvas background transparent. Either printPng or printPdf must be true, else error will be printed.
unsigned int GetNumberOfParameters (const std::string &formula, const std::string &parName="p")
 Return the biggest parameter index + 1 in formula of labmda function that was used in TF1 constructor.

Function Documentation

◆ DrawFrame() [1/2]

void ROOTTools::DrawFrame ( const double xMin,
const double yMin,
const double xMax,
const double yMax,
const std::string & title,
const std::string & xTitle,
const std::string & yTitle,
const double xTitleOffset = 1.,
const double yTitleOffset = 1.5,
const double xTitleSize = 0.05,
const double yTitleSize = 0.05,
const bool drawOppositeAxis = true )

◆ DrawFrame() [2/2]

template<typename T>
void ROOTTools::DrawFrame ( T * hist,
const std::string & title,
const std::string & xTitle,
const std::string & yTitle,
const double xTitleOffset = 1.,
const double yTitleOffset = 1.5,
const double xTitleSize = 0.05,
const double yTitleSize = 0.05,
const bool drawOppositeAxis = true,
const bool drawContents = true )

◆ GetNumberOfParameters()

unsigned int ROOTTools::GetNumberOfParameters ( const std::string & formula,
const std::string & parName = "p" )

Return the biggest parameter index + 1 in formula of labmda function that was used in TF1 constructor.

Parameters
[in]formulaformula that was used to define fit function in TF1. The formula must be a labmda expression (see examples below).
[in]parNameparameter name in formula

Example:

printf("%u\n", ROOTTools::GetNumberOfParameters("[](double *x, double *p) {return p[0] + p[1]*x[0] + p[2]*x[0]*x[0];}"));
printf("%u\n", ROOTTools::GetNumberOfParameters("[](double *x, double *p) {return p[0] + p[3]*x[0]*x[0];}"));
printf("%u\n", ROOTTools::GetNumberOfParameters("[](double *x, double *p) {return p[0] + p[1]*pow(x, p[2]);}"));
printf("%u\n", ROOTTools::GetNumberOfParameters("[](double *x, double *par) {return par[0]*x + par[1]*x[0]*x[0];}", "par"));
unsigned int GetNumberOfParameters(const std::string &formula, const std::string &parName="p")
Return the biggest parameter index + 1 in formula of labmda function that was used in TF1 constructor...
Definition TF1Tools.cpp:16

Result:

3
4
2
3

◆ PrintCanvas()

void ROOTTools::PrintCanvas ( TCanvas * canv,
const std::string & outputFileNameNoExt,
const bool printPng = true,
const bool printPdf = true,
const bool compressPdf = true,
const bool parallelCompression = true )

Saves TCanvas in .pdf format and additionaly in .png format if specified. Also makes canvas background transparent. Either printPng or printPdf must be true, else error will be printed.

Parameters
[in]canvTCanvas object that will be written
[in]outputFileNameNoExtname of the output file without extention (such as ".pdf" or ".png"). Extentions of the files will be added automaticaly
[in]printPngif true .png file will be printed (note that saving complex canvases in .png takes much more time than saving them in .pdf)
[in]printPdfif true .pdf file will be printed
[in]compressPdfif true .pdf file will be compressed with ghostscript. It is recommended to leave this parameter true since it doesn't take a lot of resources to compress the file and the size of the compressed file will usually be reduced by ~0.5-0.7 of the uncompressed file size (depends on the contents of canvas and with more complex canvases more reduction in size can be achieved)
[in]parallelCompressionif true the compression will be ran on the separate thread detached from the current program. Parallel compression speeds up the function completion time since the program does not need to wait until compression is done. It is recommended to leave this parameter true unless the program you're running takes all resources of the machine.