chain.HNLmass = float(sample.name.rsplit('-', 1)[1]) chain.year = int(args.year) # # Loop over all events # from HNL.Tools.helpers import progress from HNL.ObjectSelection.tauSelector import tau_DMfinding, isCleanFromLightLeptons, passedMuonDiscr, passedElectronDiscr, tau_id_WP, isGoodGenTau algo_iso = 'deeptauVSjets' for entry in event_range: chain.GetEntry(entry) progress(entry - event_range[0], len(event_range)) for index in xrange(chain._gen_nL): cutter.cut(isGoodGenTau(chain, index), 'total gen tau') for index in xrange(chain._nLight, chain._nL): if chain._tauGenStatus[index] != 5: continue cutter.cut(True, 'total reconstructed tau') if not cutter.cut(chain._lFlavor[index] == 2, 'lFlavor == 2'): continue if not cutter.cut(chain._lPt[index] > 20, 'pt > 20 GeV'): continue if not cutter.cut(chain._lEta[index] < 2.3, 'eta < 2.3'): continue if not cutter.cut( tau_DMfinding[algo_iso](chain)[index] and chain._tauDecayMode[index] != 5 and chain._tauDecayMode[index] != 6, 'DM finding'): continue if not cutter.cut(isCleanFromLightLeptons(chain, index), 'clean from light lep'):
def isGoodGenLepton(chain, index): if chain._gen_lFlavor[index] == 0: return isGoodGenElectron(chain, index) if chain._gen_lFlavor[index] == 1: return isGoodGenMuon(chain, index) if chain._gen_lFlavor[index] == 2: return isGoodGenTau(chain, index) else: return False
for entry in event_range: chain.GetEntry(entry) progress(entry - event_range[0], len(event_range)) # # If reco efficiency should be included, we start from genuine generator level taus and match # these to reco taus # if args.includeReco is not None: for lepton in xrange(chain._gen_nL): chain.pt_tau = chain._gen_lPt[lepton] chain.eta_tau = chain._gen_lEta[lepton] if not isGoodGenTau(chain, lepton): continue matched_l = matchGenToReco(chain, lepton) for discr in args.discriminators: for algo in algos[discr]: if args.includeReco == 'noIso' or not args.makeCombinations: wp = None for v in list_of_var_hist['efficiency'][discr][ algo].keys(): list_of_var_hist['efficiency'][discr][algo][v][ wp].fill(chain, 1., matched_l is not None) else: for ele_wp in algos['ele'][linkIsoToLep('ele', algo)]: for mu_wp in algos['mu'][linkIsoToLep('mu', algo)]: for index, wp in enumerate(algos[discr][algo]): wp_passed = matched_l is not None and isGeneralTau(