Beispiel #1
0
 'SoftJetLessNOBTAG': [
    MVAVar("LepGood_mcMatchAny",lambda x: getattr(x,'mcMatchAny',-999)),
  ],
}
_CommonSpect['forMoriond_eleOLD'] = _CommonSpect['forMoriond']
_CommonSpect['forMoriond_eleHZZ'] = _CommonSpect['forMoriond']
_CommonSpect['forMoriond_eleGP'] = _CommonSpect['forMoriond']

_CommonVars = {
 'forMoriond':[ 
    MVAVar("LepGood_pt",lambda x: x.pt()),
    MVAVar("LepGood_eta",lambda x: x.eta()),
    MVAVar("LepGood_jetNDauChargedMVASel",lambda lepton: sum((deltaR(x.eta(),x.phi(),lepton.eta(),lepton.phi())<=0.4 and x.charge()!=0 and x.fromPV()>1 and x.hasTrackDetails() and qualityTrk(x.pseudoTrack(),lepton.associatedVertex)) for x in lepton.jet.daughterPtrVector()) if hasattr(lepton,'jet') and lepton.jet != lepton else 0),
    MVAVar("LepGood_miniRelIsoCharged",lambda x: getattr(x,'miniAbsIsoCharged',-99)/x.pt()), 
    MVAVar("LepGood_miniRelIsoNeutral",lambda x: getattr(x,'miniAbsIsoNeutral',-99)/x.pt()), 
    MVAVar("LepGood_jetPtRelv2", lambda x : ptRelv2(x) if hasattr(x,'jet') else -1),
    MVAVar("LepGood_jetPtRatio := min(LepGood_jetPtRatiov2,1.5)", lambda x : min((x.pt()/jetLepAwareJEC(x).Pt() if hasattr(x,'jet') else -1), 1.5)),
    MVAVar("LepGood_jetBTagCSV := max(LepGood_jetBTagCSV,0)", lambda x : max( (x.jet.btag('pfCombinedInclusiveSecondaryVertexV2BJetTags') if hasattr(x.jet, 'btag') else -99) ,0.)),
    MVAVar("LepGood_sip3d",lambda x: x.sip3D()),
    MVAVar("LepGood_dxy := log(abs(LepGood_dxy))",lambda x: log(abs(x.dxy()))),
    MVAVar("LepGood_dz  := log(abs(LepGood_dz))", lambda x: log(abs(x.dz()))),
 ],
 'SoftJetLessNOBTAG': [
    MVAVar("LepGood_pt",lambda x: x.pt()),
    MVAVar("LepGood_eta",lambda x: x.eta()),
    MVAVar("LepGood_miniRelIsoCharged := min(LepGood_miniRelIsoCharged,4)",lambda x: min(getattr(x,'miniAbsIsoCharged',-99)/x.pt(),4)),
    MVAVar("LepGood_miniRelIsoNeutral := min(LepGood_miniRelIsoNeutral,4)",lambda x: min(getattr(x,'miniAbsIsoNeutral',-99)/x.pt(),4)),
    MVAVar("LepGood_isoRelH04",lambda x: isoRelH(x,'04') if hasattr(x,'isoSumRawP4Charged04') else -1),
    MVAVar("LepGood_RelIsoChargedFix04 := min(LepGood_RelIsoChargedFix04,4)",lambda x: min(getattr(x,'AbsIsoMIVCharged04',-99)/x.pt(),4)),
    MVAVar("LepGood_RelIsoNeutralFix04 := min(LepGood_RelIsoNeutralFix04,4)",lambda x: min(getattr(x,'AbsIsoMIVNeutral04',-99)/x.pt(),4)),
    MVAVar("LepGood_sip3d",lambda x: x.sip3D()),
Beispiel #2
0
_CommonVars = {
    'forMoriond': [
        MVAVar("LepGood_pt", lambda x: x.pt()),
        MVAVar("LepGood_eta", lambda x: x.eta()),
        MVAVar(
            "LepGood_jetNDauChargedMVASel", lambda lepton: sum(
                (deltaR(x.eta(), x.phi(), lepton.jet.eta(), lepton.jet.phi())
                 <= 0.4 and x.charge() != 0 and x.fromPV() > 1 and qualityTrk(
                     x.pseudoTrack(), lepton.associatedVertex))
                for x in lepton.jet.daughterPtrVector())
            if hasattr(lepton, 'jet') and lepton.jet != lepton else 0),
        MVAVar("LepGood_miniRelIsoCharged",
               lambda x: getattr(x, 'miniAbsIsoCharged', -99) / x.pt()),
        MVAVar("LepGood_miniRelIsoNeutral",
               lambda x: getattr(x, 'miniAbsIsoNeutral', -99) / x.pt()),
        MVAVar("LepGood_jetPtRelv2", lambda x: ptRelv2(x)
               if hasattr(x, 'jet') else -1),
        MVAVar(
            "LepGood_jetPtRatio := min(LepGood_jetPtRatiov2,1.5)",
            lambda x: min((x.pt() / jetLepAwareJEC(x).Pt()
                           if hasattr(x, 'jet') else -1), 1.5)),
        MVAVar(
            "LepGood_jetBTagCSV := max(LepGood_jetBTagCSV,0)", lambda x: max(
                (x.jet.btag('pfCombinedInclusiveSecondaryVertexV2BJetTags')
                 if hasattr(x.jet, 'btag') else -99), 0.)),
        MVAVar("LepGood_sip3d", lambda x: x.sip3D()),
        MVAVar("LepGood_dxy := log(abs(LepGood_dxy))",
               lambda x: log(abs(x.dxy()))),
        MVAVar("LepGood_dz  := log(abs(LepGood_dz))",
               lambda x: log(abs(x.dz()))),
    ],
Beispiel #3
0
class CategorizedMVA:
    def __init__(self,catMvaPairs):
        self.catMvaPairs = catMvaPairs
    def __call__(self,lep,ncorr):
        for c,m in self.catMvaPairs:
            if c(lep): return m(lep,ncorr)
        return -99.

_CommonSpect = [ 
]
_CommonVars = {
 'WithPtV2':[ 
    MVAVar("LepGood_pt",lambda x: x.pt()),
    MVAVar("LepGood_miniRelIsoCharged",lambda x: getattr(x,'miniAbsIsoCharged',-99)/x.pt()), 
    MVAVar("LepGood_miniRelIsoNeutral",lambda x: getattr(x,'miniAbsIsoNeutral',-99)/x.pt()), 
    MVAVar("LepGood_jetPtRelv2", lambda x : ptRelv2(x) if hasattr(x,'jet') else -1),
    MVAVar("LepGood_jetPtRatio := min(LepGood_jetPtRatio_LepAwareJECv2,1.5)", lambda x : min((x.pt()/jetLepAwareJEC(x).Pt() if hasattr(x,'jet') else -1), 1.5)),
    MVAVar("LepGood_jetBTagCSV := max(LepGood_jetBTagCSV,0)", lambda x : max( (x.jet.btag('pfCombinedInclusiveSecondaryVertexV2BJetTags') if hasattr(x.jet, 'btag') else -99) ,0.)),
    MVAVar("LepGood_sip3d",lambda x: x.sip3D()),
    MVAVar("LepGood_dxy := log(abs(LepGood_dxy))",lambda x: log(abs(x.dxy()))),
    MVAVar("LepGood_dz  := log(abs(LepGood_dz))", lambda x: log(abs(x.dz()))),
 ], 'forMoriond16':[ 
    MVAVar("LepGood_pt",lambda x: x.pt()),
    MVAVar("LepGood_eta",lambda x: x.eta()),
    MVAVar("LepGood_jetNDauChargedMVASel",lambda lepton: sum((deltaR(x.eta(),x.phi(),lepton.jet.eta(),lepton.jet.phi())<=0.4 and x.charge()!=0 and x.fromPV()>1 and qualityTrk(x.pseudoTrack(),lepton.associatedVertex)) for x in lepton.jet.daughterPtrVector()) if hasattr(lepton,'jet') and lepton.jet != lepton else 0),
    MVAVar("LepGood_miniRelIsoCharged",lambda x: getattr(x,'miniAbsIsoCharged',-99)/x.pt()), 
    MVAVar("LepGood_miniRelIsoNeutral",lambda x: getattr(x,'miniAbsIsoNeutral',-99)/x.pt()), 
    MVAVar("LepGood_jetPtRelv2", lambda x : ptRelv2(x) if hasattr(x,'jet') else -1),
    MVAVar("LepGood_jetPtRatio := min(LepGood_jetPtRatiov2,1.5)", lambda x : min((x.pt()/jetLepAwareJEC(x).Pt() if hasattr(x,'jet') else -1), 1.5)),
    MVAVar("LepGood_jetBTagCSV := max(LepGood_jetBTagCSV,0)", lambda x : max( (x.jet.btag('pfCombinedInclusiveSecondaryVertexV2BJetTags') if hasattr(x.jet, 'btag') else -99) ,0.)),
    MVAVar("LepGood_sip3d",lambda x: x.sip3D()),