type='float', help="scale the signal yield by this factor (default %.1f)" % defaultSigScale) 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() sigInputFname = options.sig bkgInputFname = options.bkg sigScale = options.sigScale verbose = options.verbose countsSigSampleSel = readFromPickle(sigInputFname) countsBkgSampleSel = readFromPickle(bkgInputFname) interestingSelections = ["sr%d" % i for i in range(6, 9 + 1)] countBkgTot = collections.defaultdict(float) 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()
# default parameters [end] ######### parser = optparse.OptionParser() parser.add_option("--sig-veto", dest="sigve", default=defaultSigVetoPickle, help="file with signal counts with veto, default : %s" % defaultSigVetoPickle) parser.add_option("--sig-nove", dest="signv", default=defaultSigNovePickle, help="file with signal counts with veto, default : %s" % defaultSigNovePickle) 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() sigInVetoFname = options.sigve sigInNoveFname = options.signv verbose = options.verbose countsSigVetoSampleSel = readFromPickle(sigInVetoFname) countsSigNoveSampleSel = readFromPickle(sigInNoveFname) reqDb = ModeAWhDbReqid() parDb = ModeAWhDbPar() def selIsRelevant(sel) : return any([sel.startswith(s) for s in ['sr6','sr7','sr8','sr9']]) def selIsBase(sel) : return 'base' in sel def selIsFinal(sel) : return sel in ['sr6','sr7','sr8','sr9'] def getBaseSel(sel) : return re.search('(sr\d+)', sel).group(1)+'base' def nicefySelectionName(s) : return s.replace('eq2j', ' N_{j}==2')\ .replace('ge2j', ' N_{j}>=2')\ .replace('ge3j', ' N_{j}>=3')\ .replace('Nfv', ' no fw-jet veto')
parser = optparse.OptionParser() parser.add_option("-s", "--sig-file", dest="sig", default=defaultSigPickle, help="file with signal counts, default : %s" % defaultSigPickle) parser.add_option("-b", "--bkg-file", dest="bkg", default=defaultBkgPickle, help="file with background counts, default : %s" % defaultBkgPickle) parser.add_option("-S", "--scale-sig", dest="sigScale", default=defaultSigScale, type='float', help="scale the signal yield by this factor (default %.1f)" % defaultSigScale) 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() sigInputFname = options.sig bkgInputFname = options.bkg sigScale = options.sigScale verbose = options.verbose countsSigSampleSel = readFromPickle(sigInputFname) countsBkgSampleSel = readFromPickle(bkgInputFname) interestingSelections = ["sr%d"%i for i in range(6,9+1)] countBkgTot = collections.defaultdict(float) 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')