/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

TestDaqDetails.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # chao@bnl.gov 2011-12-14
00003 '''
00004 Test DaqDetails
00005 '''
00006 #!/usr/bin/env python
00007 # chao@bnl.gov 2011-09-13
00008 '''
00009 Test DybPython.Util.decorators
00010 '''
00011 
00012 from DybPython.DybPythonAlg import DybPythonAlg
00013 from GaudiPython import SUCCESS, FAILURE
00014 from GaudiPython import gbl
00015 from DybPython.Util.decorators import register_svc, initialize_alg, finalize_alg
00016 
00017 ServiceMode = gbl.ServiceMode
00018 
00019 class TestDaqDetails(DybPythonAlg):
00020     
00021     def __init__(self,name):
00022         DybPythonAlg.__init__(self,name)
00023         return
00024     
00025     # -------------------------------------- 
00026     # @register_svc('cableSvc', ('ICableSvc','CableSvc'))
00027     @register_svc('daqDetailsSvc', ('IDaqDetailsSvc','DetailsFromRecordSvc'))
00028     @initialize_alg
00029     def initialize(self):
00030         self.info(str(self.daqDetailsSvc))    
00031         return SUCCESS
00032         
00033     # --------------------------------------         
00034     def execute(self): 
00035         evt = self.evtSvc()     
00036         hdr = evt["/Event/Readout/ReadoutHeader"]
00037         if not hdr:
00038             self.warning('cannot find /Event/Readout/ReadoutHeader')
00039             return FAILURE 
00040 
00041         svcMode = ServiceMode(hdr.context(), 0)
00042         runDetails = self.daqDetailsSvc.runDetails(svcMode)
00043         if runDetails:
00044             runNo = runDetails.runNumber()
00045             self.info('runNo: %d' % (runNo,))
00046         else:
00047             raise ValueError("no runDetails!!") 
00048                              
00049         return SUCCESS
00050         
00051     # -------------------------------------- 
00052     @finalize_alg
00053     def finalize(self):     
00054         return SUCCESS
00055 
00056 
00057 #####  Job Configuration for nuwa.py ########################################
00058 
00059 def configure(argv=[]):
00060     pass
00061 
00062 def run(app):
00063     app.ExtSvc += ["DetailsFromRecordSvc"]
00064     
00065     myAlg = TestDaqDetails("TestDaqDetails")
00066     app.addAlgorithm(myAlg)
00067     pass
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:59:23 for DataSvc by doxygen 1.7.4