def ConfiguredAsgPhotonIsEMSelector(name,
                                    quality,
                                    menu=photonPIDmenu.menuDC14,
                                    **kw):
    """
    Configure the AsgPhotonIsEMSelector with the quality cuts
    and allow for (re-)setting of all provided cuts.
    """
    try:
        ntuple = PhotonIsEMMap(quality, menu)
    except KeyError:
        sys.stderr.write(
            "Photon quality not found. Please use an egammaIDQuality (ElectronPhotonSelectorTools/egammaPIDdefs.h).\n This function only supports standard photon IDs, and not photon or forward IDs\n"
        )
        raise

    # Get the label for user data
    tmpName = (ntuple[1]).func_name
    labelName = "is" + ((tmpName.split("Selector")[0]).split("IsEM")[1])

    # Create and instance of the tool
    tool = CfgMgr.AsgPhotonIsEMSelector(name, **kw)

    # Configure it with the standard configuration
    ntuple[1](tool)
    tool.isEMMask = ntuple[0]

    # Get all provided properties and overwrite the default values with them
    SetToolProperties(tool, **kw)

    #print tool
    return tool
Exemple #2
0
def PhotonPidTools():
    from AthenaCommon.AppMgr import ToolSvc
    # Run2 Photon trigger
    for key in PhotonToolName:
        tool = CfgMgr.AsgPhotonIsEMSelector(PhotonToolName[key])
        tool.ConfigFile = ConfigFilePath + PhotonToolConfigFile[key]
        tool.isEMMask = PhotonIsEMBits[key]
        tool.ForceConvertedPhotonPID = True
        addToToolSvc(tool)
Exemple #3
0
def getMETMakerAlg(suffix, jetSelection="Tier0", jetColl=""):
    from AthenaCommon import CfgMgr

    print "Generate METMaker and METMakerAlg for METAssoc_" + suffix
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()

    doPFlow = 'PFlow' in suffix
    doTruth = suffix.startswith('Truth')
    metMaker = CfgMgr.met__METMaker(
        'METMaker_' + suffix,
        DoPFlow=doPFlow,
        DoSoftTruth=doTruth,
        JetSelection=jetSelection,
    )
    ToolSvc += metMaker

    muonSel = CfgMgr.CP__MuonSelectionTool(
        "MuonSelectionTool_METMakerAlg",
        MuQuality=1,  # Medium
        MaxEta=2.4)
    ToolSvc += muonSel

    elecSelLH = CfgMgr.AsgElectronLikelihoodTool(
        "EleSelLikelihood_METMakerAlg", WorkingPoint="MediumLHElectron")
    ToolSvc += elecSelLH

    photonSelIsEM = CfgMgr.AsgPhotonIsEMSelector("PhotonSelIsEM_METMakerAlg",
                                                 WorkingPoint="TightPhoton")
    ToolSvc += photonSelIsEM

    tauSel = CfgMgr.TauAnalysisTools__TauSelectionTool(
        "TauSelectionTool_METMakerAlg")
    ToolSvc += tauSel

    if jetColl == "":
        jetColl = suffix + 'Jets'
        if doTruth:
            jetColl = suffix.split('_')[1] + 'Jets'
    makerAlg = CfgMgr.met__METMakerAlg(
        'METMakerAlg_' + suffix,
        METMapName='METAssoc_' + suffix,
        METCoreName='MET_Core_' + suffix,
        METName='MET_Reference_' + suffix,
        InputJets=jetColl,
        Maker=metMaker,
        MuonSelectionTool=muonSel,
        ElectronLHSelectionTool=elecSelLH,
        PhotonIsEMSelectionTool=photonSelIsEM,
        TauSelectionTool=tauSel,
    )
    return makerAlg
Exemple #4
0
def PhotonPidTools():
    from AthenaCommon.AppMgr import ToolSvc
    # Run2 Photon trigger
    for key in PhotonToolName:
        if not ('1' in key):
            tool = CfgMgr.AsgPhotonIsEMSelector(PhotonToolName[key])
            tool.ConfigFile = ConfigFilePath + PhotonToolConfigFile[key]
            tool.isEMMask = PhotonIsEMBits[key]
            tool.ForceConvertedPhotonPID = True
            addToToolSvc(tool)

    # Run1 Photon triggers
    PhotonLoose1Sel = ConfiguredAsgElectronIsEMSelector(
        "AsgPhotonIsEMLoose1Selector", egammaPID.PhotonIDLooseEF,
        electronPIDmenu.menuTrig2012)
    PhotonLoose1Sel.caloOnly = True

    PhotonMedium1Sel = ConfiguredAsgElectronIsEMSelector(
        "AsgPhotonIsEMMedium1Selector", egammaPID.PhotonIDMediumEF,
        electronPIDmenu.menuTrig2012)
    PhotonMedium1Sel.caloOnly = True

    PhotonTight1Sel = ConfiguredAsgPhotonIsEMSelector(
        "AsgPhotonIsEMTight1Selector", egammaPID.PhotonIDTight)
    PhotonTight1Sel.ConfigFile = 'ElectronPhotonSelectorTools/dc14b_20141031/PhotonIsEMTight8TeVSelectorCutDefs.conf'
    PhotonTight1Sel.ForceConvertedPhotonPID = True

    addToToolSvc(PhotonLoose1Sel)
    addToToolSvc(PhotonMedium1Sel)
    addToToolSvc(PhotonTight1Sel)

    print "====  PhotonLooseHLT:                              0x%08x              =====" % SelectionDefPhoton.PhotonLoose
    print "====  PhotonLoose:                                 0x%08x              =====" % egammaPID.PhotonLoose
    print "====  PhotonMediumHLT:                             0x%08x              =====" % SelectionDefPhoton.PhotonMedium
    print "====  PhotonMedium:                                0x%08x              =====" % egammaPID.PhotonMedium
    print "====  PhotonTightHLT:                              0x%08x              =====" % SelectionDefPhoton.PhotonTight
    print "====  PhotonTight:                                 0x%08x              =====" % egammaPID.PhotonTight
Exemple #5
0
                                   JetJvtMomentName="NewJvt",
                                   DoPFlow=False)
tool1.METMakerTopo = mettoolTopo

mettoolPFlow = CfgMgr.met__METMaker('METMaker_AntiKt4PFlow',
                                    JetSelection="PFlow",
                                    JetJvtMomentName="NewJvt",
                                    DoPFlow=True)
tool1.METMakerPFlow = mettoolPFlow

museltool = CfgMgr.CP__MuonSelectionTool(
    "MuonSelectionTool",
    MuQuality=1,  # Medium
    MaxEta=2.4,
    TurnOffMomCorr=True)
tool1.MuonSelectionTool = museltool

eseltool = CfgMgr.AsgElectronLikelihoodTool("ElectronLHSelectionTool",
                                            WorkingPoint="MediumLHElectron")
tool1.ElectronLHSelectionTool = eseltool

phoseltool = CfgMgr.AsgPhotonIsEMSelector("PhotonIsEMSelectionTool",
                                          WorkingPoint="TightPhoton")
tool1.PhotonIsEMSelectionTool = phoseltool

tauseltool = CfgMgr.TauAnalysisTools__TauSelectionTool("TauSelectionTool")
tool1.TauSelectionTool = tauseltool

monMan = CfgMgr.AthenaMonManager("PhysValMonManager")
monMan.AthenaMonTools += [tool1]