Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:11

0001 #ifndef GUARD_surveypxbimage_h
0002 #define GUARD_surveypxbimage_h
0003 
0004 #include <sstream>
0005 #include <vector>
0006 #include <utility>
0007 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0008 #include "DataFormats/GeometryVector/interface/LocalTag.h"
0009 #include "DataFormats/GeometryVector/interface/Point3DBase.h"
0010 
0011 //! Class to hold one picture of the BPix survey
0012 class SurveyPxbImage {
0013 public:
0014   typedef unsigned int count_t;
0015   typedef unsigned int id_t;
0016   typedef double value_t;
0017   typedef Point3DBase<value_t, LocalTag> coord_t;
0018   typedef std::pair<id_t, id_t> idPair_t;
0019 
0020   //! \p enum to help access specific locations on a picture
0021   enum location {
0022     ll,  // lower left mark   (0)
0023     ul,  // upper left mark   (1)
0024     lr,  // lower right mark  (2)
0025     ur   // upper right mark  (3)
0026   };
0027 
0028   // Constructors
0029   SurveyPxbImage();
0030   /*! Constructor from a string stream.\n
0031       Observe the ordering:
0032       A line needs to be of the form <tt>rawID1 y_1_1 x_1_1 y_2_1 x_2_1 rawId2 y_1_2 x_1_2 y_2_2 x_2_2 sigma_y sigma_x</tt>\n
0033       <tt>x_i_1</tt> denoting the left, <tt>x_i_2</tt> the right module. The data is then mapped to
0034       \verbatim
0035       -------------++--------------
0036               (1) +||+ (3)  
0037                ||
0038        left module || right module
0039                ||
0040                ||
0041               (0) +||+ (2)     
0042       -------------++-------------- \endverbatim
0043       where <tt>(i)</tt> refers to the entry in the std::vector measurements\n
0044       Therefore the mapping is as follows:
0045       - <tt>y_1_1, x_1_1 -> (0)</tt>
0046       - <tt>y_2_1, x_2_1 -> (1)</tt>
0047       - <tt>y_1_2, x_1_2 -> (2)</tt>
0048       - <tt>y_2_2, x_2_2 -> (3)</tt>
0049       The sigmas denote the Gaussian error of the measurement in the u and v coordinate
0050       */
0051   SurveyPxbImage(std::istringstream &iss) : isValidFlag_(false) { fill(iss); };
0052 
0053   void fill(std::istringstream &iss);
0054 
0055   //! Get \p Id of first module
0056   id_t getIdFirst() { return idPair_.first; };
0057   //! Get \p Id of second module
0058   id_t getIdSecond() { return idPair_.second; };
0059   //! Get \p Id pair
0060   const idPair_t getIdPair() { return idPair_; };
0061 
0062   /*! Get coordinate of a measurement
0063       \param m number of mark
0064      */
0065   const coord_t getCoord(count_t m);
0066 
0067   //! Get Gaussian error in u direction
0068   value_t getSigmaX() { return sigma_x_; }
0069 
0070   //! Get Gaussian error in u direction
0071   value_t getSigmaY() { return sigma_y_; }
0072 
0073   //! returns validity flag
0074   bool isValid() { return isValidFlag_; };
0075 
0076 protected:
0077   //! Vector to hold four measurements
0078   std::vector<coord_t> measurementVec_;
0079 
0080   //! Gaussian errors
0081   value_t sigma_x_, sigma_y_;
0082 
0083   //! Flag if the image was rotated or not
0084   bool isRotated_;
0085 
0086   //! Validity Flag
0087   bool isValidFlag_;
0088 
0089   //! Pair to hold the Id's of the involved modules
0090   //! first: module with lower Id
0091   idPair_t idPair_;
0092 };
0093 
0094 #endif