print "Doing ",vBtag #eff_Matched_BTag = makeEff(vBtag , ["offBTags_matched","offBTags"],inFileMC,binning=1) #eff_Matched_BTag_noV0 = makeEff(vBtag , ["offBTags_matched_noV0","offBTags_noV0"],inFileMC,binning=1) yLeg = 0.93 xLeg = 0.5 if v in ["algo","origAlgo"]: yLeg = 0.4 xLeg = 0.6 if not o.doPuppiJets: drawComp("Eff_"+v,[(eff_Matched,"t#bar{t} MC (All Tracks)",ROOT.kBlack), # (eff_Matched_noV0,"t#bar{t} MC (After V0 veto)",ROOT.kRed), # (eff_Matched_noV0,"t#bar{t} MC (After V0/K_{S}^{0} veto)",ROOT.kRed), #(eff_Matched_BTag,"t#bar{t} MC ",ROOT.kBlue), #(eff_Matched_BTag_noV0,"t#bar{t} MC ",ROOT.kGreen) ] ,yTitle="Online Track Efficiency Relative to Offline",xTitle=eff_Matched.GetXaxis().GetTitle(),outDir=o.outDir,yMax=1.2,yLeg=yLeg,xLeg=xLeg, xMax=eff_Matched.GetXaxis().GetXmax(), xMin=eff_Matched.GetXaxis().GetXmin() ) else: drawComp("Eff_"+v,[(eff_MatchedPuppi,"t#bar{t} MC (All Tracks)",ROOT.kBlack), # (eff_Matched_noV0,"t#bar{t} MC (After V0 veto)",ROOT.kRed), (eff_MatchedPuppi_noV0,"t#bar{t} MC (After V0/K_{S}^{0} veto)",ROOT.kRed), #(eff_Matched_BTag,"t#bar{t} MC ",ROOT.kBlue), #(eff_Matched_BTag_noV0,"t#bar{t} MC ",ROOT.kGreen) ] ,yTitle="Online Track Efficiency Relative to Offline",xTitle=eff_MatchedPuppi.GetXaxis().GetTitle(),outDir=o.outDir,yMax=1.2,yLeg=yLeg,xLeg=xLeg, xMax=eff_MatchedPuppi.GetXaxis().GetXmax(), xMin=eff_MatchedPuppi.GetXaxis().GetXmin() )
eff_Matched_2 = makeEff( [p[0].replace("_L", "_B"), p[1].replace("_L", "_B")], dirName, inFile1, binning=1) else: eff_Matched_2 = makeEff(p, dirName, inFile2, binning=1) yLeg = 0.93 xLeg = 0.5 doFit = True #o.mc drawComp( "Eff_" + p[0], [ (eff_Matched_1, o.name1, ROOT.kBlack), (eff_Matched_2, o.name2, ROOT.kRed, ROOT.kOpenCircle), #(eff_Matched_BTag,"t#bar{t} MC ",ROOT.kBlue), #(eff_Matched_BTag_noV0,"t#bar{t} MC ",ROOT.kGreen) ], yTitle="Trigger Efficiency", xTitle=eff_Matched_1.GetXaxis().GetTitle(), outDir=o.outDir, yMax=1.25, yLeg=yLeg, xLeg=xLeg, xMax=eff_Matched_1.GetXaxis().GetXmax(), xMin=eff_Matched_1.GetXaxis().GetXmin(), doFit=doFit)
], inFileMC, binning=effBinning) reveff_DeepCSV_Data[jetType][op] = makeEff("DeepCSV_l", [ "offJets" + op + "_matched" + jetType + "Jet", "offJets_matched" + jetTypeDen + "Jet" ], inFileData, binning=effBinning) drawComp("RevEff_" + jetType + "CSV_MC", [ (reveff_CSV_MC[jetType]["Loose"], "Loose", ROOT.kBlue), (reveff_CSV_MC[jetType]["Medium"], "Medium", ROOT.kGreen), (reveff_CSV_MC[jetType]["Tight"], "Tight", ROOT.kRed), ], yTitle="Efficiency", xTitle="CSV Value of Jets", otherText="" + jetType + " Jets (MC)", outDir=o.outDir, cmsText=o.cmsText, lumiText=o.lumiText) drawComp("RevEff_" + jetType + "CSV_Data", [ (reveff_CSV_Data[jetType]["Loose"], "Loose", ROOT.kBlue), (reveff_CSV_Data[jetType]["Medium"], "Medium", ROOT.kGreen), (reveff_CSV_Data[jetType]["Tight"], "Tight", ROOT.kRed), ], yTitle="Efficiency", xTitle="CSV Value of Jets", otherText="" + jetType + " Jets (Data)", outDir=o.outDir,
reveff_CSV_MC[jetType] = {} reveff_CSV_Data[jetType] = {} reveff_DeepCSV_MC[jetType] = {} reveff_DeepCSV_Data[jetType] = {} for op in ["Loose","Medium","Tight"]: jetTypeDen = jetType if jetType == "Puppi" else "" # reveff_CSV_MC [jetType][op] = makeEff("CSVv2_l" , ["offJets"+op+"_matched"+jetType+"Jet", "offJets_matched"+jetTypeDen+"Jet"] ,inFileMC ,binning=effBinning) # reveff_CSV_Data[jetType][op] = makeEff("CSVv2_l" , ["offJets"+op+"_matched"+jetType+"Jet", "offJets_matched"+jetTypeDen+"Jet"] ,inFileData ,binning=effBinning) reveff_DeepCSV_MC [jetType][op] = makeEff("DeepCSV_l" , ["offJets"+op+"_matched"+jetType+"Jet", "offJets_matched"+jetTypeDen+"Jet"] ,inFileMC ,binning=effBinning) reveff_DeepCSV_Data[jetType][op] = makeEff("DeepCSV_l" , ["offJets"+op+"_matched"+jetType+"Jet", "offJets_matched"+jetTypeDen+"Jet"] ,inFileData ,binning=effBinning) drawComp("RevEff_"+jetType+"DeepCSV_MC",[(reveff_DeepCSV_MC[jetType]["Loose"], "Loose",ROOT.kBlue), (reveff_DeepCSV_MC[jetType]["Medium"],"Medium",ROOT.kGreen), (reveff_DeepCSV_MC[jetType]["Tight"], "Tight",ROOT.kRed),] ,yTitle="Efficiency",xTitle="DeepCSV Value of Jets", otherText=""+jetType+" Jets (MC)",outDir=o.outDir,cmsText=o.cmsText,lumiText=o.lumiText) drawComp("RevEff_"+jetType+"DeepCSV_Data",[(reveff_DeepCSV_Data[jetType]["Loose"], "Loose",ROOT.kBlue), (reveff_DeepCSV_Data[jetType]["Medium"],"Medium",ROOT.kGreen), (reveff_DeepCSV_Data[jetType]["Tight"], "Tight",ROOT.kRed),] ,yTitle="Efficiency",xTitle="DeepCSV Value of Jets", otherText=""+jetType+" Jets (Data)",outDir=o.outDir,cmsText=o.cmsText,lumiText=o.lumiText) # drawComp("RevEff_"+jetType+"CSV_All",[(reveff_CSV_Data[jetType]["Loose"], "Loose (Data)",ROOT.kBlue), # (reveff_CSV_MC[jetType]["Loose"], "Loose (MC)",ROOT.kBlue,24), # (reveff_CSV_Data[jetType]["Medium"],"Medium (Data)",ROOT.kGreen+1), # (reveff_CSV_MC[jetType]["Medium"],"Medium (MC)",ROOT.kGreen+1,24), # (reveff_CSV_Data[jetType]["Tight"], "Tight (Data)",ROOT.kRed), # (reveff_CSV_MC[jetType]["Tight"], "Tight (MC)",ROOT.kRed,24), # ]
# ,yTitle="Efficiency",xTitle="DeepCSV Value of Jets", otherText=["Online Calo WP: DeepCSV > 0.17","Online PF WP: DeepCSV > 0.24"],outDir=o.outDir,xStartOther=0.4,yStartOther=0.15,cmsText=o.cmsText,lumiText=o.lumiText) #drawComp("Eff_CaloVsPF_DeepCSV_MC",[(eff_CaloDeepCSV_MC,"Calo (MC)",ROOT.kBlue),(eff_PFDeepCSV_MC,"PF (MC)",ROOT.kRed)] # ,yTitle="Efficiency",xTitle="DeepCSV Value of Jets", otherText=["Online Calo WP: DeepCSV > 0.17","Online PF WP: DeepCSV > 0.24"],outDir=o.outDir,xStartOther=0.4,yStartOther=0.15,cmsText=o.cmsText,lumiText=o.lumiText) # (Calo vs PF) x (Data vs MC ) drawComp("Eff_CaloVsPF_DeepCSVvsDeepCSV_DataVsMC", [ (eff_CaloDeepCSV_Data, "Calo-Jet (Data 18)", ROOT.kBlue), (eff_CaloDeepCSV_MC, "Calo-Jet (Data 17) ", ROOT.kBlue, 24), (eff_PFDeepCSV_Data, "PF-Jet (Data 18)", ROOT.kRed), (eff_PFDeepCSV_MC, "PF-Jet (Data 17) ", ROOT.kRed, 24), ], yTitle="Efficiency", xTitle="Offline DeepCSV Value", otherText=[ "Online Calo WP: DeepCSV > 0.17", "Online PF WP: DeepCSV > 0.24" ], outDir=o.outDir, xStartOther=0.4, yStartOther=0.15, cmsText=o.cmsText, lumiText=o.lumiText, xLeg=0.6, yLeg=0.7, xLumiStart=0.6) #otherText="Online WP: DeepCSV > 0.63",outDir=o.outDir) # # Offline vs Online # csvBinning = 3
xMax=eff_Matched_1.GetXaxis().GetXmax(), xMin=eff_Matched_1.GetXaxis().GetXmin(), cmsText=o.cmsText, lumiText=o.lumiText, histForXBarycenterCalc=numHistOrigBinning) else: drawComp( "Eff_" + config[2] + "_" + v, [ (eff_Matched_1, o.name1, ROOT.kBlack), (eff_Matched_2, o.name2, ROOT.kRed, ROOT.kOpenCircle), #(eff_Matched_BTag,"t#bar{t} MC ",ROOT.kBlue), #(eff_Matched_BTag_noV0,"t#bar{t} MC ",ROOT.kGreen) ], yTitle="Online BTag Efficiency Relative to Offline", xTitle=eff_Matched_1.GetXaxis().GetTitle(), outDir=o.outDir, yMax=1.2, yLeg=yLeg, xLeg=xLeg, xMax=eff_Matched_1.GetXaxis().GetXmax(), xMin=eff_Matched_1.GetXaxis().GetXmin(), cmsText=o.cmsText, lumiText=o.lumiText, ) outFile.cd() eff_Matched_1.Write() eff_Matched_2.Write()
effDenName = "offTracks" eff_Matched_1 = makeEff(v , [effNumName, effDenName], inFile1,binning=binning) eff_Matched_2 = makeEff(v , [effNumName, effDenName], inFile2, binning=binning) yLeg = 0.93 xLeg = 0.5 if v in ["algo","origAlgo"]: yLeg = 0.4 xLeg = 0.6 drawComp("Eff_"+v,[(eff_Matched_1,o.name1, ROOT.kBlack), (eff_Matched_2,o.name2, ROOT.kRed, ROOT.kOpenCircle), #(eff_Matched_BTag,"t#bar{t} MC ",ROOT.kBlue), #(eff_Matched_BTag_noV0,"t#bar{t} MC ",ROOT.kGreen) ] ,yTitle="Online Track Efficiency Relative to Offline",xTitle=eff_Matched_1.GetXaxis().GetTitle(),outDir=o.outDir,yMax=1.2,yLeg=yLeg,xLeg=xLeg, xMax=eff_Matched_1.GetXaxis().GetXmax(), xMin=eff_Matched_1.GetXaxis().GetXmin() ) # # # if o.doCaloJets: effNumName = "offTracksCalo_matched" effDenName = "offTracksCalo" print v , [effNumName, effDenName] eff_Matched_1 = makeEff(v , [effNumName, effDenName], inFile1,binning=binning)