Ejemplo n.º 1
0
def getTauWPDecoratorJetRNN():

    _name = sPrefix + 'TauWPDecoratorJetRNN'

    if _name in cached_instances:
        return cached_instances[_name]

    import PyUtils.RootUtils as ru
    ROOT = ru.import_root()
    import cppyy
    cppyy.loadDictionary('xAODTau_cDict')

    from AthenaCommon.AppMgr import ToolSvc
    from tauRecTools.tauRecToolsConf import TauWPDecorator
    TauWPDecorator = TauWPDecorator( name=_name,
                                     flatteningFile0Prong = "rnnid_flat_0p_v4.root",
                                     flatteningFile1Prong = "rnnid_flat_1p_v4.root",
                                     flatteningFile3Prong = "rnnid_flat_mp_v4.root",
                                     CutEnumVals =
                                     [ ROOT.xAOD.TauJetParameters.JetRNNSigVeryLoose, ROOT.xAOD.TauJetParameters.JetRNNSigLoose,
                                       ROOT.xAOD.TauJetParameters.JetRNNSigMedium, ROOT.xAOD.TauJetParameters.JetRNNSigTight ],
                                     SigEff0P = [0.98, 0.90, 0.65, 0.50],
                                     SigEff1P = [0.992, 0.99, 0.965, 0.94],
                                     SigEff3P = [0.99, 0.98, 0.865, 0.80],
                                     ScoreName = "RNNJetScore",
                                     NewScoreName = "RNNJetScoreSigTrans",
                                     DefineWPs = True,
                                 )

    ToolSvc += TauWPDecorator
    cached_instances[_name] = TauWPDecorator
    return TauWPDecorator
Ejemplo n.º 2
0
def getTauWPDecoratorJetBDT():
    import PyUtils.RootUtils as ru
    ROOT = ru.import_root()
    import cppyy
    cppyy.loadDictionary('xAODTau_cDict')

    _name = sPrefix + 'TauWPDecoratorJetBDT'
    from tauRecTools.tauRecToolsConf import TauWPDecorator
    myTauWPDecorator = TauWPDecorator(
        name=_name,
        flatteningFile1Prong="FlatJetBDT1Pv2.root",  #update
        flatteningFile3Prong="FlatJetBDT3Pv2.root",  #update
        CutEnumVals=[
            ROOT.xAOD.TauJetParameters.JetBDTSigVeryLoose,
            ROOT.xAOD.TauJetParameters.JetBDTSigLoose,
            ROOT.xAOD.TauJetParameters.JetBDTSigMedium,
            ROOT.xAOD.TauJetParameters.JetBDTSigTight
        ],
        SigEff1P=[0.95, 0.85, 0.75, 0.60],
        SigEff3P=[0.95, 0.75, 0.60, 0.45],
        ScoreName="BDTJetScore",
        NewScoreName="BDTJetScoreSigTrans",
        DefineWPs=True,
    )
    cached_instances[_name] = myTauWPDecorator
    return myTauWPDecorator
Ejemplo n.º 3
0
def getTauWPDecoratorEleBDT():
    import PyUtils.RootUtils as ru
    ROOT = ru.import_root()
    import cppyy
    cppyy.loadDictionary('xAODTau_cDict')

    _name = sPrefix + 'TauWPDecoratorEleBDT'
    from tauRecTools.tauRecToolsConf import TauWPDecorator
    TauScoreFlatteningTool = TauWPDecorator(
        name=_name,
        flatteningFile1Prong="EleBDTFlat1P.root",  #update
        flatteningFile3Prong=
        "EleBDTFlat3P.root",  #update                                             
        UseEleBDT=True,
        ScoreName="BDTEleScore",
        NewScoreName="BDTEleScoreSigTrans",  #dynamic
        DefineWPs=True,
        CutEnumVals=[
            ROOT.xAOD.TauJetParameters.EleBDTLoose,
            ROOT.xAOD.TauJetParameters.EleBDTMedium,
            ROOT.xAOD.TauJetParameters.EleBDTTight
        ],
        SigEff1P=[0.95, 0.85, 0.75],
        SigEff3P=[0.95, 0.85, 0.75],
    )
    cached_instances[_name] = TauScoreFlatteningTool
    return TauScoreFlatteningTool
Ejemplo n.º 4
0
def MC12PlusTruthServiceCfg(ConfigFlags, name="ISF_MC12PlusTruthService", **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary("AtlasDetDescrDict")
    AtlasRegion = ROOT.AtlasDetDescr
    kwargs.setdefault("ForceEndVtxInRegions", [AtlasRegion.fAtlasID] )
    return MC12TruthServiceCfg(ConfigFlags, name, **kwargs)
Ejemplo n.º 5
0
def getTauTrackRNNClassifier():
    _name = sPrefix + 'TauTrackRNNClassifier'

    if _name in cached_instances:
        return cached_instances[_name]

    from AthenaCommon.AppMgr import ToolSvc
    from tauRecTools.tauRecToolsConf import tauRecTools__TauTrackRNNClassifier as TauTrackRNNClassifier
    from tauRecTools.tauRecToolsConf import tauRecTools__TrackRNN as TrackRNN

    import cppyy
    cppyy.loadDictionary('xAODTau_cDict')

    _RNN = TrackRNN(
        name=_name + "_0",
        InputWeightsPath=tauFlags.tauRecRNNTrackClassificationConfig()[0],
        calibFolder=tauFlags.tauRecToolsCVMFSPath(),
    )

    ToolSvc += _RNN
    cached_instances[_RNN.name] = _RNN

    # create tool alg
    myTauTrackClassifier = TauTrackRNNClassifier(name=_name,
                                                 Classifiers=[_RNN])
    cached_instances[_name] = myTauTrackClassifier

    return myTauTrackClassifier
Ejemplo n.º 6
0
def have_cppyy():
    import sys, platform
    try:
        import cppyy as Dict
        if platform.system() == 'Linux':
            Dict.loadDictionary('libOnlineKernelDict')
        else:
            Dict.loadDictionary('OnlineKernelDict.dll')

        CPP = Dict.makeNamespace('CPP')
        gbl = Dict.gbl
        std = gbl.std

        Interactor = CPP.PyInteractor
        Event = CPP.Event
        BaseSensor = CPP.Sensor
        IocSensor = CPP.IocSensor
        TimeSensor = CPP.TimeSensor
        Sensor = gbl.UpiSensor
        UpiSensor = gbl.UpiSensor
        return True
    except Exception, X:
        print 'OnlineKernel: Failed to use cppyy - you need to live without. [%s]' % (
            str(X), )
        return None
Ejemplo n.º 7
0
def getTauWPDecoratorJetBDT():

    _name = sPrefix + 'TauWPDecoratorJetBDT'
    if _name in cached_instances:
        return cached_instances[_name]

    import PyUtils.RootUtils as ru
    ROOT = ru.import_root()
    import cppyy
    cppyy.loadDictionary('xAODTau_cDict')

    from AthenaCommon.AppMgr import ToolSvc
    from tauRecTools.tauRecToolsConf import TauWPDecorator
    TauWPDecorator = TauWPDecorator(
        name=_name,
        flatteningFile1Prong="FlatJetBDT1P_trigger_v1.root",
        flatteningFile3Prong="FlatJetBDT3P_trigger_v1.root",
        CutEnumVals=[
            ROOT.xAOD.TauJetParameters.JetBDTSigVeryLoose,
            ROOT.xAOD.TauJetParameters.JetBDTSigLoose,
            ROOT.xAOD.TauJetParameters.JetBDTSigMedium,
            ROOT.xAOD.TauJetParameters.JetBDTSigTight
        ],
        SigEff1P=[0.995, 0.99, 0.97, 0.90],
        SigEff3P=[0.995, 0.94, 0.88, 0.78],
        ScoreName="BDTJetScore",
        NewScoreName="BDTJetScoreSigTrans",
        DefineWPs=True)

    ToolSvc += TauWPDecorator
    cached_instances[_name] = TauWPDecorator
    return TauWPDecorator
Ejemplo n.º 8
0
def getTauTrackClassifier():

    _name = sPrefix + 'TauTrackClassifier'

    if _name in cached_instances:
        return cached_instances[_name]

    from AthenaCommon.AppMgr import ToolSvc
    from tauRecTools.tauRecToolsConf import tauRecTools__TauTrackClassifier as TauTrackClassifier
    from tauRecTools.tauRecToolsConf import tauRecTools__TrackMVABDT as TrackMVABDT

    import PyUtils.RootUtils as ru
    ROOT = ru.import_root()
    import cppyy
    cppyy.loadDictionary('xAODTau_cDict')

    input_file_name = 'EFtracks_BDT_classifier_v0.root'
    BDTcut = 0.45
    deltaZ0 = 1.0

    # =========================================================================
    EFtrackBDT = TrackMVABDT(
        name=_name + "_MVABDT",
        InputWeightsPath=input_file_name,
        Threshold=BDTcut,
        DeltaZ0=deltaZ0,
        ExpectedFlag=ROOT.xAOD.TauJetParameters.unclassified,
        inTrigger=True)

    ToolSvc += EFtrackBDT

    trackclassifier = TauTrackClassifier(name=_name, Classifiers=[EFtrackBDT])

    cached_instances[_name] = trackclassifier
    return trackclassifier
Ejemplo n.º 9
0
def getMC15aPlusTruthService(name="ISF_MC15aPlusTruthService", **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary('AtlasDetDescrDict')
    AtlasRegion = ROOT.AtlasDetDescr
    kwargs.setdefault('ForceEndVtxInRegions', [AtlasRegion.fAtlasID])
    return getMC15TruthService(name, **kwargs)
Ejemplo n.º 10
0
def _installBindings():
    """load the python bindings to FourMomUtils' function, at module import
    """
    import ROOT
    import cppyy
    cppyy.loadDictionary('libFourMomUtilsDict')

    return
Ejemplo n.º 11
0
def getParticlePositionFilterID(name="ISF_ParticlePositionFilterID", **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary('AtlasDetDescrDict')
    AtlasRegion = ROOT.AtlasDetDescr

    kwargs.setdefault('CheckRegion', [AtlasRegion.fAtlasID])
    return getParticlePositionFilter(name, **kwargs)
Ejemplo n.º 12
0
def _installBindings():
    """load the python bindings to FourMomUtils' function, at module import
    """
    import cppyy
    cppyy.loadDictionary('libFourMomUtilsDict')

    x = cppyy.gbl.xAOD.Helpers._importHelper()

    return
Ejemplo n.º 13
0
def ParticlePositionFilterIDCfg(ConfigFlags,
                                name="ISF_ParticlePositionFilterID",
                                **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary("AtlasDetDescrDict")
    AtlasRegion = ROOT.AtlasDetDescr

    kwargs.setdefault("CheckRegion", [AtlasRegion.fAtlasID])
    return ParticlePositionFilterCfg(ConfigFlags, name, **kwargs)
Ejemplo n.º 14
0
def ParticlePositionFilterMSCfg(name="ISF_ParticlePositionFilterMS", **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary("AtlasDetDescrDict")
    AtlasRegion = ROOT.AtlasDetDescr

    kwargs.setdefault("CheckRegion", [
        AtlasRegion.fAtlasID, AtlasRegion.fAtlasForward,
        AtlasRegion.fAtlasCalo, AtlasRegion.fAtlasMS
    ])
    return ParticlePositionFilterCfg(name, **kwargs)
Ejemplo n.º 15
0
 def initialize (self):
     import ROOT
     import cppyy
     cppyy.loadDictionary("libDataModelTestDataCommonDict")
     cppyy.loadDictionary("libDataModelTestDataReadDict")
     ROOT.DMTest.B
     ROOT.gROOT.GetClass('DMTest::HAuxContainer_v1')
     ROOT.gROOT.GetClass('DataVector<DMTest::H_v1>')
     ROOT.gROOT.GetClass('DMTest::HView_v1')
     ROOT.DMTest.setConverterLibrary ('libDataModelTestDataReadCnvPoolCnv.so')
     ROOT.DMTest.setTrigConverterLibrary ('libDataModelTestDataReadSerCnv.so')
     return StatusCode.Success
Ejemplo n.º 16
0
    def BDTtoolset(self):

        if TriggerFlags.run2Config == '2016':
            from TauDiscriminant.TauDiscriminantConf import TauJetBDT
            bdt_set = TauJetBDT(inTrigger=True,
                                calibFolder='TrigTauRec/00-11-01/',
                                jetBDT="bdt.2016.bin",
                                jetSigBits="trigger.sig.bits.jet.BDT.txt")
            return [bdt_set]

        else:
            from tauRecTools.tauRecToolsConf import TauJetBDTEvaluator
            # BDT evaluators 1p / mp
            bdt_1p = TauJetBDTEvaluator(
                name="TrigTauJetBDT1P",
                calibFolder='tauRecTools/00-02-00/',
                weightsFile='vars2016_pt_gamma_1p_isofix.root',
                inTrigger=True,
                minNTracks=0,
                maxNTracks=1)
            bdt_mp = TauJetBDTEvaluator(
                name="TrigTauJetBDTMP",
                calibFolder='tauRecTools/00-02-00/',
                weightsFile='vars2016_pt_gamma_3p_isofix.root',
                inTrigger=True,
                minNTracks=2,
                maxNTracks=1000)

            import PyUtils.RootUtils as ru
            ROOT = ru.import_root()
            import cppyy
            cppyy.loadDictionary('xAODTau_cDict')
            from tauRecTools.tauRecToolsConf import TauWPDecorator
            # wp creators 1p / mp
            wp_decorator = TauWPDecorator(
                name="TrigTauJetWPDecorator",
                calibFolder='TrigTauRec/00-11-01/',
                inTrigger=True,
                flatteningFile1Prong="FlatJetBDT1P_trigger_v1.root",
                flatteningFile3Prong="FlatJetBDT3P_trigger_v1.root",
                CutEnumVals=[
                    ROOT.xAOD.TauJetParameters.JetBDTSigVeryLoose,
                    ROOT.xAOD.TauJetParameters.JetBDTSigLoose,
                    ROOT.xAOD.TauJetParameters.JetBDTSigMedium,
                    ROOT.xAOD.TauJetParameters.JetBDTSigTight
                ],
                SigEff1P=[0.995, 0.99, 0.97, 0.90],
                SigEff3P=[0.995, 0.94, 0.88, 0.78],
                ScoreName="BDTJetScore",
                NewScoreName="BDTJetScoreSigTrans",
                DefineWPs=True)
            return [bdt_1p, bdt_mp, wp_decorator]
Ejemplo n.º 17
0
def getMC15TruthService(name="ISF_MC15TruthService", **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary('AtlasDetDescrDict')
    AtlasRegion = ROOT.AtlasDetDescr
    kwargs.setdefault('TruthStrategies', ['ISF_MCTruthStrategyGroupID_MC15',
                                          'ISF_MCTruthStrategyGroupIDHadInt_MC15',
                                          'ISF_MCTruthStrategyGroupCaloMuBrem', #FIXME this should be ISF_MCTruthStrategyGroupCaloMuBrem_MC15!!
                                          'ISF_MCTruthStrategyGroupCaloDecay_MC15'])
    kwargs.setdefault('IgnoreUndefinedBarcodes', False)
    kwargs.setdefault('PassWholeVertices', False) # new for MC15 - can write out partial vertices.
    kwargs.setdefault('ForceEndVtxInRegions', [AtlasRegion.fAtlasID])
    return getGenericTruthService(name, **kwargs)
Ejemplo n.º 18
0
def getMC15TruthService(name="ISF_MC15TruthService", **kwargs):
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary('AtlasDetDescrDict')
    AtlasRegion = ROOT.AtlasDetDescr

    beam_pipe_strategies = getMC15BeamPipeTruthStrategies()
    id_strategies = getMC15IDTruthStrategies()
    calo_strategies = getMC15CaloTruthStrategies()
    ms_strategies = getMC15MSTruthStrategies()

    kwargs.setdefault(
        'BeamPipeTruthStrategies', beam_pipe_strategies
    )  # this is used for beam pipe but not BeamPipeCentral which uses same as ID
    kwargs.setdefault('IDTruthStrategies', id_strategies)
    kwargs.setdefault('CaloTruthStrategies', calo_strategies)
    kwargs.setdefault('MSTruthStrategies', ms_strategies)

    kwargs.setdefault('IgnoreUndefinedBarcodes', False)
    kwargs.setdefault('PassWholeVertices',
                      False)  # new for MC15 - can write out partial vertices.
    kwargs.setdefault('ForceEndVtxInRegions', [AtlasRegion.fAtlasID])
    return getGenericTruthService(name, **kwargs)
Ejemplo n.º 19
0
def MC15TruthServiceCfg(ConfigFlags, name="ISF_MC15TruthService", **kwargs):
    result = ComponentAccumulator()
    # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
    import ROOT, cppyy
    cppyy.loadDictionary("AtlasDetDescrDict")
    AtlasRegion = ROOT.AtlasDetDescr

    if "TruthStrategies" not in kwargs:
        truthCfgs = [
            TruthStrategyGroupID_MC15Cfg,
            TruthStrategyGroupIDHadInt_MC15Cfg,
            TruthStrategyGroupCaloMuBrem_MC15Cfg,
            TruthStrategyGroupCaloDecay_MC15Cfg,
        ]
        truthStrats = [result.popToolsAndMerge(cfg(ConfigFlags)) for cfg in truthCfgs]
        kwargs.setdefault("TruthStrategies", truthStrats)

    kwargs.setdefault("IgnoreUndefinedBarcodes", False)
    kwargs.setdefault("PassWholeVertices", False) # new for MC15 - can write out partial vertices.
    kwargs.setdefault("ForceEndVtxInRegions", [AtlasRegion.fAtlasID])
    truthService = GenericTruthServiceCfg(ConfigFlags, name, **kwargs)
    result.addService(truthService.getPrimary(), primary=True)
    result.merge(truthService)
    return result
Ejemplo n.º 20
0
 def initialize(self):
     import ROOT
     import cppyy
     cppyy.loadDictionary("libDataModelTestDataCommonDict")
     cppyy.loadDictionary("libDataModelTestDataWriteDict")
     cppyy.loadDictionary("libDataModelTestDataWriteCnvDict")
     ROOT.DMTest.B
     ROOT.DMTest.setConverterLibrary(
         'libDataModelTestDataWriteCnvPoolCnv.so')
     ROOT.DMTest.setTrigConverterLibrary(
         'libDataModelTestDataWriteSerCnv.so')
     return StatusCode.Success
Ejemplo n.º 21
0
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

__doc__ = "Configure the electron and photon selectors."

from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
EMPIDBuilder = CompFactory.EMPIDBuilder
from ROOT import egammaPID
import cppyy
cppyy.loadDictionary('ElectronPhotonSelectorToolsDict')


def EMPIDBuilderElectronCfg(flags, name='EMPIDBuilderElectron', **kwargs):

    mlog = logging.getLogger(name)
    mlog.debug('Start configuration')

    acc = ComponentAccumulator()

    # Electron Selectors
    # Cut based
    from ROOT import LikeEnum
    from ElectronPhotonSelectorTools.AsgElectronIsEMSelectorsConfig import AsgElectronIsEMSelectorCfg
    if "electronIsEMselectors" not in kwargs:
        LooseElectronSelectorAcc = AsgElectronIsEMSelectorCfg(
            flags, "LooseElectronSelector", egammaPID.ElectronIDLoosePP)
        MediumElectronSelectorAcc = AsgElectronIsEMSelectorCfg(
            flags, "MediumElectronSelector", egammaPID.ElectronIDMediumPP)
        TightElectronSelectorAcc = AsgElectronIsEMSelectorCfg(
            flags, "TightElectronSelector", egammaPID.ElectronIDTightPP)
Ejemplo n.º 22
0
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

########################################################################
#                                                                      #
# ConstModUtils: A module for configuring constituent modifiers        #
# Author: TJ Khoo                                                      #
#                                                                      #
########################################################################
import cppyy
try:
    cppyy.loadDictionary('xAODBaseObjectTypeDict')
except Exception:
    pass
from ROOT import xAODType
xAODType.ObjectType

from AthenaCommon import Logging
constmodlog = Logging.logging.getLogger('ConstModHelpers')

from AthenaConfiguration.ComponentFactory import CompFactory

# Tool types and configs can be expanded if the user
# wishes to add their own custom definitions

# Maybe we need a config class in JetDefinition?
ConstModTools = {
    # Topoclusters
    "Origin": CompFactory.CaloClusterConstituentsOrigin,
    "EM": CompFactory.ClusterAtEMScaleTool,
    # Particle flow
    "CorrectPFO": CompFactory.CorrectPFOTool,
Ejemplo n.º 23
0
##=============================================================================
## Name:        ElectronIsEMSelectorMapping.py
##
## Author:      Tulay Cuhadar Donszelmann, Jovan Mitrevski
## Created:     Dec 2011
##
## Description: Find mapping of mask and function for ID quality
##=============================================================================

import cppyy
try :
    cppyy.loadDictionary('ElectronPhotonSelectorToolsDict')
except :
    pass

from ROOT import egammaPID

class electronPIDmenu:
    menu2011 = 0
    menu2012 = 1
    origMenu2012 = 2
    menuH4l2011 = 3
    menuTrig2012 = 4
    menuTrigDC14 = 5
    menuDC14 = 6

import ElectronPhotonSelectorTools.ElectronIsEMSelectorCutDefs as ElectronIsEMSelectorCutDefs
import ElectronPhotonSelectorTools.ElectronIsEMLooseSelectorCutDefs as ElectronIsEMLooseSelectorCutDefs
import ElectronPhotonSelectorTools.ElectronIsEMMediumSelectorCutDefs as ElectronIsEMMediumSelectorCutDefs
import ElectronPhotonSelectorTools.ElectronIsEMTightSelectorCutDefs as ElectronIsEMTightSelectorCutDefs
import ElectronPhotonSelectorTools.ElectronIsEMH4l2011SelectorCutDefs as ElectronIsEMH4l2011SelectorCutDefs
Ejemplo n.º 24
0
     DMTest__xAODTestWriteCInfo, \
     DMTest__xAODTestWriteCVecConst, \
     DMTest__xAODTestWrite
topSequence += DMTest__xAODTestWriteCVec("xAODTestWriteCVec")
topSequence += DMTest__xAODTestWriteHVec("xAODTestWriteHVec")
topSequence += DMTest__xAODTestWriteCView("xAODTestWriteCView")
topSequence += DMTest__xAODTestWriteCInfo("xAODTestWriteCInfo")
topSequence += DMTest__xAODTestWrite("xAODTestWrite")
topSequence += DMTest__xAODTestWriteCVecConst("xAODTestWriteCVecConst")

#--------------------------------------------------------------
# Output options
#--------------------------------------------------------------
import ROOT
import cppyy
cppyy.loadDictionary("libDataModelTestDataCommonDict")
cppyy.loadDictionary("libDataModelTestDataWriteDict")
ROOT.DMTest.B
ROOT.DMTest.setConverterLibrary('libDataModelTestDataWriteCnvPoolCnv.so')

theApp.CreateSvc += ['xAODMaker::EventFormatSvc']

# ItemList:
include("EventAthenaPool/EventAthenaPoolItemList_joboptions.py")
fullItemList += ["DMTest::CVec#cvec"]
fullItemList += ["DMTest::CAuxContainer#cvecAux."]
fullItemList += ["DMTest::CVecWithData#cvecWD"]
fullItemList += ["DMTest::CView#cview"]
fullItemList += ["DMTest::CAuxContainer#cvecWDAux."]
fullItemList += ["DMTest::GVec#gvec"]
fullItemList += ["DMTest::GAuxContainer#gvecAux."]
Ejemplo n.º 25
0
def declareDefaultTools():

  from JetRecConfig.JetRecFlags import jetFlags
  from JetRecConfig.JetRecStandardToolManager import jtm
  try:
    from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool
    jtm.haveJetCaloCellQualityTool = True
  except ImportError:
    jtm.haveJetCaloCellQualityTool = False

  try:
    from JetMomentTools.JetMomentToolsConf import JetJetBadChanCorrTool
    jtm.haveJetBadChanCorrTool = True
  except ImportError:
    jtm.haveJetBadChanCorrTool = False

  from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool
  from JetRec.JetRecConf import PseudoJetGetter
  from JetRecTools.JetRecToolsConf import TrackPseudoJetGetter
  from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
  from JetRecTools.JetRecToolsConf import JetTrackSelectionTool
  from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool

  #--------------------------------------------------------------
  # Non-substructure moment builders.
  #--------------------------------------------------------------

  # Quality from clusters.
  jtm += JetCaloQualityTool(
    "caloqual_cluster",
    TimingCuts = [5, 10],
    Calculations = ["LArQuality", "N90Constituents", "FracSamplingMax",  "NegativeE", "Timing", "HECQuality", "Centroid", "AverageLArQF", "BchCorrCell"],
  )

  # Quality from cells.
  if jtm.haveJetCaloCellQualityTool:
    jtm += JetCaloCellQualityTool(
      "caloqual_cell",
      LArQualityCut = 4000,
      TileQualityCut = 254,
      TimingCuts = [5, 10],
      Calculations = ["LArQuality", "N90Cells", "FracSamplingMax",  "NegativeE", "Timing", "HECQuality", "Centroid", "AverageLArQF"]
    )

  # Jet width.
  jtm += JetWidthTool("width", WeightPFOToolEM=jtm.pflowweighter, WeightPFOToolLC=jtm.pflowweighterLC)

  # Calo layer energies.
  jtm += JetCaloEnergies("jetens")

  # Read in missing cell map (needed for the following)
  # commented out : incompatible with trigger : ATR-9696
  ## if jtm.haveJetRecCalo:
  ##     def missingCellFileReader(): 
  ##       import os
  ##       dataPathList = os.environ[ 'DATAPATH' ].split(os.pathsep)
  ##       dataPathList.insert(0, os.curdir)
  ##       from AthenaCommon.Utils.unixtools import FindFile
  ##       RefFileName = FindFile( "JetBadChanCorrTool.root" ,dataPathList, os.R_OK )
  ##       from AthenaCommon.AppMgr import ServiceMgr
  ##       if not hasattr(ServiceMgr, 'THistSvc'):
  ##         from GaudiSvc.GaudiSvcConf import THistSvc
  ##         ServiceMgr += THistSvc()
  ##       ServiceMgr.THistSvc.Input += ["JetBadChanCorrTool DATAFILE=\'%s\' OPT=\'READ\'" % RefFileName]
  ##       missingCellFileReader.called = True 

  ##     missingCellFileReader()

  ##     jtm += MissingCellListTool(
  ##       "missingcells",
  ##       AddCellList = [],
  ##       RemoveCellList = [],
  ##       AddBadCells = True,
  ##       DeltaRmax = 1.0,
  ##       AddCellFromTool = False,
  ##       LArMaskBit = 608517,
  ##       TileMaskBit = 1,
  ##       MissingCellMapName = "MissingCaloCellsMap"
  ## )

  ## # Bad channel corrections from cells
  ## if jtm.haveJetBadChanCorrTool:
  ##   jtm += JetBadChanCorrTool(
  ##     "bchcorrcell",
  ##     NBadCellLimit = 10000,
  ##     StreamName = "/JetBadChanCorrTool/",
  ##     ProfileName = "JetBadChanCorrTool.root",
  ##     ProfileTag = "",
  ##     UseCone = True,
  ##     UseCalibScale = False,
  ##     MissingCellMap = "MissingCaloCellsMap",
  ##     ForceMissingCellCheck = False,
  ##     UseClusters = False,
  ##   )

  ##   # Bad channel corrections from clusters
  ##   jtm += JetBadChanCorrTool(
  ##     "bchcorrclus",
  ##     NBadCellLimit = 0,
  ##     StreamName = "",
  ##     ProfileName = "",
  ##     ProfileTag = "",
  ##     UseCone = True,
  ##     UseCalibScale = False,
  ##     MissingCellMap = "",
  ##     ForceMissingCellCheck = False,
  ##     UseClusters = True
  ##   )

  # Bad LAr fractions.
  jtm += JetECPSFractionTool(
    "ecpsfrac",
  )

  #--------------------------------------------------------------
  # Track-vertex association.
  #--------------------------------------------------------------
  from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TightTrackVertexAssociationTool
  jtm += CP__TightTrackVertexAssociationTool("jetTighTVAtool", dzSinTheta_cut=3, doPV=True)

  jtm += TrackVertexAssociationTool(
    "tvassoc",
    TrackParticleContainer  = jtm.trackContainer,
    TrackVertexAssociation  = "JetTrackVtxAssoc",
    VertexContainer         = jtm.vertexContainer,
    TrackVertexAssoTool     = jtm.jetTighTVAtool,
  )

  jtm += TrackVertexAssociationTool(
    "tvassoc_old",
    TrackParticleContainer  = jtm.trackContainer,
    TrackVertexAssociation  = "JetTrackVtxAssoc_old",
    VertexContainer         = jtm.vertexContainer,
    MaxTransverseDistance   = 1.5,
    MaxLongitudinalDistance = 1.0e7,
    MaxZ0SinTheta = 1.5
  )

  #--------------------------------------------------------------
  # Track selection.
  #--------------------------------------------------------------

  # This is the InDet loose selection from
  # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/InDetTrackingPerformanceGuidelines
  # October 28, 2014
  #jtm += InDet__InDetDetailedTrackSelectionTool(
  jtm += InDet__InDetTrackSelectionTool(
    "trk_trackselloose",
    CutLevel                = "Loose"
  )

  jtm += JetTrackSelectionTool(
    "trackselloose",
    InputContainer  = jtm.trackContainer,
    OutputContainer = "JetSelectedTracks",
    Selector        = jtm.trk_trackselloose
  )

  jtm += InDet__InDetTrackSelectionTool(
    "trk_trackselloose_trackjets",
    CutLevel                = "Loose"
  )

  jtm += JetTrackSelectionTool(
     "trackselloose_trackjets",
    InputContainer  = jtm.trackContainer,
    OutputContainer = "JetSelectedTracks_LooseTrackJets",
    Selector        = jtm.trk_trackselloose_trackjets
  )

  if jetFlags.useInDetTrackSelection():
    jtm += JetTrackSelectionTool(
      "tracksel",
      InputContainer  = jtm.trackContainer,
      OutputContainer = "JetSelectedTracks",
      Selector        = jtm.trk_trackselloose
    )
  else:
    jtm += SimpleJetTrackSelectionTool(
      "tracksel",
      PtMin = 500.0,
      InputContainer  = jtm.trackContainer,
      OutputContainer = "JetSelectedTracks",
    )


  # Tracks.
  jtm += TrackPseudoJetGetter(
    "trackget",
    InputContainer = jtm.trackselloose_trackjets.OutputContainer,
    Label = "Track",
    OutputContainer = "PseudoJetTracks",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    SkipNegativeEnergy = True,
    GhostScale = 0.0
  )


  # Ghost tracks.
  jtm += TrackPseudoJetGetter(
    "gtrackget",
    InputContainer = jtm.tracksel.OutputContainer,
    Label = "GhostTrack",
    OutputContainer = "PseudoJetGhostTracks",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    SkipNegativeEnergy = True,
    GhostScale = 1e-20
  )


  # Jet vertex fraction.
  jtm += JetVertexFractionTool(
    "jvfold",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    JVFName = "JVFOld"
  )

  # Jet vertex fraction with selection.
  jtm += JetVertexFractionTool(
    "jvf",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    TrackSelector = jtm.trackselloose,
    JVFName = "JVF"
  )

  # Jet vertex tagger.
  jtm += JetVertexTaggerTool(
    "jvt",
    VertexContainer = jtm.vertexContainer,
    TrackParticleContainer  = jtm.trackContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    TrackSelector = jtm.trackselloose,
    JVTName = "Jvt",
    K_JVFCorrScale = 0.01,
    Z0Cut = 3.0,
    PUTrkPtCut = 30000.0
  )

  # Jet track info.
  jtm += JetTrackMomentsTool(
    "trkmoms",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    TrackMinPtCuts = [500, 1000],
    TrackSelector = jtm.trackselloose
  )

  # Jet track vector sum info
  jtm += JetTrackSumMomentsTool(
    "trksummoms",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    RequireTrackPV = True,
    TrackSelector = jtm.trackselloose
  )

  # Jet cluster info.
  jtm += JetClusterMomentsTool(
    "clsmoms",
    DoClsPt = True,
    DoClsSecondLambda = True,
    DoClsCenterLambda = True,
    DoClsSecondR = True
  )


  jtm += JetVoronoiMomentsTool(
    "voromoms",
    AreaXmin= -5.,
    AreaXmax=  5.,
    AreaYmin= -3.141592,
    AreaYmax=  3.141592
  )

  # Isolations.
  # Note absence of PseudoJetGetter property means the jet inputs
  # are obtained according to the InputType property of the jet.
  jtm += JetIsolationTool(
    "jetisol",
    IsolationCalculations = ["IsoDelta:2:SumPt", "IsoDelta:3:SumPt"],
  )
  jtm += JetIsolationTool(
    "run1jetisol",
    IsolationCalculations = ["IsoKR:11:Perp", "IsoKR:11:Par", "IsoFixedCone:6:SumPt",],
  )


  # Bad LAr fractions.
  jtm += JetLArHVTool("larhvcorr")


  # Jet origin correction.
  jtm += JetOriginCorrectionTool(
    "jetorigincorr",
    VertexContainer = jtm.vertexContainer,
    OriginCorrectedName = "JetOriginConstitScaleMomentum"
  )

  # Just set the PV without applying origin correction
  jtm += JetOriginCorrectionTool(
    "jetorigin_setpv",
    VertexContainer = jtm.vertexContainer,
    OriginCorrectedName = "",
    OnlyAssignPV = True,
  )

  # Load the xAODCaloEvent dictionary for cluster scale enum
  import cppyy
  try: cppyy.loadDictionary('xAODCaloEventDict')
  except: pass
  from ROOT import xAOD
  # Touch an unrelated class so the dictionary is loaded
  # and therefore the CaloCluster version typedef is recognised
  xAOD.CaloVertexedTopoCluster
Ejemplo n.º 26
0
from RootUtils import PyROOTFixes

import ROOT
import glob
import sys
import os


from PyUtils.Helpers import ROOT6Setup
ROOT6Setup()

# Turn off annoying dict auto-generation --- it doesn't work anyway.
ROOT.gInterpreter.ProcessLine(".autodict")

# Make sure the proper dictionaries are loaded.
cppyy.loadDictionary('libAtlasSTLAddReflexDict')

# Make sure abstract base classes have streaminfos built.
# Otherwise, we can get crashes from TTree::Scan.

# Prevent AthenaBarCodeImpl from trying to create JobIDSvc.
import os
import uuid
os.environ['_ATHENABARCODEIMPL_JOBUUID'] = uuid.uuid1().hex


# Bump up resource limits as much as possible.
from AthenaCommon.ResourceLimits import SetMaxLimits
SetMaxLimits()
del SetMaxLimits
Ejemplo n.º 27
0
def _load_dict(lib):
    """Helper function to remember which libraries have been already loaded
    """
    import cppyy
    return cppyy.loadDictionary(lib)
Ejemplo n.º 28
0
def _setup():
    import cppyy
    # StoreGate bindings from dictionary
    cppyy.loadDictionary( "libAthenaPythonDict" )      # for clidsvc
    cppyy.loadDictionary( "libStoreGateBindingsDict" ) # for storegatesvc
    cppyy.loadDictionary( "libStoreGateBindings" ) # not linked from libStoreGateBindingsDict in ROOT6

    # make sure the global C++ namespace has been created
    gbl = cppyy.makeNamespace('')
    _ath= cppyy.makeNamespace('AthenaInternal')

    # ROOT6 workaround, kick the loading of headers
    _ath.ROOT6_AthenaPython_WorkAround_Dummy
    _ath.ROOT6_StoreGateBindings_WorkAround_Dummy
    # end workaround
    
    global py_retrieve
    py_retrieve = cppyy.gbl.AthenaInternal.retrieveObjectFromStore

    global py_record
    py_record   = cppyy.gbl.AthenaInternal.recordObjectToStore

    global py_sg_contains
    py_sg_contains = cppyy.gbl.AthenaInternal.py_sg_contains

    global py_sg_getitem
    py_sg_getitem = cppyy.gbl.AthenaInternal.py_sg_getitem

    # retrieve the StoreGateSvc class
    global StoreGate, StoreGateSvc
    StoreGateSvc = cppyy.gbl.StoreGateSvc
    StoreGate    = cppyy.gbl.StoreGate

    # add specialized retrieve method
    def retrieve( self, klass, key = None ):
        ret = py_retrieve( self, klass, key )
        if ret and hasattr(ret,'setStore') and not ret.hasStore():
            if not hasattr(ret,'trackIndices') or ret.trackIndices():
                if py_sg_contains (self, 'SG::IConstAuxStore', key + 'Aux.'):
                    aux = py_retrieve (self, 'SG::IConstAuxStore', key + 'Aux.')
                    ret.setStore (aux)
        return ret
    StoreGateSvc.retrieve = retrieve

    # add specialized record method
    def record( self, obj, key, allowMods=True, resetOnly=True, noHist=False ):
        return py_record( self, obj, key, allowMods, resetOnly, noHist )
    StoreGateSvc.record = record

    # add specialized contains method
    def contains( self, klass_or_clid, key ):
        print "---- StoreGateSvc.contains() ",  klass_or_clid, key
        if isinstance(klass_or_clid, str):
            try:
                clid = int(klass_or_clid)
                klass = self._pyclidsvc.typename(clid)
            except ValueError:
                klass = str(klass_or_clid)
                pass
        elif isinstance(klass_or_clid, (int, long)):
            klass = self._pyclidsvc.typename(klass_or_clid)
        elif isinstance(klass_or_clid, type):
            klass = klass_or_clid.__name__
        else:
            raise TypeError(
                'argument 2 must be a typename, a clid or a type (got %r)' %
                type(klass_or_clid))
        return py_sg_contains( self, klass, key )
    StoreGateSvc.contains = contains

    # dict-pythonization of storegate: __setitem__
    def __setitem__ (self, key, obj):
        return py_record( self, obj, key, True, True, False )
    StoreGateSvc.__setitem__ = __setitem__

    # dict-pythonization of storegate: __getitem__
    def __getitem__ (self, key):
        try:
            ret = py_sg_getitem(self, key)
        except LookupError,err:
            raise KeyError(str(err))
        if ret and hasattr(ret,'setStore') and not ret.hasStore():
            if not hasattr(ret,'trackIndices') or ret.trackIndices():
                if py_sg_contains (self, 'SG::IConstAuxStore', key + 'Aux.'):
                    aux = py_retrieve (self, 'SG::IConstAuxStore', key + 'Aux.')
                    ret.setStore (aux)
        return ret
Ejemplo n.º 29
0
print " iovUntil ", iovUntil

#=== values for the comment channel
author   = "gunal"
comment  = "Updated noise values"

#==================================================
#===
#=== Code starts below here
#===
#==================================================
#=== set shortcut
#g = PyCintex.gbl
#PyCintex.makeClass('std::vector<float>')
#PyCintex.loadDict("STLAddRflx")
cppyy.loadDictionary("STLAddRflx")

#=== get a logger
log = CaloCondLogger.getLogger("CaloNoiseWriter")

#=== (re-)create the database
#db = CaloCondTools.openDb('SQLITE', 'CONDBR2', 'UPDATE')
dbSvc = cool.DatabaseSvcFactory.databaseService()
try:
   db=dbSvc.openDatabase("sqlite://;schema="+filename+";dbname="+dbname, False)
except:
   db=dbSvc.createDatabase("sqlite://;schema="+filename+";dbname="+dbname)
   
try:
    #=== creating folder specifications
    spec = cool.RecordSpecification()
Ejemplo n.º 30
0
def _load_dict(lib):
    """Helper function to remember which libraries have been already loaded
    """
    import cppyy
    return cppyy.loadDictionary(lib)
Ejemplo n.º 31
0
class ConstituentToolManager(object):
    """This class is modelled after JetToolManager.
    It is intended to be a central place where to
      * register constituent modifier tools
      * map them to shortcut
      * collect them in a mod sequencer tool
    This class is provided standalone, but could be merged with JetToolManager if needed.

    and example call could be :

    clustModSeq = ctm.buildConstitModifSequence( 'JetWeightedTopoClusters',
                                             inputName= 'CaloCalTopoClusters',
                                             modList = [  'clust_weight'] )


    """

    # map of tool names or alias to tool instance
    #  (there can be multiple entries pointing to the same instance)
    modifiersMap = dict()

    # map of named standard list of modifiers
    standardModifierLists = dict()
    import cppyy
    try:
        cppyy.loadDictionary('xAODBaseObjectTypeDict')
    except:
        pass
    from ROOT import xAODType
    xAODType.ObjectType

    # map of known input collections to their type
    inputContainerMap = dict(CaloCalTopoClusters=xAODType.CaloCluster,
                             CaloTopoClusters=xAODType.CaloCluster,
                             EMOriginTopoClusters=xAODType.CaloCluster,
                             LCOriginTopoClusters=xAODType.CaloCluster,
                             InDetTrackParticles=xAODType.TrackParticle,
                             JetETMiss=xAODType.ParticleFlow)

    log = Logging.logging.getLogger("ConstituentToolManager")

    def add(self, tool, alias=None):
        """Register a tool in the manager.  If alias is given, the tool is also registered under the alias key"""
        name = tool.name()
        if name in self.modifiersMap:
            self.log.warning("Tool named " + name +
                             " already registered. Not adding a new one")
            return self.modifiersMap[name]
        if alias is not None and alias in self.modifiersMap:
            self.log.warning(
                "Tool named " + alias +
                " already registered. Not adding a new one under this alias. Was "
                + name)
            return self.modifiersMap[alias]

        from AthenaCommon.AppMgr import ToolSvc

        self.modifiersMap[name] = tool
        if alias: self.modifiersMap[alias] = tool
        return tool

    def __iadd__(self, tool):
        """Enables the += syntax to add tool """
        self.add(tool)
        return self

    def buildConstitModifSequence(self,
                                  seqName,
                                  OutputContainer,
                                  InputContainer,
                                  modList,
                                  InputType=None):
        """Returns a configured JetConstituentModSequence instance.
        The tool is build according to
           seqName (str)    : name of the JetConstituentModSequence tool
           OutputContainer (str) : name of desired output constituents container (property of JetConstituentModSequence)
           InputContainer  (str) : name of input constituents container (property of JetConstituentModSequence)
           modList (str or list): if str, this is taken as a shortcut to a knonw, default list of modifier tools (from self.standardModifierLists)
                                  if list, entries are eihter configured modifier tools either strings in which case they are shortcut to known modifier tool (in self.modifiersMap).
          InputType : (int or None) the type of particles in the input container. If None attempt is made to guess it from InputContainer (from self.inputContainerMap).
          
        """

        #seqName = OutputContainer+'_modSeq'

        # Deal with input -----------------
        if InputType is None:
            # get it from the known inputs
            InputType = self.inputContainerMap[InputContainer]
        if InputType is None:
            self.log.error(seqName + '. Unknown input container : ' +
                           InputContainer)
            return

        # deal with modifiers ---------------
        if isinstance(modList, str):
            modKey = modList
            # translate into a known list :
            modList = self.standardModifierLists.get(modKey, None)
            if modList is None:
                self.log.error(
                    seqName +
                    ". Unknown shortcut for constit modifier list : " + modKey)
                return None
        # loop over modList
        finalList = []
        for t in modList:
            if isinstance(t, str):
                # translate into a real tool
                tool = self.modifiersMap.get(t, None)
                if tool is None:
                    self.log.error(
                        seqName +
                        ". Unknown shortcut for constit modifier list : " + t)
                    return None
                t = tool
                t.InputType = InputType
            # append to the final list
            finalList.append(t)

        constModSeq = CfgMgr.JetConstituentModSequence(
            seqName,  # the name of the tool 
            InputContainer=InputContainer,
            OutputContainer=OutputContainer,
            InputType=InputType,
            Modifiers=finalList,  # pass the list of modifier we want 
        )
        self += constModSeq

        return constModSeq
Ejemplo n.º 32
0
from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool
CaloIsolationTool = ToolFactory(xAOD__CaloIsolationTool,
                                name="CaloIsolationTool",
                                CaloFillRectangularClusterTool=None,
                                ClustersInConeTool=CaloClustersInConeTool,
                                PFlowObjectsInConeTool=None,
                                IsoLeakCorrectionTool=leakTool,
                                saveOnlyRequestedCorrections=False,
                                EMCaloNums=[],
                                HadCaloNums=[],
                                UseEMScale=True,
                                addCaloExtensionDecoration=False)

import ROOT, cppyy
# Need to be sure base dict is loaded first.
cppyy.loadDictionary('xAODCoreRflxDict')
cppyy.loadDictionary('xAODPrimitivesDict')
isoPar = ROOT.xAOD.Iso

# The types to be computed
# For this fix, we recompute topoetconeXX for El, Ph, Fwd...
IsoTypesEG = [[isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40]]

# ...but the corrections are different for El/Ph vs Fwd
IsoCorEG = [[isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection]]

IsoCorFe = [[isoPar.coreCone, isoPar.pileupCorrection]]

from IsolationAlgs.IsolationAlgsConf import IsolationBuilder
isoAODFixBuilderElectron = AlgFactory(
    IsolationBuilder,
Ejemplo n.º 33
0
from PyKernel import PyKernel

from PyKernel.PyKernel import plot,plot2,fill,fill2,dumpSG,book,bookProf
from PyKernel.PyKernel import plotProf,fillProf,unregister,dumpHist,retrieveHist

import cppyy
cppyy.loadDictionary("libPyKernelDict")

# Bind the C++ global namespace to the Python variable g 
g = cppyy.gbl

## temporary hack to 'fix' #58078
if 0:
    # set ROOT stream
    import re
    import ROOT
    rootStream=None
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    EventSelector = svcMgr.EventSelector
    if hasattr(EventSelector,"CollectionType") and  EventSelector.CollectionType == "ExplicitROOT":
        filename = EventSelector.InputCollections[0]
        if not re.search('\.root$',filename):
            filename = filename+'.root'
        file = ROOT.TFile(filename)
        rootStream=ROOT.gROOT.FindObject('CollectionTree')

    # this must be the last one
    PyKernel.init(theApp,rootStream)

    pass # temporary hack
Ejemplo n.º 34
0
######################################################################
#
# Test for AlgTool
#
######################################################################

# load dict for MyCutClass
import cppyy
cppyy.loadDictionary("PyAnalysisExamplesDict")

## get a handle to the default top-level algorithm sequence
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

# add my Algorithm
from PyAnalysisExamples.PyAnalysisExamplesConf import AthPyEx__MySelectionAlg
topSequence += AthPyEx__MySelectionAlg("MySelectionAlg")

# add my Tool
from PyAnalysisExamples.PyAnalysisExamplesConf import AthPyEx__MyTool
from AthenaCommon.AppMgr import ToolSvc
ToolSvc += AthPyEx__MyTool("MyTool")

# init application mgr
theApp.initialize()

# retrieve AlgTool
tool = theApp.toolsvc().retrieve(ToolSvc.MyTool.getFullJobOptName())._itool
tool.setPython(tool)

# set proxy
Ejemplo n.º 35
0
# This is needed to initialize the TrackIsolationTool properly.
# Without this, there will be ERRORs!
#include( "TrackIsolationTools/TrackIsolationTool_jobOptions.py" )

#---- Muon Isolation
# This is needed to initialize the MuonIsolationTool properly.
# Without this, there will be ERRORs!
#include( "MuonIsolationTools/MuonIsolationTool_jobOptions.py" )

#---- Load the egammaPID and egammaParameters information
# This is needed to always be up-to-date with the egamma
# IsEM selections and also the author selections
import PyUtils.RootUtils as ru
ROOT = ru.import_root()
import cppyy
cppyy.loadDictionary('egammaEnumsDict')
from ROOT import egammaPID
from ROOT import egammaParameters

#---- Load the TauJetParameters
# This is needed to always be up-to-date with the tau
# ID selections and also the author selections
# This only works starting with tauEvent-00-05-21!!!
#cppyy.loadDictionary('tauEventEnumsDict')
#from ROOT import TauJetParameters

# ====================================================================
# Test AODSelect
# ====================================================================
#from AODSelect.AODSelectFlags import AODSelectFlags
#AODSelectFlags.doAll = True