execfile('plotter_config_ELE.txt') ZJets.addCorrectionFactor(SF_Zjets, 'efakecorr') ##### Add Signal Samples, for all the mass points in one input file############ sigPlotters = [] sigSamples = ["step1p5_SMS-T6ttZg"] sigin = ROOT.TFile.Open(indir + '/' + sigSamples[0] + '.root') scanpoints = [[600, 200, ROOT.kRed, 'T6ttZg(600_200)'], [800, 400, ROOT.kBlue, 'T6ttZg(800_400)']] for sample in sigSamples: for mass in scanpoints: mstop = mass[0] mnlsp = mass[1] # sigPlotters.append(TreePlotter(sample+"_Mst"+str(mstop)+"_Mnl"+str(mnlsp), indir+'/'+sample+'.root',tree)) sigPlotters.append( TreePlotter("SMS_T6ttZg_Mst" + str(mstop) + "_Mnl" + str(mnlsp), indir + '/' + sample + '.root', tree)) sigPlotters[-1].addCorrectionFactor("1./BTotalScanpointEventsNumber", 'norm') sigPlotters[-1].addCorrectionFactor( '(BlheStopMass==' + str(mstop) + ')*(BlheNLSPMass==' + str(mnlsp) + ')', 'masspoint') sigPlotters[-1].addCorrectionFactor('Bstopxsec', 'xsec') sigPlotters[-1].addCorrectionFactor('Bnlspdecayweight', 'br') sigPlotters[-1].setAlias("BphoWeight", "(1*1.)") # sigPlotters[-1].addCorrectionFactor('genWeight','genWeight') # sigPlotters[-1].addCorrectionFactor(puWeight,'puWeight') # sigPlotters[-1].addCorrectionFactor(lepsf,'lepsf') # sigPlotters[-1].addCorrectionFactor(mc_scale,'mc_scale') sigPlotters[-1].setFillProperties(0, ROOT.kWhite) ####################################
def __init__(self, indir="../AnalysisRegion", LogY=True, doRatio=True, addSig=True, addData=True, doElMu=False): if doElMu: lepsf = 'elmununu_l1_l1_lepsf*elmununu_l1_l2_lepsf' else: lepsf = 'llnunu_l1_l1_lepsf*llnunu_l1_l2_lepsf' #######----------- Prepare samples to plot: zjetsPlotters = [] #zjetsSamples = ['DYJetsToLL_M50_HT100to200','DYJetsToLL_M50_HT200to400','DYJetsToLL_M50_HT400to600','DYJetsToLL_M50_HT600toInf'] #zjetsSamples = ['DYJetsToLL_M50','DYJetsToLL_M50_Ext'] zjetsSamples = ['DYJetsToLL_M50_BIG'] # M50_BIG = M50 + M50_Ext for sample in zjetsSamples: zjetsPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) zjetsPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') #zjetsPlotters[-1].addCorrectionFactor('xsec','tree') zjetsPlotters[-1].addCorrectionFactor('(1921.8*3)', 'xsec') zjetsPlotters[-1].addCorrectionFactor('genWeight', 'tree') zjetsPlotters[-1].addCorrectionFactor('puWeight', 'tree') zjetsPlotters[-1].addCorrectionFactor('triggersf', 'tree') zjetsPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.ZJets = MergedPlotter(zjetsPlotters) self.ZJets.setFillProperties(1001, ROOT.kGreen + 2) wwPlotters = [] wwSamples = ['WWTo2L2Nu', 'WWToLNuQQ', 'WZTo1L1Nu2Q'] for sample in wwSamples: wwPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) wwPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') wwPlotters[-1].addCorrectionFactor('xsec', 'tree') wwPlotters[-1].addCorrectionFactor('genWeight', 'tree') wwPlotters[-1].addCorrectionFactor('puWeight', 'tree') wwPlotters[-1].addCorrectionFactor('triggersf', 'tree') wwPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.WW = MergedPlotter(wwPlotters) self.WW.setFillProperties(1001, ROOT.kOrange) vvPlotters = [] vvSamples = ['WZTo2L2Q', 'WZTo3LNu', 'ZZTo2L2Nu', 'ZZTo2L2Q', 'ZZTo4L'] for sample in vvSamples: vvPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) vvPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') vvPlotters[-1].addCorrectionFactor('xsec', 'tree') vvPlotters[-1].addCorrectionFactor('genWeight', 'tree') vvPlotters[-1].addCorrectionFactor('puWeight', 'tree') vvPlotters[-1].addCorrectionFactor('triggersf', 'tree') vvPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.VV = MergedPlotter(vvPlotters) self.VV.setFillProperties(1001, ROOT.kMagenta) wjetsPlotters = [] wjetsSamples = ['WJetsToLNu'] for sample in wjetsSamples: wjetsPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) wjetsPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') wjetsPlotters[-1].addCorrectionFactor('xsec', 'tree') wjetsPlotters[-1].addCorrectionFactor('genWeight', 'tree') wjetsPlotters[-1].addCorrectionFactor('puWeight', 'tree') wjetsPlotters[-1].addCorrectionFactor('triggersf', 'tree') wjetsPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.WJets = MergedPlotter(wjetsPlotters) self.WJets.setFillProperties(1001, ROOT.kBlue - 6) ttPlotters = [] ttSamples = ['TTTo2L2Nu'] #,'TTZToLLNuNu','TTWJetsToLNu'] for sample in ttSamples: ttPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) ttPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') ttPlotters[-1].addCorrectionFactor('xsec', 'tree') ttPlotters[-1].addCorrectionFactor('genWeight', 'tree') ttPlotters[-1].addCorrectionFactor('puWeight', 'tree') ttPlotters[-1].addCorrectionFactor('triggersf', 'tree') ttPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.TT = MergedPlotter(ttPlotters) self.TT.setFillProperties(1001, ROOT.kAzure - 9) # --> define different background sets: nonZBGPlotters = [] nonZBGSamples = wwSamples + vvSamples + wjetsSamples + ttSamples for sample in nonZBGSamples: nonZBGPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) nonZBGPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') nonZBGPlotters[-1].addCorrectionFactor('xsec', 'tree') nonZBGPlotters[-1].addCorrectionFactor('genWeight', 'tree') nonZBGPlotters[-1].addCorrectionFactor('puWeight', 'tree') nonZBGPlotters[-1].addCorrectionFactor('triggersf', 'tree') nonZBGPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.NonZBG = MergedPlotter(nonZBGPlotters) self.NonZBG.setFillProperties(1001, ROOT.kPink + 6) nonResBGPlotters = [] nonResBGSamples = wwSamples + wjetsSamples + ttSamples for sample in nonResBGSamples: nonResBGPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) nonResBGPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') nonResBGPlotters[-1].addCorrectionFactor('xsec', 'tree') nonResBGPlotters[-1].addCorrectionFactor('genWeight', 'tree') nonResBGPlotters[-1].addCorrectionFactor('puWeight', 'tree') nonResBGPlotters[-1].addCorrectionFactor('triggersf', 'tree') nonResBGPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.NonResBG = MergedPlotter(nonResBGPlotters) self.NonResBG.setFillProperties(1001, ROOT.kYellow) resBGPlotters = [] resBGSamples = zjetsSamples + vvSamples for sample in resBGSamples: resBGPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) resBGPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') resBGPlotters[-1].addCorrectionFactor('xsec', 'tree') resBGPlotters[-1].addCorrectionFactor('genWeight', 'tree') resBGPlotters[-1].addCorrectionFactor('puWeight', 'tree') resBGPlotters[-1].addCorrectionFactor('triggersf', 'tree') resBGPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.ResBG = MergedPlotter(resBGPlotters) self.ResBG.setFillProperties(1001, ROOT.kRed) # --> Prepare the signal plotters: sigPlotters = [] sigSamples = [ 'BulkGravToZZToZlepZinv_narrow_800', 'BulkGravToZZToZlepZinv_narrow_1000', 'BulkGravToZZToZlepZinv_narrow_1200', ] k = 1000 sigSampleNames = [ str(k) + ' x BulkG-800', str(k) + ' x BulkG-1000', str(k) + ' x BulkG-1200', ] sigXsec = { 'BulkGravToZZToZlepZinv_narrow_800': 4.42472e-04 * k, 'BulkGravToZZToZlepZinv_narrow_1000': 1.33926e-04 * k, 'BulkGravToZZToZlepZinv_narrow_1200': 4.76544e-05 * k, } if addSig: for sample in sigSamples: sigPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) sigPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') sigPlotters[-1].addCorrectionFactor(str(sigXsec[sample]), 'tree') sigPlotters[-1].addCorrectionFactor('genWeight', 'tree') sigPlotters[-1].addCorrectionFactor('puWeight', 'tree') sigPlotters[-1].addCorrectionFactor('triggersf', 'tree') sigPlotters[-1].addCorrectionFactor(lepsf, 'tree') sigPlotters[-1].setFillProperties(0, ROOT.kWhite) else: print "[Info] I do not add Signal samples to plot " # --> Prepare data plotters: dataPlotters = [] if doElMu: dataSamples = [ 'MuonEG_Run2015C_25ns_16Dec', 'MuonEG_Run2015D_16Dec' ] else: dataSamples = [ 'SingleElectron_Run2015C_25ns_16Dec', 'SingleElectron_Run2015D_16Dec', 'SingleMuon_Run2015C_25ns_16Dec', 'SingleMuon_Run2015D_16Dec' ] if addData: for sample in dataSamples: dataPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) self.Data = MergedPlotter(dataPlotters) self.Data.setFillProperties(1001, ROOT.kGreen + 2) else: self.Data = None print "[Info] I do not add Data samples to plot " self.Stack = StackPlotter() if addData: self.Stack.addPlotter(self.Data, "data_obs", "Data", "data") self.Stack.addPlotter(self.WJets, "WJets", "W+Jets", "background") self.Stack.addPlotter(self.WW, "WW", "WW, WZ non-reson.", "background") self.Stack.addPlotter(self.TT, "TT", "TT", "background") self.Stack.addPlotter(self.VV, "ZZ", "ZZ, WZ reson.", "background") self.Stack.addPlotter(self.ZJets, "ZJets", "Z+Jets", "background") if addSig: for i in range(len(sigSamples)): sigPlotters[i].setLineProperties(2, ROOT.kRed + i, 2) self.Stack.addPlotter(sigPlotters[i], sigSamples[i], sigSampleNames[i], 'signal') self.Stack.setLog(LogY) self.Stack.doRatio(doRatio)
def __init__(self, indir="../AnalysisRegion", LogY=True, doRatio=True, addSig=True, addData=True, doElMu=False, scaleElMu=False, scaleDphi=False, onlyStats=False, sigK=1000): if doElMu: lepsf = 'elmununu_l1_l1_lepsf*elmununu_l1_l2_lepsf' triggersf = 'triggersf_elmu' else: lepsf = 'llnunu_l1_l1_lepsf*llnunu_l1_l2_lepsf' triggersf = 'triggersf' if onlyStats: print "[info] plotters: only statistics involved" if scaleDphi: print "[Info] plotters: 'dphi_sf' applied." else: print "[Info] plotters: NO 'dphi_sf' applied." #######----------- Prepare samples to plot: zjetsPlotters = [] self.zjetsSamples = ['DYJetsToLL_M50_BIG'] # M50_BIG = M50 + M50_Ext print '[Info] zjets sample: %s' % (indir + '/' + self.zjetsSamples[0] + '.root') for sample in self.zjetsSamples: zjetsPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if not onlyStats: zjetsPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') zjetsPlotters[-1].addCorrectionFactor('xsec', 'tree') #zjetsPlotters[-1].addCorrectionFactor('(1921.8*3)','xsec') zjetsPlotters[-1].addCorrectionFactor('genWeight', 'tree') zjetsPlotters[-1].addCorrectionFactor('puWeight', 'tree') zjetsPlotters[-1].addCorrectionFactor(triggersf, 'tree') zjetsPlotters[-1].addCorrectionFactor(lepsf, 'tree') if scaleDphi: zjetsPlotters[-1].addCorrectionFactor( 'dphi_sf', 'tree' ) # to scale dphi shape in BCD regions as the one in regA self.ZJets = MergedPlotter(zjetsPlotters) self.ZJets.setFillProperties(1001, ROOT.kGreen + 2) wwPlotters = [] self.wwSamples = ['WWTo2L2Nu', 'WWToLNuQQ', 'WZTo1L1Nu2Q'] for sample in self.wwSamples: wwPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if not onlyStats: wwPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') wwPlotters[-1].addCorrectionFactor('xsec', 'tree') wwPlotters[-1].addCorrectionFactor('genWeight', 'tree') wwPlotters[-1].addCorrectionFactor('puWeight', 'tree') wwPlotters[-1].addCorrectionFactor(triggersf, 'tree') wwPlotters[-1].addCorrectionFactor(lepsf, 'tree') if scaleDphi: wwPlotters[-1].addCorrectionFactor( 'dphi_sf', 'tree' ) # to scale dphi shape in BCD regions as the one in regA self.WW = MergedPlotter(wwPlotters) self.WW.setFillProperties(1001, ROOT.kOrange) vvPlotters = [] self.vvSamples = [ 'WZTo2L2Q', 'WZTo3LNu', 'ZZTo2L2Nu', 'ZZTo2L2Q', 'ZZTo4L' ] for sample in self.vvSamples: vvPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if not onlyStats: vvPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') vvPlotters[-1].addCorrectionFactor('xsec', 'tree') vvPlotters[-1].addCorrectionFactor('genWeight', 'tree') vvPlotters[-1].addCorrectionFactor('puWeight', 'tree') vvPlotters[-1].addCorrectionFactor(triggersf, 'tree') vvPlotters[-1].addCorrectionFactor(lepsf, 'tree') if scaleDphi: vvPlotters[-1].addCorrectionFactor( 'dphi_sf', 'tree' ) # to scale dphi shape in BCD regions as the one in regA self.VV = MergedPlotter(vvPlotters) self.VV.setFillProperties(1001, ROOT.kMagenta) wjetsPlotters = [] self.wjetsSamples = ['WJetsToLNu'] for sample in self.wjetsSamples: wjetsPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if not onlyStats: wjetsPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') wjetsPlotters[-1].addCorrectionFactor('xsec', 'tree') wjetsPlotters[-1].addCorrectionFactor('genWeight', 'tree') wjetsPlotters[-1].addCorrectionFactor('puWeight', 'tree') wjetsPlotters[-1].addCorrectionFactor(triggersf, 'tree') wjetsPlotters[-1].addCorrectionFactor(lepsf, 'tree') if scaleDphi: wjetsPlotters[-1].addCorrectionFactor( 'dphi_sf', 'tree' ) # to scale dphi shape in BCD regions as the one in regA self.WJets = MergedPlotter(wjetsPlotters) self.WJets.setFillProperties(1001, ROOT.kBlue - 6) ttPlotters = [] self.ttSamples = ['TTTo2L2Nu'] #,'TTZToLLNuNu','TTWJetsToLNu'] for sample in self.ttSamples: ttPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if not onlyStats: ttPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') ttPlotters[-1].addCorrectionFactor('xsec', 'tree') ttPlotters[-1].addCorrectionFactor('genWeight', 'tree') ttPlotters[-1].addCorrectionFactor('puWeight', 'tree') ttPlotters[-1].addCorrectionFactor(triggersf, 'tree') ttPlotters[-1].addCorrectionFactor(lepsf, 'tree') if scaleDphi: ttPlotters[-1].addCorrectionFactor( 'dphi_sf', 'tree' ) # to scale dphi shape in BCD regions as the one in regA self.TT = MergedPlotter(ttPlotters) self.TT.setFillProperties(1001, ROOT.kAzure - 9) # --> define different background sets: nonZBGPlotters = wwPlotters + vvPlotters + wjetsPlotters + ttPlotters self.nonZBGSamples = self.wwSamples + self.vvSamples + self.wjetsSamples + self.ttSamples self.NonZBG = MergedPlotter(nonZBGPlotters) self.NonZBG.setFillProperties(1001, ROOT.kPink + 6) nonResBGPlotters = wwPlotters + wjetsPlotters + ttPlotters self.nonResBGSamples = self.wwSamples + self.wjetsSamples + self.ttSamples self.NonResBG = MergedPlotter(nonResBGPlotters) self.NonResBG.setFillProperties(1001, ROOT.kYellow) resBGPlotters = zjetsPlotters + vvPlotters self.resBGSamples = self.zjetsSamples + self.vvSamples self.ResBG = MergedPlotter(resBGPlotters) self.ResBG.setFillProperties(1001, ROOT.kRed) allBGPlotters = zjetsPlotters + wwPlotters + vvPlotters + wjetsPlotters + ttPlotters self.allBGSamples = self.zjetsSamples + self.wwSamples + self.vvSamples + self.wjetsSamples + self.ttSamples self.allBG = MergedPlotter(allBGPlotters) self.allBG.setFillProperties(1001, ROOT.kRed) # --> Prepare the signal plotters: self.sigPlotters = [] self.sigSamples = [ 'BulkGravToZZToZlepZinv_narrow_800', 'BulkGravToZZToZlepZinv_narrow_1000', 'BulkGravToZZToZlepZinv_narrow_1200', ] sigk = sigK if sigK else 1000 self.sigSampleNames = [ str(sigk) + ' x BulkG-800', str(sigk) + ' x BulkG-1000', str(sigk) + ' x BulkG-1200', ] sigXsec = { 'BulkGravToZZToZlepZinv_narrow_800': 4.42472e-04 * sigk, 'BulkGravToZZToZlepZinv_narrow_1000': 1.33926e-04 * sigk, 'BulkGravToZZToZlepZinv_narrow_1200': 4.76544e-05 * sigk, } if addSig: for sample in self.sigSamples: self.sigPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if not onlyStats: self.sigPlotters[-1].addCorrectionFactor( '1./SumWeights', 'tree') self.sigPlotters[-1].addCorrectionFactor( str(sigXsec[sample]), 'tree') self.sigPlotters[-1].addCorrectionFactor( 'genWeight', 'tree') self.sigPlotters[-1].addCorrectionFactor( 'puWeight', 'tree') self.sigPlotters[-1].addCorrectionFactor(triggersf, 'tree') self.sigPlotters[-1].addCorrectionFactor(lepsf, 'tree') self.sigPlotters[-1].setFillProperties(0, ROOT.kWhite) else: print "[Info] I do not add Signal samples to plot " # --> Prepare data plotters: dataPlotters = [] if doElMu: self.dataSamples = [ 'MuonEG_Run2015C_25ns_16Dec', 'MuonEG_Run2015D_16Dec' ] else: self.dataSamples = [ 'SingleElectron_Run2015C_25ns_16Dec', 'SingleElectron_Run2015D_16Dec', 'SingleMuon_Run2015C_25ns_16Dec', 'SingleMuon_Run2015D_16Dec' ] if addData: for sample in self.dataSamples: if doElMu and scaleElMu: dataPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree', weight='1.51')) dataPlotters[-1].addCorrectionFactor('Melmu_sf', 'tree') else: dataPlotters.append( TreePlotter(indir + '/' + sample + '.root', 'tree')) if scaleDphi: dataPlotters[-1].addCorrectionFactor( 'dphi_sf', 'tree' ) # to scale dphi shape in BCD regions as the one in regA self.Data = MergedPlotter(dataPlotters) self.Data.setFillProperties(1001, ROOT.kGreen + 2) else: self.Data = None print "[Info] I do not add Data samples to plot " self.Stack = StackPlotter() if addData: self.Stack.addPlotter(self.Data, "data_obs", "Data", "data") self.Stack.addPlotter(self.WJets, "WJets", "W+Jets", "background") self.Stack.addPlotter(self.WW, "WW", "WW, WZ non-reson.", "background") self.Stack.addPlotter(self.TT, "TT", "TT", "background") self.Stack.addPlotter(self.VV, "ZZ", "ZZ, WZ reson.", "background") self.Stack.addPlotter(self.ZJets, "ZJets", "Z+Jets", "background") if addSig: for i in range(len(self.sigSamples)): self.sigPlotters[i].setLineProperties(2, ROOT.kRed + i, 2) self.Stack.addPlotter(self.sigPlotters[i], self.sigSamples[i], self.sigSampleNames[i], 'signal') self.Stack.setLog(LogY) self.Stack.doRatio(doRatio)
dataPlotters = [] dataPlotters = [] dataSamples = [ 'step1_SingleMu_Run2016B_FebReminiAOD', 'step1_SingleMu_Run2016C_FebReminiAOD', 'step1_SingleMu_Run2016D_FebReminiAOD', 'step1_SingleMu_Run2016E_FebReminiAOD', 'step1_SingleMu_Run2016F_FebReminiAOD1', 'step1_SingleMu_Run2016F_FebReminiAOD2', 'step1_SingleMu_Run2016G_FebReminiAOD', 'step1_SingleMu_Run2016H_FebReminiAODv2', 'step1_SingleMu_Run2016H_FebReminiAODv3' ] for sample in dataSamples: dataPlotters.append( TreePlotter(sample, indir + '/' + sample + '.root', tree)) Data = MergedPlotter(dataPlotters) mcPlotters = [] mcSamples = [] mcSamples = [['step1p5_WW', 110.8], ['step1p5_WZ', 47.13], ['step1p5_ZZ', 16.523], ['step1p5_WGToLNuG', 405.271], ['step1p5_ZGTo2LG', 117.864], ['step1p5_W3JetsToLNu', 1160], ['step1p5_W4JetsToLNu', 600], ['step1p5_TTGJets', 3.697], ['step1p5_DYJetsToLL', 5765.4], ['step1p5_TT', 831.76], ['step1p5_TTWJetsToLNu', 0.2043], ['step1p5_TTWJetsToQQ', 0.4062], ['step1p5_TTZToLLNuNu', 0.2529], ['step1p5_TTZToQQ', 0.5297], ['step1p5_ST_tW_antitop_5f_inclusiveDecays', 35.85], ['step1p5_ST_tW_top_5f_inclusiveDecays', 35.85], ['step1p5_ST_s-channel_4f_leptonDecays', 3.36], ['step1p5_ST_t-channel_top_4f_inclusiveDecays', 136.02],
elif cutChain == 'tightzpt100met100dphi': cuts = cuts_loose_zll_met100_dphi elif cutChain == 'tightmet250dphi': cuts = cuts_loose_zll_met250_dphi elif cutChain == 'zjetscut': cuts = cuts_zjets elif cutChain == 'zjetscutmet50': cuts = cuts_zjets_met50 else: cuts = cuts_loose if channel == 'el': cuts = cuts + '&&' + elChannel elif channel == 'mu': cuts = cuts + '&&' + muChannel ROOT.gROOT.ProcessLine('.x tdrstyle.C') NonResoPlotters = [] NonResoSamples = ['NonReso'] for sample in NonResoSamples: NonResoPlotters.append(TreePlotter(indir + '/' + sample + '.root', 'tree')) NonResoPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') NonResoPlotters[-1].addCorrectionFactor('xsec', 'tree') NonResoPlotters[-1].addCorrectionFactor('genWeight', 'tree') NonResoPlotters[-1].addCorrectionFactor('puWeight', 'tree') NonReso = MergedPlotter(NonResoPlotters) NonReso.setFillProperties(1001, ROOT.kOrange) ZResoPlotters = [] ZResoSamples = ['ZReso'] for sample in ZResoSamples: ZResoPlotters.append(TreePlotter(indir + '/' + sample + '.root', 'tree')) ZResoPlotters[-1].addCorrectionFactor('1./SumWeights', 'tree') ZResoPlotters[-1].addCorrectionFactor('xsec', 'tree')