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

In This Package:

ExamplePmtId.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Template for writing your own algorithm
00004 #
00005 #  Usage:
00006 #   nuwa.py -n 1 DivingIn.ExamplePmtId simulationData.root
00007 
00008 # Load DybPython
00009 from DybPython.DybPythonAlg import DybPythonAlg
00010 from GaudiPython import SUCCESS, FAILURE
00011 from GaudiPython import gbl
00012 
00013 ServiceMode = gbl.ServiceMode
00014 
00015 # Make your algorithm
00016 class ExampleAlg(DybPythonAlg):
00017     "Example Python Algorithm"
00018     def __init__(self,name):
00019         DybPythonAlg.__init__(self,name)
00020         return
00021 
00022     def initialize(self):
00023         status = DybPythonAlg.initialize(self)
00024         if status.isFailure(): return status
00025         self.info("initializing")
00026 
00027         self.cableSvc = self.svc('ICableSvc','CableSvc')
00028         self.pmtGeomSvc = self.svc('IPmtGeomInfoSvc','PmtGeomInfoSvc')
00029 
00030         return SUCCESS
00031 
00032     def execute(self):
00033         self.info("executing")
00034 
00035         # Get the Triggered Readout of the detector        
00036         evt = self.evtSvc()
00037         readoutHdr = evt["/Event/Readout/ReadoutHeader"]
00038         readout = readoutHdr.readout()
00039         if readout == None:
00040             self.info("No Triggered Readout for this event")
00041             return SUCCESS
00042 
00043         # Get the service mode
00044         svcMode = ServiceMode( readoutHdr.context(), 0 )
00045 
00046         # Look at data from each channel
00047         for channelPair in readout.channelReadout():
00048             channel = channelPair.second
00049 
00050             # See #319
00051             adc = channel.adc()
00052 
00053             channelId = channel.channelId()
00054             print "==================================="
00055             print "VME board= ", channelId.board()
00056             print "connector= ", channelId.connector()
00057             
00058             # Find the PMT ID connected this electronics channel
00059             pmtId = self.cableSvc.adPmtSensor( channelId, svcMode )
00060             print "pmt ring=", pmtId.ring()
00061             print "pmt column=", pmtId.column()
00062             
00063             # Get the physical PMT number for this PMT,
00064             # to compare with the PMT Test bench
00065             pmtHardwareId = self.cableSvc.pmtHardwareId( pmtId, svcMode )
00066             
00067             # Get the PMT position
00068             pmtGeomInfo = self.pmtGeomSvc.get( pmtId.fullPackedData() )
00069             pmtPosition = pmtGeomInfo.localPosition()
00070             # position relative to AD center
00071             print "pmt x= ", pmtPosition.x()
00072             print "pmt y= ", pmtPosition.y()
00073             print "pmt z= ", pmtPosition.z()
00074             print "=================================="
00075 
00076         return SUCCESS
00077         
00078     def finalize(self):
00079         self.info("finalizing")
00080         status = DybPythonAlg.finalize(self)
00081         return status
00082 
00083 
00084 #####  Job Configuration for nuwa.py ########################################
00085 
00086 def configure():
00087     from DetHelpers.DetHelpersConf import PmtGeomInfoSvc
00088     pgiSvc = PmtGeomInfoSvc()
00089     pgiSvc.StreamItems = ["/dd/Structure/DayaBay"]
00090     import DataSvc
00091     DataSvc.Configure()
00092     return
00093 
00094 def run(app):
00095     '''
00096     Configure and add an algorithm to job
00097     '''
00098     app.ExtSvc += ["PmtGeomInfoSvc"]
00099     example = ExampleAlg("MyExample")
00100     app.addAlgorithm(example)
00101     pass
00102 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:49:50 for DivingIn by doxygen 1.7.4