![]() |
|
|
Generated: 8 Jan 2009 |


Definition at line 564 of file Bindings.py.
Public Member Functions | |
| def | __new__ |
| def | __init__ |
| def | state |
| def | FSMState |
| def | targetFSMState |
| def | loaddict |
| def | service |
| def | declSvcType |
| def | createSvc |
| def | services |
| def | algorithm |
| def | algorithms |
| def | tool |
| def | property |
| def | datasvc |
| def | evtsvc |
| def | detsvc |
| def | evtsel |
| def | histsvc |
| def | ntuplesvc |
| def | partsvc |
| def | toolsvc |
| def | optSvc |
| def | readOptions |
| def | addAlgorithm |
| def | setAlgorithms |
| def | removeAlgorithm |
| def | config |
| def | configure |
| def | start |
| def | run |
| def | executeEvent |
| def | execute |
| def | exit |
Public Attributes | |
| JobOptionsType | |
| OutputLevel | |
| topAlg | |
Static Public Attributes | |
| evtSvc = evtsvc | |
| histSvc = histsvc | |
| ntupleSvc = ntuplesvc | |
| evtSel = evtsel | |
| detSvc = detsvc | |
| toolSvc = toolsvc | |
| partSvc = partsvc | |
| def GaudiPython::Bindings::AppMgr::__new__ | ( | cls, | ||
| args, | ||||
| kwargs | ||||
| ) |
Definition at line 565 of file Bindings.py.
00565 : 00566 global _gaudi 00567 if not _gaudi : 00568 newobj = object.__new__( cls, *args, **kwargs ) 00569 cls.__init__(newobj, *args, **kwargs) 00570 _gaudi = newobj 00571 return _gaudi def __init__(self, outputlevel = -1, joboptions = None, selfoptions = {},
| def GaudiPython::Bindings::AppMgr::__init__ | ( | self, | ||
outputlevel = -1, |
||||
joboptions = None, |
||||
selfoptions = {}, |
||||
dllname = None, |
||||
factname = None | ||||
| ) |
Definition at line 572 of file Bindings.py.
00572 {}, 00573 dllname = None, factname = None) : 00574 global _gaudi 00575 if _gaudi : return 00576 try: 00577 from GaudiKernel.Proxy.Configurable import expandvars 00578 except ImportError: 00579 # pass-through implementation if expandvars is not defined (AthenaCommon) 00580 expandvars = lambda data : data 00581 if dllname and factname: 00582 self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr(dllname,factname) 00583 elif dllname: 00584 self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr(dllname) 00585 else: 00586 self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr() 00587 self.__dict__['_svcloc'] = gbl.Gaudi.svcLocator() 00588 self.__dict__['_algmgr'] = InterfaceCast(gbl.IAlgManager)(self._appmgr) 00589 self.__dict__['_evtpro'] = InterfaceCast(gbl.IEventProcessor)(self._appmgr) 00590 self.__dict__['_svcmgr'] = InterfaceCast(gbl.ISvcManager)(self._appmgr) 00591 self.__dict__['pyalgorithms'] = [] 00592 iService.__init__(self, 'ApplicationMgr', self._appmgr ) 00593 #------python specific initialization------------------------------------- 00594 if self.FSMState() < Gaudi.StateMachine.CONFIGURED : # Not yet configured 00595 self.JobOptionsType = 'NONE' 00596 if joboptions : 00597 from GaudiKernel.ProcessJobOptions import importOptions 00598 importOptions(joboptions) 00599 # Ensure that the ConfigurableUser instances have been applied 00600 import GaudiKernel.Proxy.Configurable 00601 if hasattr(GaudiKernel.Proxy.Configurable, "applyConfigurableUsers"): 00602 GaudiKernel.Proxy.Configurable.applyConfigurableUsers() 00603 # This is the default and could be overridden with "selfopts" 00604 self.OutputLevel = 3 00605 selfprops = Configurable.allConfigurables.get('ApplicationMgr',{}) 00606 if selfprops : selfprops = expandvars(selfprops.getValuedProperties()) 00607 for p,v in selfprops.items() : setattr(self, p, v) 00608 for p,v in selfoptions.items() : setattr(self, p, v) 00609 # Override job options 00610 if outputlevel != -1 : self.OutputLevel = outputlevel 00611 self.configure() 00612 #---MessageSvc------------------------------------------------------------ 00613 ms = self.service('MessageSvc') 00614 if 'MessageSvc' in Configurable.allConfigurables: 00615 msprops = Configurable.allConfigurables['MessageSvc'] 00616 ms = self.service('MessageSvc') 00617 if hasattr(msprops,"getValuedProperties"): 00618 msprops = expandvars(msprops.getValuedProperties()) 00619 for p,v in msprops.items(): 00620 setattr(ms, p, v) 00621 if outputlevel != -1 : ms.OutputLevel = outputlevel 00622 #---JobOptions------------------------------------------------------------ 00623 self.__dict__['_optsvc'] = InterfaceCast(gbl.IJobOptionsSvc)(Helper.service(self._svcloc,'JobOptionsSvc')) 00624 #------Configurables initialization (part2)------------------------------- 00625 for n in getNeededConfigurables(): 00626 c = Configurable.allConfigurables[n] 00627 if n in ['ApplicationMgr','MessageSvc'] : continue # These are already done--- 00628 for p, v in c.getValuedProperties().items() : 00629 v = expandvars(v) 00630 # Note: AthenaCommon.Configurable does not have Configurable.PropertyReference 00631 if hasattr(Configurable,"PropertyReference") and type(v) == Configurable.PropertyReference: 00632 # this is done in "getFullName", but the exception is ignored, 00633 # so we do it again to get it 00634 v = v.__resolve__() 00635 if type(v) == str : v = '"%s"' % v # need double quotes 00636 elif type(v) == long: v = '%d' % v # prevent pending 'L' 00637 self._optsvc.addPropertyToCatalogue(n, StringProperty(p,str(v))) 00638 if hasattr(Configurable,"_configurationLocked"): 00639 Configurable._configurationLocked = True
| def GaudiPython::Bindings::AppMgr::state | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::FSMState | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::targetFSMState | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::loaddict | ( | self, | ||
| dict | ||||
| ) |
| def GaudiPython::Bindings::AppMgr::service | ( | self, | ||
| name, | ||||
interface = None | ||||
| ) |
Definition at line 645 of file Bindings.py.
00645 : 00646 svc = Helper.service( self._svcloc, name ) 00647 if interface : 00648 return InterfaceCast(interface)(svc) 00649 else : 00650 return iService(name, svc ) def declSvcType(self, svcname, svctype ) :
| def GaudiPython::Bindings::AppMgr::declSvcType | ( | self, | ||
| svcname, | ||||
| svctype | ||||
| ) |
| def GaudiPython::Bindings::AppMgr::createSvc | ( | self, | ||
| name | ||||
| ) |
| def GaudiPython::Bindings::AppMgr::services | ( | self | ) |
Definition at line 655 of file Bindings.py.
00655 : 00656 l = self._svcloc.getServices() 00657 nl = l.__class__(l) # get a copy 00658 s = [] 00659 for i in range(l.size()) : 00660 s.append(nl.front().name()) 00661 nl.pop_front() 00662 return s def algorithm(self, name ) :
| def GaudiPython::Bindings::AppMgr::algorithm | ( | self, | ||
| name | ||||
| ) |
Definition at line 663 of file Bindings.py.
00663 : 00664 alg = Helper.algorithm( self._algmgr, name ) 00665 return iAlgorithm(name, alg ) def algorithms(self) :
| def GaudiPython::Bindings::AppMgr::algorithms | ( | self | ) |
Definition at line 666 of file Bindings.py.
00666 : 00667 l = self._algmgr.getAlgorithms() 00668 nl = l.__class__(l) # get a copy 00669 s = [] 00670 for i in range(l.size()) : 00671 s.append(nl.front().name()) 00672 nl.pop_front() 00673 return s def tool(self, name ) :
| def GaudiPython::Bindings::AppMgr::tool | ( | self, | ||
| name | ||||
| ) |
| def GaudiPython::Bindings::AppMgr::property | ( | self, | ||
| name | ||||
| ) |
Definition at line 676 of file Bindings.py.
00676 : 00677 if name in self.algorithms() : return self.algorithm( name ) 00678 elif name in self.services() : return self.service(name ) 00679 else : return iProperty( name ) def datasvc(self, name) :
| def GaudiPython::Bindings::AppMgr::datasvc | ( | self, | ||
| name | ||||
| ) |
Definition at line 680 of file Bindings.py.
00680 : 00681 if self.state() == Gaudi.StateMachine.CONFIGURED : self.initialize() 00682 svc = Helper.service( self._svcloc, name ) 00683 return iDataSvc(name, svc) def evtsvc(self) :
| def GaudiPython::Bindings::AppMgr::evtsvc | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::detsvc | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::evtsel | ( | self | ) |
Definition at line 688 of file Bindings.py.
00688 : 00689 if self.state() == Gaudi.StateMachine.CONFIGURED : self.initialize() 00690 if not hasattr(self,'_evtsel') : self.__dict__['_evtsel'] = iEventSelector() 00691 return self._evtsel def histsvc(self, name='HistogramDataSvc') :
| def GaudiPython::Bindings::AppMgr::histsvc | ( | self, | ||
name = 'HistogramDataSvc' | ||||
| ) |
Definition at line 692 of file Bindings.py.
00692 : 00693 svc = Helper.service( self._svcloc, name ) 00694 return iHistogramSvc(name, svc) def ntuplesvc(self, name='NTupleSvc') :
| def GaudiPython::Bindings::AppMgr::ntuplesvc | ( | self, | ||
name = 'NTupleSvc' | ||||
| ) |
Definition at line 695 of file Bindings.py.
00695 : 00696 if name not in self.ExtSvc : self.ExtSvc += [name] 00697 # if self.HistogramPersistency == 'NONE' : self.HistogramPersistency = 'ROOT' 00698 svc = Helper.service( self._svcloc, name, True ) 00699 return iNTupleSvc(name, svc) def partsvc(self ) :
| def GaudiPython::Bindings::AppMgr::partsvc | ( | self | ) |
Definition at line 700 of file Bindings.py.
00700 : 00701 if self.FSMState() == Gaudi.StateMachine.CONFIGURED : self.initialize() 00702 svc = Helper.service( self._svcloc, 'ParticlePropertySvc' ) 00703 return InterfaceCast(gbl.IParticlePropertySvc)(svc) def toolsvc(self, name='ToolSvc') :
| def GaudiPython::Bindings::AppMgr::toolsvc | ( | self, | ||
name = 'ToolSvc' | ||||
| ) |
Definition at line 704 of file Bindings.py.
00704 : 00705 svc = Helper.service( self._svcloc, name, True ) 00706 return iToolSvc(name, svc) def optSvc (self, name='JobOptionsSvc') :
| def GaudiPython::Bindings::AppMgr::optSvc | ( | self, | ||
name = 'JobOptionsSvc' | ||||
| ) |
Definition at line 707 of file Bindings.py.
00707 : 00708 svc = Helper.service( self._svcloc, name, True ) 00709 return iJobOptSvc(name, svc) def readOptions(self, file) :
| def GaudiPython::Bindings::AppMgr::readOptions | ( | self, | ||
| file | ||||
| ) |
Definition at line 710 of file Bindings.py.
00710 : 00711 return self._optsvc.readOptions(file) def addAlgorithm(self, alg) :
| def GaudiPython::Bindings::AppMgr::addAlgorithm | ( | self, | ||
| alg | ||||
| ) |
Add an Algorithm to the list of Top algorithms. It can be either a instance of an Algorithm class or it name
Definition at line 712 of file Bindings.py.
00712 : 00713 """ Add an Algorithm to the list of Top algorithms. It can be either a instance of 00714 an Algorithm class or it name """ 00715 if type(alg) is str : 00716 self.topAlg += [alg] 00717 else : 00718 self.pyalgorithms.append(alg) 00719 setOwnership(alg,0) 00720 if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED : 00721 alg.sysInitialize() 00722 if self.targetFSMState() == Gaudi.StateMachine.RUNNING : 00723 alg.sysStart() 00724 self.topAlg += [alg.name()] def setAlgorithms(self, algs) :
| def GaudiPython::Bindings::AppMgr::setAlgorithms | ( | self, | ||
| algs | ||||
| ) |
Set the list of Top Algorithms. It can be an individual of a list of algorithms names or instances
Definition at line 725 of file Bindings.py.
00725 : 00726 """ Set the list of Top Algorithms. 00727 It can be an individual of a list of algorithms names or instances """ 00728 if type(algs) is not list : algs = [algs] 00729 names = [] 00730 for alg in algs : 00731 if type(alg) is str : names.append(alg) 00732 else : 00733 self.pyalgorithms.append(alg) 00734 if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED : 00735 alg.sysInitialize() 00736 if self.targetFSMState() == Gaudi.StateMachine.RUNNING : 00737 alg.sysStart() 00738 names.append(alg.name()) 00739 self.topAlg = names def removeAlgorithm(self, alg) :
| def GaudiPython::Bindings::AppMgr::removeAlgorithm | ( | self, | ||
| alg | ||||
| ) |
Remove an Algorithm to the list of Top algorithms. It can be either a instance of an Algorithm class or it name
Definition at line 740 of file Bindings.py.
00740 : 00741 """ Remove an Algorithm to the list of Top algorithms. It can be either a instance of 00742 an Algorithm class or it name """ 00743 tmp = self.topAlg 00744 if type(alg) is str : 00745 tmp.remove(alg) 00746 else : 00747 tmp.remove(alg.name()) 00748 self.pyalgorithms.remove(alg) 00749 setOwnership(alg,1) 00750 self.topAlg = tmp def config ( self, **args ):
| def GaudiPython::Bindings::AppMgr::config | ( | self, | ||
| args | ||||
| ) |
Simple utility to perform the configuration of Gaudi application.
It reads the set of input job-options files, and set few
additional parameters 'options' through the usage of temporary *.opts file
Usage:
gaudi.config( files = [ '$GAUSSOPTS/Gauss.opts' ,
'$DECFILESROOT/options/10022_010.0GeV.opts' ] ,
options = [ 'EventSelector.PrintFreq = 5 ' ] )
Definition at line 751 of file Bindings.py.
00751 : 00752 """ 00753 Simple utility to perform the configuration of Gaudi application. 00754 It reads the set of input job-options files, and set few 00755 additional parameters 'options' through the usage of temporary *.opts file 00756 Usage: 00757 gaudi.config( files = [ '$GAUSSOPTS/Gauss.opts' , 00758 '$DECFILESROOT/options/10022_010.0GeV.opts' ] , 00759 options = [ 'EventSelector.PrintFreq = 5 ' ] ) 00760 """ 00761 files = args.get('files',[]) 00762 for file in files : 00763 sc = self.readOptions(file) 00764 if sc.isFailure() : 00765 raise RuntimeError , ' Unable to read file "' + file +'" ' 00766 options = args.get('options',None) 00767 if options : 00768 import tempfile 00769 tmpfilename = tempfile.mktemp() 00770 tmpfile = open( tmpfilename, 'w' ) 00771 tmpfile.write ( '#pragma print on \n' ) 00772 tmpfile.write ( '/// File "' + tmpfilename+'" generated by GaudiPython \n\n' ) 00773 for opt in options : 00774 if type(options) is dict : 00775 tmpfile.write( ' \t ' + opt + ' = '+ options[opt]+ ' ; // added by GaudiPython \n' ) 00776 else : 00777 tmpfile.write( ' \t ' + opt + ' ; // added by GaudiPython \n' ) 00778 tmpfile.write ( '/// End of file "' + tmpfilename+'" generated by GaudiPython \n\n' ) 00779 tmpfile.close() 00780 sc = self.readOptions( tmpfilename ) 00781 if sc.isFailure() : 00782 raise RuntimeError , ' Unable to read file "' + tmpfilename +'" ' 00783 os.remove( tmpfilename ) 00784 # We need to make sure that the options are taken by the ApplicationMgr 00785 if self.FSMState() != Gaudi.StateMachine.OFFLINE : # The state is already configured, so we need to do something.... 00786 00787 ## get job-options-service, @see class iJobOptSvc 00788 jos = self.optSvc() 00789 00790 ## list of all libraries 00791 _dlls = jos.getProperty ( self.name() , 'DLLs' ) 00792 ## take care about libraries : APPEND if not done yet 00793 if _dlls : 00794 libs = [ l for l in _dlls if not l in self.DLLs ] 00795 if libs : self.DLLs += libs 00796 00797 ## all external services 00798 _svcs = jos.getProperty ( self.name() , 'ExtSvc' ) 00799 ## take care about services : APPEND if not done yet 00800 if _svcs : 00801 svcs = [ s for s in _svcs if not s in self.ExtSvc ] 00802 if svcs : self.ExtSvc += svcs 00803 00804 ## get all properties 00805 props = jos.getProperties ( self.name() ) 00806 ## finally treat all other properties (presumably scalar properties) 00807 for key in props : 00808 if 'DLLS' == key or 'EXTSVC' == key : continue 00809 self.__setattr__( key , props[key] ) 00810 return SUCCESS # RETURN def configure(self) :
| def GaudiPython::Bindings::AppMgr::configure | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::start | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::run | ( | self, | ||
| n | ||||
| ) |
Definition at line 815 of file Bindings.py.
00815 : 00816 if self.FSMState() == Gaudi.StateMachine.CONFIGURED : 00817 sc = self.initialize() 00818 if sc.isFailure(): return sc 00819 if self.FSMState() == Gaudi.StateMachine.INITIALIZED : 00820 sc = self.start() 00821 if sc.isFailure(): return sc 00822 return self._evtpro.executeRun(n) def executeEvent(self) :
| def GaudiPython::Bindings::AppMgr::executeEvent | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::execute | ( | self | ) |
| def GaudiPython::Bindings::AppMgr::exit | ( | self | ) |
Definition at line 827 of file Bindings.py.
00827 : 00828 if self.FSMState() == Gaudi.StateMachine.RUNNING: self._appmgr.stop().ignore() 00829 if self.FSMState() == Gaudi.StateMachine.INITIALIZED: self._appmgr.finalize().ignore() 00830 return self._appmgr.terminate() evtSvc = evtsvc
GaudiPython::Bindings::AppMgr::evtSvc = evtsvc [static] |
Definition at line 831 of file Bindings.py.
GaudiPython::Bindings::AppMgr::histSvc = histsvc [static] |
Definition at line 832 of file Bindings.py.
GaudiPython::Bindings::AppMgr::ntupleSvc = ntuplesvc [static] |
Definition at line 833 of file Bindings.py.
GaudiPython::Bindings::AppMgr::evtSel = evtsel [static] |
Definition at line 834 of file Bindings.py.
GaudiPython::Bindings::AppMgr::detSvc = detsvc [static] |
Definition at line 835 of file Bindings.py.
GaudiPython::Bindings::AppMgr::toolSvc = toolsvc [static] |
Definition at line 836 of file Bindings.py.
GaudiPython::Bindings::AppMgr::partSvc = partsvc [static] |
Definition at line 837 of file Bindings.py.
Definition at line 594 of file Bindings.py.
Definition at line 603 of file Bindings.py.
Definition at line 739 of file Bindings.py.