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

Namespaces

namespace  ThrObjHolder
 

Classes

class  CheckFileForNan
 class CheckFileForNan can be used to check if the file contains objects with Nan values More...
 
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  ThrObj
 Class ThrObj can be used to simplify the work with TThreadedObject histograms in multithreaded applications. More...
 

Functions

void PrintCanvas (TCanvas *canv, const std::string &outputFileNameNoExt, const bool printPng=true, const bool compressPdf=true, const bool parallelCompression=true)
 Saves TCanvas in .pdf format and additionaly in .png format if specified.
 
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

◆ 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 compressPdf = true,
const bool parallelCompression = true )

Saves TCanvas in .pdf format and additionaly in .png format if specified.

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 is also printed additionaly to .pdf file; else only .pdf file will be printed. Note that saving complex canvases in .png takes much more time than saving them in .pdf
[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.