#samples.append('QCD') #samples.append('VJets') #samples.append('WZJets3LNu') #samples.extend(['WWZ', 'WZZ', 'ZZZ', 'WWG']) #samples.extend(['ttW', 'ttZ', 'ttG']) p_plot = [] if doPlots: print '\nMaking the plots...\n' r.gROOT.SetBatch() plotter = PlotProducer(inputFile = 'fcncAnalysis/combined_histos/' + selection + '_cut1_' + period + batch + '.root', savePath = '', scale = LUMIDATA, isAFS = False) plotter.set_period(period) plotter.set_output_type(plotType) ### DATASETS ### ### Specify the datasets you wish to stack ### and overlay accordingly. plotter.add_datasets(samples) plotter._overlayList.extend(['DATA_MUON']) #plotter._overlayList.extend(['FCNH']) #plotter.get_scale_factors(['FCNH']) plotter.get_scale_factors() ### VARIABLES ###
for fakeType in fakeTypes: print ' {0} '.format(fakeType), count = 0 hCombined = 0. for category in categories: hist = inFile.Get('{0}/{1}/h1_FakeablePt'.format(category, fakeType)) if hist: pct = hist.Integral(hist.FindBin(40), hist.GetNbinsX())/hist.Integral() fakeInfo.append(pct) print '& {0:.1%} '.format(pct), else: print '& -- ', continue pp.set_hist_style(hist, category, styles) legend.AddEntry(hist, category) if count == 0: hist.SetTitle('{0};p_{{T}}; Normalized Entries/Bin'.format(styles[fakeType][4])) hist.GetXaxis().SetRangeUser(0., 150.) hist.GetYaxis().SetTitleOffset(1.2) hist.SetMinimum(0.) hist.SetMaximum(1.25*hist.GetMaximum()) hist.DrawNormalized() line.Draw('same') else: hist.DrawNormalized('same') if hCombined == 0.:
### Samples to be included in stacks ### samples = {} samples['inclusive'] = ['Rare', 'ZJets', 'ttbar', 'WJets', 'WZJets3LNu', 'QCD'] samples['ZPlusJet'] = ['Rare', 'WZJets3LNu', 'ZJets', 'WJets'] samples['QCD2l'] = ['ZJets', 'WJets', 'QCD', 'ttbar'] samples['SameSign'] = ['Rare', 'WZJets3LNu', 'ttbar', 'ZJets', 'WJets', 'QCD'] #samples['SameSign'] = ['WZJets3LNu', 'ttbar', 'ZJets', 'W1JetsToLNu', 'W2JetsToLNu', 'W3JetsToLNu', 'W4JetsToLNu'] if doPlots: print '\nMaking the plots...\n' r.gROOT.SetBatch() ### Initialize plot producer ### plotter = PlotProducer(inputFile = 'fakeEstimator/histos/{0}.root'.format(batch), savePath = '', scale = LUMIDATA, isAFS = False) plotter.set_period(period) plotter.set_output_type(plotType) plotter.set_save_path('plots/{0}/{1}_{2}_{3}/log'.format(currentDate, selection, batch, suffix)) ### DATASETS ### plotter.add_datasets(samples['inclusive']) plotter._overlayList.extend(['DATA']) plotter.get_scale_factors(corrected = False) plotter._directoryList1D = ['Muon', 'Electron'] plotter._variableDict['Muon'] = ['MuPassLepPt', 'MuPassLepEta', 'MuPassTransverseMass', 'MuProbeLepPt', 'MuProbeLepEta', 'MuProbeTransverseMass', 'MuNumerPt', 'MuNumerEta', 'MuNumerMet', 'MuNumerIsoRel',
#'5_MET' ] period = '2012' LUMIDATA = 19.1 samples = ['WZJets3LNu', 'ttbar', 'ZJets']#, 'WJets', 'ZJets_M-10To50'] cat3l = ['3l_inclusive', '3l_OSSF', '3l_SSSF'] now = datetime.datetime.now() currentDate = '{0:02d}/{1:02d}/{2:02d}'.format(now.year, now.month, now.day) r.gROOT.SetBatch() plotter = PlotProducer(inputFile = 'histos/' + selection + '_cut1_' + period + '.root', savePath = '', scale = LUMIDATA, isAFS = False) plotter.set_period(period) ### DATASETS ### ### Specify the datasets you wish to stack ### and overlay accordingly. plotter.add_datasets(samples) plotter._overlayList.extend(['fakes']) plotter.get_scale_factors() ### VARIABLES ### ### First specify the directories in which your ### histograms are stored. If directories are ### not used enter '' as the only entry. Then
samples['ss'].append(fakeType + '_ttbarLep') #samples['ss'].append(fakeType + '_WG') samples['ss'].append(fakeType + '_ttbarHad') samples['ss'].append(fakeType + '_WJets') #samples['ss'].append(fakeType + '_QCD') p_plot = [] if doPlots: print '\nMaking the plots...\n' r.gROOT.SetBatch() ### Initialize plot producer ### plotter = PlotProducer(inputFile = 'fcncAnalysis/combined_histos/{0}_cut1_{1}_{2}.root'.format(selection, period, batch), savePath = '', scale = LUMIDATA, isAFS = False) plotter.set_period(period) plotter.set_output_type(plotType) plotter.set_clean_fakes(False) ### DATASETS ### ### Specify the datasets you wish to stack ### and overlay accordingly. plotter.add_datasets(samples['all']) plotter.get_scale_factors() ### VARIABLES ### ### First specify the directories in which your ### histograms are stored. If directories are ### not used enter '' as the only entry. Then
samples['WZ'].extend(['WW/ZZ', 'top', 'ZJets', 'WZJets3LNu']) samples['ttbar'].extend(['single top', 'ZJets', 'ttbar']) samples['ttZ'].extend(['top', 'ZJets', 'ZZ4l', 'WZJets3LNu', 'ttW', 'ttG', 'ttZ']) samples['ZFake'].extend(['ZZ4l', 'WZJets3LNu', 'Fakes']) p_plot = [] if doPlots: print '\nMaking the plots...\n' r.gROOT.SetBatch() ### Initialize plot producer ### plotter = PlotProducer(inputFile = 'fcncAnalysis/combined_histos/{0}_cut1_{1}_{2}.root'.format(selection, period, batch), savePath = '', scale = LUMIDATA, isAFS = False) plotter.set_period(period) plotter.set_output_type(plotType) ### DATASETS ### ### Specify the datasets you wish to stack ### and overlay accordingly. plotter.add_datasets(samples['all']) plotter._overlayList.extend(['DATA']) plotter._overlayList.extend(['FCNH', 'FCNHUp']) #plotter.get_scale_factors() plotter.get_scale_factors(['FCNH', 'FCNHUp']) ### VARIABLES ###
selection = 'fakes' period = '2012' LUMIDATA = 20. samples = ['WZJets3LNu', 'ttbar', 'ZJets']#, 'WJets', 'ZJets_M-10To50'] eleFakes = ['ele_v1', 'ele_v2', 'ele_v3', 'ele_v4'] muFakes = ['mu_v1', 'mu_v2'] now = datetime.datetime.now() currentDate = '{0:02d}/{1:02d}/{2:02d}'.format(now.year, now.month, now.day) r.gROOT.SetBatch() plotter = PlotProducer(inputFile = 'histos/fakeHistograms.root', savePath = '', scale = LUMIDATA, isAFS = False) plotter.set_period(period) ### DATASETS ### ### Specify the datasets you wish to stack ### and overlay accordingly. plotter.add_datasets(samples) plotter._overlayList.extend(['DATA_MUON']) plotter.get_scale_factors() ### VARIABLES ### ### First specify the directories in which your ### histograms are stored. If directories are ### not used enter '' as the only entry. Then