def rcPre2Loose(t,cuts): ops = config.logicOperators() rcjets = [] for b,pt in enumerate(t.reclusteredW_pt): rcjet = Py4Vector() rcjet.SetPtEtaPhiE(pt,t.reclusteredW_eta[b],t.reclusteredW_phi[b],t.reclusteredW_e[b]) rcPt = cuts['reclustered']['whad_pt']['value'] rcPt_cond = cuts['reclustered']['whad_pt']['cond'] Ms = cuts['reclustered']['whad_mwin']['value'][0] #only 1 bin if ops[rcPt_cond](rcjet.Pt,rcPt) and Ms[0] <= rcjet.M <= Ms[1]: subpt = []; subeta = [] subphi = []; sube = [] subm = [] nsub = t.reclusteredW_nsub[b] # for n in range(nsub): # subpt.append(t.reclusteredWsub_pt[b][n]) # subeta.append(t.reclusteredWsub_eta[b][n]) # subphi.append(t.reclusteredWsub_phi[b][n]) # sube.append(t.reclusteredWsub_e[b][n]) # subm.append(t.reclusteredWsub_m[b][n]) rcjet.SetRTSubJet(nsub,subpt,subeta,subphi,sube,subm) rcjets.append(rcjet) logging.info(" Setup Re-clustered Jets.") return rcjets
def getWcandidate(candidates,num,cond): """ :: DEPRECATED :: No longer used -- now use W-tagging information Choose the highest pT (no b-tagging stuff) jet(s) @param candidates = List of hadronic W candidates num = Number of hadronic W's required (1,2,3,etc.) cond = Conditional for number of hadronic W's (==,>,<,>=,<=,etc.) """ import pyMiniSL.config as config ops = config.logicOperators() wcandidates = [] if ops[cond](len(candidates),num): wcandidates = candidates return wcandidates if cond == '==': if len(candidates) > num: for n in range(num): wcandidates.append(candidates[n]) elif len(boostedWcands) < num: logging.error(" Too few W candidates.") wcandidates = [] else: logging.error(" No other condidtionals supported") logging.error(" Please try '=='") wcandidates = [] return wcandidates return wcandidates
def __init__(self,cfg_filename): """ Init @param cfg_filename Filename of the config file ("PyUser.ini") """ self.p_settings = info.getConfigSettings(cfg_filename) self.p_cfg_name = 'configuration' self.ops = config.logicOperators() self.key2attr = info.key2attr() self.obj2ttree = info.obj2ttree() self.truthObj = info.truthObject() self.nonGeVvars = info.nonGeVvariables() # variables that aren't in GeV (for scaling plots) self.GeV = 1000.
def __init__(self,parser,cuts): """Initialize the class by loading the config file.""" self.cuts = cuts # same for all events self.parser = parser # same for all events self.lvl = '' self.ops = config.logicOperators() self.name2attr = {'dr':'DeltaR',\ 'dp':'DeltaPhi',\ 'dm':'DeltaM'} self.op_keys = self.name2attr.keys()+['min','max'] self.key2attr = info.key2attr() # dictionary of object attributes and text file keys self.vector_objects = info.listed_objects() # list of objects that are stored as lists in event self.unique_objects = ['ht','met+mtw','nbtags','mass_lb','vlq_evtype',\ 'A_mass','A_dr','A_distance'] # simple definitions return
def fjPre2Loose(t,cuts): ops = config.logicOperators() boostedWcands = [] whad_n_cond = cuts['inclusive']['whad_n']['cond'] whad_n = cuts['inclusive']['whad_n']['value'] ## Check for boosted W first logging.debug(' Boosted Event') for b,pt in enumerate(t.boostedW_pt): fatjet = Py4Vector() fatjet.SetPtEtaPhiE(pt,t.boostedW_eta[b],t.boostedW_phi[b],t.boostedW_e[b]) skipThisFatJet=False for jj,smalljet in enumerate(t.jet_pt): smalljet = Py4Vector() smalljet.SetPtEtaPhiE(t.jet_pt[jj],t.jet_eta[jj],t.jet_phi[jj],t.jet_e[jj]) if skipThisFatJet: continue setattr(fatjet,'isSmoothTop50',t.boostedW_isSmoothTop50[b]) setattr(fatjet,'isSmoothTop80',t.boostedW_isSmoothTop80[b]) setattr(fatjet,'isPtLowTop50',t.boostedW_isPtLowTop50[b]) setattr(fatjet,'isPtHighTop50',t.boostedW_isPtHighTop50[b]) setattr(fatjet,'isPtLowTop80',t.boostedW_isPtLowTop80[b]) setattr(fatjet,'isPtHighTop80',t.boostedW_isPtHighTop80[b]) setattr(fatjet,'isWmed',t.boostedW_isWmed[b]) setattr(fatjet,'isWtight',t.boostedW_isWtight[b]) setattr(fatjet,'isZmed',t.boostedW_isZmed[b]) setattr(fatjet,'isZtight',t.boostedW_isZtight[b]) setattr(fatjet,'isGood',t.boostedW_isGood[b]) # Energy Correlations setattr(fatjet,'C2',t.boostedW_C2[b]) setattr(fatjet,'D2',t.boostedW_D2[b]) # Splitting Scales setattr(fatjet,'d12',t.boostedW_d12[b]) setattr(fatjet,'d23',t.boostedW_d23[b]) # N-subjettiness setattr(fatjet,'tau1',t.boostedW_tau1[b]) setattr(fatjet,'tau2',t.boostedW_tau2[b]) setattr(fatjet,'tau3',t.boostedW_tau3[b]) setattr(fatjet,'tau21',t.boostedW_tau21[b]) setattr(fatjet,'tau32',t.boostedW_tau32[b]) setattr(fatjet,'tau1_wta',t.boostedW_tau1_wta[b]) setattr(fatjet,'tau2_wta',t.boostedW_tau2_wta[b]) setattr(fatjet,'tau3_wta',t.boostedW_tau3_wta[b]) setattr(fatjet,'tau21_wta',t.boostedW_tau21_wta[b]) setattr(fatjet,'tau32_wta',t.boostedW_tau32_wta[b]) ## Re-structure the cuts to be easier to access Pts = cuts['boosted']['whad_pt']['value'] # bin edges Ms = cuts['boosted']['whad_mwin']['value'] # mass windows/bin D2s = cuts['boosted']['whad_d2']['value'] # single values/bin D2s_cond = cuts['boosted']['whad_d2']['cond'] nbins = len(Pts)-1 logging.debug(' Fat Jet pT,M,d2 = {0},{1},{2}'.format(fatjet.Pt(),fatjet.M(), fatjet.D2)) logging.debug(' pT bin edges: {0}'.format(Pts)) logging.debug(' D2 cut values: {0}'.format(D2s)) logging.debug(' Mass Window: {0}'.format(Ms)) if fatjet.Pt() < Pts[0]: continue for bin in range(nbins): if Pts[bin] < fatjet.Pt() < Pts[bin+1]: WmassMin = Ms[bin][0] WmassMax = Ms[bin][1] if WmassMin <= fatjet.M() <= WmassMax and ops[D2s_cond](fatjet.D2,D2s[bin]): boostedWcands.append(fatjet) break logging.debug(' Fat Jet Loop') logging.debug(' Number of Fat Jets: {0}'.format(len(boostedWcands))) if boostedWcands: boostedWcands = vlq.getWcandidate(boostedWcands,whad_n,whad_n_cond) logging.info(" Fat Jet Whad Candidate. ") return boostedWcands