def plotPU(category): MJArray = [ 200., 230., 260.0, 290.0, 320.0, 350.0, 390.0, 430.0, 470.0, 510.0, 550.0, 590.0, 640.0, 690.0, 740.0, 790.0, 840.0, 900.0, 960.0, 1020.0, 1090.0, 1160.0, 1250.0 ] MVArray = [250, 300, 350, 400, 500, 600, 1000] theArray = MJArray if category == 'monoV': theArray = MVArray plotter.ResetWeight() plotter.AddWeight(cuts.cut(category, 'signal') + '* (mcWeight)') plotter.AddWeight(cuts.cut(category, 'signal') + '* (mcWeight * puWeight)') plotter.AddWeight( cuts.cut(category, 'signal') + '* (mcWeight * puWeightOff)') plotter.SetDefaultExpr('met') plotter.MakeCanvas('~/www/plots/160314/' + category, len(theArray) - 1, array('d', theArray), 'MET [GeV]', 'Events/GeV', True) plotter.SetDefaultExpr('npv') plotter.MakeCanvas('~/www/plots/160314/NPV_' + category, 30, 0, 30, 'NPV', 'Events', False)
def MakePlot(args): holding = list(args) expr = args[0] holding[0] = outDir + 'VBFStudy_' + expr plotter.SetDefaultWeight( Nminus1Cut( cuts.cut('monoJet_inc', 'signal') + '*(' + cuts.METTrigger + ' * mcWeight * XSecWeight * puWeight * zkfactor * ewk_z)', expr)) plotter.SetDefaultExpr(expr) plotter.MakeCanvas(*holding)
plotter.AddTree(aFile.Get('events')) plotter.AddTree(cChain) plotter.SetRatioIndex(0) #plotter.SetNormalizedHists(True) plotter.AddWeight('(fatjet1Pt > 0) * mcWeight * 2.450') plotter.AddWeight('(fatjet1Pt > 0) * mcWeight * 2.058') plotter.AddLegendEntry('Axial 2000 #rightarrow 50 80X', 1, 2, 1) plotter.AddLegendEntry('Axial 2000 #rightarrow 50 74X', 2, 2, 2) plotter.SetLegendLocation(plotter.kUpper, plotter.kRight, 0.4, 0.3) plotter.SetDefaultExpr('fatjet1Pt') plotter.MakeCanvas('~/www/plots/160728/compare_releases_pT', 30, 250, 1000, "p_{T} [GeV]", "A.U.") plotter.SetDefaultExpr('fatjet1PrunedM') plotter.MakeCanvas('~/www/plots/160728/compare_releases_masspruned', 20, 0, 200, "m_{pruned} [GeV]", "A.U.") plotter.SetDefaultExpr('fatjet1Mass') plotter.MakeCanvas('~/www/plots/160728/compare_releases_mass', 25, 0, 250, "m_{raw} [GeV]", "A.U.") plotter.SetDefaultExpr('met') plotter.MakeCanvas('~/www/plots/160728/compare_releases_met', 30, 250, 1000, "E_{T}^{miss} [GeV]", "A.U.") plotter.SetLegendLocation(plotter.kUpper, plotter.kLeft, 0.4, 0.3) plotter.SetDefaultExpr('fatjet1tau21') plotter.MakeCanvas('~/www/plots/160728/compare_releases_tau21', 24, -0.2, 1.0, "#tau_{2}/#tau_{1}", "A.U.")
outDir = '~/www/plots/' + os.environ['CROMBIEDATE'] + '/' gammaMCFile = TFile(directory + 'merged/monojet_GJets.root') print gammaMCFile.GetName() zeeMCFile = TFile(directory + 'merged/monojet_DY.root') print zeeMCFile.GetName() dataFile = TFile(directory + 'monojet_Data.root') print dataFile.GetName() xArray = [200, 250, 300, 350, 400, 500, 600, 1000] plotter.SetLumiLabel('2.24') plotter.SetIsCMSPrelim(True) plotter.SetLegendLocation(plotter.kUpper, plotter.kRight) plotter.SetDefaultExpr('met') plotter.SetEventsPer(1.0) plotter.SetAxisMinMax(0.0, 0.12) plotter.SetRatioMinMax(0.0, 2.0) plotter.AddTreeWeight(zeeMCFile.events, '(' + cuts.ZeeMJ + ')*mcFactors*XSecWeight') plotter.AddTreeWeight(dataFile.events, cuts.ZeeMJ) zPlots = plotter.MakeHists(len(xArray) - 1, array('d', xArray)) plotter.ResetTree() plotter.ResetWeight() plotter.AddTreeWeight(gammaMCFile.events, '(' + cuts.gjetMJ + ')*mcFactors*XSecWeight')
from CrombieTools.PlotTools.PlotHists import plotter from CrombieTools.PlotTools import AddOutDir from ROOT import TFile directory = '/data/t3home000/dabercro/hbb/compare/wjets/' nlo_file = TFile(directory + 'WJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8.root') lo_file = TFile(directory + 'WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM-pythia8.root') nlobinned_file = TFile(directory + 'WJetsToLNu_Pt.root') lobinned_file = TFile(directory + 'WJetsToLNu_HT.root') plotter.SetDefaultExpr('genboson_pt') plotter.SetDefaultWeight('genboson * mc_weight * XSecWeight') plotter.AddTree(nlo_file.Get('events')) plotter.AddTree(nlobinned_file.Get('events')) plotter.AddTree(lo_file.Get('events')) plotter.AddTree(lobinned_file.Get('events')) plotter.AddLegendEntry('NLO', 1, 2, 1) plotter.AddLegendEntry('NLO binned', 3, 2, 1) plotter.AddLegendEntry('LO', 2, 2, 1) plotter.AddLegendEntry('LO binned', 4, 2, 1) plotter.SetMakeRatio(True) plotter.SetRatioIndex(3)
#!/usr/bin/env python from CrombieTools.PlotTools.PlotHists import plotter from ROOT import TFile theFile = TFile('signalTest.root') plotter.SetDefaultTree(theFile.Get('events')) plotter.SetDefaultExpr('fatjetPrunedML2L3') weight = 'fatjetPt > 250 && n_looselep == 0 && n_loosepho == 0 && n_bjetsLoose == 0 && met > 250' plotter.AddWeight(weight) plotter.AddWeight(weight + ' && fatjetDRWq2 > 0 && fatjetDRWq1 > 0.8') plotter.AddWeight(weight + ' && fatjetDRWq2 > 0.8 && fatjetDRWq1 > 0.8') plotter.AddLegendEntry('All',1) plotter.AddLegendEntry('Part of W',2) plotter.AddLegendEntry('Not Matching W',4) plotter.MakeCanvas("plots/fatjetPrunedMx",25,0,150,"m_{pruned} [GeV]","A.U.")
#!/usr/bin/env python from CrombieTools.PlotTools.PlotHists import plotter from ROOT import TFile directory = '/Users/dabercro/GradSchool/Summer16/Skim_160622/' theFile = TFile(directory + 'wscale_TTJets_SingleLeptFromT.root') plotter.SetDefaultExpr('topPtReweighting') plotter.SetDefaultTree(theFile.Get('events')) plotter.AddWeight( 'fatjetPt > 250 && thirdFatMass < 50 && n_tightlep == 1 && n_looselep == 1 && n_bjetsLoose > 0 && fatjetDRLooseB > 0.8 && fatjetDRLooseB < 1.2 && fatjetDPhiLep1 > 2.0 && ((n_jetsNotFat == 3 && fatjet2Pt < 0) || (n_jetsNotFat == 2)) && n_tightlep == 1 && n_looselep == 1 && fatjet1DRGenW < 0.2' ) plotter.AddWeight( 'fatjetPt > 250 && thirdFatMass < 50 && n_tightlep == 1 && n_looselep == 1 && n_bjetsLoose > 0 && fatjetDRLooseB > 0.8 && fatjetDRLooseB < 1.2 && fatjetDPhiLep1 > 2.0 && n_tightlep == 1 && n_looselep == 1 && fatjet1DRGenW < 0.2' ) plotter.AddLegendEntry('With n_{jets} cut', 1) plotter.AddLegendEntry('Without that cut', 2) plotter.SetRatioIndex(1) plotter.MakeCanvas("topPtWeight", 50, 0.75, 1.2, "top p_{T} reweighting", "A.U.")