MPF.pyrootHelpers module

Set of utility functions used in the plotting scripts

class MPF.pyrootHelpers.SolarizedColors[source]
blue = <Mock name='mock.GetColor()' id='140254955486032'>
cyan = <Mock name='mock.GetColor()' id='140254955486480'>
green = <Mock name='mock.GetColor()' id='140254955486928'>
magenta = <Mock name='mock.GetColor()' id='140254955485264'>
orange = <Mock name='mock.GetColor()' id='140254955484368'>
red = <Mock name='mock.GetColor()' id='140254955484816'>
violet = <Mock name='mock.GetColor()' id='140254955485584'>
yellow = <Mock name='mock.GetColor()' id='140254955483984'>
class MPF.pyrootHelpers.TangoColors[source]
blue1 = <Mock name='mock.GetColor()' id='140254955570704'>
blue2 = <Mock name='mock.GetColor()' id='140254955571152'>
blue3 = <Mock name='mock.GetColor()' id='140254955571600'>
butter1 = <Mock name='mock.GetColor()' id='140254955507920'>
butter2 = <Mock name='mock.GetColor()' id='140254955508368'>
butter3 = <Mock name='mock.GetColor()' id='140254955508816'>
chocolate1 = <Mock name='mock.GetColor()' id='140254955510608'>
chocolate2 = <Mock name='mock.GetColor()' id='140254955511056'>
chocolate3 = <Mock name='mock.GetColor()' id='140254955511504'>
dark1 = <Mock name='mock.GetColor()' id='140254956956496'>
dark2 = <Mock name='mock.GetColor()' id='140254956956944'>
dark3 = <Mock name='mock.GetColor()' id='140254956957392'>
green1 = <Mock name='mock.GetColor()' id='140254955569360'>
green2 = <Mock name='mock.GetColor()' id='140254955569808'>
green3 = <Mock name='mock.GetColor()' id='140254955570256'>
grey1 = <Mock name='mock.GetColor()' id='140254956955152'>
grey2 = <Mock name='mock.GetColor()' id='140254956955600'>
grey3 = <Mock name='mock.GetColor()' id='140254956956048'>
orange1 = <Mock name='mock.GetColor()' id='140254955509264'>
orange2 = <Mock name='mock.GetColor()' id='140254955509712'>
orange3 = <Mock name='mock.GetColor()' id='140254955510160'>
plum1 = <Mock name='mock.GetColor()' id='140254955572048'>
plum2 = <Mock name='mock.GetColor()' id='140254955572496'>
plum3 = <Mock name='mock.GetColor()' id='140254955572944'>
red1 = <Mock name='mock.GetColor()' id='140254956953808'>
red2 = <Mock name='mock.GetColor()' id='140254956954256'>
red3 = <Mock name='mock.GetColor()' id='140254956954704'>
MPF.pyrootHelpers.addOverflowToLastBin(hist)[source]
MPF.pyrootHelpers.calcPoissonCLLower(q, obs)[source]

Calculate lower confidence limit e.g. to calculate the 68% lower limit for 2 observed events: calcPoissonCLLower(0.68, 2.) cf. plot_data_Poisson.C

MPF.pyrootHelpers.calcPoissonCLUpper(q, obs)[source]

Calculate upper confidence limit e.g. to calculate the 68% upper limit for 2 observed events: calcPoissonCLUpper(0.68, 2.)

MPF.pyrootHelpers.calculateMarginMaximum(relMargin, minimum, maximum, logy=False)[source]

Calculate a new maximum for the given range, taking into account a relative top margin inside the pad

Parameters:
  • relMargin – relative top margin inside the pad - for example 0.2 will leave 20% space to the top
  • minimum – minimum to be used on the y-axis
  • maximum – histograms current maximum
  • logy – calculate for log scale?
MPF.pyrootHelpers.getBranchNames(tree)[source]
MPF.pyrootHelpers.getExpCLsAsimov(s, b, db)[source]

Calculate the expected CLs (CLs=p_(s+b)/p_b) value based on the asymptotic approximation. See Eur.Phys.J.C71, arXiv:1007.1727 (“CCGV paper”) for the formulas. The derivation follows the same procedure as described for p0 in <http://www.pp.rhul.ac.uk/~cowan/stat/medsig/medsigNote.pdf>

MPF.pyrootHelpers.getHistFromYieldsDict(yieldsDict)[source]

Fills a histogram from a dictionary - keys will be the labels - the values can be given as a tuple (rawYield, yield, error) or (yield, error) or just a yield.

MPF.pyrootHelpers.getIntegralAndError(hist)[source]
MPF.pyrootHelpers.getMergedHist(hists)[source]

returns a merged histogram

MPF.pyrootHelpers.getMergedYieldsDict(*yieldsDicts)[source]
MPF.pyrootHelpers.getMinMaxWithErrors(*histsOrStack, **kwargs)[source]
MPF.pyrootHelpers.getRelErrHist(hist)[source]
MPF.pyrootHelpers.getTreeNames(tFile, getAll=False)[source]
MPF.pyrootHelpers.getTreeNamesFromFile(fileName, getAll=False)[source]
MPF.pyrootHelpers.histFromGraph(g)[source]

Convert a TGraphAsymmErrors to a histogram. If asymmetric errors are given, they are symmetrised. The bin boundaries are determined by the x-errors

MPF.pyrootHelpers.pdfUnite(pathList, outputfile)[source]
MPF.pyrootHelpers.pdfUniteOrMove(pathList, outputfile)[source]
MPF.pyrootHelpers.rootStyleColor(color)[source]

function to convert different color expressions to the standard ROOT int

MPF.pyrootHelpers.scaleYieldsDict(yieldsDict, factor)[source]
MPF.pyrootHelpers.setBatchMode()[source]

Set ROOT to batch and ignore command line options

MPF.pyrootHelpers.tempNameGenerator()[source]
MPF.pyrootHelpers.yieldBinNumbers(hist, overFlow=False, underFlow=False)[source]
MPF.pyrootHelpers.yieldColors()[source]