def rmNanAndOutliers(): """Plot without NAN and outliers from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) < 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 sd = 6 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'] t = epmData['Timestamp'] nanPos = np.argwhere(np.isnan(y)) y = np.delete(y,nanPos) t = np.delete(t,nanPos) s3 = np.floor(sd * np.sqrt(y.std())) smin = y.mean() - s3 smax = y.mean() + s3 outPos = np.argwhere(y<smin) y = np.delete(y,outPos) t = np.delete(t,outPos) outPos = np.argwhere(y>smax) y = np.delete(y,outPos) t = np.delete(t,outPos) res = vec2epm(t,y) penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_NoOutliers' sr.plot(penName, res) return res
def plotGetSelection(): """ Get data range from selected pen. """ selData = [] if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'].copy() x = np.arange(len(y)) fig = pl.figure(figsize=(8,6)) ax = fig.add_subplot(211, axisbg='#FFFFCC') ax.plot(x, y, '-') ax.set_title('Press left mouse button and drag to test') ax2 = fig.add_subplot(212, axisbg='#FFFFCC') line2, = ax2.plot(x, y, '-') def onselect(xmin, xmax): selData.append([xmin, xmax]) indmin, indmax = np.searchsorted(x, (xmin, xmax)) indmax = min(len(x)-1, indmax) thisx = x[indmin:indmax] thisy = y[indmin:indmax] line2.set_data(thisx, thisy) ax2.set_xlim(thisx[0], thisx[-1]) ax2.set_ylim(thisy.min(), thisy.max()) fig.canvas.draw() span = SpanSelector(ax, onselect, 'horizontal', useblit=True, rectprops=dict(alpha=0.5, facecolor='red') ) pl.show() return selData
def plotGetRetangle(): """ Area selection from selected pen. """ selRect = [] if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'].copy() x = np.arange(len(y)) fig, current_ax = pl.subplots() pl.plot(x, y, lw=2, c='g', alpha=.3) def line_select_callback(eclick, erelease): 'eclick and erelease are the press and release events' x1, y1 = eclick.xdata, eclick.ydata x2, y2 = erelease.xdata, erelease.ydata print ("\n(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2)) selRect.append((int(x1), y1, int(x2), y2)) def toggle_selector(event): if event.key in ['Q', 'q'] and toggle_selector.RS.active: toggle_selector.RS.set_active(False) if event.key in ['A', 'a'] and not toggle_selector.RS.active: toggle_selector.RS.set_active(True) toggle_selector.RS = RectangleSelector(current_ax, line_select_callback, drawtype='box', useblit=True, button=[1,3], minspanx=5, minspany=5, spancoords='pixels') pl.connect('key_press_event', toggle_selector) pl.show() return selRect
def rmNanAndOutliers(): """Plot without NAN and outliers from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) < 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 sd = 6 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'] t = epmData['Timestamp'] nanPos = np.argwhere(np.isnan(y)) y = np.delete(y, nanPos) t = np.delete(t, nanPos) s3 = np.floor(sd * np.sqrt(y.std())) smin = y.mean() - s3 smax = y.mean() + s3 outPos = np.argwhere(y < smin) y = np.delete(y, outPos) t = np.delete(t, outPos) outPos = np.argwhere(y > smax) y = np.delete(y, outPos) t = np.delete(t, outPos) res = vec2epm(t, y) penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_NoOutliers' sr.plot(penName, res) return res
def main(): PreselectionRunner17 = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Studies', selectionname='LQDMHLTCheck', backgrounds=['LQLQToBTau_MLQ1000_MPS117_MC1100_L1p0', 'LQLQToBTauPsiChi_MLQ1000_MPS117_MC1100_L1p0', 'LQLQToPsiChi_MLQ1000_MPS117_MC1100_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS2221_MC12089_L1p0'], signals=[]) # PreselectionRunner17.CalculateSelectionEfficiencies(num_and_denom=[('singlemu', 'input'), ('doublemu', 'input'), ('mutau', 'input'), ('singleele', 'input'), ('eletau', 'input'), ('elejet', 'input'), ('ditau', 'input'), ('met', 'input'), ('triggercategories', 'input')]) PreselectionRunner17.CalculateSelectionEfficiencies(num_and_denom=[('muon', 'input'), ('electron', 'input'), ('tau', 'input'), ('MET', 'input'), ('combined', 'input')])
def invCountEPMData(): """ Show count direction changes from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values n = invCount(epmData['Value']) msg = 'Number of changes: ' + '%.0f' % (n) sr.msgBox('EPM PyPlugin!', msg, 'Information')
def removeMean(): """ Plot removed mean data from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values rmMean = epmData.copy(); rmMean['Value'] = epmData['Value'] - epmData['Value'].mean() penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_ZeroMean' sr.plot(penName, rmMean) return rmMean
def normalizeData(): """ Plot normalized data from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values nc = epmData.copy(); nc['Value'] = (epmData['Value'] - epmData['Value'].mean())/epmData['Value'].std() penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Normalized' sr.plot(penName, nc) return nc
def plotXY(): """ Plot XY from selected pens. """ import ScriptRunner as sr if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 2: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select two interpolated pens before applying this function!', 'Warning') return 0 epmData1 = ds.EpmDatasetAnalysisPens.SelectedPens[0].values epmData2 = ds.EpmDatasetAnalysisPens.SelectedPens[1].values pl.figure pl.plot(epmData1['Value'], epmData2['Value']) pl.show()
def integralData(): """ Show area from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values v = epmData['Value'] curveArea = integrate.simps(v) statMsg = 'Integral: ' + '%.2f' % (curveArea) sr.msgBox('EPM PyPlugin!', statMsg, 'Information') return curveArea
def statsInfos(): """ Show basic statistics from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values v = epmData['Value'] vmean = v.mean() vstd = v.std() statMsg = 'Mean: ' + '%.2f' % (vmean) + '\nStdDev: ' + '%.2f' % (vstd) sr.msgBox('EPM PyPlugin!', statMsg, 'Information') return (vmean, vstd)
def removeMean(): """ Plot removed mean data from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values rmMean = epmData.copy() rmMean['Value'] = epmData['Value'] - epmData['Value'].mean() penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_ZeroMean' sr.plot(penName, rmMean) return rmMean
def deltaVector(): """ Plot deltas from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values delta = epmData['Value'][1:] - epmData['Value'][:-1] deltaCurves = epmData.copy(); deltaCurves['Value'][0] = 0 deltaCurves['Value'][1:] = delta penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Delta' sr.plot(penName, deltaCurves) return deltaCurves
def plotXY(): """ Plot XY from selected pens. """ import ScriptRunner as sr if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 2: sr.msgBox( 'EPM Python Plugin - Demo Tools', 'Please select two interpolated pens before applying this function!', 'Warning') return 0 epmData1 = ds.EpmDatasetAnalysisPens.SelectedPens[0].values epmData2 = ds.EpmDatasetAnalysisPens.SelectedPens[1].values pl.figure pl.plot(epmData1['Value'], epmData2['Value']) pl.show()
def normalizeData(): """ Plot normalized data from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values nc = epmData.copy() nc['Value'] = (epmData['Value'] - epmData['Value'].mean()) / epmData['Value'].std() penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Normalized' sr.plot(penName, nc) return nc
def deltaVector(): """ Plot deltas from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values delta = epmData['Value'][1:] - epmData['Value'][:-1] deltaCurves = epmData.copy() deltaCurves['Value'][0] = 0 deltaCurves['Value'][1:] = delta penName = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Delta' sr.plot(penName, deltaCurves) return deltaCurves
def plotGetPoints(): """ Get data points from selected pen. """ selPoints = [] if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'].copy() x = np.arange(len(y)) fig = pl.figure(figsize=(8, 6)) ax = fig.add_subplot(111, axisbg='#FFFFFF') ax.plot(x, y, '-o') def onclick(event): selPoints.append((event.xdata, event.ydata)) cursor = Cursor(ax, useblit=True, color='red', linewidth=1 ) cid = fig.canvas.mpl_connect('button_press_event', onclick) pl.show() return selPoints
def plotGetRetangle(): """ Area selection from selected pen. """ selRect = [] if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'].copy() x = np.arange(len(y)) fig, current_ax = pl.subplots() pl.plot(x, y, lw=2, c='g', alpha=.3) def line_select_callback(eclick, erelease): 'eclick and erelease are the press and release events' x1, y1 = eclick.xdata, eclick.ydata x2, y2 = erelease.xdata, erelease.ydata print("\n(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2)) selRect.append((int(x1), y1, int(x2), y2)) def toggle_selector(event): if event.key in ['Q', 'q'] and toggle_selector.RS.active: toggle_selector.RS.set_active(False) if event.key in ['A', 'a'] and not toggle_selector.RS.active: toggle_selector.RS.set_active(True) toggle_selector.RS = RectangleSelector(current_ax, line_select_callback, drawtype='box', useblit=True, button=[1, 3], minspanx=5, minspany=5, spancoords='pixels') pl.connect('key_press_event', toggle_selector) pl.show() return selRect
def percentTimeIn(): """ Funcao que retorna o percentual de tempo em cada intervalo informado. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values global nodes runDialogInterval() global nodes t, y = rmNanAndOutliers2(epmData) if len(nodes) < 2: minVal = int(np.floor(np.nanmin(y))) maxVal = int(np.ceil(np.nanmax(y))) step = int((maxVal - minVal) / 3) nodes = range(minVal, maxVal, step) intervNum = np.size(nodes) + 1 totTime = np.empty(intervNum, dtype=object) totTime.fill(dtt.timedelta(0, 0)) for i in range(1, np.size(y)): dt = t[i] - t[i - 1] ix = np.digitize([y[i]], nodes) totTime[ix] += dt nodesPercents = np.zeros([np.size(totTime), 2]) totalPeriod = totTime.sum().total_seconds() for i in range(np.size(totTime)): if i: nodesPercents[i, 0] = nodes[i - 1] else: nodesPercents[i, 0] = -np.inf nodesPercents[i, 1] = totTime[i].total_seconds() / totalPeriod labels = [] for item in nodesPercents[:, 0]: labels.append(str(item)) pl.pie(nodesPercents[:, 1], labels=labels, autopct='%1.1f%%', shadow=True) pl.show() return nodesPercents
def plotGetPoints(): """ Get data points from selected pen. """ selPoints = [] if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'].copy() x = np.arange(len(y)) fig = pl.figure(figsize=(8, 6)) ax = fig.add_subplot(111, axisbg='#FFFFFF') ax.plot(x, y, '-o') def onclick(event): selPoints.append((event.xdata, event.ydata)) cursor = Cursor(ax, useblit=True, color='red', linewidth=1) cid = fig.canvas.mpl_connect('button_press_event', onclick) pl.show() return selPoints
def percentTimeIn(): """ Funcao que retorna o percentual de tempo em cada intervalo informado. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values global nodes runDialogInterval() global nodes t,y = rmNanAndOutliers2(epmData) if len(nodes) < 2: minVal = int(np.floor(np.nanmin(y))) maxVal = int(np.ceil(np.nanmax(y))) step = int((maxVal-minVal)/3) nodes = range(minVal,maxVal,step) intervNum = np.size(nodes)+1 totTime = np.empty(intervNum, dtype=object) totTime.fill(dtt.timedelta(0,0)) for i in range(1,np.size(y)): dt = t[i] - t[i-1] ix = np.digitize([y[i]], nodes) totTime[ix] += dt nodesPercents = np.zeros([np.size(totTime),2]) totalPeriod = totTime.sum().total_seconds() for i in range(np.size(totTime)): if i: nodesPercents[i,0] = nodes[i-1] else: nodesPercents[i,0] = -np.inf nodesPercents[i,1] = totTime[i].total_seconds()/totalPeriod labels = [] for item in nodesPercents[:,0]: labels.append(str(item)) pl.pie(nodesPercents[:,1], labels=labels, autopct='%1.1f%%', shadow=True) pl.show() return nodesPercents
def plotGetSelection(): """ Get data range from selected pen. """ selData = [] if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values y = epmData['Value'].copy() x = np.arange(len(y)) fig = pl.figure(figsize=(8, 6)) ax = fig.add_subplot(211, axisbg='#FFFFCC') ax.plot(x, y, '-') ax.set_title('Press left mouse button and drag to test') ax2 = fig.add_subplot(212, axisbg='#FFFFCC') line2, = ax2.plot(x, y, '-') def onselect(xmin, xmax): selData.append([xmin, xmax]) indmin, indmax = np.searchsorted(x, (xmin, xmax)) indmax = min(len(x) - 1, indmax) thisx = x[indmin:indmax] thisy = y[indmin:indmax] line2.set_data(thisx, thisy) ax2.set_xlim(thisx[0], thisx[-1]) ax2.set_ylim(thisy.min(), thisy.max()) fig.canvas.draw() span = SpanSelector(ax, onselect, 'horizontal', useblit=True, rectprops=dict(alpha=0.5, facecolor='red')) pl.show() return selData
def plotMinMax(): """ Plot Min-Max lines from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values minValue = epmData['Value'].min(); maxValue = epmData['Value'].max(); vmin = epmData.copy() vmax = epmData.copy() vmin['Value'][:] = minValue vmax['Value'][:] = maxValue penMin = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Min' penMax = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Max' sr.plot(penMin, vmin) sr.plot(penMax, vmax) return (minValue, maxValue)
def plotMinMax(): """ Plot Min-Max lines from selected pen. """ if len(ds.EpmDatasetAnalysisPens.SelectedPens) != 1: sr.msgBox('EPM Python Plugin - Demo Tools', 'Please select a single pen before applying this function!', 'Warning') return 0 epmData = ds.EpmDatasetAnalysisPens.SelectedPens[0].values minValue = epmData['Value'].min() maxValue = epmData['Value'].max() vmin = epmData.copy() vmax = epmData.copy() vmin['Value'][:] = minValue vmax['Value'][:] = maxValue penMin = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Min' penMax = ds.EpmDatasetAnalysisPens.SelectedPens[0].name + '_Max' sr.plot(penMin, vmin) sr.plot(penMax, vmax) return (minValue, maxValue)
def main(): # print 'hello1' # StudiesRunner17 = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Studies', selectionname='PsiPsi_LeptonIDEfficiencies', backgrounds=[], signals=['PsiPsiToLQChi_MLQ1000_MPS117_MC1100_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS244_MC1214_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS567_MC1457_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS1051_MC1977_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS2221_MC12089_L1p0']) # StudiesRunner17.CalculateLeptonReconstructionEfficiencies() # StudiesRunner17.CalculateLeptonIDEfficiencies() # PreselectionRunner17 = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Preselection', selectionname='PsiPsi_Initial', backgrounds=['TT', 'DYJets', 'ST', 'WJets', 'QCD_Had'], signals=['PsiPsiToLQChi_MLQ1000_MPS117_MC1100_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS244_MC1214_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS567_MC1457_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS1051_MC1977_L1p0', 'PsiPsiToLQChi_MLQ1000_MPS2221_MC12089_L1p0']) # PreselectionRunner17.CalculateSelectionEfficiencies(num_and_denom=[('trigger', 'input'), ('base', 'input'), ('plateau', 'input'), ('tach_leptonveto', 'input'), ('tach_plateau', 'input'), ('tach_tau', 'input'), ('tach_met', 'input'), ('final', 'input')]) # LQ pair-production # systematics17 = ['nominal', 'lumi', 'rate_tt', 'rate_dyjets', 'rate_st'] # # backgrounds17 = ['TT', 'DYJets', 'ST', 'WJets', 'QCD_Had'] # backgrounds17 = ['TT', 'DYJets', 'ST'] # signals17 = ['LQLQToBTau_MLQ1000_MPS117_MC1100_L1p0', 'LQLQToBTau_MLQ1360_MPS117_MC1100_L1p0', 'LQLQToBTau_MLQ1810_MPS117_MC1100_L1p0', 'LQLQToBTau_MLQ2170_MPS117_MC1100_L1p0', 'LQLQToBTau_MLQ2620_MPS117_MC1100_L1p0'] # channels17 = ['elch', 'much', 'elmuch', 'tach'] # histnames_in_out_per_category17 = {'cat1': ('stmet3', 'STMET'), 'cat2': ('stmet3', 'STMET')} # limithisttag17 = 'Limits' # # processes_per_systematic17 = {'lumi': 'all', 'rate_tt': 'TT', 'rate_dyjets': 'DYJets', 'rate_st': 'ST', 'rate_wjets': 'WJets', 'rate_qcd': 'QCD_Had', 'pu': 'all', 'pdf': 'all', 'muid': 'all', 'muiso': 'all', 'mutrigger': 'all', 'eleid': 'all', 'elereco': 'all', 'btag_bc': 'all', 'btag_udsg': 'all', 'scale_tt': 'TT', 'scale_dyjets': 'DYJets', 'scale_st': 'ST'} # pdf_per_systematic17 = {'lumi': 'lnN', 'pu': 'shape', 'pdf': 'shape', 'muid': 'shape', 'muiso': 'shape', 'mutrigger': 'shape', 'eleid': 'shape', 'elereco': 'shape', 'btag_bc': 'shape', 'btag_udsg': 'shape', 'rate_tt': 'lnN', 'rate_dyjets': 'lnN', 'rate_st': 'lnN', 'rate_wjets': 'lnN', 'rate_qcd': 'lnN', 'scale_tt': 'shape', 'scale_dyjets': 'shape', 'scale_st': 'shape'} # value_per_systematic17 = {'lumi': 1.025, 'pu': 1, 'pdf': 1, 'muid': 1, 'muiso': 1, 'mutrigger': 1, 'eleid': 1, 'elereco': 1, 'btag_bc': 1, 'btag_udsg': 1, 'rate_tt': 1.056, 'rate_dyjets': 1.1, 'rate_st': 1.1, 'rate_wjets': 1.25, 'rate_qcd': 1.5, 'scale_tt': 1, 'scale_dyjets': 1, 'scale_st': 1} # Analyzer17 = PostAnalyzer('2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionname='TauTau_ElTau_MuTau_ElMu_2Jets_12LooseBTag_met50', systematics=systematics17, backgrounds=backgrounds17, signals=signals17, channels=channels17, histnames_in_out_per_category=histnames_in_out_per_category17, limithisttag=limithisttag17, processes_per_systematic=processes_per_systematic17, pdf_per_systematic=pdf_per_systematic17, value_per_systematic=value_per_systematic17) # Analyzer17.ProduceCombineHistograms(signal_scaled_by=0.01) # Analyzer17.CreateDatacards() # Analyzer17.CombineChannels() # Analyzer17.ExecuteCombineCombination() # Analyzer17.PlotLimits(signal_scaled_by=0.01, draw_observed=False) # LQ t-channel PreselectionRunner17_tach = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Preselection', selectionname='TChannelTauNu_tau', backgrounds=['TT', 'VV', 'DYJets', 'ST', 'WJets', 'QCD_Had'], signals=['LQTChannelTauNu_DynamicScale_MLQ1000_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1360_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1810_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2620_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2980_MPS117_MC1100_L1p0']) # PreselectionRunner17_tach.CalculateSelectionEfficiencies(num_and_denom=[('trigger', 'input'), ('base', 'input'), ('plateau', 'input'), ('tach_leptonveto', 'input'), ('tach_plateau', 'input'), ('tach_tau', 'input'), ('tach_met', 'input'), ('final', 'input')]) PreselectionRunner17_much = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Preselection', selectionname='TChannelTauNu_muon', backgrounds=['TT', 'VV', 'DYJets', 'ST', 'WJets', 'QCD_Had'], signals=['LQTChannelTauNu_DynamicScale_MLQ1000_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1360_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1810_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2620_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2980_MPS117_MC1100_L1p0']) # PreselectionRunner17_much.CalculateSelectionEfficiencies(num_and_denom=[('trigger', 'input'), ('plateau', 'input'), ('much_leptonveto', 'input'), ('much_lepton', 'input'), ('much_plateau', 'input'), ('much_dphi', 'input'), ('much_ptratio', 'input'), ('final', 'input')]) FullselectionRunner17_tach = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Fullselection', selectionname='TChannelTauNu_tau', backgrounds=['TT', 'VV', 'DYJets', 'ST', 'WJets', 'QCD_Had'], signals=['LQTChannelTauNu_DynamicScale_MLQ1000_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1360_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1810_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2620_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2980_MPS117_MC1100_L1p0']) # FullselectionRunner17_tach.CalculateSelectionEfficiencies(num_and_denom=[('tach_trigger', 'input'), ('tach_taucleaner', 'input'), ('tach_tauselection', 'input'), ('tach_dphi', 'input'), ('tach_ptratio', 'input'), ('tach_cat1_nominal', 'input')]) # FullselectionRunner17_tach.CalculateSelectionEfficiencies(num_and_denom=[('tach_trigger', 'input'), ('tach_taucleaner', 'input'), ('tach_tauselection', 'input'), ('tach_cat1jets_initial', 'input'), ('tach_cat1jets_dphi', 'input'), ('tach_cat1jets_ptratio', 'input'), ('tach_cat1jets_1btagloose', 'input'), ('tach_cat1jets_1btagloose_nominal', 'input'), ('tach_cat1jets_0btagloose', 'input'), ('tach_cat1jets_0btagloose_nominal', 'input'), ('tach_cat1jets_nominal', 'input'), ('tach_cat0jets_initial', 'input'), ('tach_cat0jets_dphi', 'input'), ('tach_cat0jets_ptratio', 'input'), ('tach_cat0jets_nominal', 'input'), ('tach_cat1_nominal', 'input')]) FullselectionRunner17_much = ScriptRunner(year='2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Fullselection', selectionname='TChannelTauNu_muon_wprime', backgrounds=['TT', 'VV', 'DYJets', 'ST', 'WJets', 'QCD_Had'], signals=['LQTChannelTauNu_DynamicScale_MLQ1000_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1360_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1810_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2620_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2980_MPS117_MC1100_L1p0']) # FullselectionRunner17_much.CalculateSelectionEfficiencies(num_and_denom=[('much_jetveto5', 'input'), ('much_btagveto1', 'input'), ('much_dphi25', 'input'), ('much_ptratio0415', 'input'), ('much_ptmu50', 'input'), ('much_cat1_nominal', 'input')]) systematics17 = ['nominal', 'lumi', 'rate_tt', 'rate_dyjets', 'rate_st', 'rate_vv', 'rate_wjets', 'rate_qcd'] backgrounds17 = ['TT', 'DYJets', 'ST', 'WJets', 'QCD_Had'] # backgrounds17 = ['TT', 'DYJets', 'ST', 'WJets'] signals17 = ['LQTChannelTauNu_DynamicScale_MLQ1000_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1360_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ1810_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2620_MPS117_MC1100_L1p0', 'LQTChannelTauNu_DynamicScale_MLQ2980_MPS117_MC1100_L1p0'] channels17 = ['tach'] histnames_in_out_per_category17 = { 'cat1': ('mt_taumet_rebinlimit2', 'MT'), # 'cat1jets_0btagloose': ('mt_taumet_rebinlimit2', 'MT'), # 'cat1jets_1btagloose': ('mt_taumet_rebinlimit2', 'MT'), # 'cat0jets': ('mt_taumet_rebinlimit2', 'MT'), } # histnames_in_out_per_category17 = {'cat1': ('mt_mumet_rebinlimit2', 'MT')} limithisttag17 = 'General' processes_per_systematic17 = {'lumi': 'all', 'rate_tt': 'TT', 'rate_dyjets': 'DYJets', 'rate_st': 'ST', 'rate_wjets': 'WJets', 'rate_qcd': 'QCD_Had', 'rate_vv': 'VV', 'pu': 'all', 'pdf': 'all', 'muid': 'all', 'muiso': 'all', 'mutrigger': 'all', 'eleid': 'all', 'elereco': 'all', 'btag_bc': 'all', 'btag_udsg': 'all', 'scale_tt': 'TT', 'scale_dyjets': 'DYJets', 'scale_st': 'ST'} pdf_per_systematic17 = {'lumi': 'lnN', 'pu': 'shape', 'pdf': 'shape', 'muid': 'shape', 'muiso': 'shape', 'mutrigger': 'shape', 'eleid': 'shape', 'elereco': 'shape', 'btag_bc': 'shape', 'btag_udsg': 'shape', 'rate_tt': 'lnN', 'rate_dyjets': 'lnN', 'rate_st': 'lnN', 'rate_vv': 'lnN', 'rate_wjets': 'lnN', 'rate_qcd': 'lnN', 'scale_tt': 'shape', 'scale_dyjets': 'shape', 'scale_st': 'shape'} value_per_systematic17 = {'lumi': 1.025, 'pu': 1, 'pdf': 1, 'muid': 1, 'muiso': 1, 'mutrigger': 1, 'eleid': 1, 'elereco': 1, 'btag_bc': 1, 'btag_udsg': 1, 'rate_tt': 1.056, 'rate_dyjets': 1.1, 'rate_st': 1.1, 'rate_vv': 1.2, 'rate_wjets': 1.25, 'rate_qcd': 1.5, 'scale_tt': 1, 'scale_dyjets': 1, 'scale_st': 1} Analyzer17 = PostAnalyzer('2017', analysisname=analysisname, t3_base_path=t3_base_path, result_base_path=result_base_path, selectionstage='Fullselection', selectionname='TChannelTauNu_wprime_tau', systematics=systematics17, backgrounds=backgrounds17, signals=signals17, channels=channels17, histnames_in_out_per_category=histnames_in_out_per_category17, limithisttag=limithisttag17, processes_per_systematic=processes_per_systematic17, pdf_per_systematic=pdf_per_systematic17, value_per_systematic=value_per_systematic17)