| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

TestCableSvc.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 from GaudiPython import *
00004 from DybPython.DybPythonAlg import DybPythonAlg
00005 
00006 Detector = gbl.DayaBay.Detector
00007 ServiceMode = gbl.ServiceMode
00008 Context = gbl.Context
00009 Site = gbl.Site
00010 DetectorId = gbl.DetectorId
00011 
00012 FeeCableMap = gbl.FeeCableMap
00013 
00014 class TestAlg(DybPythonAlg):
00015     def __init__(self,name):
00016         DybPythonAlg.__init__(self,name)
00017         self.cableSvcName = 'StaticCableSvc'
00018         print "Making TestAlg",name
00019 
00020     def initialize(self):
00021         status = DybPythonAlg.initialize(self)
00022         print "Init TestAlg",self.name()
00023         if status.isFailure(): return status
00024         self.cableSvc = self.svc('ICableSvc',self.cableSvcName)
00025         print "===========================================================\n\n"
00026         # Select all sites
00027         context = Context()
00028         context.SetSite(Site.kAll)
00029         # Select all detectors
00030         context.SetDetId(DetectorId.kAll)
00031         svcMode = ServiceMode(context,0)
00032         adPmtSensors = self.cableSvc.adPmtSensors(svcMode)
00033         hrdwTypes = ["kUnknown","kPmt8inch","kPmt2inch","kRpc","kFee","kFec","kRot","kRom","kHighVoltage"]
00034         print "  number of sensors =",adPmtSensors.size()
00035         print "  Detector \t Ring \t Colmn \t HrdwType  PmtHrdwId \t DAQChannel \t ElecHrdwType \t FEEHrdwId FEEHrdwConnector"
00036         for sens in adPmtSensors:
00037             pmtHrdw = self.cableSvc.pmtHardwareId(sens, svcMode)
00038             chan = self.cableSvc.feeChannelId(sens, svcMode)
00039             feeHrdw = self.cableSvc.feeHardwareId(chan, svcMode)
00040 
00041             daqIndex = "%2d %2d" % (chan.board(), chan.connector())
00042             pmtHrdwId = "%4d" % pmtHrdw.id()
00043             print " ",sens.detName(),"\t ",sens.ring(),"\t ",sens.column(),"\t",hrdwTypes[pmtHrdw.type()]," ",pmtHrdwId,"\t ",daqIndex,"\t ",hrdwTypes[feeHrdw.type()],"\t\t ",feeHrdw.boardId(),"\t  ",feeHrdw.connector()
00044             
00045         print "\n\n==========================================================="
00046         return SUCCESS
00047 
00048     def execute(self):
00049         print "Executing TestAlg",self.name()
00050         return SUCCESS
00051 
00052     def finalize(self):
00053         print "Finalizing TestAlg",self.name()
00054         status = DybPythonAlg.finalize(self)
00055         return status
00056 
00057 cableSvcName = "StaticCableSvc"
00058 
00059 def configure(argv = []):
00060     global cableSvcName
00061     import getopt
00062     opts,args = getopt.getopt(argv,"",["svc-name="])
00063     for opt,arg in opts:
00064         if opt == "--svc-name":
00065             cableSvcName = arg
00066     import DataSvc
00067     DataSvc.Configure( cableSvc = cableSvcName )
00068     return
00069 
00070 def run(app):
00071     global cableSvcName
00072     app.ExtSvc += [ cableSvcName ]
00073     testAlg = TestAlg("TestAlg")
00074     testAlg.cableSvcName = cableSvcName
00075     app.addAlgorithm( testAlg )
00076     return
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:21:03 2011 for DataSvc by doxygen 1.4.7