psana_examples/src/dump_imp.py

Go to the documentation of this file.
00001 #--------------------------------------------------------------------------
00002 # File and Version Information:
00003 #  $Id: dump_imp.py 6350 2013-05-22 15:56:02Z salnikov@SLAC.STANFORD.EDU $
00004 #
00005 # Description:
00006 #  Psana user analysis module dump_imp...
00007 #
00008 #------------------------------------------------------------------------
00009 
00010 """Example module for psana which dumps Imp data.
00011 
00012 This software was developed for the LCLS project.  If you use all or 
00013 part of it, please give an appropriate acknowledgment.
00014 
00015 @version $Id: dump_imp.py 6350 2013-05-22 15:56:02Z salnikov@SLAC.STANFORD.EDU $
00016 
00017 @author Andy Salnikov
00018 """
00019 
00020 #------------------------------
00021 #  Module's version from SVN --
00022 #------------------------------
00023 __version__ = "$Revision: 6350 $"
00024 # $Source$
00025 
00026 #--------------------------------
00027 #  Imports of standard modules --
00028 #--------------------------------
00029 import sys
00030 import logging
00031 
00032 #-----------------------------
00033 # Imports for other modules --
00034 #-----------------------------
00035 from psana import *
00036 
00037 #----------------------------------
00038 # Local non-exported definitions --
00039 #----------------------------------
00040 
00041 #---------------------
00042 #  Class definition --
00043 #---------------------
00044 class dump_imp (object) :
00045     '''Class whose instance will be used as a user analysis module.'''
00046 
00047 
00048     #----------------
00049     #  Constructor --
00050     #----------------
00051     def __init__(self):
00052         self.m_src = self.configSrc('source', ':Imp')
00053 
00054     #-------------------
00055     #  Public methods --
00056     #-------------------
00057 
00058     def beginRun( self, evt, env ) :
00059 
00060         config = env.configStore().get(Imp.Config, self.m_src)
00061         if config:
00062             print "dump_imp: %s: %s" % (config.__class__.__name__, self.m_src)
00063             print "  range =", config.range()
00064             print "  calRange =", config.calRange()
00065             print "  reset =", config.reset()
00066             print "  biasData =", config.biasData()
00067             print "  calData =", config.calData()
00068             print "  biasDacData =", config.biasDacData()
00069             print "  calStrobe =", config.calStrobe()
00070             print "  numberOfSamples =", config.numberOfSamples()
00071             print "  trigDelay =", config.trigDelay()
00072             print "  adcDelay =", config.adcDelay()
00073 
00074     def event( self, evt, env ) :
00075 
00076         data = evt.get(Imp.Element, self.m_src)
00077         if not data:
00078             return
00079 
00080         print "dump_imp: %s: %s" % (data.__class__.__name__, self.m_src)
00081 
00082         print "  vc =", data.vc()
00083         print "  lane =", data.lane()
00084         print "  frameNumber =", data.frameNumber()
00085         print "  range =", data.range()
00086 
00087         laneStatus = data.laneStatus()
00088         print "  laneStatus.linkErrCount =", laneStatus.linkErrCount()
00089         print "  laneStatus.linkDownCount =", laneStatus.linkDownCount()
00090         print "  laneStatus.cellErrCount =", laneStatus.cellErrCount()
00091         print "  laneStatus.rxCount =", laneStatus.rxCount()
00092         print "  laneStatus.locLinked =", laneStatus.locLinked()
00093         print "  laneStatus.remLinked =", laneStatus.remLinked()
00094         print "  laneStatus.zeros =", laneStatus.zeros()
00095         print "  laneStatus.powersOkay =", laneStatus.powersOkay()
00096         
00097         for i, sample in enumerate(data.samples()):
00098             print "  sample[%d]: channels = %s" % (i, sample.channels())
00099 

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7