psana_examples/src/dump_alias.py

Go to the documentation of this file.
00001 #--------------------------------------------------------------------------
00002 # File and Version Information:
00003 #  $Id: dump_alias.py 6920 2013-10-07 22:09:39Z salnikov@SLAC.STANFORD.EDU $
00004 #
00005 # Description:
00006 #  Psana user analysis module dump_alias...
00007 #
00008 #------------------------------------------------------------------------
00009 
00010 """Psana module which dumps alias configuration.
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_alias.py 6920 2013-10-07 22:09:39Z salnikov@SLAC.STANFORD.EDU $
00016 
00017 @author Andy Salnikov
00018 """
00019 
00020 #------------------------------
00021 #  Module's version from SVN --
00022 #------------------------------
00023 __version__ = "$Revision: 6920 $"
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_alias (object) :
00045 
00046     #----------------
00047     #  Constructor --
00048     #----------------
00049     def __init__(self):
00050         '''Class constructor. Does not need any parameters'''
00051 
00052         self.m_src = self.configSrc('source', 'ProcInfo()')
00053 
00054     #-------------------
00055     #  Public methods --
00056     #-------------------
00057 
00058     def beginRun( self, evt, env ) :
00059         """This optional method is called if present at the beginning 
00060         of the new run.
00061 
00062         @param evt    event data object
00063         @param env    environment object
00064         """
00065 
00066         config = env.configStore().get(Alias.Config, self.m_src)
00067         if config:
00068         
00069             print "%s: %s" % (config.__class__.__name__, self.m_src)
00070             print "  numSrcAlias =", config.numSrcAlias()
00071             for i, alias in enumerate(config.srcAlias()):
00072                 print "    {0}: {1} -> {2}".format(i, alias.aliasName(), alias.src())
00073 
00074     def event( self, evt, env ) :
00075         """This method is called for every L1Accept transition.
00076 
00077         @param evt    event data object
00078         @param env    environment object
00079         """
00080 
00081         pass
00082 

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7