00001 #ifndef PSCALIB_SEGGEOMETRYEPIX100V1_H 00002 #define PSCALIB_SEGGEOMETRYEPIX100V1_H 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: SegGeometryEpix100V1.h 10053 2015-05-11 22:27:46Z dubrovin@SLAC.STANFORD.EDU $ 00007 // 00008 // Description: 00009 // Class SegGeometryEpix100V1 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------- 00014 // C/C++ Headers -- 00015 //----------------- 00016 00017 //---------------------- 00018 // Base Class Headers -- 00019 //---------------------- 00020 #include "PSCalib/SegGeometry.h" 00021 00022 //------------------------------- 00023 // Collaborating Class Headers -- 00024 //------------------------------- 00025 00026 //------------------------------------ 00027 // Collaborating Class Declarations -- 00028 //------------------------------------ 00029 //#include "psddl_psana/cspad.ddl.h" 00030 00031 // --------------------- 00032 // -- Class Interface -- 00033 // --------------------- 00034 00035 namespace PSCalib { 00036 00037 00038 /// @addtogroup PSCalib 00039 00040 /** 00041 * @ingroup PSCalib 00042 * 00043 * @brief Class SegGeometryEpix100V1 defines the Epix100 V1 sensor pixel coordinates in its local frame. 00044 * 00045 * 00046 * 2x1 sensor coordinate frame: 00047 * 00048 * @code 00049 * (Xmin,Ymax) ^ Y (Xmax,Ymax) 00050 * (0,0) | (0,768) 00051 * +----------------------------+ 00052 * | | | 00053 * | | | 00054 * | | | 00055 * | | | 00056 * | | | 00057 * | | | 00058 * | | | 00059 * --|-------------+--------------|----> X 00060 * | | | 00061 * | | | 00062 * | | | 00063 * | | | 00064 * | | | 00065 * | | | 00066 * | | | 00067 * +----------------------------+ 00068 * (704,0) | (704,768) 00069 * (Xmin,Ymin) (Xmax,Ymin) 00070 * @endcode 00071 * 00072 * Pixel (r,c)=(0,0) is in the top left corner of the matrix which has coordinates (Xmin,Ymax) 00073 * Here we assume that segment has 704 rows and 768 columns. 00074 * Epix100 has a pixel size 50x50um, 00075 * Epix10k has a pixel size 100x100um, 00076 * This assumption differs from the DAQ map, where rows and cols are interchanged: 00077 * /reg/g/psdm/sw/external/lusi-xtc/2.12.0a/x86_64-rhel5-gcc41-opt/pdsdata/cspad/ElementIterator.hh, 00078 * Detector.hh 00079 * 00080 * @anchor interface 00081 * @par<interface> Interface Description 00082 * 00083 * @li Include and typedef 00084 * @code 00085 * #include "PSCalib/SegGeometryEpix100V1.h" 00086 * typedef PSCalib::SegGeometryEpix100V1 SG; 00087 * @endcode 00088 * 00089 * @li Instatiation 00090 * @code 00091 * SG *seg_geom = new SG(); 00092 * or 00093 * bool use_wide_pix_center = true; 00094 * SG *seg_geom = new SG(use_wide_pix_center); 00095 * @endcode 00096 * 00097 * @li Print info 00098 * @code 00099 * unsigned pbits=0377; // 1-member data; 2-coordinate arrays; 4-min/max coordinate values 00100 * seg_geom -> print_seg_info(pbits); 00101 * @endcode 00102 * 00103 * @li Access methods 00104 * @code 00105 * // scalar values 00106 * const size_t array_size = seg_geom -> size(); 00107 * const size_t number_of_rows = seg_geom -> rows(); 00108 * const size_t number_of_cols = seg_geom -> cols(); 00109 * const pixel_coord_t pixel_scale_size = seg_geom -> pixel_scale_size(); 00110 * const pixel_coord_t pixel_coord_min = seg_geom -> pixel_coord_min(SG::AXIS_Z); 00111 * const pixel_coord_t pixel_coord_max = seg_geom -> pixel_coord_max(SG::AXIS_X); 00112 * 00113 * // pointer to arrays with size equal to array_size 00114 * const size_t* p_array_shape = seg_geom -> shape(); 00115 * const pixel_area_t* p_pixel_area = seg_geom -> pixel_area_array(); // array of 1-for regular or 2.5-for long pixels 00116 * const pixel_coord_t* p_pixel_size_arr = seg_geom -> pixel_size_array(SG::AXIS_X); 00117 * const pixel_coord_t* p_pixel_coord_arr = seg_geom -> pixel_coord_array(SG::AXIS_Y); 00118 * 00119 * unsigned mbits=0377; // 1-edges; 2-wide central cols; 4-non-bound; 8-non-bound neighbours 00120 * const pixel_mask_t* p_mask_arr = seg_geom -> pixel_mask_array(mbits); 00121 * @endcode 00122 * 00123 * This software was developed for the LCLS project. If you use all or 00124 * part of it, please give an appropriate acknowledgment. 00125 * 00126 * 00127 * @version \$Id: SegGeometryEpix100V1.h 10053 2015-05-11 22:27:46Z dubrovin@SLAC.STANFORD.EDU $ 00128 * 00129 * @author Mikhail S. Dubrovin 00130 */ 00131 00132 class SegGeometryEpix100V1 : public PSCalib::SegGeometry { 00133 public: 00134 00135 /// Number of pixel rows in segment 00136 static const size_t ROWS = 704; 00137 00138 /// Number of pixel columns in segment 00139 static const size_t COLS = 768; 00140 00141 /// Half number of pixel rows in segment 00142 static const size_t ROWSHALF = 352; 00143 00144 /// Half number of pixel columns in segment 00145 static const size_t COLSHALF = 384; 00146 00147 /// Number of pixels in segment 00148 static const size_t SIZE = COLS*ROWS; 00149 00150 /// Number of corners 00151 static const size_t NCORNERS = 4; 00152 00153 /// Pixel scale size [um] for indexing 00154 static const pixel_coord_t PIX_SCALE_SIZE; // = 50.0; 00155 00156 /// Pixel size [um] in column direction 00157 static const pixel_coord_t PIX_SIZE_COLS; // = 50.0; 00158 00159 /// Pixel size [um] in row direction 00160 static const pixel_coord_t PIX_SIZE_ROWS; // = 50.0; 00161 00162 /// Wide pixel length [um] 00163 static const pixel_coord_t PIX_SIZE_WIDE; // = 200.0; 00164 00165 /// Pixel size [um] in depth 00166 static const pixel_coord_t PIX_SIZE_DEPTH; // = 400.; 00167 00168 /// Conversion factor between um and pix 00169 static const double UM_TO_PIX; // = 1./50; 00170 00171 //--------------------------- 00172 00173 /// Implementation of interface methods 00174 00175 /// Prints segment info for selected bits 00176 virtual void print_seg_info(const unsigned& pbits=0); 00177 00178 /// Returns size of the coordinate arrays 00179 virtual const size_t size() { return SIZE; } 00180 00181 /// Returns number of rows in segment 00182 virtual const size_t rows() { return ROWS; } 00183 00184 /// Returns number of cols in segment 00185 virtual const size_t cols() { return COLS; } 00186 00187 /// Returns shape of the segment {rows, cols} 00188 virtual const size_t* shape() { return &ARR_SHAPE[0]; } 00189 00190 /// Returns pixel size in um for indexing 00191 virtual const pixel_coord_t pixel_scale_size() { return PIX_SCALE_SIZE; } 00192 00193 /// Returns pointer to the array of pixel areas 00194 virtual const pixel_area_t* pixel_area_array(); 00195 00196 /** 00197 * @brief Returns pointer to the array of pixel size in um for AXIS 00198 * @param[in] axis Axis from the enumerated list for X, Y, and Z axes 00199 */ 00200 virtual const pixel_coord_t* pixel_size_array(AXIS axis); 00201 00202 /// Returns pointer to the array of segment pixel coordinates in um for AXIS 00203 virtual const pixel_coord_t* pixel_coord_array(AXIS axis); 00204 00205 /// Returns minimal value in the array of segment pixel coordinates in um for AXIS 00206 virtual const pixel_coord_t pixel_coord_min(AXIS axis); 00207 00208 /// Returns maximal value in the array of segment pixel coordinates in um for AXIS 00209 virtual const pixel_coord_t pixel_coord_max(AXIS axis); 00210 00211 /** 00212 * @brief Returns pointer to the array of pixel mask: 1/0 = ok/masked 00213 * @param[in] mbits - mask control bits; 00214 * + 1 - mask edges, 00215 * + 2 - mask two central columns, 00216 */ 00217 virtual const pixel_mask_t* pixel_mask_array(const unsigned& mbits = 0377); 00218 00219 //--------------------------- 00220 // Singleton stuff: 00221 00222 static PSCalib::SegGeometry* instance(const bool& use_wide_pix_center=false); 00223 00224 private: 00225 00226 // Constructor 00227 /** 00228 * @brief Fills-in the map of perfect segment coordinates, defined through the chip geometry. 00229 * @param[in] use_wide_pix_center Optional parameter can be used if the wide-pixel row coordinate is prefered to be in the raw center. 00230 */ 00231 SegGeometryEpix100V1 (const bool& use_wide_pix_center=false); 00232 00233 /// Destructor 00234 virtual ~SegGeometryEpix100V1 (); 00235 00236 static PSCalib::SegGeometry* m_pInstance; 00237 00238 //--------------------------- 00239 00240 /// Generator of the pixel coordinate arrays. 00241 void make_pixel_coord_arrs (); 00242 00243 /// Generator of the pixel size and area arrays. 00244 void make_pixel_size_arrs (); 00245 00246 /// Prints class member data 00247 void print_member_data (); 00248 00249 /// Prints segment pixel coordinates 00250 void print_coord_arrs(); 00251 00252 /// Prints minimal and maximal values of the segment coordinates for X, Y, and Z axes 00253 void print_min_max_coords(); 00254 00255 00256 /// switch between two options of the wide pixel row center 00257 bool m_use_wide_pix_center; 00258 00259 /// done bits 00260 unsigned m_done_bits; 00261 00262 /// 1-d pixel coordinates of rows and cols 00263 pixel_coord_t m_x_rhs_um [COLSHALF]; 00264 pixel_coord_t m_y_rhs_um [ROWSHALF]; 00265 pixel_coord_t m_x_arr_um [COLS]; 00266 pixel_coord_t m_y_arr_um [ROWS]; 00267 00268 const static size_t IND_CORNER[NCORNERS]; 00269 const static size_t ARR_SHAPE[2]; 00270 00271 /// 2-d pixel coordinate arrays 00272 pixel_coord_t m_x_pix_coord_um [ROWS][COLS]; 00273 pixel_coord_t m_y_pix_coord_um [ROWS][COLS]; 00274 pixel_coord_t m_z_pix_coord_um [ROWS][COLS]; 00275 00276 /// 2-d pixel size arrays 00277 pixel_coord_t m_x_pix_size_um [ROWS][COLS]; 00278 pixel_coord_t m_y_pix_size_um [ROWS][COLS]; 00279 pixel_coord_t m_z_pix_size_um [ROWS][COLS]; 00280 00281 /// 2-d pixel area arrays 00282 pixel_area_t m_pix_area_arr [ROWS][COLS]; 00283 00284 /// 2-d pixel mask arrays 00285 pixel_mask_t m_pix_mask_arr [ROWS][COLS]; 00286 00287 // Copy constructor and assignment are disabled by default 00288 SegGeometryEpix100V1 ( const SegGeometryEpix100V1& ) ; 00289 SegGeometryEpix100V1& operator = ( const SegGeometryEpix100V1& ) ; 00290 }; 00291 00292 } // namespace PSCalib 00293 00294 #endif // PSCALIB_SEGGEOMETRYEPIX100V1_H