def doubles(arg1, *arg): """Construct the std::vector<double> from the arguments >>> v1 = doubles ( 1.01 ) >>> v2 = doubles ( 1.01 , 1.02 , 1.03 ) >>> v3 = doubles ( [ 1.01 , 1.02 , 1.03 ] ) """ VT = std.vector('double') vct = VT() return _make_vct_(vct, arg1, lambda v, s: _append_(v, s), *arg)
def ints(arg1, *arg): """Construct the std::vector<int> from the arguments >>> v1 = ints ( 1 ) >>> v2 = ints ( 1 , 1 , 10 ) >>> v3 = ints ( [ 1 , 2 , 3 ] ) """ VT = std.vector('int') vct = VT() return _make_vct_(vct, arg1, lambda v, s: _append_(v, s), *arg)
def strings(arg1, *arg): """Construct the std::vector<std::string> from the arguments >>> v1 = strings ( 'sadfsdf' ) >>> v2 = strings ( 'sadfsdf' , 'sadf' , 'afadf' ) >>> v3 = strings ( [ 'sadfsdf' , 'sadf' , 'afadf' ] ) """ VT = std.vector('std::string') vct = VT() return _make_vct_(vct, arg1, lambda v, s: _append_(v, str(s)), *arg)
""" # ============================================================================= __author__ = "Vanya BELYAEV [email protected]" __date__ = "2011-02-03" __version__ = "$Revision$" # ============================================================================= from LoKiCore.basic import cpp, std, LoKi LHCb = cpp.LHCb Hlt = cpp.Hlt _TC = 'const Hlt::Candidate*' _TS = 'const Hlt::Stage*' vTC = std.vector(_TC) vTS = std.vector(_TS) # ============================================================================= ## add iterators over involved smart ref-vectors import LoKiCore.functions as _LCF _t1 = Hlt.Candidate _t2 = Hlt.Stage _t3 = LHCb.Track _t4 = LHCb.Particle for _t in (_t2, _t3, _t4): _tt = cpp.SmartRefVector(_t) # redefine the iterator _tt.__iter__ = _LCF._iter_SRV_
# ============================================================================= __author__ = "Vanya BELYAEV [email protected]" __date__ = "????-??-??" __version__ = "Version $Revision$" # ============================================================================= import LoKiCore.decorators as _LoKiCore from LoKiCore.functions import equal_to # Namespaces: from LoKiCore.basic import cpp, std, LoKi, LHCb, Gaudi _RCP = 'const LHCb::Particle*' _RCV = 'const LHCb::VertexBase*' _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')
""" # v2 = type(v)(v) if hasattr(o, '__len__') and not issubclass(type(o), str): for i in o: v2.push_back(i) else: v2.push_back(o) # return v2 ## minor decorations for t in ('int', 'double', 'long', 'string'): k = std.vector(t) k.__str__ = lambda s: str([i for i in s]) k.__repr__ = k.__str__ k.__iadd__ = _iadd_ k.__add__ = _add_ _tes_location_ = LoKi.Print.Printer.tesLocation # ============================================================================= ## make print for TES-location for the object def tesLocation(o): """Get TES location for the object: >>> particle = ... >>> print tesLocation ( particle ) """
'C++ ToolKit for Smart and Friendly Physics Analysis' The package has been designed with the kind help from Galina PAKHLOVA and Sergey BARSUK. Many bright ideas, contributions and advices from G.Raven, J.van Tilburg, A.Golutvin, P.Koppenburg have been used in the design. """ # ============================================================================= __author__ = "Pieter David [email protected]" __date__ = "2007-05-29" __version__ = "$Revision$ " # ============================================================================= from LoKiCore.basic import LoKi, std, cpp FALL = LoKi.Constant("void", bool)(True) _c1 = std.vector('const LHCb::MCParticle*') MCRange = cpp.Gaudi.NamedRange_(_c1) # ============================================================================= if '__main__' == __name__: print 80 * '*' print __doc__ print ' Author : ', __author__ print ' Version : ', __version__ print ' Date : ', __date__ print 80 * '*' for i in dir(): print i # =============================================================================
__date__ = "????-??-??" __version__ = "Version $Revision: 198748 $" # ============================================================================= import LoKiCore.decorators as _LoKiCore from LoKiCore.functions import equal_to # Namespaces: from LoKiCore.basic import cpp, std, LoKi, LHCb, Gaudi _RCP = 'const LHCb::Particle*' _RCV = 'const LHCb::VertexBase*' _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
XNULL = LoKi.Constant(_d, _d)(0.0) XVONE = LoKi.Constant(_v, _d)(1.0) XVZERO = LoKi.Constant(_v, _d)(0.0) XVTRUE = LoKi.Constant(_v, bool)(True) XVALL = LoKi.Constant(_v, bool)(True) XVFALSE = LoKi.Constant(_v, bool)(False) XVNONE = LoKi.Constant(_v, bool)(False) X = LoKi.Identity(_d, _d)() XID = X XV = LoKi.Identity(_v, _v)() XVID = XV XVector = std.vector(_d) # TES checkers ## @see LoKi::Cuts::EXISTS EXISTS = LoKi.TES.Exists ## @see LoKi::Cuts::CONTAINS CONTAINS = LoKi.TES.Contains ## @see LoKi::Cuts::COUNTER COUNTER = LoKi.TES.Counter ## @see LoKi::Cuts::STAT STAT = LoKi.TES.Stat # RecSummary for Sophie Redford & Andy Powell ## @see LoKi::Cuts::HASRECSUMMARY
import LoKiCore from GaudiPython import PyAlgorithm # ============================================================================= if '__main__' == __name__: print '*' * 120 print __doc__ print ' Author : %s ' % __author__ print ' Version : %s ' % __version__ print ' Date : %s ' % __date__ print '*' * 120 from LoKiCore.basic import cpp, std, LoKi Hlt.Candidate.ConstVector = std.vector('const Hlt::Candidate*') Hlt.Candidate.ConstVector.__repr__ = lambda s: str([str(i) for i in s]) Hlt.Candidate.ConstVector.__str__ = lambda s: str([str(i) for i in s]) s = LHCb.State() s.setState(0.0, 0.0, 0.0, 0.01, 0.01, 0.2) t = LHCb.Track() t.addToStates(s) #print 'track: (TrP,TrPT)=(%s,%s)'%(TrP(t),TrPT(t)) #print 'track: ( t>>TrP , p>>cos(TrPT) )=(%s,%s)'%(t>>TrP,t>>cos(TrPT)) v = std.vector('LHCb::Track*')() #v.push_back(t)
import LoKiCore.decorators as _LoKiCore import LoKiTrigger.Hlt # Namespaces: 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