00001 #ifndef CSPAD_MOD_CSPADFILTER_H 00002 #define CSPAD_MOD_CSPADFILTER_H 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: CsPadFilter.h 2478 2011-10-05 16:33:11Z salnikov@SLAC.STANFORD.EDU $ 00007 // 00008 // Description: 00009 // Class CsPadFilter. 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------- 00014 // C/C++ Headers -- 00015 //----------------- 00016 #include <list> 00017 00018 //---------------------- 00019 // Base Class Headers -- 00020 //---------------------- 00021 #include "psana/Module.h" 00022 00023 //------------------------------- 00024 // Collaborating Class Headers -- 00025 //------------------------------- 00026 00027 //------------------------------------ 00028 // Collaborating Class Declarations -- 00029 //------------------------------------ 00030 00031 // --------------------- 00032 // -- Class Interface -- 00033 // --------------------- 00034 00035 namespace cspad_mod { 00036 00037 /// @addtogroup cspad_mod 00038 00039 /** 00040 * @ingroup cspad_mod 00041 * 00042 * @brief Module which performs CsPad filtering. 00043 * 00044 * This class defines psana module which perform event filtering 00045 * based on the signal in CsPad images. If this module determines that 00046 * CsPad does not have sufficient signal it forces psana to skip 00047 * remaining modules for this event. It also skips event if there is no 00048 * CsPad data at all, this behavior can be changed by setting 00049 * configuration option "skipIfNoData" to "no" or "false". 00050 * 00051 * This software was developed for the LCLS project. If you use all or 00052 * part of it, please give an appropriate acknowledgment. 00053 * 00054 * @version \$Id: CsPadFilter.h 2478 2011-10-05 16:33:11Z salnikov@SLAC.STANFORD.EDU $ 00055 * 00056 * @author Andy Salnikov 00057 */ 00058 00059 class CsPadFilter : public Module { 00060 public: 00061 00062 // Default constructor 00063 CsPadFilter (const std::string& name) ; 00064 00065 // Destructor 00066 virtual ~CsPadFilter () ; 00067 00068 /// Method which is called once at the beginning of the job 00069 virtual void beginJob(Event& evt, Env& env); 00070 00071 /// Method which is called at the beginning of the run 00072 virtual void beginRun(Event& evt, Env& env); 00073 00074 /// Method which is called at the beginning of the calibration cycle 00075 virtual void beginCalibCycle(Event& evt, Env& env); 00076 00077 /// Method which is called with event data, this is the only required 00078 /// method, all other methods are optional 00079 virtual void event(Event& evt, Env& env); 00080 00081 /// Method which is called at the end of the calibration cycle 00082 virtual void endCalibCycle(Event& evt, Env& env); 00083 00084 /// Method which is called at the end of the run 00085 virtual void endRun(Event& evt, Env& env); 00086 00087 /// Method which is called once at the end of the job 00088 virtual void endJob(Event& evt, Env& env); 00089 00090 protected: 00091 00092 private: 00093 00094 Source m_src; ///< Data source address 00095 std::string m_key; ///< event key for input data, default is empty 00096 bool m_skipIfNoData; ///< If true then even is filtered out if there is no CsPad data 00097 int m_mode; ///< Filter mode, see pdscalibdata::CsPadFilterV1, if negative use calib file 00098 std::list<double> m_param; ///< Filter parameters, only if m_mode is non-negative 00099 00100 }; 00101 00102 } // namespace cspad_mod 00103 00104 #endif // CSPAD_MOD_CSPADFILTER_H