コード例 #1
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def vbfgHfakeCtrl(sample, rname):
    """
    VBF + photon had->photon fake control sample (low MET).
    """

    selector = vbfgBase(sample, rname)

    selector.setPreskim('superClusters.rawPt > 80.')

    selector.removeOperator(selconf['vbfTrigger'])
    selector.addOperator(ROOT.HLTFilter(selconf['vbfCtrlTrigger']))

    selector.findOperator('DijetSelection').setIgnoreDecision(True)

    # fake rate function obtained from hadron_fake/direct.py
    hproxyWeight = ROOT.TF1('hproxyWeight', 'TMath::Exp(-0.0173 * x - 0.178)', 80., 600.)

    weight = ROOT.PhotonPtWeight(hproxyWeight, 'vbfhtfactor')
    selector.addOperator(weight)

    photonSel = selector.findOperator('PhotonSelection')

    sp.setupPhotonSelection(photonSel, changes = selconf['hadronProxyDef'])
    sp.setupPhotonSelection(photonSel, veto = True)

    return selector
コード例 #2
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def vbfgHfake(sample, rname):
    """
    VBF + photon had->photon fake control sample.
    """

    selector = vbfgBase(sample, rname)

    filename, suffix = selconf['hadronTFactorSource']

    hadproxyTightWeight = su.getFromFile(filename, 'tfactTight', 'tfactTight' + suffix)
    hadproxyLooseWeight = su.getFromFile(filename, 'tfactLoose', 'tfactLoose' + suffix)
    hadproxyPurityUpWeight = su.getFromFile(filename, 'tfactNomPurityUp', 'tfactNomPurityUp' + suffix)
    hadproxyPurityDownWeight = su.getFromFile(filename, 'tfactNomPurityDown', 'tfactNomPurityDown' + suffix)

    sp.modHfake(selector)

    weight = selector.findOperator('hadProxyWeight')

    weight.addVariation('proxyDefUp', hadproxyTightWeight)
    weight.addVariation('proxyDefDown', hadproxyLooseWeight)
    weight.addVariation('purityUp', hadproxyPurityUpWeight)
    weight.addVariation('purityDown', hadproxyPurityDownWeight)

    photonSel = selector.findOperator('PhotonSelection')

    # Need to keep the cuts looser than nominal to accommodate proxyDefUp & Down
    # Proper cut applied at plotconfig as variations
    sp.setupPhotonSelection(photonSel, changes = ['!CHIso', '+CHIso11', '-NHIso', '+NHIsoLoose', '-PhIso', '+PhIsoLoose'])
    sp.setupPhotonSelection(photonSel, veto = True)

    return selector
コード例 #3
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def gghgNoE(sample, rname):
    """
    Full monophoton selection filtering out electron events.
    """

    selector = gghgBase(sample, rname, selcls=ROOT.PartonSelector)
    selector.setRejectedPdgId(11)

    sp.setupPhotonSelection(selector.findOperator('PhotonSelection'))

    sp.addIDSFWeight(sample, selector)

    return selector
コード例 #4
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def gghg(sample, rname):
    """
    GGH + photon candidate sample.
    """

    selector = gghgBase(sample, rname)

    sp.setupPhotonSelection(selector.findOperator('PhotonSelection'))

    if not sample.data:
        sp.addIDSFWeight(sample, selector)

    return selector
コード例 #5
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def vbfzee(sample, rname):
    """
    VBF + Zee sample for e-fake validation.
    """

    selector = vbfgBase(sample, rname)

    sp.setupPhotonSelection(selector.findOperator('PhotonSelection'))

    if not sample.data:
        sp.addIDSFWeight(sample, selector)

    leptonSel = selector.findOperator('LeptonSelection')
    leptonSel.setN(1, 0)

    return selector
コード例 #6
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def vbfem(sample, rname):
    """
    VBF + EM jet.
    """

    selector = vbfgBase(sample, rname)

    selector.removeOperator('VBFTrigger')
    if sample.data:
        selector.removeOperator('VBFVetoTrigger')

    selector.addOperator(ROOT.HLTFilter('HLT_Photon75'))

    sp.setupPhotonSelection(selector.findOperator('PhotonSelection'), changes = ['-Sieie', '+Sieie15', '-CHIso', '-NHIso', '+NHIsoLoose', '-PhIso', '+PhIsoLoose', '-EVeto'])

    selector.findOperator('DijetSelection').setIgnoreDecision(True)

    #if not sample.data:
    #    sp.addIDSFWeight(sample, selector)

    return selector
コード例 #7
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def vbfg(sample, rname):
    """
    VBF + photon candidate sample.
    """

    selector = vbfgBase(sample, rname)

    sp.setupPhotonSelection(selector.findOperator('PhotonSelection'))

    if not sample.data:
        digenjetSel = ROOT.DijetSelection('DigenjetSelection')
        digenjetSel.setMinDEta(0.)
        digenjetSel.setMinMjj(0.)
        digenjetSel.setJetType(ROOT.DijetSelection.jGen)
        selector.addOperator(digenjetSel)

        sp.addIDSFWeight(sample, selector)

#        if sample.name.startswith('gj'):
#            dijetSel = selector.findOperator('DijetSelection')
#            plots = ROOT.TFile.Open('/data/t3home000/yiiyama/monophoton/plots/vbfgloCtrl.root')
#            dijetSel.setDEtajjReweight(plots)

    return selector
コード例 #8
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def gghlBase(sample, rname, flavor, selcls=None):
    """
    Base for n-lepton + photon selection.
    For MC, we could use PartonSelector, but for interest of clarity and comparing cut flow
    with the other groups, we let events with all flavors pass.
    """

    if selcls is None:
        selector = ROOT.EventSelector(rname)
    else:
        selector = selcls(rname)

    selector.setPreskim(
        'superClusters.rawPt > 210. && TMath::Abs(superClusters.eta) < 1.4442')

    if sample.data:
        selector.addOperator(ROOT.HLTFilter(selconf['sphTrigger']))
    else:
        partons = ROOT.PartonFlavor()
        if flavor == ROOT.lElectron:
            partons.setRequiredPdgId(11)
        elif flavor == ROOT.lMuon:
            partons.setRequiredPdgId(13)

        partons.setIgnoreDecision(True)
        selector.addOperator(partons)

    operators = [
        'MetFilters',
        'PhotonSelection',
        'LeptonSelection',
        'TauVeto',
        'JetCleaning',
        'DijetSelection',
        'BjetVeto',
        'CopyMet',
        'CopySuperClusters',
        'LeptonRecoil',
    ]

    if not sample.data:
        operators.append('MetVariations')

    operators += [
        'PhotonMetDPhi', 'JetMetDPhi', 'Met', 'PhotonPtOverMet', 'PhotonMt'
    ]

    for op in operators:
        selector.addOperator(getattr(ROOT, op)())

    jetDPhi = selector.findOperator('JetMetDPhi')
    jetDPhi.setMetSource(ROOT.kInMet)

    photonSel = selector.findOperator('PhotonSelection')
    photonSel.setMinPt(220.)
    photonSel.setIDTune(selconf['photonIDTune'])
    photonSel.setWP(selconf['photonWP'])

    leptonSel = selector.findOperator('LeptonSelection')
    leptonSel.setRequireMedium(False)

    dijetSel = selector.findOperator('DijetSelection')
    dijetSel.setMinDEta(3.)
    dijetSel.setMinMjj(500.)
    dijetSel.setIgnoreDecision(True)

    sp.setupPhotonSelection(photonSel)

    selector.findOperator('LeptonRecoil').setFlavor(flavor)

    if not sample.data:
        metVar = selector.findOperator('MetVariations')
        metVar.setPhotonSelection(photonSel)

        realMetVar = ROOT.MetVariations('RealMetVar')
        realMetVar.setMetSource(ROOT.kInMet)
        realMetVar.setPhotonSelection(photonSel)

        selector.findOperator('PhotonMetDPhi').setMetVariations(metVar)

        jetDPhi.setMetVariations(realMetVar)

        selector.addOperator(
            ROOT.ConstantWeight(sample.crosssection / sample.sumw,
                                'crosssection'))

        sg.addPUWeight(sample, selector)
        sp.addIDSFWeight(sample, selector)
        sg.addPDFVariation(sample, selector)

        if flavor == ROOT.lElectron:
            sp.addElectronIDSFWeight(sample, selector)
        else:
            sp.addMuonIDSFWeight(sample, selector)

    selector.findOperator('TauVeto').setIgnoreDecision(True)
    selector.findOperator('BjetVeto').setIgnoreDecision(True)
    selector.findOperator('JetCleaning').setCleanAgainst(ROOT.cTaus, False)
    selector.findOperator('PhotonMetDPhi').setIgnoreDecision(True)
    selector.findOperator('JetMetDPhi').setIgnoreDecision(True)
    selector.findOperator('Met').setIgnoreDecision(True)
    selector.findOperator('Met').setThreshold(100.)
    selector.findOperator('PhotonPtOverMet').setIgnoreDecision(True)

    return selector
コード例 #9
0
ファイル: selectors.py プロジェクト: MiT-HEP/MonoX
def ph75(sample, rname):
    selector = ROOT.EventSelector(rname)
    vbfgSetting()

    selector.setPreskim('superClusters.rawPt > 50.')

    selector.addOperator(ROOT.HLTFilter('HLT_Photon50_OR_HLT_Photon75'))

    hltph50 = ROOT.HLTFilter('HLT_Photon50')
    hltph50.setIgnoreDecision(True)
    selector.addOperator(hltph50)
    hltph75 = ROOT.HLTFilter('HLT_Photon75')
    hltph75.setIgnoreDecision(True)
    selector.addOperator(hltph75)
    hltph75vbf = ROOT.HLTFilter(selconf['vbfTrigger'])
    hltph75vbf.setIgnoreDecision(True)
    selector.addOperator(hltph75vbf)

    operators = [
        'MetFilters',
        'PhotonSelection',
        'LeptonSelection',
        'TauVeto',
        'JetCleaning',
        'BjetVeto',
        'CopyMet',
        'CopySuperClusters'
    ]

    if not sample.data:
        operators.append('MetVariations')
        
    operators += [
        'PhotonMetDPhi',
        'JetMetDPhi',
        'PhotonJetDPhi',
        'PhotonMt',
        'DijetSelection'
    ]

    for op in operators:
        selector.addOperator(getattr(ROOT, op)())

    photonSel = selector.findOperator('PhotonSelection')
    photonSel.setMinPt(50.)
    photonSel.setIDTune(selconf['photonIDTune'])
    photonSel.setWP(selconf['photonWP'])
    sp.setupPhotonSelection(photonSel, changes = ['-Sieie', '-CHIso', '+Sieie15', '+CHIso11'])

    leptonSel = selector.findOperator('LeptonSelection')
    leptonSel.setN(0, 0)
    leptonSel.setRequireMedium(False)
    leptonSel.setRequireTight(False)

    dijetSel = selector.findOperator('DijetSelection')
    dijetSel.setMinDEta(3.)
    dijetSel.setMinMjj(500.)
    dijetSel.setIgnoreDecision(True)

    if not sample.data:
        metVar = selector.findOperator('MetVariations')
        metVar.setPhotonSelection(photonSel)

        photonDPhi = selector.findOperator('PhotonMetDPhi')
        photonDPhi.setMetVariations(metVar)
        
        jetDPhi = selector.findOperator('JetMetDPhi')
        jetDPhi.setMetVariations(metVar)

        selector.findOperator('PhotonJetDPhi').setMetVariations(metVar)

        selector.addOperator(ROOT.ConstantWeight(sample.crosssection / sample.sumw, 'crosssection'))

        sg.addPUWeight(sample, selector)
        sg.addPDFVariation(sample, selector)

        sp.addElectronVetoSFWeight(sample, selector)
        sp.addMuonVetoSFWeight(sample, selector)

    selector.findOperator('TauVeto').setIgnoreDecision(True)
    selector.findOperator('BjetVeto').setIgnoreDecision(True)
    selector.findOperator('JetCleaning').setCleanAgainst(ROOT.cTaus, False)
    selector.findOperator('PhotonMetDPhi').setIgnoreDecision(True)
    selector.findOperator('JetMetDPhi').setIgnoreDecision(True)

    return selector