CSPadPixCoords/include/PixCoordsTest.h

Go to the documentation of this file.
00001 #ifndef CSPADPIXCOORDS_PIXCOORDSTEST_H
00002 #define CSPADPIXCOORDS_PIXCOORDSTEST_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: PixCoordsTest.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class PixCoordsTest.
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 "PSCalib/CSPadCalibPars.h"
00026 
00027 #include "CSPadPixCoords/QuadParameters.h"
00028 #include "CSPadPixCoords/PixCoords2x1.h"
00029 #include "CSPadPixCoords/PixCoordsQuad.h"
00030 #include "CSPadPixCoords/PixCoordsCSPad.h"
00031 
00032 //------------------------------------
00033 // Collaborating Class Declarations --
00034 //------------------------------------
00035 
00036 //              ---------------------
00037 //              -- Class Interface --
00038 //              ---------------------
00039 
00040 namespace CSPadPixCoords {
00041 
00042 /// @addtogroup CSPadPixCoords
00043 
00044 /**
00045  *  @ingroup CSPadPixCoords
00046  *
00047  *  @brief PixCoordsTest class is a test/example module for psana.
00048  *
00049  *  PixCoordsTest class is a test of PixCoords2x1, PixCoordsQuad, and PixCoordsCSPad
00050  *  classes in psana framework.
00051  *  In this test the data image from the event is combined with pixel coordinates
00052  *  for 2x1, quad, and CSPad. Relevant images are saved in the files,
00053  *  which can be viewed with rendering script.  
00054  *
00055  *  This software was developed for the LCLS project.  If you use all or 
00056  *  part of it, please give an appropriate acknowledgment.
00057  *
00058  *  @see PixCoords2x1, PixCoordsQuad, and PixCoordsCSPad
00059  *
00060  *  @version \$Id: PixCoordsTest.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00061  *
00062  *  @author Mikhail S. Dubrovin
00063  */
00064 
00065 class PixCoordsTest : public Module {
00066 public:
00067 
00068   // Default constructor
00069   PixCoordsTest (const std::string& name) ;
00070 
00071   // Destructor
00072   virtual ~PixCoordsTest () ;
00073 
00074   /// Method which is called once at the beginning of the job
00075   virtual void beginJob(Event& evt, Env& env);
00076   
00077   /// Method which is called at the beginning of the run
00078   virtual void beginRun(Event& evt, Env& env);
00079   
00080   /// Method which is called at the beginning of the calibration cycle
00081   virtual void beginCalibCycle(Event& evt, Env& env);
00082   
00083   /// Method which is called with event data, this is the only required 
00084   /// method, all other methods are optional
00085   virtual void event(Event& evt, Env& env);
00086   
00087   /// Method which is called at the end of the calibration cycle
00088   virtual void endCalibCycle(Event& evt, Env& env);
00089 
00090   /// Method which is called at the end of the run
00091   virtual void endRun(Event& evt, Env& env);
00092 
00093   /// Method which is called once at the end of the job
00094   virtual void endJob(Event& evt, Env& env);
00095 
00096   void getQuadConfigPars(Env& env);
00097 
00098 /**
00099  *  @brief Group of methods which do actual tests. 
00100  */
00101   void test_2x1   (const int16_t* data, QuadParameters* quadpars, PSCalib::CSPadCalibPars *cspad_calibpar);
00102   void test_quad  (const int16_t* data, QuadParameters* quadpars, PSCalib::CSPadCalibPars *cspad_calibpar);
00103   void test_cspad (const int16_t* data, QuadParameters* quadpars, PSCalib::CSPadCalibPars *cspad_calibpar);
00104   //void test_2x1   (const ndarray<int16_t, 3>& data, QuadParameters* quadpars, PSCalib::CSPadCalibPars *cspad_calibpar);
00105   //void test_quad  (const ndarray<int16_t, 3>& data, QuadParameters* quadpars, PSCalib::CSPadCalibPars *cspad_calibpar);
00106   //void test_cspad (const ndarray<int16_t, 3>& data, QuadParameters* quadpars, PSCalib::CSPadCalibPars *cspad_calibpar);
00107   void test_cspad_init();
00108   void test_cspad_save();
00109 
00110 
00111 protected:
00112 
00113 private:
00114 
00115   // Data members, this is for example purposes only
00116 
00117   std::string m_calibDir;       // i.e. /reg/d/psdm/CXI/cxi35711/calib
00118   std::string m_typeGroupName;  // i.e. CsPad::CalibV1
00119   std::string m_source;         // i.e. CxiDs1.0:Cspad.0
00120    
00121   Source m_src;         // Data source set from config file
00122   unsigned m_runNumber;
00123   unsigned m_maxEvents;
00124   bool m_filter;
00125   long m_count;
00126 
00127   uint32_t m_roiMask        [4];
00128   uint32_t m_numAsicsStored [4];
00129 
00130   uint32_t m_n2x1;         // 8
00131   uint32_t m_ncols2x1;     // 185
00132   uint32_t m_nrows2x1;     // 388
00133   uint32_t m_sizeOf2x1Arr; // 185*388;
00134 
00135   PSCalib::CSPadCalibPars        *m_cspad_calibpar;
00136 
00137   CSPadPixCoords::PixCoords2x1   *m_pix_coords_2x1;
00138   CSPadPixCoords::PixCoordsQuad  *m_pix_coords_quad;
00139   CSPadPixCoords::PixCoordsCSPad *m_pix_coords_cspad;
00140 
00141   CSPadPixCoords::PixCoords2x1::COORDINATE XCOOR;
00142   CSPadPixCoords::PixCoords2x1::COORDINATE YCOOR;
00143   CSPadPixCoords::PixCoords2x1::COORDINATE ZCOOR;
00144         
00145   uint32_t   m_cspad_ind;
00146   double    *m_coor_x_pix;
00147   double    *m_coor_y_pix;
00148   uint32_t  *m_coor_x_int;
00149   uint32_t  *m_coor_y_int;
00150 
00151   enum{ NX_2x1=450, 
00152         NY_2x1=250 };
00153   double m_arr_2x1_image[NX_2x1][NY_2x1];
00154 
00155   enum{ NX_QUAD=850, 
00156         NY_QUAD=850 };
00157   double m_arr_quad_image[NX_QUAD][NY_QUAD];
00158 
00159   enum{ NX_CSPAD=1750, 
00160         NY_CSPAD=1750 };
00161   double m_arr_cspad_image[NX_CSPAD][NY_CSPAD];
00162 
00163 };
00164 
00165 } // namespace CSPadPixCoords
00166 
00167 #endif // CSPADPIXCOORDS_PIXCOORDSTEST_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7