Exemple #1
0
_c1 = std.vector(_RCP)
_c2 = std.vector(_RCV)

## ranges
Range = Gaudi.NamedRange_(_c1)
VRange = Gaudi.NamedRange_(_c2)
## range-lists:
RangeL = LoKi.RangeList_(Range)
VRangeL = LoKi.RangeList_(VRange)

# =============================================================================
## "The main" types
# =============================================================================

## @see LoKi::Types::Func
Func = LoKi.Functor(_RCP, 'double')
## @see LoKi::Types::Cuts
Cuts = LoKi.Functor(_RCP, bool)
## @see LoKi::Types::Fun
Fun = LoKi.FunctorFromFunctor(_RCP, 'double')
## @see LoKi::Types::Cut
Cut = LoKi.FunctorFromFunctor(_RCP, bool)
## @see LoKi::Types::Func
VFunc = LoKi.Functor(_RCV, 'double')
## @see LoKi::Types::Cuts
VCuts = LoKi.Functor(_RCV, bool)
## @see LoKi::Types::Fun
VFun = LoKi.FunctorFromFunctor(_RCV, 'double')
## @see LoKi::Types::Cut
VCut = LoKi.FunctorFromFunctor(_RCV, bool)
# =============================================================================

import LoKiCore.decorators as _LoKiCore

# Namespaces:
from LoKiCore.basic import cpp, std, LoKi
LHCb = cpp.LHCb

_T = 'const LHCb::Track*'

# =============================================================================
## "Ordinary" functions for Tracks: "Tr"
# =============================================================================

## @see LoKi::Types::TrFunc
TrFunc = LoKi.Functor(_T, 'double')
## @see LoKi::Types::TrCuts
TrCuts = LoKi.Functor(_T, bool)
## @see LoKi::Types::TrFun
TrFun = LoKi.FunctorFromFunctor(_T, 'double')
## @see LoKi::Types::TrCut
TrCut = LoKi.FunctorFromFunctor(_T, bool)

## @see LoKi::Cuts::TrTYPE
TrTYPE = LoKi.Tracks.Type()

## @see @see LoKi::Cuts::TrALL
TrALL = LoKi.Constant(_T, bool)(True)
## @see LoKi::Cuts::TrBACKWARD
TrBACKWARD = LoKi.Tracks.CheckFlag(LHCb.Track.Backward)
## @see LoKi::Cuts::TrCHI2
def _decorate(name=_name):
    """
    Make the decoration of all objects from this module
    """

    import LoKiCore.decorators as _LoKiCore

    p = 'const LHCb::Particle*'
    v = 'const LHCb::VertexBase*'
    d = 'double'
    _vp = 'std::vector<const LHCb::Particle*>'  ## std.vector( p )
    _vv = 'std::vector<const LHCb::VertexBase*>'  ## std.vector( v )
    _vd = 'std::vector<double>'  ## std.vector( 'double' )
    #_vp  = std.vector( p )
    #_vv  = std.vector( v )
    #_vd  = std.vector( 'double' )
    #

    # "function" : Particle -> double
    _decorated = _LoKiCore.getAndDecorateFunctions(
        name,  ## module name                                   , ## the base 
        LoKi.Functor(p, 'double'),  ## the base
        LoKi.Dicts.FunCalls(LHCb.Particle),  ## call-traits
        LoKi.Dicts.FuncOps(p, p))  ## operators&operations

    # "function" : Vertex -> double
    _decorated |= _LoKiCore.getAndDecorateFunctions(
        name,  ## module name  
        LoKi.Functor(v, 'double'),  ## the base
        LoKi.Dicts.FunCalls(LHCb.VertexBase),  ## call-traits
        LoKi.Dicts.FuncOps(v, v))  ## operators&operations

    # "predicate/cut" :  Particle -> bool
    _decorated |= _LoKiCore.getAndDecoratePredicates(
        name,  ## module name  
        LoKi.Functor(p, bool),  ## the base
        LoKi.Dicts.CutCalls(LHCb.Particle),  ## call-traits
        LoKi.Dicts.CutsOps(p, p))  ## operators&operations

    # "predicate/cut" :  Vertex -> bool
    _decorated |= _LoKiCore.getAndDecoratePredicates(
        name,  ## moduel name  
        LoKi.Functor(v, bool),  ## the base
        LoKi.Dicts.CutCalls(LHCb.VertexBase),  ## call-traits
        LoKi.Dicts.CutsOps(v, v))  ## operators&operations

    # =========================================================================
    ## functional part:
    # =========================================================================

    # "map" : vector<T> -> vector<double>
    _decorated |= _LoKiCore.getAndDecorateMaps(
        name,  ## module name  
        LoKi.Functor(_vp, _vd),  ## the base
        LoKi.Dicts.MapsOps(p))  ## call-traits
    _decorated |= _LoKiCore.getAndDecorateMaps(
        name,  ## module name  
        LoKi.Functor(_vv, _vd),  ## the base
        LoKi.Dicts.MapsOps(v))  ## call-traits

    # "pipe" : vector<T> -> vector<T>
    _decorated |= _LoKiCore.getAndDecoratePipes(
        name,  ## module name  
        LoKi.Functor(_vp, _vp),  ## the base
        LoKi.Dicts.PipeOps(p, p))  ## call-traits
    _decorated |= _LoKiCore.getAndDecoratePipes(
        name,  ## module name  
        LoKi.Functor(_vv, _vv),  ## the base
        LoKi.Dicts.PipeOps(v, v))  ## call-traits

    # "funval" : vector<T> -> double
    _decorated |= _LoKiCore.getAndDecorateFunVals(
        name,  ## module name  
        LoKi.Functor(_vp, 'double'),  ## the base
        LoKi.Dicts.FunValOps(p))  ## call-traits
    _decorated |= _LoKiCore.getAndDecorateFunVals(
        name,  ## module name  
        LoKi.Functor(_vv, 'double'),  ## the base
        LoKi.Dicts.FunValOps(v))  ## call-traits

    # "cutval" : vector<T> -> bool
    _decorated |= _LoKiCore.getAndDecorateCutVals(
        name,  ## module name  
        LoKi.Functor(_vp, bool),  ## the base
        LoKi.Dicts.CutValOps(p))  ## call-traits
    _decorated |= _LoKiCore.getAndDecorateCutVals(
        name,  ## module name  
        LoKi.Functor(_vv, bool),  ## the base
        LoKi.Dicts.CutValOps(v))  ## call-traits

    # 'source' : void -> vector<T>
    _decorated |= _LoKiCore.getAndDecorateSources(
        name,  ## module name  
        LoKi.Functor('void', _vp),  ## the base
        LoKi.Dicts.SourceOps(p, p))  ## call-traits
    _decorated |= _LoKiCore.getAndDecorateSources(
        name,  ## module name  
        LoKi.Functor('void', _vv),  ## the base
        LoKi.Dicts.SourceOps(v, v))  ## call-traits

    # 'infos'
    _decorated |= _LoKiCore.getAndDecorateInfos(
        name,  ## module name
        LoKi.Functor(p, 'double'),  ## the base 
        LoKi.Dicts.InfoOps(p))  ## methods
    _decorated |= _LoKiCore.getAndDecorateInfos(
        name,  ## module name
        LoKi.Functor(v, 'double'),  ## the base 
        LoKi.Dicts.InfoOps(v))  ## methods

    ## void primitives
    _decorated |= _LoKiCore.getAndDecoratePrimitiveVoids(name)

    # decorate pids (Comparison with strings, integers and ParticleID objects:
    for t in (ID, ABSID):
        t = type(t)
        _LoKiCore.decoratePID(t, LoKi.Dicts.PIDOps(t))
        _decorated.add(t)
    ##
    return _decorated
try:
    from GaudiKernel import ROOT6WorkAroundEnabled
except ImportError:
    # dummy implementation
    def ROOT6WorkAroundEnabled(id=None):
        return False


if ROOT6WorkAroundEnabled('template-autoloading'):
    cpp.gSystem.Load('libLoKiNumbersDict')

_d = 'double'
## _v = std.vector( _d )
_v = 'std::vector<double>'
XFunc = LoKi.Functor(_d, _d)
XFun = LoKi.FunctorFromFunctor(_d, _d)
XCuts = LoKi.Functor(_d, bool)
XCut = LoKi.FunctorFromFunctor(_d, bool)

XMaps = LoKi.Functor(_v, _v)
XMap = LoKi.FunctorFromFunctor(_v, _v)
XPipes = XMaps
XPipe = XMap

XFunVals = LoKi.Functor(_v, _d)
XFunVal = LoKi.FunctorFromFunctor(_v, _d)
XSources = LoKi.Functor('void', _v)
XSource = LoKi.FunctorFromFunctor('void', _v)

XVCuts = LoKi.Functor(_v, bool)
Exemple #5
0
from LoKiCore.basic import cpp, std, LoKi
LHCb     = cpp.LHCb
Hlt      = cpp.Hlt

# =============================================================================
## new stuff ##
# =============================================================================

_TC = 'const Hlt::Candidate*'
_TS = 'const Hlt::Stage*'
_vC = std.vector( _TC      ) ## std::vector<const Hlt::Candidate*>
_vD = std.vector( 'double' ) ## std::vector<double>


## @see LoKi::Types::TC_Func
TC_Func      = LoKi.Functor                 ( _TC    , 'double' )
## @see LoKi::Types::TC_Cuts
TC_Cuts      = LoKi.Functor                 ( _TC    ,  bool    )
## @see LoKi::Types::TC_Fun
TC_Fun       = LoKi.FunctorFromFunctor      ( _TC    , 'double' )
## @see LoKi::Types::TC_Cut
TC_Cut       = LoKi.FunctorFromFunctor      ( _TC    ,  bool    )

## @see LoKi::Types::TS_Func
TS_Func      = LoKi.Functor                 ( _TS    , 'double' )
## @see LoKi::Types::TC_Cuts
TS_Cuts      = LoKi.Functor                 ( _TS    ,  bool    )
## @see LoKi::Types::TC_Fun
TS_Fun       = LoKi.FunctorFromFunctor      ( _TS    , 'double' )
## @see LoKi::Types::TC_Cut
TS_Cut       = LoKi.FunctorFromFunctor      ( _TS    ,  bool    )