00001 #ifndef PDSCALIBDATA_CSPADCOMMONMODESUBV1_H 00002 #define PDSCALIBDATA_CSPADCOMMONMODESUBV1_H 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: CsPadCommonModeSubV1.h 6832 2013-09-24 21:14:17Z salnikov@SLAC.STANFORD.EDU $ 00007 // 00008 // Description: 00009 // Class CsPadCommonModeSubV1. 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------- 00014 // C/C++ Headers -- 00015 //----------------- 00016 #include <string> 00017 #include <stdint.h> 00018 00019 //---------------------- 00020 // Base Class Headers -- 00021 //---------------------- 00022 00023 //------------------------------- 00024 // Collaborating Class Headers -- 00025 //------------------------------- 00026 00027 //------------------------------------ 00028 // Collaborating Class Declarations -- 00029 //------------------------------------ 00030 00031 // --------------------- 00032 // -- Class Interface -- 00033 // --------------------- 00034 00035 namespace pdscalibdata { 00036 00037 /** 00038 * 00039 * This software was developed for the LCLS project. If you use all or 00040 * part of it, please give an appropriate acknowledgment. 00041 * 00042 * @see AdditionalClass 00043 * 00044 * @version $Id: CsPadCommonModeSubV1.h 6832 2013-09-24 21:14:17Z salnikov@SLAC.STANFORD.EDU $ 00045 * 00046 * @author Andrei Salnikov 00047 */ 00048 00049 class CsPadCommonModeSubV1 { 00050 public: 00051 00052 enum CommonMode { 00053 None = 0, 00054 Default = 1 00055 }; 00056 00057 enum { DataSize = 16 }; 00058 00059 // constant for unknown common mode 00060 enum { UnknownCM = -10000 }; 00061 00062 /// Default constructor, all pixel codes set to 0 00063 CsPadCommonModeSubV1 () ; 00064 00065 /** 00066 * Read constant from file. 00067 * 00068 * @throw std::exception 00069 */ 00070 CsPadCommonModeSubV1 (const std::string& fname) ; 00071 00072 /** 00073 * Initialize constants from parameters. 00074 */ 00075 CsPadCommonModeSubV1 (CommonMode mode, const double data[DataSize]) ; 00076 00077 // Destructor 00078 ~CsPadCommonModeSubV1 () ; 00079 00080 // access common mode 00081 CommonMode mode() const { return CommonMode(m_mode); } 00082 00083 // access common mode data 00084 const double* data() const { return m_data; } 00085 00086 /** 00087 * Find common mode for an CsPad section. 00088 * 00089 * Function will return UnknownCM value if the calculation 00090 * cannot be performed (or need not be performed). 00091 * 00092 * @param sdata pixel data 00093 * @param peddata pedestal data, can be zero pointer 00094 * @param pixStatus pixel status data, can be zero pointer 00095 * @param ssize size of all above arrays 00096 * @param stride increment for pixel indices 00097 */ 00098 float findCommonMode(const int16_t* sdata, 00099 const float* peddata, 00100 const uint16_t *pixStatus, 00101 unsigned ssize, 00102 int stride = 1) const; 00103 00104 protected: 00105 00106 private: 00107 00108 // Data members 00109 uint32_t m_mode; 00110 double m_data[DataSize]; 00111 00112 // Copy constructor and assignment are disabled by default 00113 CsPadCommonModeSubV1 ( const CsPadCommonModeSubV1& ) ; 00114 CsPadCommonModeSubV1& operator = ( const CsPadCommonModeSubV1& ) ; 00115 }; 00116 00117 } // namespace pdscalibdata 00118 00119 #endif // PDSCALIBDATA_CSPADCOMMONMODESUBV1_H