GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
VersatileDiskRowLayout.h
1 #ifndef VersatileDiskRowLayout_h
2 #define VersatileDiskRowLayout_h 1
3 
4 #include <vector>
5 #include "gearimpl/FixedDiskLayoutBase.h"
6 
7 
8 namespace gear {
9 
26 
27  public:
28 
30  class Row
31  {
32  protected:
33  int _rowNumber{};
34  int _nPads{};
35  double _padPitch_mm{};
36  double _padPitch{};
37  double _padWidth_mm{};
38  double _padWidth{};
39  double _rowHeight{};
40  double _padHeight{};
41  double _offset_mm{};
42  double _offset{};
43 
44  double _rCentre{};
45 
46  double _phiMax{};
47  double _rMin{};
48  double _rMax{};
49 
50  double distanceToPhiMin(double r, double phi) const;
51  double distanceToPhiMax(double r, double phi) const;
52 
53  public:
54  Row(int rowNumber, int nPads, double rCentre, double padPitch_mm, double rowHeight,
55  double padWidth_mm, double padHeight, double offset_mm);
56  int getRowNumber() const {return _rowNumber;}
57  int getNPads() const {return _nPads;}
58  double getPadPitch_mm() const {return _padPitch_mm;}
59  double getPadPitch() const {return _padPitch;}
60  double getPadWidth_mm() const {return _padWidth_mm;}
61  double getPadWidth() const {return _padWidth;}
62  double getRowHeight() const {return _rowHeight;}
63  double getPadHeight() const {return _padHeight;}
64  double getOffset_mm() const {return _offset_mm;}
65  double getOffset() const {return _offset;}
66  double getRCentre() const {return _rCentre;}
67  double getPhiMin() const {return _offset;}
68  double getPhiMax() const {return _phiMax;}
69  double getRMin() const {return _rMin;}
70  double getRMax() const {return _rMax;}
71 
73  double getDistanceToRow(double r, double phi) const;
74 
76  int getNearestPad(double r, double phi) const;
77  };
78 
79 
80  protected:
81 
82  int _nPad {};
83  std::vector<Row> _rows {};
84  std::vector<double> _extent {};
85  mutable std::vector< std::vector<int>* > _padIndices {};
86 
88  bool _isFrayed {};
89 
95 
100  void cleanup();
101 
102 
103  public:
104 
109  VersatileDiskRowLayout( double rMin ) ;
110 
115 
118 
120  virtual ~VersatileDiskRowLayout() ;
121 
122  /* The clone function. Used to access the copy-constructor if this class via the
123  * acstract PadRowLayout2D interface.
124  */
125  PadRowLayout2D* clone() const;
126 
132  virtual void addRow( int nPads , double padPitch , double rowHeight ,
133  double offset = 0., double padWidth =0., double padHeight = 0.,
134  int repeat = 1);
135 
139  virtual int getPadLayoutImplType() const { return PadRowLayout2D::VERSATILEDISKROWLAYOUT; }
140 
150  virtual int getPadLayoutType() const;
151 
152  /* The type of the row layout: PadRowLayout2D::POLAR.
153  */
154  //
155  // Already implemented in FixedDiskLayoutBase
156  //virtual int getCoordinateType() const { return PadRowLayout2D::POLAR ; }
157 
160  virtual int getPadShape() const { return PadRowLayout2D::RECTANGLE ; }
161 
164  virtual int getNPads() const { return _nPad ; }
165 
168  virtual int getNRows() const ;
169 
172  virtual double getRowHeight(int rowNumber) const;
173 
176  virtual double getPadHeight(int padIndex) const;
177 
180  virtual double getPadWidth(int padIndex) const ;
181 
184  virtual double getPadPitch(int padIndex) const ;
185 
188  virtual Vector2D getPadCenter(int padIndex) const;
189 
190 
194  virtual const std::vector<int>& getPadsInRow(int rowNumber) const ;
195 
199  virtual const std::vector<double>& getPlaneExtent() const { return _extent ; }
200 
203  virtual int getRowNumber(int padIndex) const;
204 
207  virtual int getPadNumber(int padIndex) const { return ( 0x0000ffff & padIndex ) ; }
208 
211  virtual int getPadIndex(int rowNum, int padNum) const;
212 
216  virtual int getNearestPad(double c0, double c1) const;
217 
220  virtual int getRightNeighbour(int padIndex) const;
221 
224  virtual int getLeftNeighbour(int padIndex) const;
225 
228  virtual bool isInsidePad(double c0, double c1, int padIndex) const;
229 
232  virtual bool isInsidePad(double c0, double c1) const;
233 
235  virtual bool isFrayed() const { return _isFrayed;}
236 
238  const std::vector<Row>& rows() const { return _rows ; }
239 
240  }; // class
241 
242 } // namespace gear
243 #endif // ifndef VersatileDiskRowLayout_h
double getDistanceToRow(double r, double phi) const
Function to calculate closest distance to the row.
bool _isFrayed
Flag that describes if the geometry is frayed.
Abstract description of a planar subdetector with pads (cells) that are positioned in rows (circular ...
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).
int _nPad
number of pads, keep for performance reasons
virtual const std::vector< double > & getPlaneExtent() const
Extent of the sensitive plane - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR.
virtual bool isInsidePad(double c0, double c1, int padIndex) const
True if coordinate (c0,c1) is within the given pad.
double _rMax
upper edge of the pad (incl.gap)
PadRowLayout2D * clone() const
Returns a copy (clone) of this class.
int getNearestPad(double r, double phi) const
Function to determine the nearest pad in the row.
VersatileDiskRowLayout(double rMin)
Construct the VersatileDiskRowLayout.
const std::vector< Row > & rows() const
Get access to the individual rows.
Base class for circular PadRowLayout2D implementations.
double _padPitch_mm
the pad pitch in mm
virtual bool isFrayed() const
Get information whether geometry has large staggering.
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 getPadIndex(int rowNum, int padNum) const
Create a padIndex for the given row and pad ( column ) number.
VersatileDiskRowLayout & operator=(const VersatileDiskRowLayout &)
The assignment operator.
virtual int getNPads() const
The total number of pads in the TPC.
virtual void addRow(int nPads, double padPitch, double rowHeight, double offset=0., double padWidth=0., double padHeight=0., int repeat=1)
Add &#39;repeat&#39; rows with the given parameters.
double _padWidth_mm
the pad width (without gap) in mm
virtual int getRowNumber(int padIndex) const
The number of the row that contains the pad at padIndex - numbering starts at r/y==0.
double _rowHeight
the row height in mm
virtual int getPadNumber(int padIndex) const
The pad number (column) within the row - numbering starts at phi/x =.
virtual int getNRows() const
The number of rows.
virtual int getPadShape() const
The shape of the pads: PadRowLayout2D::RECTANGLE (i.e.
virtual Vector2D getPadCenter(int padIndex) const
The center of the pad in 2d coordinates, (x,y) or (r,phi).
double _phiMax
the maximum Angle of this row
virtual int getPadLayoutImplType() const
The type of the row layout implementation: PadRowLayout2D.FIXEDPADSIZEDISKLAYOUT. ...
double _offset_mm
the offset (staggering) with respect to phi=0 in mm
double _padPitch
the pad pitch in radians
void cleanup()
function to delete all the objects pointed to and owned by the VersatileDiskRowLayout.
Internal helper class for VersatileDiskRowLayout, describing one row.
std::vector< std::vector< int > * > _padIndices
vector for getPadsInRow
void copy_and_assign(const VersatileDiskRowLayout &)
function to copy all internal variables, incl.
virtual double getPadHeight(int padIndex) const
The height of the pad in mm.
double _padWidth
the pad width (without gap) in radians
virtual double getRowHeight(int rowNumber) const
The row height in mm.
virtual double getPadPitch(int padIndex) const
The pitch of the pad in radians.
virtual ~VersatileDiskRowLayout()
Destructor.
virtual double getPadWidth(int padIndex) const
The width of the pad in radians.
std::vector< Row > _rows
vector with all the rows of the pad plane
std::vector< double > _extent
the plane extent
double _rCentre
radius at the pad centre
double _offset
the offset (staggering) with respect to phi=0 in radians, aka phiMin
double _rMin
lower edge of the pad (incl. gap)
Implementation of PadRowLayout2D for a wedge shaped module.
double _padHeight
the height of the pad (without gap)
virtual int getLeftNeighbour(int padIndex) const
The index of the left neighbour pad.
virtual int getRightNeighbour(int padIndex) const
The index of the right neighbour pad.
int _nPads
number of pads in the row