![]() |
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... | |
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.
void RootTools::draw2D | ( | TH2D * | hist, |
TString | opt | ||
) |
Draw 2D histogram and set bin limits to be symmetrical about zero.
hist | is the TH2D* to draw. |
opt | is 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.
hs | is a pointer to an array of pointers to the histograms. |
numHists | is the number of histograms. |
can | is the TCanvas to draw on, if one is not given a new one is created. |
colWeights | is a pointer to a Double_t array, which will weight to colors drawn. |
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.
grs | is a pointer to an array of pointers to the TGraphs. |
numGrs | is the number of TGraphs. |
can | is the TCanvas to draw on, if one is not given a new one is created. |
drawOpt | is the draw option, select "p" for markers and "l" for lines. |
colWeights | is a pointer to an array of doubles to be used as weights for colors. |
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.
numHists | is, 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 |
drawOpt | is the draw option in ROOT, e.g. "e" for error bars. |
statsOption | sets 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.
firstRun | is the first run. |
lastRun | is the last run. |
pat | a 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).
pol | is the polarization |
antInd | is 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.
bitIndex | is the bit to get (count from 0) |
bitMask | is 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.
index | is the numerator of the fraction |
maxVal | is 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.
angle1 | is the first angle |
angle2 | is the second angle |
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.
h | is a histogram |
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.
firstRun | is the first run. |
lastRun | is the last run. |
headPtr | a 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).
len | is the length of arr. |
arr | is a pointer to an array of doubles of length len. |
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)
gr | is the TGraph you want information about. |
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.
gr | is the TGraph you want information about. |
maxY | is a reference to a Double_t, updated with the local maximum y-axis value of the TGraph. |
maxX | is a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph. |
minY | is a reference to a Double_t, updated with the local minimum y-axis value of the TGraph. |
minX | is 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.
gr | is the TGraph you want information about. |
maxY | is a reference to a Double_t, updated with the local maximum y-axis value of the TGraph. |
maxX | is a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph. |
minY | is a reference to a Double_t, updated with the local minimum y-axis value of the TGraph. |
minX | is a reference to a Double_t, updated with the x-axis value at the minY of the TGraph. |
lowerLimit | is a Double_t containing the lower value of the x-axis to search from. |
upperLimit | is 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.
h | is a histogram |
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.
gr | is the TGraph you want information about. |
maxY | is a reference to a Double_t, updated with the maximum y-axis value of the TGraph. |
minY | is 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.
gr | is the TGraph you want information about. |
maxY | is a reference to a Double_t, updated with the maximum y-axis value of the TGraph. |
maxX | is a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph. |
minY | is a reference to a Double_t, updated with the minimum y-axis value of the TGraph. |
minX | is 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.
gr | is the TGraph you want information about. |
maxY | is a reference to a Double_t, updated with the maximum y-axis value of the TGraph. |
maxX | is a reference to a Double_t, updated with the x-axis value at the maxY of the TGraph. |
minY | is a reference to a Double_t, updated with the minimum y-axis value of the TGraph. |
minX | is a reference to a Double_t, updated with the x-axis value at the minY of the TGraph. |
lowerLimit | is a Double_t containing the lower value of the x-axis to search from. |
upperLimit | is 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.
gr | is the TGraph you want information about. |
mean | is a reference to a Double_t, updated with the mean value of gr before modification. |
rms | is 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.
numBitsToCheck | is the number of little endian bits to check. |
bitMask | is 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.
h | is a histogram |
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.
hist | is a histogram |
binx | is a reference to the x-axis bin number (in ROOT bin counting starts at 1) |
biny | is a reference to the y-axis bin number (in ROOT bin counting starts at 1) |
Definition at line 1169 of file RootTools.cxx.
Double_t RootTools::getSumOfYVals | ( | TGraph * | gr | ) |
Adds up all y-axis values of input TGraph.
gr | is the TGraph you want to sum the y-axis values of. |
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.
grIn | points to the TGraph containing the waveform to interpolate |
startTime | is the start time for interpolation: zero pads if this is earlier than the TGraph start time. |
dt | is the time between samples |
nSamp | is 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.
gr | is the TGraph from which to make the derivative |
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)
grs | is a pointer to an array of pointers to the TGraphs. |
numGrs | is the number of TGraphs. |
titles | is an array of TStrings containing the titles |
opt | is the legend option ("l" by default) |
minX | is the Pad coordinates, 0.8 by default. |
minY | is the Pad coordinates, 0.8 by default. |
maxX | is the Pad coordinates, 1 by default. |
maxY | is the Pad coordinates, 1 by default. |
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).
hs | is a pointer to an array of pointers to the histograms (TH1Ds). |
numHists | is the number of histgorams in the array hs. |
titles | is an array of TStrings containing the titles |
opt | is the legend option ("l" by default) |
minX | is the Pad coordinates, 0.8 by default. |
minY | is the Pad coordinates, 0.8 by default. |
maxX | is the Pad coordinates, 1 by default. |
maxY | is the Pad coordinates, 1 by default. |
Definition at line 945 of file RootTools.cxx.
TGraph * RootTools::makeLinearlyInterpolatedGraph | ( | TGraph * | grIn, |
Double_t | dt | ||
) |
Make interpolated TGraph using linear interpolation between points.
grIn | is the TGraph you want to interpolate. |
dt | is the time (in x-axis units of grIn) between points in grOut. |
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).
gr | is 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).
gr | is the TGraph you want to manipulate. |
mean | is a reference to a Double_t, updated with the mean value of gr. |
rms | is 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.
tree | is a pointer to a TTree containing the variables to be plotted. |
drawText | is 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. |
cutString | is passed to TTree->Draw() for selection (e.g. "eventNumber > 30000000") |
wrapValue | e.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.
gr | is the wrapped 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.
h | is 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.
numGrs | is the length of both arrays. |
grs | is an array of pointers to TGraphs. |
factors | an 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.
gr | is the TGraph you want to manipulate. |
mean | is a reference to a Double_t, updated with the mean value of gr before modification. |
rms | is 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.
gr | is 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.
numGrs | is the length of both arrays. |
grs | is a vector of pointers to TGraphs. |
offsets | a 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.
h2 | is a pointer to the TH2D you want to examine. |
hName | is a the name of the new histogram. |
nBins | is the number of bins for the new histogram. |
xMin | is the x-axis minimum for the new histogram. |
xMax | is 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.
n | is the length of the array. |
array | is the first element of the array. |
delimiter | is for decoration, ", " by default, change as you please. |
start | is for decoration, "{" by default, change as you please. |
end | is 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.
gr | is 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.
gr | is the TGraph you want information about. |
delimiter | is for decoration, ", " by default, change as you please. |
start | is for decoration, "{" by default, change as you please. |
end | is for decoration, "}\n" by default, change as you please. |
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.
gr | is the TGraph you want information about. |
delimiter | is for decoration, ", " by default, change as you please. |
start | is for decoration, "{" by default, change as you please. |
end | is for decoration, "}\n" by default, change as you please. |
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.
c | is a pointer to the TCanvas |
fileName | is 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.
gr | is the TGraph you want to manipulate. |
offset | is 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.
gr | is a pointer to the TGraph you want to save. |
name | is 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.
gr | is the TGraph you want to pad. |
newLen | is the desired length of gr. |
dt |
Definition at line 576 of file RootTools.cxx.