GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
FixedPadSizeDiskLayout.h
1 #ifndef FixedPadSizeDiskLayout_h
2 #define FixedPadSizeDiskLayout_h 1
3 
4 #include <vector>
5 #include "gearimpl/FixedDiskLayoutBase.h"
6 
7 #include <cmath>
8 
9 namespace gear {
10 
11 
12 
24 
25  public:
26 
28  struct Row{
29  int NPad {};
30  double RCenter {};
31  double PhiPad {};
32  } ;
33 
34 
35  protected:
36  double _rMin {};
37  double _rMax {};
38  double _phiMax {};
39  double _rowHeight {};
40  double _padWidth {};
41  double _padHeight {};
42  double _padGap {};
43  int _nRow {};
44  int _nPad {};
45  std::vector<Row> _rows {};
46  std::vector<double> _extent {};
47  mutable std::vector< std::vector<int>* > _padIndices {};
48 
54 
59  void cleanup();
60 
61 
62  public:
63 
70  FixedPadSizeDiskLayout( double rMin, double rMax, double padHeight, double PadWidth,
71  int nRow=0 ,
72  double padGap=0.,
73  double phiMax=2*M_PI) ;
74 
79 
82 
84  virtual ~FixedPadSizeDiskLayout() ;
85 
86  /* The clone function. Used to access the copy-constructor if this class via the
87  * acstract PadRowLayout2D interface.
88  */
89  PadRowLayout2D* clone() const;
90 
91 
93  virtual double getPadGap() const { return _padGap ; }
94 
97  virtual double getFixedPadWidth() const { return _padWidth ; }
98 
99 
103  virtual int getPadLayoutImplType() const { return PadRowLayout2D::FIXEDPADSIZEDISKLAYOUT; }
104 
105  /* The type of the row layout: PadRowLayout2D::POLAR.
106  */
107  //
108  // Already implemented in FixedDiskLayoutBase
109  //virtual int getCoordinateType() const { return PadRowLayout2D::POLAR ; }
110  //virtual int getPadLayoutType() const;
111 
114  virtual int getPadShape() const { return PadRowLayout2D::RECTANGLE ; }
115 
118  virtual int getNPads() const { return _nPad ; }
119 
122  virtual int getNRows() const ;
123 
126  virtual double getRowHeight(int /*rowNumber*/) const { return _rowHeight ; }
127 
130  virtual double getPadHeight(int /*padIndex*/) const { return _padHeight ; }
131 
134  virtual double getPadWidth(int padIndex) const ;
135 
138  virtual double getPadPitch(int padIndex) const ;
139 
142  virtual Vector2D getPadCenter(int padIndex) const;
143 
144 
148  virtual const std::vector<int>& getPadsInRow(int rowNumber) const ;
149 
153  virtual const std::vector<double>& getPlaneExtent() const { return _extent ; }
154 
157  virtual int getRowNumber(int padIndex) const { return ( 0xffff0000 & padIndex ) >> 16 ; }
158 
161  virtual int getPadNumber(int padIndex) const { return ( 0x0000ffff & padIndex ) ; }
162 
165  virtual int getPadIndex(int rowNum, int padNum) const;
166 
170  virtual int getNearestPad(double c0, double c1) const;
171 
174  virtual int getRightNeighbour(int padIndex) const;
175 
178  virtual int getLeftNeighbour(int padIndex) const;
179 
182  virtual bool isInsidePad(double c0, double c1, int padIndex) const;
183 
186  virtual bool isInsidePad(double c0, double c1) const;
187 
188  }; // class
189 
190 } // namespace gear
191 #endif // ifndef FixedPadSizeDiskLayout_h
FixedPadSizeDiskLayout(double rMin, double rMax, double padHeight, double PadWidth, int nRow=0, double padGap=0., double phiMax=2 *M_PI)
Construct the FixedPadSizeDiskLayout from the given parameters rMin, rMax, padHeight and PadWidth whe...
FixedPadSizeDiskLayout & operator=(const FixedPadSizeDiskLayout &)
The assignment operator.
virtual int getNRows() const
The number of rows.
virtual double getRowHeight(int) const
The row height in mm.
virtual double getPadPitch(int padIndex) const
The pitch of the pad in radians (metal + gap)
void copy_and_assign(const FixedPadSizeDiskLayout &)
function to copy all internal variables, incl.
virtual int getPadNumber(int padIndex) const
The pad number (column) within the row - numbering starts at phi/x =.
void cleanup()
function to delete all the objects pointed to and owned by the FixedPadSizeDiskLayout.
Implementation of PadRowLayout2D for a disk with fixed sized keystone pads.
virtual int getNearestPad(double c0, double c1) const
The index of the pad nearest to the given point in 2d coordinates (x,y,) or (r,phi).
Base class for circular PadRowLayout2D implementations.
virtual int getPadShape() const
The shape of the pads: PadRowLayout2D::RECTANGLE (i.e.
virtual double getPadGap() const
The gap width in mm that was given in the C&#39;tor.
virtual int getRightNeighbour(int padIndex) const
The index of the right neighbour pad.
virtual bool isInsidePad(double c0, double c1, int padIndex) const
True if coordinate (c0,c1) is within the given pad.
virtual double getFixedPadWidth() const
The fixed width of the pads in mm.
virtual double getPadHeight(int) const
The height of the pad in mm.
Internal helper class for FixedPadSizeDiskLayout.
virtual int getPadLayoutImplType() const
The type of the row layout implementation: PadRowLayout2D.FIXEDPADSIZEDISKLAYOUT. ...
virtual int getLeftNeighbour(int padIndex) const
The index of the left neighbour pad.
virtual int getNPads() const
The total number of pads in the TPC.
virtual int getPadIndex(int rowNum, int padNum) const
Create a padIndex for the given row and pad ( column ) number.
virtual const std::vector< double > & getPlaneExtent() const
Extent of the sensitive plane - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR.
virtual const std::vector< int > & getPadsInRow(int rowNumber) const
Indices of all pads in row rowNumber (row indices start from 0 at the bottom (CARTESIAN) or at the ce...
virtual int getRowNumber(int padIndex) const
The number of the row that contains the pad at padIndex - numbering starts at r/y==0.
virtual Vector2D getPadCenter(int padIndex) const
The center of the pad in 2d coordinates, (x,y) or (r,phi).
PadRowLayout2D * clone() const
Returns a copy (clone) of this class.
virtual ~FixedPadSizeDiskLayout()
Destructor.
virtual double getPadWidth(int padIndex) const
The width of the pad in radians (only the metal)