CSPadPixCoords/include/PixCoords2x1.h

Go to the documentation of this file.
00001 #ifndef CSPADPIXCOORDS_PIXCOORDS2X1_H
00002 #define CSPADPIXCOORDS_PIXCOORDS2X1_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: PixCoords2x1.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class PixCoords2x1.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 
00017 //----------------------
00018 // Base Class Headers --
00019 //----------------------
00020 
00021 //-------------------------------
00022 // Collaborating Class Headers --
00023 //-------------------------------
00024 
00025 //------------------------------------
00026 // Collaborating Class Declarations --
00027 //------------------------------------
00028 #include "psddl_psana/cspad.ddl.h"
00029 
00030 //              ---------------------
00031 //              -- Class Interface --
00032 //              ---------------------
00033 
00034 namespace CSPadPixCoords {
00035 
00036 /// @addtogroup CSPadPixCoords
00037 
00038 /**
00039  *  @ingroup CSPadPixCoords
00040  *
00041  *  @brief PixCoords2x1 class defines the 2x1 section pixel coordinates in its local frame.
00042  *
00043  *  Defines the X,Y,Z pixel coordinates for single 2x1 in its own (ONLINE) frame:
00044  *  X coordinate is directed along rows from 0 to 388 (from top to botton for 0 rotation angle).
00045  *  Y coordinate is directed opposite columns from 184 to 0 (from left to right for 0 rotation angle).
00046  *  getPixCoorRot...(...) methods return these coordinates for rotated by N*90 degree 2x1
00047  *  in um(micrometer) or pixels.
00048  *  
00049  *  Rows and columns are defined like in ONLINE:
00050  *  /reg/g/psdm/sw/external/lusi-xtc/2.12.0a/x86_64-rhel5-gcc41-opt/pdsdata/cspad/ElementIterator.hh,
00051  *  Detector.hh
00052  *  
00053  *  This software was developed for the LCLS project.  If you use all or 
00054  *  part of it, please give an appropriate acknowledgment.
00055  *
00056  *  @see CSPadImageProducer, PixCoordsTest
00057  *
00058  *  @version $Id: PixCoords2x1.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00059  *
00060  *  @author Mikhail S. Dubrovin
00061  */
00062 
00063 class PixCoords2x1  {
00064 public:
00065   enum ARRAXIS     { ROW = 0, 
00066                      COL, 
00067                      ORT };
00068 
00069   enum COORDINATE  { X = 0, 
00070                      Y, 
00071                      Z };
00072 
00073   enum ORIENTATION { R000 = 0, 
00074                      R090, 
00075                      R180, 
00076                      R270 };
00077 
00078   enum UNITS       { UM = 0,
00079                      PIX };  // coordinates in micrometers or pixels
00080 
00081   enum { NCols2x1  = Psana::CsPad::ColumnsPerASIC     }; // 185
00082   enum { NRows2x1  = Psana::CsPad::MaxRowsPerASIC * 2 }; // 194*2 = 388
00083   enum { NRowsASIC = Psana::CsPad::MaxRowsPerASIC     }; // 194
00084 
00085   // Default constructor
00086   /**
00087    *  @brief No parameters needed; everything is defined through the fixed 2x1 chip geometry.
00088    *  
00089    *  Fills/holds/provides access to the arrays of row, column, and ortogonal coordinate of 2x1 pixels
00090    */
00091   PixCoords2x1 () ;
00092 
00093   // Destructor
00094   virtual ~PixCoords2x1 () ;
00095 
00096   // Methods
00097   void fill_pix_coords_2x1 () ;
00098 
00099   /**
00100    *  Access methods return the coordinate for indicated axis, 2x1 row and column
00101    *  indexes after the 2x1 rotation by n*90 degree.
00102    *  The pixel coordinates can be returned in um(micrometer) and pix(pixel).
00103    */
00104   double getPixCoorRot000_um  (COORDINATE icoor, unsigned row, unsigned col) ;
00105   double getPixCoorRot090_um  (COORDINATE icoor, unsigned row, unsigned col) ;
00106   double getPixCoorRot180_um  (COORDINATE icoor, unsigned row, unsigned col) ;
00107   double getPixCoorRot270_um  (COORDINATE icoor, unsigned row, unsigned col) ;
00108  
00109   double getPixCoorRot000_pix (COORDINATE icoor, unsigned row, unsigned col) ;
00110   double getPixCoorRot090_pix (COORDINATE icoor, unsigned row, unsigned col) ;
00111   double getPixCoorRot180_pix (COORDINATE icoor, unsigned row, unsigned col) ;
00112   double getPixCoorRot270_pix (COORDINATE icoor, unsigned row, unsigned col) ;
00113 
00114   double getPixCoorRotN90_um  (ORIENTATION n90, COORDINATE icoor, unsigned row, unsigned col) ;
00115   double getPixCoorRotN90_pix (ORIENTATION n90, COORDINATE icoor, unsigned row, unsigned col) ;
00116   double getPixCoorRotN90     (UNITS units, ORIENTATION n90, COORDINATE icoor, unsigned row, unsigned col) ;
00117 
00118   static ORIENTATION getOrientation(double angle) ;
00119   static size_t getNCols     (ORIENTATION n90) ;
00120   static size_t getNRows     (ORIENTATION n90) ;
00121   double  getXCenterOffset_um (ORIENTATION n90) ; 
00122   double  getYCenterOffset_um (ORIENTATION n90) ; 
00123 
00124   void print_member_data () ;
00125   void print_selected_coords_2x1 (ARRAXIS arraxis) ;
00126 
00127 protected:
00128 
00129 private:
00130 
00131   // Data members
00132   double  m_row_size_um;
00133   double  m_col_size_um;
00134   double  m_gap_size_um;
00135   double  m_coor_row_max;
00136   double  m_coor_col_max;
00137 
00138   // Cols and rows are interchanged in order to have an order of arrays like in ONLINE.
00139   double  m_coor_row[NRows2x1];  
00140   double  m_coor_col[NCols2x1];  
00141   double  m_coor_ort[NCols2x1][NRows2x1];  
00142 
00143   double  k_center_of_rows_um; 
00144   double  k_center_of_cols_um; 
00145   double  k_center_of_rows_pix; 
00146   double  k_center_of_cols_pix; 
00147 
00148   double  k_row_um_to_pix;
00149   double  k_col_um_to_pix;
00150   double  k_ort_um_to_pix;
00151 
00152   // Copy constructor and assignment are disabled by default
00153   PixCoords2x1 ( const PixCoords2x1& ) ;
00154   PixCoords2x1& operator = ( const PixCoords2x1& ) ;
00155 };
00156 
00157 } // namespace CSPadPixCoords
00158 
00159 #endif // CSPADPIXCOORDS_PIXCOORDS2X1_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7