Ejemplo n.º 1
0
def distribution(tree, name, nbins=10, min=-0.7, max=1):
    
    h = TH1F(name, ';VBF mva', nbins, min, max)
    h.Sumw2()
    tree.Project(name, 'VBF_mva', '(VBF_mva>-0.7)*weight')
    h.Scale(1/h.Integral())
    if name is 'WJets':
        sBlue.formatHisto(h)
    elif name is 'zdata':
        sRed.formatHisto(h)   
    return h 
Ejemplo n.º 2
0
    from ROOT import TH1F, TCanvas, gPad
    from CMGTools.RootTools.Style import sBlue, sGreen, sRed, sData, formatPad

    plot = DataMCPlot('plot')

    mult = 10000
    h1 = TH1F('h1', 'h1', 100, -5, 5)
    h1.FillRandom('gaus', 1 * mult)
    h2 = TH1F('h2', 'h2', 100, -5, 5)
    h2.FillRandom('pol0', 1 * mult)
    h3 = TH1F('h3', 'h3', 100, -5, 5)
    h3.FillRandom('pol0', 1 * mult)

    sBlue.formatHisto(h1)
    sGreen.formatHisto(h2)
    sRed.formatHisto(h3)

    plot.AddHistogram('signal', h1)
    plot.AddHistogram('bgd1', h2)
    plot.AddHistogram('bgd2', h3)

    plot.Hist('signal').layer = 4
    plot.Hist('bgd1').layer = 1
    plot.Hist('bgd2').layer = 2

    h4 = TH1F('h4', 'h4', 100, -5, 5)
    h4.Sumw2()
    sData.formatHisto(h4)

    plot._BuildStack(plot.histos)
    dataModel = plot.stack.totalHist.obj
Ejemplo n.º 3
0
    from ROOT import TH1F, TCanvas, gPad
    from CMGTools.RootTools.Style import sBlue, sGreen, sRed, sData, formatPad

    plot = DataMCPlot('plot')

    mult = 10000
    h1 = TH1F('h1','h1', 100,-5,5)
    h1.FillRandom('gaus', 1*mult )
    h2 = TH1F('h2','h2', 100,-5,5)
    h2.FillRandom('pol0', 1*mult )
    h3 = TH1F('h3','h3', 100,-5,5)
    h3.FillRandom('pol0', 1*mult )    

    sBlue.formatHisto(h1)
    sGreen.formatHisto(h2)
    sRed.formatHisto(h3)
    
    plot.AddHistogram('signal', h1)
    plot.AddHistogram('bgd1', h2)
    plot.AddHistogram('bgd2', h3)

    plot.Hist('signal').layer = 4
    plot.Hist('bgd1').layer = 1
    plot.Hist('bgd2').layer = 2

    
    h4 = TH1F('h4','h4', 100,-5,5)
    h4.Sumw2()
    sData.formatHisto(h4)

    plot._BuildStack(plot.histos)