Functions
RootTools Namespace Reference

My commonly used, general functions to manipulate ROOT objects; so I only ever write them once. More...

Functions

void writeTGraph (TGraph *gr, TString name)
 Sets the name of a TGraph to name and then writes it to the current file. More...
 
void printArray (int n, double *array, TString delimiter=", ", TString start="{", TString end="}\n")
 Print all the elements of a c-styles array to the screen for debugging. More...
 
void printYVals (TGraph *gr, TString delimiter=", ", TString start="{", TString end="}\n")
 Print all the the y-axis values of a TGraph to the screen for debugging. More...
 
void printXVals (TGraph *gr, TString delimiter=", ", TString start="{", TString end="}\n")
 Print all the the x-axis values of a TGraph to the screen for debugging. More...
 
void printTGraphInfo (TGraph *gr)
 Print summary information about gr: name, title, number of points, all x and y values. More...
 
Int_t getIndexOfMaximum (Int_t len, Double_t *arr)
 Find indices where input is not a number (for debugging). More...
 
std::vector< Int_t > getIndicesOfNans (TGraph *gr)
 Find indices where input is not a number (for debugging) More...
 
Double_t getSumOfYVals (TGraph *gr)
 Adds up all y-axis values of input TGraph. More...
 
void getMaxMin (TGraph *gr, Double_t &max, Double_t &min)
 Scan long TGraph and update the references to the maximum and minimum input values. More...
 
void getMeanAndRms (TGraph *gr, Double_t &mean, Double_t &rms)
 Get mean and rms of gr. More...
 
void getMaxMin (TGraph *gr, Double_t &maxY, Double_t &maxX, Double_t &minY, Double_t &minX)
 Scan long TGraph and update the references to the maximum and minimum input values. More...
 
void getMaxMinWithinLimits (TGraph *gr, Double_t &maxY, Double_t &maxX, Double_t &minY, Double_t &minX, Double_t lowerLimit, Double_t upperLimit)
 Scan long TGraph and update the references to the maximum and minimum input values. More...
 
void getLocalMaxToMin (TGraph *gr, Double_t &maxY, Double_t &maxX, Double_t &minY, Double_t &minX)
 Updates input based on absolute largest local maximum to local minimum difference. For pulse finding. More...
 
void getLocalMaxToMinWithinLimits (TGraph *gr, Double_t &maxY, Double_t &maxX, Double_t &minY, Double_t &minX, Double_t lowerLimit, Double_t upperLimit)
 Updates input based on absolute largest local maximum to local minimum difference. For pulse finding. More...
 
Int_t getPeakBinOfHistogram (TH1D *h)
 Finds the bin containing the maximum value of a TH1D. More...
 
Double_t getPeakBinOfHistogram (TH2D *hist, Int_t &binx, Int_t &biny)
 Finds the bin containing the maximum value of a TH2D. More...
 
Double_t getLowBinEdgeOfHistogramPeak (TH1D *h)
 Finds the bin containing the maximum value of a TH1D. More...
 
Double_t getFullWidthHalfMax (TH1D *h)
 Assumes a nice distribution with a single peak, finds the full width half max. More...
 
Int_t getBit (UInt_t bitIndex, UInt_t bitMask)
 For decoding bit masks. More...
 
Int_t getNumBitsSet (Int_t numBitsToCheck, UInt_t bitMask)
 For counting how many bits are set to one in a bitmask. More...
 
Double_t getDeltaAngleDeg (Double_t angle1, Double_t angle2)
 Do angle1-angle2 (in degrees) and +- 360 such that the result lies in -180 < deltaAngle < 180. More...
 
void subtractOffset (TGraph *gr, Double_t offset)
 Subtract a constant value from the y-axis values at each point. More...
 
void normalize (TGraph *gr, Double_t &mean, Double_t &rms)
 Modify gr to set mean=0 and rms=1. More...
 
void normalize (TGraph *gr)
 Modify gr to set mean=0 and rms=1. More...
 
void zeroPadTGraph (TGraph *gr, Int_t newLen, Double_t dt=0)
 Add a bunch of zeros to the end of a TGraph. More...
 
void offsetTGraphXAxes (Int_t numGrs, TGraph *grs[], Double_t offsets[])
 Adds a set of offsets to the x-axis values of each respective TGraph. More...
 
void multiplyTGraphYAxes (Int_t numGrs, TGraph *grs[], Double_t factors[])
 Multiples a set of factors to the y-axis values of each respective TGraph. More...
 
void makeZaxisScaleEqualAboutZero (TH2D *h)
 For nice plotting of 2D dists about 0, makes max = -min. More...
 
TGraph * makeNormalized (TGraph *gr)
 Creates new TGraph (leaving original unchanged) with mean = 0 & RMS = 1. More...
 
TGraph * makeNormalized (TGraph *gr, Double_t &mean, Double_t &rms)
 Create normalized copy of gr, where mean=0 and rms=1 (input unmodified). More...
 
TGraph * makeSortedTGraph (TTree *tree, TString drawText, TString cutString, Double_t wrapValue)
 Plot a time (or any TTree branch) ordered TGraph of some TTree branch. More...
 
TGraph * makeLinearlyInterpolatedGraph (TGraph *grIn, Double_t dt)
 Make interpolated TGraph using linear interpolation between points. More...
 
TGraph * makeDerivativeTGraph (TGraph *gr)
 Makes a derivative TGraph, contains gr->GetN() - 1 points. More...
 
TGraph * makeUnwrappedCorrelationGraph (TGraph *gr)
 Unwraps a circularly correlated graph so the -ve time lies behind the +ve time. More...
 
TGraph * interpolateWithStartTime (TGraph *grIn, Double_t startTime, Double_t dt, Int_t nSamp)
 Wrapper function for ROOT's interpolator, can zero pad the front to start from a particular time. More...
 
TH1D * plotsZaxisDist (TH2 *h2, TString hName, Int_t nBins, Double_t xMin, Double_t xMax)
 Put Z-axis values of a TH2D histogram into a TH1D histogram. More...
 
TCanvas * drawArrayOfHistosPrettily (TH1D *hs[], Int_t numHists, TCanvas *can=NULL, Double_t *colWeights=NULL)
 Draws an array of histograms with a rainbow on a single TCanvas. More...
 
TCanvas * drawArrayOfTGraphsPrettily (TGraph *grs[], Int_t numGrs, TString drawOpt="l", TCanvas *can=NULL, Double_t *colWeights=NULL)
 Draws an array of TGraphs with a rainbow on a single TCanvas. More...
 
TLegend * makeLegend (TGraph *grs[], Int_t numGrs, TString titles[], TString opt="l", Double_t minX=0.8, Double_t minY=0.8, Double_t maxX=1, Double_t maxY=1)
 Generates a TLegend from input arrays of TGraphs and titles (TStrings) More...
 
TLegend * makeLegend (TH1D *hs[], Int_t numHists, TString titles[], TString opt="l", Double_t minX=0.8, Double_t minY=0.8, Double_t maxX=1, Double_t maxY=1)
 Generates a TLegend from input arrays of TGraphs and titles (TStrings). More...
 
void saveCanvas (TCanvas *c1, TString fileName)
 My function to save a TCanvas for talks, and save an editable version. More...
 
void setWhiteZeroColorScale ()
 Set color scale where white is in the middle. More...
 
void draw2D (TH2D *hist, TString opt)
 Draw 2D histogram and set bin limits to be symmetrical about zero. More...
 
Int_t getColorFracThroughPalette (Int_t index, Int_t maxVal)
 Gets the color a fraction through the current palette. More...
 
TCanvas * drawHistsWithStatsBoxes (Int_t numHists, TH1D *hs[], TString drawOpt, TString statsOption)
 Draw histograms on the same (new) canvas with nice stats boxes. More...
 
TString getAntName (AnitaPol::AnitaPol_t pol, Int_t antInd)
 Use polarization and index to get the antenna name (1st phi-sector called 1, not 0). More...
 
TChain * getHeadChain (Int_t firstRun, Int_t lastRun, RawAnitaHeader *&headPtr)
 Get a TChain of the ANITA-3 header data. More...
 
TChain * getAdu5PatChain (Int_t firstRun, Int_t lastRun, Adu5Pat *&pat)
 Get a TChain of the ANITA-3 adu5Pat data. More...
 

Detailed Description

My commonly used, general functions to manipulate ROOT objects; so I only ever write them once.

This lovingly curated namespace can be imported into CINT with gSystem->Load('libBensAnitaTools.so"). I find myself often writing little routines to modify things like TGraphs over and over again. Functions that do little jobs, too simple to deserve a dedicated class of their own go in this namespace. The idea that I only spend any time coding up a particular function once. Expect this namespace to be referenced a lot in my code.

Function Documentation

void RootTools::draw2D ( TH2D *  hist,
TString  opt 
)

Draw 2D histogram and set bin limits to be symmetrical about zero.

Parameters
histis the TH2D* to draw.
optis the draw option.

Definition at line 1301 of file RootTools.cxx.

TCanvas * RootTools::drawArrayOfHistosPrettily ( TH1D *  hs[],
Int_t  numHists,
TCanvas *  can = NULL,
Double_t *  colWeights = NULL 
)

Draws an array of histograms with a rainbow on a single TCanvas.

Parameters
hsis a pointer to an array of pointers to the histograms.
numHistsis the number of histograms.
canis the TCanvas to draw on, if one is not given a new one is created.
colWeightsis a pointer to a Double_t array, which will weight to colors drawn.
Returns
the TCanvas the histograms are drawn on.

Definition at line 730 of file RootTools.cxx.

TCanvas * RootTools::drawArrayOfTGraphsPrettily ( TGraph *  grs[],
Int_t  numGrs,
TString  drawOpt = "l",
TCanvas *  can = NULL,
Double_t *  colWeights = NULL 
)

Draws an array of TGraphs with a rainbow on a single TCanvas.

Parameters
grsis a pointer to an array of pointers to the TGraphs.
numGrsis the number of TGraphs.
canis the TCanvas to draw on, if one is not given a new one is created.
drawOptis the draw option, select "p" for markers and "l" for lines.
colWeightsis a pointer to an array of doubles to be used as weights for colors.
Returns
the TCanvas the TGraphs are drawn on.

Definition at line 832 of file RootTools.cxx.

TCanvas * RootTools::drawHistsWithStatsBoxes ( Int_t  numHists,
TH1D *  hs[],
TString  drawOpt,
TString  statsOption 
)

Draw histograms on the same (new) canvas with nice stats boxes.

Parameters
numHistsis, as you might guess, the number of histograms (the lengths of the array hs[])
hs[]is the array of pointers to TH1Ds to be plotted
drawOptis the draw option in ROOT, e.g. "e" for error bars.
statsOptionsets the stats to be displayed. I usually use "mre" for mean, RMS and entries.

Definition at line 1409 of file RootTools.cxx.

TChain * RootTools::getAdu5PatChain ( Int_t  firstRun,
Int_t  lastRun,
Adu5Pat *&  pat 
)

Get a TChain of the ANITA-3 adu5Pat data.

Parameters
firstRunis the first run.
lastRunis the last run.
pata reference to a pointer to an Adu5Pat (yikes!).

Definition at line 1343 of file RootTools.cxx.

TString RootTools::getAntName ( AnitaPol::AnitaPol_t  pol,
Int_t  antInd 
)

Use polarization and index to get the antenna name (1st phi-sector called 1, not 0).

Parameters
polis the polarization
antIndis the antenna index (counting from 0)

Definition at line 1365 of file RootTools.cxx.

Int_t RootTools::getBit ( UInt_t  bitIndex,
UInt_t  bitMask 
)

For decoding bit masks.

Parameters
bitIndexis the bit to get (count from 0)
bitMaskis the bitMask

Definition at line 1242 of file RootTools.cxx.

Int_t RootTools::getColorFracThroughPalette ( Int_t  index,
Int_t  maxVal 
)

Gets the color a fraction through the current palette.

Parameters
indexis the numerator of the fraction
maxValis the denominator of the fraction

Definition at line 1391 of file RootTools.cxx.

Double_t RootTools::getDeltaAngleDeg ( Double_t  angle1,
Double_t  angle2 
)

Do angle1-angle2 (in degrees) and +- 360 such that the result lies in -180 < deltaAngle < 180.

Parameters
angle1is the first angle
angle2is the second angle
Returns
deltaAngle is the difference in the range -180 < deltaAngle < 180

If it looks like there's an insane angle being passed in will return -9999.

Definition at line 267 of file RootTools.cxx.

Double_t RootTools::getFullWidthHalfMax ( TH1D *  h)

Assumes a nice distribution with a single peak, finds the full width half max.

Parameters
his a histogram
Returns
the full width half max

Definition at line 1102 of file RootTools.cxx.

TChain * RootTools::getHeadChain ( Int_t  firstRun,
Int_t  lastRun,
RawAnitaHeader *&  headPtr 
)

Get a TChain of the ANITA-3 header data.

Parameters
firstRunis the first run.
lastRunis the last run.
headPtra reference to a pointer to a RawAnitaHeader (yikes!).

Definition at line 1322 of file RootTools.cxx.

Int_t RootTools::getIndexOfMaximum ( Int_t  len,
Double_t *  arr 
)

Find indices where input is not a number (for debugging).

Parameters
lenis the length of arr.
arris a pointer to an array of doubles of length len.
Returns
std::vector<Int_t> containing the indices of the TGraph where is value is not a number.

Definition at line 404 of file RootTools.cxx.

std::vector< Int_t > RootTools::getIndicesOfNans ( TGraph *  gr)

Find indices where input is not a number (for debugging)

Parameters
gris the TGraph you want information about.
Returns
std::vector<Int_t> containing the indices of the TGraph where is value is not a number

Definition at line 432 of file RootTools.cxx.

void RootTools::getLocalMaxToMin ( TGraph *  gr,
Double_t &  maxY,
Double_t &  maxX,
Double_t &  minY,
Double_t &  minX 
)

Updates input based on absolute largest local maximum to local minimum difference. For pulse finding.

Parameters
gris the TGraph you want information about.
maxYis a reference to a Double_t, updated with the local maximum y-axis value of the TGraph.
maxXis a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph.
minYis a reference to a Double_t, updated with the local minimum y-axis value of the TGraph.
minXis a reference to a Double_t, updated with the x-axis value at the minY of the TGraph.

Definition at line 991 of file RootTools.cxx.

void RootTools::getLocalMaxToMinWithinLimits ( TGraph *  gr,
Double_t &  maxY,
Double_t &  maxX,
Double_t &  minY,
Double_t &  minX,
Double_t  lowerLimit,
Double_t  upperLimit 
)

Updates input based on absolute largest local maximum to local minimum difference. For pulse finding.

Parameters
gris the TGraph you want information about.
maxYis a reference to a Double_t, updated with the local maximum y-axis value of the TGraph.
maxXis a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph.
minYis a reference to a Double_t, updated with the local minimum y-axis value of the TGraph.
minXis a reference to a Double_t, updated with the x-axis value at the minY of the TGraph.
lowerLimitis a Double_t containing the lower value of the x-axis to search from.
upperLimitis a Double_t containing the upper value of the x-axis to search to.

Definition at line 1015 of file RootTools.cxx.

Double_t RootTools::getLowBinEdgeOfHistogramPeak ( TH1D *  h)

Finds the bin containing the maximum value of a TH1D.

Parameters
his a histogram
Returns
the peak bin (in ROOT bin counting starts at 1)

Definition at line 1200 of file RootTools.cxx.

void RootTools::getMaxMin ( TGraph *  gr,
Double_t &  maxY,
Double_t &  minY 
)

Scan long TGraph and update the references to the maximum and minimum input values.

Parameters
gris the TGraph you want information about.
maxYis a reference to a Double_t, updated with the maximum y-axis value of the TGraph.
minYis a reference to a Double_t, updated with the minimum y-axis value of the TGraph.

Definition at line 146 of file RootTools.cxx.

void RootTools::getMaxMin ( TGraph *  gr,
Double_t &  maxY,
Double_t &  maxX,
Double_t &  minY,
Double_t &  minX 
)

Scan long TGraph and update the references to the maximum and minimum input values.

Parameters
gris the TGraph you want information about.
maxYis a reference to a Double_t, updated with the maximum y-axis value of the TGraph.
maxXis a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph.
minYis a reference to a Double_t, updated with the minimum y-axis value of the TGraph.
minXis a reference to a Double_t, updated with the x-axis value at the minY of the TGraph.

Definition at line 165 of file RootTools.cxx.

void RootTools::getMaxMinWithinLimits ( TGraph *  gr,
Double_t &  maxY,
Double_t &  maxX,
Double_t &  minY,
Double_t &  minX,
Double_t  lowerLimit,
Double_t  upperLimit 
)

Scan long TGraph and update the references to the maximum and minimum input values.

Parameters
gris the TGraph you want information about.
maxYis a reference to a Double_t, updated with the maximum y-axis value of the TGraph.
maxXis a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph.
minYis a reference to a Double_t, updated with the minimum y-axis value of the TGraph.
minXis a reference to a Double_t, updated with the x-axis value at the minY of the TGraph.
lowerLimitis a Double_t containing the lower value of the x-axis to search from.
upperLimitis a Double_t containing the upper value of the x-axis to search to.

Definition at line 201 of file RootTools.cxx.

void RootTools::getMeanAndRms ( TGraph *  gr,
Double_t &  mean,
Double_t &  rms 
)

Get mean and rms of gr.

Parameters
gris the TGraph you want information about.
meanis a reference to a Double_t, updated with the mean value of gr before modification.
rmsis a reference to a Double_t, updated with the rms value of gr before modification.

Definition at line 381 of file RootTools.cxx.

Int_t RootTools::getNumBitsSet ( Int_t  numBitsToCheck,
UInt_t  bitMask 
)

For counting how many bits are set to one in a bitmask.

Parameters
numBitsToCheckis the number of little endian bits to check.
bitMaskis the object to check the bits of.

Definition at line 1257 of file RootTools.cxx.

Int_t RootTools::getPeakBinOfHistogram ( TH1D *  h)

Finds the bin containing the maximum value of a TH1D.

Parameters
his a histogram
Returns
the peak bin (in ROOT bin counting starts at 1)

Definition at line 1141 of file RootTools.cxx.

Double_t RootTools::getPeakBinOfHistogram ( TH2D *  hist,
Int_t &  binx,
Int_t &  biny 
)

Finds the bin containing the maximum value of a TH2D.

Parameters
histis a histogram
binxis a reference to the x-axis bin number (in ROOT bin counting starts at 1)
binyis a reference to the y-axis bin number (in ROOT bin counting starts at 1)
Returns
the value of the histogram peak bin

Definition at line 1169 of file RootTools.cxx.

Double_t RootTools::getSumOfYVals ( TGraph *  gr)

Adds up all y-axis values of input TGraph.

Parameters
gris the TGraph you want to sum the y-axis values of.
Returns
sum is a Double_t.

Definition at line 14 of file RootTools.cxx.

TGraph * RootTools::interpolateWithStartTime ( TGraph *  grIn,
Double_t  startTime,
Double_t  dt,
Int_t  nSamp 
)

Wrapper function for ROOT's interpolator, can zero pad the front to start from a particular time.

Parameters
grInpoints to the TGraph containing the waveform to interpolate
startTimeis the start time for interpolation: zero pads if this is earlier than the TGraph start time.
dtis the time between samples
nSampis the time number of samples

Definition at line 679 of file RootTools.cxx.

TGraph * RootTools::makeDerivativeTGraph ( TGraph *  gr)

Makes a derivative TGraph, contains gr->GetN() - 1 points.

Parameters
gris the TGraph from which to make the derivative
Returns
Pointer to TGraph containing derivative of input gr.

Definition at line 92 of file RootTools.cxx.

TLegend * RootTools::makeLegend ( TGraph *  grs[],
Int_t  numGrs,
TString  titles[],
TString  opt = "l",
Double_t  minX = 0.8,
Double_t  minY = 0.8,
Double_t  maxX = 1,
Double_t  maxY = 1 
)

Generates a TLegend from input arrays of TGraphs and titles (TStrings)

Parameters
grsis a pointer to an array of pointers to the TGraphs.
numGrsis the number of TGraphs.
titlesis an array of TStrings containing the titles
optis the legend option ("l" by default)
minXis the Pad coordinates, 0.8 by default.
minYis the Pad coordinates, 0.8 by default.
maxXis the Pad coordinates, 1 by default.
maxYis the Pad coordinates, 1 by default.
Returns
the newly generated TLegend

Definition at line 913 of file RootTools.cxx.

TLegend * RootTools::makeLegend ( TH1D *  hs[],
Int_t  numHists,
TString  titles[],
TString  opt = "l",
Double_t  minX = 0.8,
Double_t  minY = 0.8,
Double_t  maxX = 1,
Double_t  maxY = 1 
)

Generates a TLegend from input arrays of TGraphs and titles (TStrings).

Parameters
hsis a pointer to an array of pointers to the histograms (TH1Ds).
numHistsis the number of histgorams in the array hs.
titlesis an array of TStrings containing the titles
optis the legend option ("l" by default)
minXis the Pad coordinates, 0.8 by default.
minYis the Pad coordinates, 0.8 by default.
maxXis the Pad coordinates, 1 by default.
maxYis the Pad coordinates, 1 by default.
Returns
the newly generated TLegend

Definition at line 945 of file RootTools.cxx.

TGraph * RootTools::makeLinearlyInterpolatedGraph ( TGraph *  grIn,
Double_t  dt 
)

Make interpolated TGraph using linear interpolation between points.

Parameters
grInis the TGraph you want to interpolate.
dtis the time (in x-axis units of grIn) between points in grOut.
Returns
grOut, a new TGraph.

Definition at line 600 of file RootTools.cxx.

TGraph * RootTools::makeNormalized ( TGraph *  gr)

Creates new TGraph (leaving original unchanged) with mean = 0 & RMS = 1.

Create normalized copy of gr, where mean=0 and rms=1 (input unmodified).

Parameters
gris the TGraph you want to manipulate.

Definition at line 343 of file RootTools.cxx.

TGraph * RootTools::makeNormalized ( TGraph *  gr,
Double_t &  mean,
Double_t &  rms 
)

Create normalized copy of gr, where mean=0 and rms=1 (input unmodified).

Parameters
gris the TGraph you want to manipulate.
meanis a reference to a Double_t, updated with the mean value of gr.
rmsis a reference to a Double_t, updated with the rms value of gr.

Definition at line 362 of file RootTools.cxx.

TGraph * RootTools::makeSortedTGraph ( TTree *  tree,
TString  drawText,
TString  cutString,
Double_t  wrapValue 
)

Plot a time (or any TTree branch) ordered TGraph of some TTree branch.

Parameters
treeis a pointer to a TTree containing the variables to be plotted.
drawTextis passed to TTree->Draw() in order to plot the data points (e.g. "eventNumber:heading") for a plot of heading as a function of event number.
cutStringis passed to TTree->Draw() for selection (e.g. "eventNumber > 30000000")
wrapValuee.g. with wrapValue=360, if neighbouring points go 359->1 degrees, then draw them as 359->361. i.e. remove discontinuities.

Definition at line 490 of file RootTools.cxx.

TGraph * RootTools::makeUnwrappedCorrelationGraph ( TGraph *  gr)

Unwraps a circularly correlated graph so the -ve time lies behind the +ve time.

Parameters
gris the wrapped correlation graph.
Returns
Pointer to TGraph containing unwrapped correlation graph.

Definition at line 115 of file RootTools.cxx.

void RootTools::makeZaxisScaleEqualAboutZero ( TH2D *  h)

For nice plotting of 2D dists about 0, makes max = -min.

Parameters
his a 2D histogram

Definition at line 1218 of file RootTools.cxx.

void RootTools::multiplyTGraphYAxes ( Int_t  numGrs,
TGraph *  grs[],
Double_t  factors[] 
)

Multiples a set of factors to the y-axis values of each respective TGraph.

Parameters
numGrsis the length of both arrays.
grsis an array of pointers to TGraphs.
factorsan array of Double_ts to add to each x-axis point of the respective TGraph.

Assumes that both grs and factors point to arrays of length numGrs

Definition at line 809 of file RootTools.cxx.

void RootTools::normalize ( TGraph *  gr,
Double_t &  mean,
Double_t &  rms 
)

Modify gr to set mean=0 and rms=1.

Parameters
gris the TGraph you want to manipulate.
meanis a reference to a Double_t, updated with the mean value of gr before modification.
rmsis a reference to a Double_t, updated with the rms value of gr before modification.

Definition at line 323 of file RootTools.cxx.

void RootTools::normalize ( TGraph *  gr)

Modify gr to set mean=0 and rms=1.

Parameters
gris the TGraph you want to manipulate.

Definition at line 306 of file RootTools.cxx.

void RootTools::offsetTGraphXAxes ( Int_t  numGrs,
TGraph *  grs[],
Double_t  offsets[] 
)

Adds a set of offsets to the x-axis values of each respective TGraph.

Parameters
numGrsis the length of both arrays.
grsis a vector of pointers to TGraphs.
offsetsa vector of Double_ts to add to each x-axis point of the respective TGraph.

Assumes that both grs and offsets point to arrays of length numGrs

Definition at line 787 of file RootTools.cxx.

TH1D * RootTools::plotsZaxisDist ( TH2 *  h2,
TString  hName,
Int_t  nBins,
Double_t  xMin,
Double_t  xMax 
)

Put Z-axis values of a TH2D histogram into a TH1D histogram.

Parameters
h2is a pointer to the TH2D you want to examine.
hNameis a the name of the new histogram.
nBinsis the number of bins for the new histogram.
xMinis the x-axis minimum for the new histogram.
xMaxis the x-axis maximum for the new histogram.

Definition at line 553 of file RootTools.cxx.

void RootTools::printArray ( int  n,
double *  array,
TString  delimiter = ", ",
TString  start = "{",
TString  end = "}\n" 
)

Print all the elements of a c-styles array to the screen for debugging.

Parameters
nis the length of the array.
arrayis the first element of the array.
delimiteris for decoration, ", " by default, change as you please.
startis for decoration, "{" by default, change as you please.
endis for decoration, "}\n" by default, change as you please.

Definition at line 36 of file RootTools.cxx.

void RootTools::printTGraphInfo ( TGraph *  gr)

Print summary information about gr: name, title, number of points, all x and y values.

Parameters
gris the TGraph you want information about.

Definition at line 452 of file RootTools.cxx.

void RootTools::printXVals ( TGraph *  gr,
TString  delimiter = ", ",
TString  start = "{",
TString  end = "}\n" 
)

Print all the the x-axis values of a TGraph to the screen for debugging.

Parameters
gris the TGraph you want information about.
delimiteris for decoration, ", " by default, change as you please.
startis for decoration, "{" by default, change as you please.
endis for decoration, "}\n" by default, change as you please.
See also
RootTools::printArray(int n, double* array, TString delimiter, TString start ,TString end)

Definition at line 77 of file RootTools.cxx.

void RootTools::printYVals ( TGraph *  gr,
TString  delimiter = ", ",
TString  start = "{",
TString  end = "}\n" 
)

Print all the the y-axis values of a TGraph to the screen for debugging.

Parameters
gris the TGraph you want information about.
delimiteris for decoration, ", " by default, change as you please.
startis for decoration, "{" by default, change as you please.
endis for decoration, "}\n" by default, change as you please.
See also
RootTools::printArray(int n, double* array, TString delimiter, TString start ,TString end)

Definition at line 59 of file RootTools.cxx.

void RootTools::saveCanvas ( TCanvas *  c,
TString  fileName 
)

My function to save a TCanvas for talks, and save an editable version.

Parameters
cis a pointer to the TCanvas
fileNameis the file name. Note that suffixes are added in the function!

Definition at line 1078 of file RootTools.cxx.

void RootTools::setWhiteZeroColorScale ( )

Set color scale where white is in the middle.

You need to draw things with RootTools::draw2D(TH2D* hist, TString opt);

Definition at line 1277 of file RootTools.cxx.

void RootTools::subtractOffset ( TGraph *  gr,
Double_t  offset 
)

Subtract a constant value from the y-axis values at each point.

Parameters
gris the TGraph you want to manipulate.
offsetis the value to subtract from each point.

Definition at line 247 of file RootTools.cxx.

void RootTools::writeTGraph ( TGraph *  gr,
TString  name 
)

Sets the name of a TGraph to name and then writes it to the current file.

Parameters
gris a pointer to the TGraph you want to save.
nameis the name you want to give the TGraph before saving it.

Definition at line 970 of file RootTools.cxx.

void RootTools::zeroPadTGraph ( TGraph *  gr,
Int_t  newLen,
Double_t  dt = 0 
)

Add a bunch of zeros to the end of a TGraph.

Parameters
gris the TGraph you want to pad.
newLenis the desired length of gr.
dt

Definition at line 576 of file RootTools.cxx.