CSPadPixCoords/include/SaveImageInFile.h

Go to the documentation of this file.
00001 #ifndef CSPADPIXCOORDS_SAVEIMAGEINFILE_H
00002 #define CSPADPIXCOORDS_SAVEIMAGEINFILE_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: SaveImageInFile.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class SaveImageInFile.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 
00017 //----------------------
00018 // Base Class Headers --
00019 //----------------------
00020 #include "psana/Module.h"
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 
00026 //------------------------------------
00027 // Collaborating Class Declarations --
00028 //------------------------------------
00029 
00030 #include "PSEvt/Source.h"
00031 
00032 
00033 //              ---------------------
00034 //              -- Class Interface --
00035 //              ---------------------
00036 
00037 namespace CSPadPixCoords {
00038 
00039 /// @addtogroup CSPadPixCoords
00040 
00041 /**
00042  *  @ingroup CSPadPixCoords
00043  *
00044  *  @brief SaveImageInFile is a test/example module for psana framework.
00045  *
00046  *  SaveImageInFile psana module class works after CSPadImageProducer.
00047  *  It gets the Image2D object from the event.
00048  *  This image object may be used in data processing.
00049  *  For the test purpose, the image of particular event is saved in the text file.
00050  *  This event number is defined in the psana.cfg configuration file. 
00051  *
00052  *  This software was developed for the LCLS project.  If you use all or 
00053  *  part of it, please give an appropriate acknowledgment.
00054  *
00055  *  @see CSPadImageProducer
00056  *
00057  *  @version \$Id: SaveImageInFile.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00058  *
00059  *  @author Mikhail S. Dubrovin
00060  */
00061 
00062 class SaveImageInFile : public Module {
00063 public:
00064 
00065   // Default constructor
00066   SaveImageInFile (const std::string& name) ;
00067 
00068   // Destructor
00069   virtual ~SaveImageInFile () ;
00070 
00071   /// Method which is called once at the beginning of the job
00072   virtual void beginJob(Event& evt, Env& env);
00073   
00074   /// Method which is called at the beginning of the run
00075   virtual void beginRun(Event& evt, Env& env);
00076   
00077   /// Method which is called at the beginning of the calibration cycle
00078   virtual void beginCalibCycle(Event& evt, Env& env);
00079   
00080   /// Method which is called with event data, this is the only required 
00081   /// method, all other methods are optional
00082   virtual void event(Event& evt, Env& env);
00083   
00084   /// Method which is called at the end of the calibration cycle
00085   virtual void endCalibCycle(Event& evt, Env& env);
00086 
00087   /// Method which is called at the end of the run
00088   virtual void endRun(Event& evt, Env& env);
00089 
00090   /// Method which is called once at the end of the job
00091   virtual void endJob(Event& evt, Env& env);
00092 
00093   std::string strTimeStamp(Event& evt);
00094   std::string strRunNumber(Event& evt);
00095   std::string strEventCounter();
00096   void saveImageInFile(Event& evt);
00097   void printInputParameters();
00098 
00099 private:
00100 
00101   // Data members, this is for example purposes only
00102 
00103   //Source      m_src;       // Data source set from config file
00104   Pds::Src    m_src;
00105   Source      m_str_src;     // i.e. CxiDs1.0:Cspad.0
00106   std::string m_key;         // i.e. Image2D
00107   unsigned    m_eventSave;   // event number starting from 1 to be saved in file
00108   bool        m_saveAll;     // should be true to save all events in files
00109   std::string m_fname;       // common part of the file name
00110   unsigned    m_print_bits;
00111   long        m_count;
00112 };
00113 
00114 } // namespace CSPadPixCoords
00115 
00116 #endif // CSPADPIXCOORDS_SAVEIMAGEINFILE_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7