cspad_mod/include/CsPadPedestals.h

Go to the documentation of this file.
00001 #ifndef CSPAD_MOD_CSPADPEDESTALS_H
00002 #define CSPAD_MOD_CSPADPEDESTALS_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: CsPadPedestals.h 7243 2013-11-28 07:35:37Z salnikov@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class CsPadPedestals.
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 #include "psddl_psana/cspad.ddl.h"
00026 
00027 //------------------------------------
00028 // Collaborating Class Declarations --
00029 //------------------------------------
00030 
00031 //              ---------------------
00032 //              -- Class Interface --
00033 //              ---------------------
00034 
00035 namespace cspad_mod {
00036 
00037 /**
00038  *  @brief Psana module which calculates pedestals from dark CsPad run.
00039  *
00040  *  This software was developed for the LCLS project.  If you use all or 
00041  *  part of it, please give an appropriate acknowledgment.
00042  *
00043  *  @version \$Id: CsPadPedestals.h 7243 2013-11-28 07:35:37Z salnikov@SLAC.STANFORD.EDU $
00044  *
00045  *  @author Andy Salnikov
00046  */
00047 
00048 class CsPadPedestals : public Module {
00049 public:
00050 
00051   enum { MaxQuads = Psana::CsPad::MaxQuadsPerSensor };
00052   enum { MaxSectors = Psana::CsPad::SectorsPerQuad };
00053   enum { NumColumns = Psana::CsPad::ColumnsPerASIC };
00054   enum { NumRows = Psana::CsPad::MaxRowsPerASIC*2 };
00055   
00056   // Default constructor
00057   CsPadPedestals (const std::string& name) ;
00058 
00059   // Destructor
00060   virtual ~CsPadPedestals () ;
00061 
00062   /// Method which is called at the beginning of the run
00063   virtual void beginRun(Event& evt, Env& env);
00064   
00065   /// Method which is called with event data, this is the only required 
00066   /// method, all other methods are optional
00067   virtual void event(Event& evt, Env& env);
00068   
00069   /// Method which is called once at the end of the job
00070   virtual void endJob(Event& evt, Env& env);
00071 
00072 protected:
00073 
00074   /// collect statistics
00075   void collectStat(unsigned qNum, const int16_t* data);
00076   
00077 private:
00078 
00079   std::string m_pedFile;
00080   std::string m_noiseFile;
00081   
00082   Pds::Src m_src; // source address of the data object
00083   
00084   unsigned m_segMask[MaxQuads];  // segment masks per quadrant
00085   
00086   unsigned long m_count[MaxQuads];  // number of events seen
00087   int64_t m_sum[MaxQuads][MaxSectors][NumColumns][NumRows];   // sum per pixel
00088   int64_t m_sum2[MaxQuads][MaxSectors][NumColumns][NumRows];  // sum of squares per pixel
00089 
00090 };
00091 
00092 } // namespace cspad_mod
00093 
00094 #endif // CSPAD_MOD_CSPADPEDESTALS_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7