00001 #ifndef FixedPadSizeDiskLayout_h
00002 #define FixedPadSizeDiskLayout_h 1
00003
00004 #include <vector>
00005 #include "gear/PadRowLayout2D.h"
00006
00007
00008 namespace gear {
00009
00010
00011
00022 class FixedPadSizeDiskLayout : public PadRowLayout2D {
00023
00024 public:
00025
00027 struct Row{
00028 int NPad ;
00029 double RCenter ;
00030 double PhiPad ;
00031 } ;
00032
00033
00034 protected:
00035 double _rMin ;
00036 double _rMax ;
00037 double _rowHeight ;
00038 double _padWidth ;
00039 double _padHeight ;
00040 int _nRow ;
00041 int _nPad ;
00042 std::vector<Row> _rows ;
00043 std::vector<double> _extent ;
00044 mutable std::vector< std::vector<int>* > _padIndices ;
00045
00046
00047 public:
00048
00055 FixedPadSizeDiskLayout( double rMin, double rMax, double padHeight, double PadWidth,
00056 int nRow=0 ,
00057 double padGap=0.) ;
00058
00060 virtual ~FixedPadSizeDiskLayout() { ; }
00061
00064 virtual int getPadLayoutType() const { return PadRowLayout2D::POLAR ; }
00065
00068 virtual int getPadShape() const { return PadRowLayout2D::RECTANGLE ; }
00069
00072 virtual int getNPads() const { return _nPad ; }
00073
00076 virtual int getNRows() const ;
00077
00080 virtual double getRowHeight(int rowNumber) const { return _rowHeight ; }
00081
00084 virtual double getPadHeight(int padIndex) const { return _padHeight ; }
00085
00088 virtual double getPadWidth(int padIndex) const ;
00089
00092 virtual Point2D getPadCenter(int padIndex) const;
00093
00094
00098 virtual const std::vector<int>& getPadsInRow(int rowNumber) const ;
00099
00103 virtual const std::vector<double>& getPlaneExtent() const { return _extent ; }
00104
00107 virtual int getRowNumber(int padIndex) const { return ( 0xffff0000 & padIndex ) >> 16 ; }
00108
00111 virtual int getPadNumber(int padIndex) const { return ( 0x0000ffff & padIndex ) ; }
00112
00115 virtual int getPadIndex(int rowNum, int padNum) const;
00116
00120 virtual int getNearestPad(double c0, double c1) const;
00121
00124 virtual int getRightNeighbour(int padIndex) const;
00125
00128 virtual int getLeftNeighbour(int padIndex) const;
00129
00132 virtual bool isInsidePad(double c0, double c1, int padIndex) const;
00133
00136 virtual bool isInsidePad(double c0, double c1) const;
00137
00138 };
00139
00140 }
00141 #endif // ifndef FixedPadSizeDiskLayout_h