["offHtAll330_l", "offHtAll0_l"], ["offHtAll370_l", "offHtAll0_l"], ["offHtAll430_l", "offHtAll0_l"], ["offHtAll510_l", "offHtAll0_l"], ["offHtAll590_l", "offHtAll0_l"], ["offHtAll680_vl", "offHtAll0_vl"], ["offHtAll780_vl", "offHtAll0_vl"], ["offHtAll890_vl", "offHtAll0_vl"], ["offHtAll1050_2vl", "offHtAll0_2vl"], ] for p in effPairs: dirName = "TrigTurnOnStudy" eff_Matched_1 = makeEff(p, dirName, inFile1, binning=1) if o.mc: 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(
plotRatio("nPV", "Events", inFileData, "Data", inFileMC, "MC", xTitle="nPV", outDir=o.outDir, binning=1) # # Offline Turnon curves: # effBinning = 5 eff_CaloCSV_Data = makeEff( "CSVv2_l", ["offJets_matchedCalocsvTag", "offJets_matchedCalo"], inFileData, binning=effBinning) eff_CaloCSV_MC = makeEff("CSVv2_l", ["offJets_matchedCalocsvTag", "offJets_matchedCalo"], inFileMC, binning=effBinning) eff_PFCSV_Data = makeEff("CSVv2_l", ["offJets_matchedPFcsvTag", "offJets_matched"], inFileData, binning=effBinning) eff_PFCSV_MC = makeEff("CSVv2_l", ["offJets_matchedPFcsvTag", "offJets_matched"], inFileMC, binning=effBinning) eff_CaloCSVvsDeepCSV_Data = makeEff(
if o.doAlgoStudy: for i in range(30): vars += ["Eta_forAlgo"+str(i)] vars += ["Pt_forAlgo"+str(i)] for v in vars: binning = 1 if not v.find("Eta_forAlgo") == -1: binning = 4 if not v.find("Pt_forAlgo") == -1: binning = [0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,50] if not o.doPuppiJets: eff_Matched = makeEff(v , ["offTracks_matched","offTracks"],inFileMC,binning=binning) # eff_Matched_noV0 = makeEff(v , ["offTracks_matched_noV0","offTracks_noV0"],inFileMC,binning=binning) else: eff_MatchedPuppi = makeEff(v , ["offTracksPuppi_matched","offTracksPuppi"],inFileMC,binning=binning) eff_MatchedPuppi_noV0 = makeEff(v , ["offTracksPuppi_matched_noV0","offTracksPuppi_noV0"],inFileMC,binning=binning) if o.doCaloJets: effCalo_Matched = makeEff(v , ["offTracksCalo_matched","offTracksCalo"],inFileMC,binning=binning) effCalo_Matched_noV0 = makeEff(v , ["offTracksCalo_matched_noV0","offTracksCalo_noV0"],inFileMC,binning=binning) vBtag = "track"+v if v=="phi": vBtag = "trackPhi" if v=="eta": vBtag = "trackEta" if v in ["HasInnerPixHit","IsFromSV","NStripHits","PV","PVweight","SV","SVweight","algo","charge"]: pass #continue if v in ["ip2d","ip2d_l","ip2d_err","ip2d_err_l","ip2d_sig","ip2d_sig_l", "ip3d","ip3d_l","ip3d_err","ip3d_err_l","ip3d_sig","ip3d_sig_l",
"trackNPixelHits", "trackNTotalHits", "trackPPar", "trackPParRatio", "trackPhi", "trackPt", "trackPtRatio", "trackPtRel", "trackPt_logx", ] for v in vars: binning = 1 eff_Matched = makeEff(v, ["offBTags_matched", "offBTags"], inFileMC, binning=binning) eff_Matched_noV0 = makeEff(v, ["offBTags_matched_noV0", "offBTags_noV0"], inFileMC, binning=binning) if o.doCaloJets: effCalo_Matched = makeEff(v, ["offBTagsCalo_matched", "offBTagsCalo"], inFileMC, binning=binning) effCalo_Matched_noV0 = makeEff( v, ["offBTagsCalo_matched_noV0", "offBTagsCalo_noV0"], inFileMC, binning=binning) vBtag = "track" + v
inFileData2, "Data 17", xTitle="DeepCSV", outDir=o.outDir, binning=1, cmsText=o.cmsText, lumiText=o.lumiText, setLogy=1) # # Offline Turnon curves: # effBinning = 5 eff_CaloCSVvsDeepCSV_Data = makeEff( "DeepCSV_l", ["offJets_matchedCalocsvTag", "offJets_matchedCalo"], inFileData1, binning=effBinning) eff_CaloCSVvsDeepCSV_MC = makeEff( "DeepCSV_l", ["offJets_matchedCalocsvTag", "offJets_matchedCalo"], inFileData2, binning=effBinning) eff_PFCSVvsDeepCSV_Data = makeEff( "DeepCSV_l", ["offJets_matchedPFcsvTag", "offJets_matched"], inFileData1, binning=effBinning) eff_PFCSVvsDeepCSV_MC = makeEff("DeepCSV_l", ["offJets_matchedPFcsvTag", "offJets_matched"], inFileData2, binning=effBinning) eff_CaloDeepCSV_Data = makeEff(
["ht330_EM_4j_3b_vs_ht330",["ht_4j_3b_em/ht_4j_3b_em_pass_4b","ht_4j_3b_em/ht_4j_3b_em_incl_4b"],["hT30_h330","hT30_all"]], # [["ht_4j_em/ht_4j_em_pass_4b","ht_4j_em/ht_4j_em_incl_4b"],["hT30_h330","hT30_all"]], ] for (pName, p1, p2) in effPairs: dirName = "trigStudy" if p1[1] == "allPt": binning = [] for i in range(20,202,2): binning.append(i) else: binning = 1 eff1 = makeEff(p1 , dirName, inFile, binning=binning, bayesRatio=0) eff2 = makeEff(p2 , dirName, inFile, binning=binning, bayesRatio=0) yLeg = 0.93 xLeg = 0.5 doFit = False#o.mc print "max is ",eff1.GetXaxis().GetXmax() drawComp("Eff_"+pName.replace("/","_"),[(eff1,p1[0], ROOT.kBlack), (eff2,p2[0], ROOT.kRed), #(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=eff1.GetXaxis().GetTitle(),outDir=o.outDir,yMax=1.25,yLeg=yLeg,xLeg=xLeg, xMax=eff1.GetXaxis().GetXmax(),
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 200, 300, 500, 750, 1000 ] if v in ["matched_dRAll", "matched_dRBjet"]: binning = 4 for config in effRatios: effNumName = config[0] effDenName = config[1] numHistOrigBinning = None if v == "pt_m": numHistOrigBinning = getHist(inFile1, effNumName, v, 1) eff_Matched_1 = makeEff(v, [effNumName, effDenName], inFile1, binning=binning, histForXBarycenterCalc=numHistOrigBinning) eff_Matched_1.SetName("Eff_" + o.name1 + "_" + effNumName + "_" + v) eff_Matched_2 = makeEff(v, [effNumName, effDenName], inFile2, binning=binning, histForXBarycenterCalc=numHistOrigBinning) eff_Matched_2.SetName("Eff_" + o.name2 + "_" + effNumName + "_" + v) min = 0.601 yLeg = 0.3 if v == "pt_m": eff_Matched_1.GetXaxis().SetTitle("p_{T} [GeV]") eff_Matched_2.GetXaxis().SetTitle("p_{T} [GeV]") min = 0.501 yLeg = 0.5
for i in range(30): vars += ["Eta_forAlgo"+str(i)] vars += ["Pt_forAlgo"+str(i)] for v in vars: binning = 1 if not v.find("Eta_forAlgo") == -1: binning = 4 if not v.find("Pt_forAlgo") == -1: binning = [0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,50] effNumName = "offTracks_matched" 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(),