AliPhysics  master (3d17d9d)

Plotting utilities. More...

#include <TH1D.h>
#include <TH2F.h>
#include <TF1.h>
#include <TMath.h>
#include <TGraphErrors.h>
Include dependency graph for PlotUtils.C:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static Double_t FunctionCrystalBall (Double_t *x, Double_t *par)
 
static Double_t FunctionGaussPol3 (Double_t *x, Double_t *par)
 
static Double_t FunctionGaussPol2 (Double_t *x, Double_t *par)
 
static Double_t FunctionGaussPol1 (Double_t *x, Double_t *par)
 
static Double_t FunctionGaussPol0 (Double_t *x, Double_t *par)
 
static Double_t FunctionTruncatedPolEta (Double_t *x, Double_t *par)
 
static Double_t FunctionTruncatedPolPi0 (Double_t *x, Double_t *par)
 
static Double_t GetFractionError (Double_t num, Double_t den, Double_t numErr, Double_t denErr)
 
static TGraphErrorsDivideGraphs (TGraphErrors *gNum, TGraphErrors *gDen)
 
static void GetRangeIntegralAndError (TH1D *h, Int_t binMin, Int_t binMax, Double_t &integral, Double_t &integralErr)
 
static void GetRangeIntegralAndError (TH1D *h, Float_t minX, Float_t maxX, Double_t &integral, Double_t &integralErr)
 
void RemovePointsOutOfRangeOrLargeErrorFromGraph (TGraphErrors *graph, Double_t min, Double_t max, Float_t errFraction=0.5, Float_t value=-1, Float_t valueErr=0)
 
static void ScaleBinBySize (TH1D *h)
 Scale histogram bins by its size. More...
 
void ScaleXaxis2D (TH2F *h2D)
 Scale 2D histogram X bins by its integral. More...
 
void GetCanvasColRowNumber (Int_t npad, Int_t &ncol, Int_t &nrow, Bool_t square=kFALSE)
 

Detailed Description

Plotting utilities.

Macro that containes useful small methods that can be used in plotting macros

Author
Gustavo Conesa Balbastre Gusta.nosp@m.vo.C.nosp@m.onesa.nosp@m..Bal.nosp@m.bastr.nosp@m.e@ce.nosp@m.rn.ch, (LPSC-CNRS)

Definition in file PlotUtils.C.

Function Documentation

static TGraphErrors* DivideGraphs ( TGraphErrors gNum,
TGraphErrors gDen 
)
static

Divide 2 TGraphErrors

Returns
TGraphError result of division
Parameters
gNumTGraphError numerator
gDenTGraphError denominator

Definition at line 152 of file PlotUtils.C.

Referenced by CompareInvMassGraphsDataProd(), CompareInvMassGraphsMCvsData(), GetFractionError(), and PlotGraphs().

static Double_t FunctionCrystalBall ( Double_t x,
Double_t par 
)
static

Crystal ball function. Fitting function.

Definition at line 26 of file PlotUtils.C.

Referenced by SetFitFun().

static Double_t FunctionGaussPol0 ( Double_t x,
Double_t par 
)
static

Gaussian plus constant function. Fitting function.

Definition at line 85 of file PlotUtils.C.

Referenced by SetFitFun().

static Double_t FunctionGaussPol1 ( Double_t x,
Double_t par 
)
static

Gaussian plus polinomial order 1 function. Fitting function.

Definition at line 73 of file PlotUtils.C.

Referenced by SetFitFun().

static Double_t FunctionGaussPol2 ( Double_t x,
Double_t par 
)
static

Gaussian plus polinomial order 2 function. Fitting function.

Definition at line 61 of file PlotUtils.C.

Referenced by SetFitFun().

static Double_t FunctionGaussPol3 ( Double_t x,
Double_t par 
)
static

Gaussian plus polinomial order 3 function. Fitting function.

Definition at line 49 of file PlotUtils.C.

Referenced by SetFitFun().

static Double_t FunctionTruncatedPolEta ( Double_t x,
Double_t par 
)
static

Truncated function in eta region. Fitting function.

Definition at line 97 of file PlotUtils.C.

Referenced by SetFitFun().

static Double_t FunctionTruncatedPolPi0 ( Double_t x,
Double_t par 
)
static

Truncated function in pi0 region. Fitting function.

Definition at line 113 of file PlotUtils.C.

Referenced by SetFitFun().

void GetCanvasColRowNumber ( Int_t  npad,
Int_t ncol,
Int_t nrow,
Bool_t  square = kFALSE 
)

When more than 1 frame pad in a canvas, define the number of columns or rows, depending on the total number of frames

Parameters
npadnumber of pads
ncolnumber of assigned columns
nrownumber of assigned rows
squaretake the number of columns and rows as the square root of npad

Definition at line 344 of file PlotUtils.C.

Referenced by CalculateAndPlot(), CalculateParamChi2MCxTalkDataPerSM(), CompareTH3DataAndMCProd(), DoIt(), and GetSMNumber().

static Double_t GetFractionError ( Double_t  num,
Double_t  den,
Double_t  numErr,
Double_t  denErr 
)
static

Calculation of error of a fraction

Returns
fraction error
Parameters
numnumerator

Definition at line 133 of file PlotUtils.C.

Referenced by CalculateAndPlot(), DivideGraphs(), Efficiency(), FunctionTruncatedPolPi0(), and PrimarySpectra().

static void GetRangeIntegralAndError ( TH1D h,
Int_t  binMin,
Int_t  binMax,
Double_t integral,
Double_t integralErr 
)
static

Get a TH1D integral and its error within a bin range

Parameters
hTH1D
binMinFirst bin of integration
binMaxLast bin of integration
integralsum between first and last bin
integralErrerror of integral

Definition at line 209 of file PlotUtils.C.

Referenced by CalculateAndPlot(), DivideGraphs(), GetRangeIntegralAndError(), PrimarySpectra(), and ProjectAndFit().

static void GetRangeIntegralAndError ( TH1D h,
Float_t  minX,
Float_t  maxX,
Double_t integral,
Double_t integralErr 
)
static

Get a TH1D integral and its error within a x axis range

Parameters
hTH1D
minXx axis minimum value
maxXx axis maximum value
integralsum between first and last bin
integralErrerror of integral

Definition at line 236 of file PlotUtils.C.

void RemovePointsOutOfRangeOrLargeErrorFromGraph ( TGraphErrors graph,
Double_t  min,
Double_t  max,
Float_t  errFraction = 0.5,
Float_t  value = -1,
Float_t  valueErr = 0 
)

When plotting multiple graphs, and need to set different ranges Those points with too large error or out of the desired range are set to a default value out of the plot scale

Parameters
graphTGraphError
minx axis minimum value
maxx axis maximum value
errFractionIf error of point is larger than a fraction of the point, it is removed
valuedefault value for removed point
valueErrdefault error value for removed point

Definition at line 258 of file PlotUtils.C.

Referenced by CompareProductions(), and GetRangeIntegralAndError().

static void ScaleBinBySize ( TH1D h)
static

Scale histogram bins by its size.

Definition at line 286 of file PlotUtils.C.

Referenced by MakeDoubleRatios(), and PrimarySpectra().

void ScaleXaxis2D ( TH2F h2D)

Scale 2D histogram X bins by its integral.

Definition at line 303 of file PlotUtils.C.