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

In This Package:

Dump.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Example script for printing job information
00004 #
00005 #  Usage:
00006 #   nuwa.py -n 1 -m"JobInfoSvc.Dump" nuwaFile.root
00007 #
00008 #
00009 
00010 # Load DybPython
00011 from DybPython.DybPythonAlg import DybPythonAlg
00012 from GaudiPython import SUCCESS, FAILURE
00013 from GaudiPython import gbl
00014 import ROOT
00015 
00016 # Dumper Algorithm
00017 class PrintJobInfoAlg(DybPythonAlg):
00018     "Print Job Info Algorithm"
00019     def __init__(self,name):
00020         DybPythonAlg.__init__(self,name)
00021         return
00022 
00023     def initialize(self):
00024         status = DybPythonAlg.initialize(self)
00025         if status.isFailure(): return status
00026         self.info("initializing")
00027 
00028         # Example histogram: Total raw ADC sum for each trigger
00029         self.jobInfoSvc = self.svc('IJobInfoSvc','JobInfoSvc')
00030         jobInfo = self.jobInfoSvc.currentJobInfo()
00031         import time
00032         print "\n"
00033         print "Current Job Information:"
00034         jobInfo.fillStream(ROOT.cout)
00035         print "\n"
00036 
00037         for jobInfoHist in self.jobInfoSvc.cachedJobInfo():
00038             print "\n"
00039             print "Cached Job Information:"
00040             jobInfoHist.fillStream(ROOT.cout)
00041             print "\n"
00042         return SUCCESS
00043 
00044     def execute(self):
00045         self.info("executing")
00046 
00047         evt = self.evtSvc()
00048         genHeader = evt["/Event/Gen/GenHeader"]
00049         if genHeader:
00050             jobInfo = self.jobInfoSvc.jobInfo(genHeader.jobId())
00051             print "Kinematics at time ",genHeader.timeStamp().AsString()," generated by job ",jobInfo.jobId()," with command: ", jobInfo.get('command')
00052         
00053         return SUCCESS
00054         
00055     def finalize(self):
00056         self.info("finalizing")
00057         status = DybPythonAlg.finalize(self)
00058         return status
00059 
00060 #####  Job Configuration for nuwa.py ########################################
00061 
00062 def configure( argv=[] ):
00063     """ Example module for printing job info """
00064     return
00065 
00066 def run(app):
00067     '''
00068     Configure and add the algorithm to job
00069     '''
00070     myAlg = PrintJobInfoAlg("MyPrintJobInfoAlg")
00071     app.addAlgorithm(myAlg)
00072     pass
00073 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:59:35 for JobInfoSvc by doxygen 1.7.4