def FillEfficiency(Chain, sample, args): global roc global ptHist global etaHist for lepton in xrange(Chain._nL): if not objSel.isGoodBaseTau(Chain, lepton): continue if Chain._tauGenStatus[lepton] != 5: continue for i in xrange(len(tau_id_algos)): roc[i].fill_eff_denominator(Chain._weight) ptHist[i].fill_denominator(Chain._lPt[lepton], Chain._weight) etaHist[i].fill_denominator(Chain._lEta[lepton], Chain._weight) if not Chain._tauEleVetoLoose[lepton]: continue if not Chain._tauMuonVetoLoose[lepton]: continue DMfinding = objSel.getDMfinding(Chain, lepton) discriminators = objSel.getTauIDs(Chain, lepton) for i, discr in enumerate(discriminators): if not DMfinding[i]: continue for j, WP in enumerate(discr): if WP: roc[i].fill_eff_numerator(j, Chain._weight) ptHist[i].fill_numerator(Chain._lPt[lepton], j, Chain._weight) etaHist[i].fill_numerator(Chain._lEta[lepton], j, Chain._weight)
def CalcFakeRate(Chain, sample, args): global roc global ptHist global etaHist for lepton in xrange(Chain._nL): if not objSel.isFakeTau(Chain, lepton): continue for i in xrange(len(tau_id_algos)): roc[i].fill_misid_denominator(Chain._weight) ptHist[i].fill_denominator(Chain._lPt[lepton], Chain._weight) etaHist[i].fill_denominator(Chain._lEta[lepton], Chain._weight) if objSel.lepHasOverlap(Chain, lepton): continue if not Chain._tauEleVetoVLoose[lepton]: continue if not Chain._tauMuonVetoLoose[lepton]: continue DMfinding = objSel.getDMfinding(Chain, lepton) discriminators = objSel.getTauIDs(Chain, lepton) for i, discr in enumerate(discriminators): if not DMfinding[i]: continue for j, WP in enumerate(discr): if WP: roc[i].fill_misid_numerator(j, Chain._weight) ptHist[i].fill_numerator(Chain._lPt[lepton], j, Chain._weight) etaHist[i].fill_numerator(Chain._lEta[lepton], j, Chain._weight)
def CalcBlujFakeRate(Chain, sample, args): global roc global ptHist global etaHist for lepton in xrange(Chain._nLight, Chain._nL): if not objSel.isGoodBaseTauIso(Chain, lepton): continue if Chain._tauGenStatus[lepton] != 6: continue for i in xrange(len(tau_id_algos)): roc[i].fill_misid_denominator(Chain._weight) ptHist[i].fill_denominator(Chain._lPt[lepton], Chain._weight) etaHist[i].fill_denominator(Chain._lEta[lepton], Chain._weight) DMfinding = objSel.getDMfinding(Chain, lepton) discriminators = objSel.getTauIDs(Chain, lepton) for i, discr in enumerate(discriminators): if not DMfinding[i]: continue for j, WP in enumerate(discr): if WP: roc[i].fill_misid_numerator(j, Chain._weight) ptHist[i].fill_numerator(Chain._lPt[lepton], j, Chain._weight) etaHist[i].fill_numerator(Chain._lEta[lepton], j, Chain._weight)
def CalcANFakeRate(Chain, sample, args): global roc global ptHist global etaHist for jet in xrange(Chain._nJets): if Chain._jetPt[jet] < 20 or abs(Chain._jetEta[jet]) > 2.3: continue jetVec = objSel.getFourVec(Chain._jetPt[jet], Chain._jetEta[jet], Chain._jetPhi[jet], Chain._jetE[jet]) #Find matching reco tau matchindex = objSel.tauMatchIndexIso(Chain, jetVec) if matchindex != 1 and Chain._tauGenStatus[matchindex] == 5: continue for i in xrange(len(tau_id_algos)): roc[i].fill_misid_denominator(CHain._weight) ptHist[i].fill_denominator(Chain._jetPt[jet], Chain._weight) etaHist[i].fill_denominator(Chain._jetEta[jet], Chain._weight) DMfinding = objSel.getDMfinding(Chain, matchindex) discriminators = objSel.getTauIDs(Chain, matchindex) for i, discr in enumerate(discriminators): if not DMfinding[i]: continue for j, WP in enumerate(discr): if WP: passedTau[i][j] += 1. ptHist[i].fill_numerator(Chain._lPt[matchindex], j, Chain._weight) etaHist[i].fill_numerator(Chain._lEta[matchindex], j, Chain._weight)
def FillANEfficiency(Chain, sample, args): global roc global ptHist global etaHist for genlepton in xrange(Chain._gen_nL): if not Chain._gen_lFlavor[genlepton] == 2: continue if not Chain._gen_lIsPrompt[genlepton]: continue if Chain._gen_lPt[genlepton] < 20 or abs( Chain._gen_lEta[genlepton]) > 2.3: continue genTauVec = objSel.GetFourVec(Chain._gen_lPt[genlepton], Chain._gen_lEta[genlepton], Chain._gen_lPhi[genlepton], Chain._gen_lE[genlepton]) #Find matching reco tau matchindex = objSel.tauMatchIndexIso(Chain, genTauVec, needFake=False) if matchindex == -1: continue for i in xrange(len(tau_id_algos)): roc[i].fill_eff_denominator(Chain._weight) ptHist[i].fill_denominator(Chain._gen_lPt[genlepton], Chain._weight) etaHist[i].fill_denominator(Chain._gen_lEta[genlepton], Chain._weight) DMfinding = objSel.getDMfinding(Chain, matchindex) discriminators = objSel.getTauIDs(Chain, matchindex) for i, discr in enumerate(discriminators): if not DMfinding[i]: continue for j, WP in enumerate(discr): if WP: roc[i].fill_eff_numerator(j, Chain._weight) ptHist[i].fill_numerator(Chain._lPt[matchindex], j, Chain._weight) etaHist[i].fill_numerator(Chain._lEta[matchindex], j, Chain._weight)