processNames=regions.itervalues().next().samples, debugLevel=debugLevel) sfVars = ("MR_NoPho","Rsq_NoPho") sfNJetsFile = rt.TFile.Open( "data/ScaleFactors/RazorMADD2015/RazorNJetsScaleFactors_%s.root"%(tag)) sfHists['NJetsInv'] = sfNJetsFile.Get("GJetsInvScaleFactors") razorWeights.loadPhotonPurityHists(sfHists, tag, debugLevel) for region in regionsOrder: analysis = regions[region] print "\nRegion:",region,"\n" #make output directory outdir = 'Plots/'+tag+'/'+region os.system('mkdir -p '+outdir) #set up analysis (xbins,cols) = analysis.unrollBins auxSFs = razorWeights.getNJetsSFs(analysis, jetName=analysis.jetVar) razorWeights.getPhotonPuritySFs(auxSFs) #perform analysis hists = makeControlSampleHistsForAnalysis( analysis, plotOpts=plotOpts, sfHists=sfHists, sfVars=sfVars, printdir=outdir, auxSFs=auxSFs, btags=analysis.nbMin, dataDrivenQCD=True, debugLevel=debugLevel, noFill=args.noFill ) #compute scale factors appendScaleFactors( region+"MR", hists, sfHists, lumiData=analysis.lumi, var="MR_NoPho", debugLevel=debugLevel, signifThreshold=1.0, printdir=outdir ) appendScaleFactors( region+"Rsq", hists, sfHists, lumiData=analysis.lumi, var="Rsq_NoPho", debugLevel=debugLevel, signifThreshold=1.0, printdir=outdir ) #export histograms macro.exportHists( hists, outFileName='controlHistograms'+region+'.root', outDir=outdir, debugLevel=debugLevel ) if not args.noSave: #write out scale factors outfile = rt.TFile(
sfVars = ("MR_NoPho", "Rsq_NoPho") sfNJetsFile = rt.TFile.Open( "data/ScaleFactors/RazorMADD2015/RazorNJetsScaleFactors_%s.root" % (tag)) sfHists['NJetsInv'] = sfNJetsFile.Get("GJetsInvScaleFactors") razorWeights.loadPhotonPurityHists(sfHists, tag, debugLevel) for region in regionsOrder: analysis = regions[region] print "\nRegion:", region, "\n" #make output directory outdir = 'Plots/' + tag + '/' + region os.system('mkdir -p ' + outdir) #set up analysis (xbins, cols) = analysis.unrollBins auxSFs = razorWeights.getNJetsSFs(analysis, jetName=analysis.jetVar) razorWeights.getPhotonPuritySFs(auxSFs) #perform analysis hists = makeControlSampleHistsForAnalysis(analysis, plotOpts=plotOpts, sfHists=sfHists, sfVars=sfVars, printdir=outdir, auxSFs=auxSFs, btags=analysis.nbMin, dataDrivenQCD=True, debugLevel=debugLevel, noFill=args.noFill) #compute scale factors appendScaleFactors(region + "MR", hists, sfHists,
outdir = 'Plots/'+tag+'/'+region if args.noSave: outdir += '_Test' if args.deltaPhiCut: outdir += '_DPhiCut' if args.njets80Cut: outdir += '_NJets80Cut' os.system('mkdir -p '+outdir) #get correct variable names sfVars = ("MR","Rsq") if region == "GJetsInv": sfVars = ("MR_NoPho","Rsq_NoPho") elif "Inv" in region: sfVars = ("MR_NoW", "Rsq_NoW") #QCD estimate for photon region if region == 'GJetsInv': dataDrivenQCD = True auxSFs = razorWeights.getPhotonPuritySFs() razorWeights.loadPhotonPurityHists(sfHists, tag, debugLevel) else: dataDrivenQCD = False auxSFs = {} #optionally cut on dPhi if args.deltaPhiCut: dPhiVar = "dPhiRazor" if region == 'GJetsInv': dPhiVar += '_NoPho' analysis.cutsData += " && abs(%s) < 2.8"%(dPhiVar) analysis.cutsMC += " && abs(%s) < 2.8"%(dPhiVar) if args.njets80Cut: njets80Var = "NJets80" if region == 'GJetsInv': njets80Var += '_NoPho'
outdir = 'Plots/' + tag + '/' + region if args.noSave: outdir += '_Test' if args.deltaPhiCut: outdir += '_DPhiCut' if args.njets80Cut: outdir += '_NJets80Cut' os.system('mkdir -p ' + outdir) #get correct variable names sfVars = ("MR", "Rsq") if region == "GJetsInv": sfVars = ("MR_NoPho", "Rsq_NoPho") elif "Inv" in region: sfVars = ("MR_NoW", "Rsq_NoW") #QCD estimate for photon region if region == 'GJetsInv': dataDrivenQCD = True auxSFs = razorWeights.getPhotonPuritySFs() razorWeights.loadPhotonPurityHists(sfHists, tag, debugLevel) else: dataDrivenQCD = False auxSFs = {} #optionally cut on dPhi if args.deltaPhiCut: dPhiVar = "dPhiRazor" if region == 'GJetsInv': dPhiVar += '_NoPho' analysis.cutsData += " && abs(%s) < 2.8" % (dPhiVar) analysis.cutsMC += " && abs(%s) < 2.8" % (dPhiVar) if args.njets80Cut: njets80Var = "NJets80" if region == 'GJetsInv': njets80Var += '_NoPho'