from PickleUtils import readFromPickle from SampleUtils import ModeAWhDbPar, ModeAWhDbReqid, ModeAWhDbMergedFake2Lreqid parser = optparse.OptionParser() parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="print more details about what is going on") (options, args) = parser.parse_args() verbose = options.verbose reqDb = ModeAWhDbReqid() parDb = ModeAWhDbPar() allMc1 = [float(m) for m in parDb.allMc1()] allMn1 = [float(m) for m in parDb.allMn1()] def roundup(val) : return round(float(val)+0.5) def rounddo(val) : return round(float(val)+0.0) mc1Range = {'min': rounddo(min(allMc1)), 'max' : roundup(max(allMc1))} mn1Range = {'min': rounddo(min(allMn1)), 'max' : roundup(max(allMn1))} histo2l = r.TH2F('mc1mn1_2lep_reqids', 'ReqIds for the WH 2lep grid ;mc_{1};mn_{1}', 50, float(mc1Range['min']), float(mc1Range['max']), 50, float(mn1Range['min']), float(mn1Range['max'])) histo2lnth = r.TH2F('mc1mn1_2lep_notauhad_reqids', 'ReqIds for the WH notauhad 2lep grid ;mc_{1};mn_{1}', 50, float(mc1Range['min']), float(mc1Range['max']), 50, float(mn1Range['min']), float(mn1Range['max'])) histo3l = r.TH2F('mc1mn1_3lep_reqids', 'ReqIds for the WH 3lep grid ;mc_{1};mn_{1}',
for sample, countsSel in countsBkgSampleSel.iteritems() : if sample in ['data', 'totbkg'] : continue for sel, counts in countsSel.iteritems() : if sel not in interestingSelections : continue print 'adding '+sample+' to '+sel+' ('+str(counts)+')' countBkgTot[sel] += counts print countBkgTot reqDb = ModeAWhDbReqid() parDb = ModeAWhDbPar() def selIsRelevant(sel) : return sel.startswith('sr') def selIsFinal(sel) : return sel in interestingSelections mc1Range = {'min': min(parDb.allMc1()), 'max' : max(parDb.allMc1())} mn1Range = {'min': min(parDb.allMn1()), 'max' : max(parDb.allMn1())} histos = dict() backgroundRelErr = 0.2 for sample, countsSel in countsSigSampleSel.iteritems() : mc1, mn1 = parDb.mc1Mn1ByReqid(reqDb.reqidBySample(sample)) print "%s (%.1f, %.1f) " % (sample, mc1, mn1) for sel, counts in sorted(countsSel.iteritems()) : if not selIsFinal(sel) : continue histo = histos[sel] if sel in histos else r.TH2F(sel+'_zn', sel+" Z_{n} (#deltab=%.2f);mc_{1};mn_{1}"%backgroundRelErr, 50, float(mc1Range['min']), float(mc1Range['max']), 50, float(mn1Range['min']), float(mn1Range['max'])) if sel not in histos : histos[sel] = histo sig, bkg, dBkg = counts, countBkgTot[sel], backgroundRelErr zn = r.RooStats.NumberCountingUtils.BinomialExpZ(sigScale*sig, bkg, dBkg)
print countBkgTot reqDb = ModeAWhDbReqid() parDb = ModeAWhDbPar() def selIsRelevant(sel): return sel.startswith('sr') def selIsFinal(sel): return sel in interestingSelections mc1Range = {'min': min(parDb.allMc1()), 'max': max(parDb.allMc1())} mn1Range = {'min': min(parDb.allMn1()), 'max': max(parDb.allMn1())} histos = dict() backgroundRelErr = 0.2 for sample, countsSel in countsSigSampleSel.iteritems(): mc1, mn1 = parDb.mc1Mn1ByReqid(reqDb.reqidBySample(sample)) print "%s (%.1f, %.1f) " % (sample, mc1, mn1) for sel, counts in sorted(countsSel.iteritems()): if not selIsFinal(sel): continue histo = histos[sel] if sel in histos else r.TH2F( sel + '_zn', sel + " Z_{n} (#deltab=%.2f);mc_{1};mn_{1}" % backgroundRelErr, 50, float(mc1Range['min']), float(mc1Range['max']), 50, float(mn1Range['min']), float(mn1Range['max'])) if sel not in histos: histos[sel] = histo sig, bkg, dBkg = counts, countBkgTot[sel], backgroundRelErr
parser = optparse.OptionParser() parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="print more details about what is going on") (options, args) = parser.parse_args() verbose = options.verbose reqDb = ModeAWhDbReqid() parDb = ModeAWhDbPar() allMc1 = [float(m) for m in parDb.allMc1()] allMn1 = [float(m) for m in parDb.allMn1()] def roundup(val): return round(float(val) + 0.5) def rounddo(val): return round(float(val) + 0.0) mc1Range = {'min': rounddo(min(allMc1)), 'max': roundup(max(allMc1))} mn1Range = {'min': rounddo(min(allMn1)), 'max': roundup(max(allMn1))} histo2l = r.TH2F('mc1mn1_2lep_reqids', 'ReqIds for the WH 2lep grid ;mc_{1};mn_{1}', 50,