PSCalib/include/SegGeometry.h

Go to the documentation of this file.
00001 #ifndef PSCALIB_SEGGEOMETRY_H
00002 #define PSCALIB_SEGGEOMETRY_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: SegGeometry.h 10053 2015-05-11 22:27:46Z dubrovin@SLAC.STANFORD.EDU $
00007 //
00008 // $Revision: 10053 $
00009 //------------------------------------------------------------------------
00010 
00011 //-----------------
00012 // C/C++ Headers --
00013 //-----------------
00014 //#include <iostream>
00015 //#include <string>
00016 //#include <vector>
00017 //#include <map>
00018 //#include <fstream>  // open, close etc.
00019 //#include <stdint.h> // for uint8_t, uint16_t etc.
00020 #include <cstddef>  // for size_t
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 
00026 //#include "ndarray/ndarray.h"
00027 
00028 //-----------------------------
00029 using namespace std;
00030 
00031 
00032 namespace PSCalib {
00033 
00034 /// @addtogroup PSCalib PSCalib
00035 
00036 /**
00037  *  @ingroup PSCalib
00038  *
00039  *  @brief Abstract base class SegGeometry defines the interface to access segment pixel coordinates.
00040  *
00041  *  This software was developed for the LCLS project. If you use all or 
00042  *  part of it, please give an appropriate acknowledgment.
00043  *
00044  *  @see CalibFileFinder
00045  *
00046  *  @version $Id: SegGeometry.h 10053 2015-05-11 22:27:46Z dubrovin@SLAC.STANFORD.EDU $
00047  *
00048  *  @author Mikhail S. Dubrovin
00049  *
00050  *  @see CalibFileFinder
00051  *
00052  */
00053 
00054 //-----------------------------
00055 
00056 class SegGeometry {
00057 public:
00058 
00059   /// Enumerator for X, Y, and Z axes
00060   enum AXIS { AXIS_X=0,
00061               AXIS_Y,
00062               AXIS_Z };
00063 
00064   //enum UNITS { UM=0, PIX };
00065  
00066   typedef double pixel_coord_t;
00067   typedef double pixel_area_t;
00068   typedef int    pixel_mask_t;
00069   //typedef int    pixel_index_t;
00070 
00071   // Destructor
00072   virtual ~SegGeometry () {}
00073 
00074   /// Prints segment info for selected bits
00075   virtual void print_seg_info(const unsigned& pbits=0) = 0;
00076 
00077   /// Returns segment size - total number of pixels in segment
00078   virtual const size_t size() = 0;
00079 
00080   /// Returns number of rows in segment
00081   virtual const size_t rows() = 0;
00082 
00083   /// Returns number of cols in segment
00084   virtual const size_t cols() = 0;
00085 
00086   /// Returns shape of the segment {rows, cols}
00087   virtual const size_t* shape() = 0;
00088 
00089   /// Returns pixel size in um for indexing
00090   virtual const pixel_coord_t pixel_scale_size() = 0;
00091 
00092   /// Returns pointer to the array of pixel areas normalized on minimal pixel area
00093   virtual const pixel_area_t* pixel_area_array() = 0;
00094 
00095   /// Returns pointer to the array of pixel size in um for AXIS
00096   virtual const pixel_coord_t* pixel_size_array(AXIS axis) = 0;
00097 
00098   /// Returns pointer to the array of segment pixel coordinates in um for AXIS
00099   virtual const pixel_coord_t* pixel_coord_array(AXIS axis) = 0;
00100 
00101   /// Returns minimal value in the array of segment pixel coordinates in um for AXIS
00102   virtual const pixel_coord_t pixel_coord_min(AXIS axis) = 0;
00103 
00104   /// Returns maximal value in the array of segment pixel coordinates in um for AXIS
00105   virtual const pixel_coord_t pixel_coord_max(AXIS axis) = 0;
00106 
00107   /// Returns pointer to the array of pixel mask
00108   virtual const pixel_mask_t* pixel_mask_array(const unsigned& mbits = 0377) = 0;
00109 };
00110 
00111 const static double DEG_TO_RAD = 3.141592653589793238463 / 180; 
00112 
00113 /// Global method for x and y arrays rotation
00114 void rotation_ang(const double* x, const double* y, unsigned size, double angle_deg,   double* xrot, double* yrot);
00115 
00116 /// Global method for x and y arrays rotation
00117 void rotation_cs(const double* x, const double* y, unsigned size, double C, double S, double* xrot, double* yrot);
00118 
00119 /// Global method, returns minimal value of the array of specified length 
00120 double min_of_arr(const double* arr, unsigned size);
00121 
00122 /// Global method, returns maximal value of the array of specified length 
00123 double max_of_arr(const double* arr, unsigned size);
00124 
00125 } // namespace PSCalib
00126 
00127 #endif // PSCALIB_SEGGEOMETRY_H
00128 
00129 //-----------------------------

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7