pdscalibdata/include/PnccdCommonModeV1.h

Go to the documentation of this file.
00001 #ifndef PDSCALIBDATA_PNCCDCOMMONMODEV1_H
00002 #define PDSCALIBDATA_PNCCDCOMMONMODEV1_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: PnccdCommonModeV1.h 8034 2014-04-19 00:51:18Z dubrovin@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class PnccdCommonModeV1.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 #include <string>
00017 
00018 //----------------------
00019 // Base Class Headers --
00020 //----------------------
00021 #include "pdscalibdata/PnccdBaseV1.h" // Segs, Rows, Cols etc.
00022 #include "pdscalibdata/GlobalMethods.h"
00023 
00024 //-------------------------------
00025 // Collaborating Class Headers --
00026 //-------------------------------
00027 #include "ndarray/ndarray.h"
00028 #include "pdsdata/psddl/pnccd.ddl.h"
00029 
00030 //------------------------------------
00031 // Collaborating Class Declarations --
00032 //------------------------------------
00033 #include "MsgLogger/MsgLogger.h"
00034 
00035 //              ---------------------
00036 //              -- Class Interface --
00037 //              ---------------------
00038 
00039 namespace pdscalibdata {
00040 
00041 /**
00042  *  This software was developed for the LCLS project.  If you use all or 
00043  *  part of it, please give an appropriate acknowledgment.
00044  *
00045  *  @see AdditionalClass
00046  *
00047  *  @version $Id: PnccdCommonModeV1.h 8034 2014-04-19 00:51:18Z dubrovin@SLAC.STANFORD.EDU $
00048  *
00049  *  @author Mikhail Dubrovin
00050  */
00051 
00052 class PnccdCommonModeV1: public PnccdBaseV1 {
00053 public:
00054 
00055   const static size_t CMSize = 16; 
00056  
00057   typedef double pars_t;
00058 
00059   /// Default constructor
00060   PnccdCommonModeV1 ()
00061   : PnccdBaseV1 ()
00062   {
00063     std::fill_n(m_pars, int(CMSize), pars_t(0));
00064     // default common_mode parameters
00065     m_pars[0] = 2;   // Common mode algorithm number
00066     m_pars[1] = 300; // Threshold; values below threshold are averaged
00067     m_pars[2] = 50;  // Maximal correction; correction is applied if it is less than this value
00068     m_pars[3] = 128; // Number of pixels for averaging
00069     m_pars[4] = 0;   // Fraction of pixels in cm peak ...
00070   }
00071 
00072   /// Read parameters from file
00073   PnccdCommonModeV1 (const std::string& fname)
00074   : PnccdBaseV1 ()
00075   {
00076     std::fill_n(m_pars, int(CMSize), pars_t(0));
00077     load_pars_from_file <pars_t> (fname, "common_mode", CMSize, m_pars, 2);
00078   }
00079 
00080   /// Destructor
00081   ~PnccdCommonModeV1 (){}
00082 
00083   /// Access parameters
00084   ndarray<pars_t, 1> common_mode() const {
00085     return make_ndarray(m_pars, CMSize);
00086   }
00087 
00088   /// Print array of parameters
00089   void  print()
00090   {
00091     MsgLog("PnccdCommonModeV1", info, "common_mode:\n" << common_mode());
00092   }
00093 
00094 protected:
00095 
00096 private:
00097 
00098   /// Data members  
00099   mutable pars_t m_pars[CMSize];
00100 
00101   //std::string m_comment; 
00102   
00103   /// Copy constructor and assignment are disabled by default
00104   PnccdCommonModeV1 ( const PnccdCommonModeV1& ) ;
00105   PnccdCommonModeV1& operator = ( const PnccdCommonModeV1& ) ;
00106 };
00107 
00108 } // namespace pdscalibdata
00109 
00110 #endif // PDSCALIBDATA_PNCCDCOMMONMODEV1_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7