def getJets(c):
    return [
        getObjDict(c, 'Jet_', [
            'eta', 'pt', 'phi', 'btagCMVA', 'btagCSV', 'mcMatchFlav',
            'partonId', 'id'
        ], i) for i in range(int(getVarValue(c, 'nJet')))
    ]
def getGenPartsAll(c):
    return [
        getObjDict(c, 'genPartAll_', [
            'eta', 'pt', 'phi', 'charge', 'pdgId', 'motherId', 'grandmotherId',
            'daughterIndex1', 'daughterIndex2'
        ], i) for i in range(int(getVarValue(c, 'ngenPartAll')))
    ]
def getLeptons(c):
    return [
        getObjDict(c, 'LepGood_', [
            'eta', 'pt', 'phi', 'charge', 'dxy', 'dz', 'relIso03', 'tightId',
            'pdgId', 'mediumMuonId', 'miniRelIso', 'sip3d', 'mvaIdPhys14',
            'convVeto', 'lostHits'
        ], i) for i in range(int(getVarValue(c, 'nLepGood')))
    ]
def getGenPartsAll(c):
    return [getObjDict(c, "genPartAll_", genVars, i) for i in range(int(getVarValue(c, "ngenPartAll")))]
def getGenLeps(c):
    return [
        getObjDict(c, "genLep_", ["eta", "pt", "phi", "charge", "pdgId", "sourceId"], i)
        for i in range(int(getVarValue(c, "ngenLep")))
    ]
def getGenPartsAll(c):
    return [
        getObjDict(c, 'genPartAll_', genVars, i)
        for i in range(int(getVarValue(c, 'ngenPartAll')))
    ]
def getPhotons(c, collVars=photonVars, idLevel='loose'):
    return [
        getObjDict(c, 'gamma_', collVars, i)
        for i in range(int(getVarValue(c, 'ngamma')))
    ]
def getGenLeps(c):
    return [
        getObjDict(c, 'genLep_',
                   ['eta', 'pt', 'phi', 'charge', 'pdgId', 'sourceId'], i)
        for i in range(int(getVarValue(c, 'ngenLep')))
    ]
def getOtherLeptons(c, collVars=leptonVars):
    return [
        getObjDict(c, 'LepOther_', collVars, i)
        for i in range(int(getVarValue(c, 'nLepOther')))
    ]
def getElectrons(c):
  return [getObjDict(c, 'LepGood_', ['eta','pt','phi','charge', 'dxy', 'dz', 'relIso03','tightId', 'pdgId', 'mediumMuonId', 'miniRelIso', 'sip3d', 'mvaIdPhys14', 'convVeto', 'lostHits'], i) for i in range(int(getVarValue(c, 'nLepGood'))) if abs(getVarValue(c,"LepGood_pdgId",i))==11]
def getGenPartsAll(c):
  return [getObjDict(c, 'genPartAll_', ['eta','pt','phi','charge', 'pdgId', 'motherId', 'grandmotherId'], i) for i in range(int(getVarValue(c, 'ngenPartAll')))]
def getPhotons(c, collVars=photonVars, idLevel="loose"):
    return [getObjDict(c, "gamma_", collVars, i) for i in range(int(getVarValue(c, "ngamma")))]
def getTaus(c, collVars=tauVars):
    return [getObjDict(c, "TauGood_", collVars, i) for i in range(int(getVarValue(c, "nTauGood")))]
def getGenParts(c):
    return [
        getObjDict(c, "GenPart_", ["eta", "pt", "phi", "charge", "pdgId", "motherId", "grandmotherId"], i)
        for i in range(int(getVarValue(c, "nGenPart")))
    ]
def getMuons(c, collVars=leptonVars):
    return [
        getObjDict(c, "LepGood_", collVars, i)
        for i in range(int(getVarValue(c, "nLepGood")))
        if abs(getVarValue(c, "LepGood_pdgId", i)) == 13
    ]
def getOtherLeptons(c, collVars=leptonVars):
    return [getObjDict(c, "LepOther_", collVars, i) for i in range(int(getVarValue(c, "nLepOther")))]
def getLeptons(c, collVars=leptonVars):
    return [getObjDict(c, "LepGood_", collVars, i) for i in range(int(getVarValue(c, "nLepGood")))]
def getGenLeps(c):
  return [getObjDict(c, 'genLep_', ['eta','pt','phi','charge', 'pdgId', 'sourceId'], i) for i in range(int(getVarValue(c, 'ngenLep')))]
def getJets(c, jetVars=jetVars, jetColl="Jet"):
    return [getObjDict(c, jetColl + "_", jetVars, i) for i in range(int(getVarValue(c, "n" + jetColl)))]
def getJets(c):
  return [getObjDict(c, 'Jet_', ['eta','pt','phi','btagCMVA','btagCSV', 'id'], i) for i in range(int(getVarValue(c, 'nJet')))]
    met_phi = reader.data.met_phi
    met_genPt = reader.data.met_genPt
    met_genPhi = reader.data.met_genPhi
    delta_met = sqrt( ( met_pt*cos(met_phi)-met_genPt*cos(met_genPhi) )**2 + ( met_pt*sin(met_phi)-met_genPt*sin(met_genPhi) )**2 )

    mt2Calc.reset()
    mt2Calc.setMet( met_pt, met_phi )
    mt2Calc.setLeptons( reader.data.l1_pt, reader.data.l1_eta, reader.data.l1_phi, reader.data.l2_pt, reader.data.l2_eta, reader.data.l2_phi )
    if not mt2Calc.mt2ll() != reader.data.dl_mt2ll:
        logger.warning( "MT2 inconsistency!" )
    mt2Calc.setMet( met_genPt, met_genPhi )
    mt2ll_genMet = mt2Calc.mt2ll()
    if mt2ll_genMet<140:
        logger.info(bold("MET mismeasurement"))

    jets = [ getObjDict(cmg_reader.data, "Jet_", ["pt","eta","phi","mcPt","id"], i) for i in range(cmg_reader.data.nJet) ] 
    dx, dy = 0., 0.
    for j in jets:
        if j['mcPt']>0:
            dx+=(j['pt']-j['mcPt'])*cos(j['phi'])
            dy+=(j['pt']-j['mcPt'])*cos(j['phi'])
        if abs(j['pt'] - j['mcPt'])>50:
            logger.info( "Mismeasured jet pt %3.2f mcPt %3.2f diff %3.2f, eta %3.2f phi %3.2f id %i", j['pt'], j['mcPt'], j['pt']-j['mcPt'], j['eta'], j['phi'], j['id'] )
        corr_pt = localJetResponse.corrected_jet_pt(j['pt'], j['eta'], j['phi'])
        local_mism = corr_pt - j['pt']
        if abs(local_mism) > 30:
            logger.info( bold("Local jet response difference!")+" mcPt %3.2f pt %3.2f corr.Pt %3.2f diff %3.2f eta %3.2f phi %3.2f id %i", j['mcPt'], j['pt'], corr_pt, local_mism, j['eta'], j['phi'], j['id'] )
    jet_mismeas = sqrt(dx**2+dy**2)

    logger.info( "Delta MET(reco-gen) %3.2f jet-mismeas %3.2f mt2ll %3.2f mt2ll(gen_met) %3.2f", delta_met, jet_mismeas, reader.data.dl_mt2ll, mt2ll_genMet )
    logger.info( "Location of %i:%i:%i %s:", cmg_reader.data.run, cmg_reader.data.lumi, cmg_reader.data.evt, cmg_reader.sample.chain.GetCurrentFile().GetName() )
def getLeptons(c, collVars=leptonVars):
    return [
        getObjDict(c, 'LepGood_', collVars, i)
        for i in range(int(getVarValue(c, 'nLepGood')))
    ]
def getJets(c, jetVars=jetVars):
    return [
        getObjDict(c, 'Jet_', jetVars, i)
        for i in range(int(getVarValue(c, 'nJet')))
    ]
def getElectrons(c, collVars=leptonVars):
    return [
        getObjDict(c, 'LepGood_', collVars, i)
        for i in range(int(getVarValue(c, 'nLepGood')))
        if abs(getVarValue(c, "LepGood_pdgId", i)) == 11
    ]
def getJets(c, jetVars=jetVars):
  return [getObjDict(c, 'Jet_', jetVars, i) for i in range(int(getVarValue(c, 'nJet')))]
def getTaus(c, collVars=tauVars):
    return [
        getObjDict(c, 'TauGood_', collVars, i)
        for i in range(int(getVarValue(c, 'nTauGood')))
    ]
def getLeptons(c, collVars=leptonVars):
  return [getObjDict(c, 'LepGood_', collVars, i) for i in range(int(getVarValue(c, 'nLepGood')))]
def getGenParts(c):
    return [
        getObjDict(c, 'GenPart_', [
            'eta', 'pt', 'phi', 'charge', 'pdgId', 'motherId', 'grandmotherId'
        ], i) for i in range(int(getVarValue(c, 'nGenPart')))
    ]
def getElectrons(c, collVars=leptonVars):
  return [getObjDict(c, 'LepGood_', collVars, i) for i in range(int(getVarValue(c, 'nLepGood'))) if abs(getVarValue(c,"LepGood_pdgId",i))==11]
def getJets(c, jetVars=jetVars, jetColl="Jet"):
    return [
        getObjDict(c, jetColl + '_', jetVars, i)
        for i in range(int(getVarValue(c, 'n' + jetColl)))
    ]
Exemple #31
0
def getTaus(c, collVars=tauVars):
  return [getObjDict(c, 'TauGood_', collVars, i) for i in range(int(getVarValue(c, 'nTauGood')))]