psana_examples/src/dump_l3t.py

Go to the documentation of this file.
00001 #--------------------------------------------------------------------------
00002 # File and Version Information:
00003 #  $Id: dump_l3t.py 6920 2013-10-07 22:09:39Z salnikov@SLAC.STANFORD.EDU $
00004 #
00005 # Description:
00006 #  Psana user analysis module dump_l3t...
00007 #
00008 #------------------------------------------------------------------------
00009 
00010 """Psana module to dump L3T information.
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_l3t.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_l3t (object) :
00045     '''Class whose instance will be used as a user analysis module.'''
00046 
00047     #----------------
00048     #  Constructor --
00049     #----------------
00050     def __init__(self):
00051         '''Class constructor. Does not need any parameters'''
00052 
00053         self.m_src = self.configSrc('source', 'ProcInfo()')
00054 
00055     #-------------------
00056     #  Public methods --
00057     #-------------------
00058 
00059     def beginRun( self, evt, env ) :
00060         """This optional method is called if present at the beginning 
00061         of the new run.
00062 
00063         @param evt    event data object
00064         @param env    environment object
00065         """
00066 
00067         config = env.configStore().get(L3T.Config, self.m_src)
00068         if config:
00069         
00070             print "%s: %s" % (config.__class__.__name__, self.m_src)
00071             print "  module_id =\"{0}\"".format(config.module_id())
00072             print "  description =\"{0}\"".format(config.desc())
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         data = evt.get(L3T.Data, self.m_src)
00082         if data:
00083             print "{0}: accept={1}".format(data.__class__.__name__, data.accept())
00084 

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7