GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
TPCModuleImpl.h
1 #ifndef TPCModuleImpl_h
2 #define TPCModuleImpl_h 1
3 
4 #include "gear/TPCModule.h"
5 #include "gearimpl/GearParametersImpl.h"
6 
7 namespace gear {
8 
24 {
25  protected:
26  std::vector<double> _planeExtent{};
27  std::vector<double> _moduleExtent{};
28  std::vector<double> _localModuleExtent{};
29  PadRowLayout2D * _padRowLayout = nullptr ;
30  double _readoutFrequency{};
33  double _zPosition{};
34  double _angle{};
35  double _cos_angle{};
36  double _sin_angle{};
38  int _moduleID{};
39  double _border{};
40 
41  bool _localIsGlobal{}; // flag to improve performance if local and global coordinates are the same
42 
43  bool _zPositionIsSet{};
44 
52 
56  std::vector<double> calculateGlobalExtentCartesianCartesian( std::vector<double> localExtent );
57 
61  std::vector<double> calculateGlobalExtentPolarPolar( std::vector<double> localExtent );
62 
66  std::vector<double> calculateGlobalExtentCartesianPolar( std::vector<double> localExtent );
67 
72  void copy_and_assign(const TPCModuleImpl & );
73 
78  void cleanup();
79 
80 
83  void checkLocalIsGlobal();
84 
85  public:
86 
91  TPCModuleImpl(int moduleID, PadRowLayout2D *padRowLayout,int TPCCoordinateType, double readoutFrequency = 0) ;
92 
95 
98 
100  virtual ~TPCModuleImpl() ;
101 
102  /* The clone function. Used to access the copy-constructor if this class via the
103  * acstract PadRowLayout2D interface.
104  */
105  PadRowLayout2D* clone() const;
106 
117  virtual int getPadLayoutType() const;
118 
122  virtual int getPadLayoutImplType() const;
123 
127  virtual int getCoordinateType() const;
128 
129 
132  virtual int getPadShape() const { return _padRowLayout->getPadShape(); }
133 
136  virtual int getNPads() const { return _padRowLayout->getNPads(); }
137 
140  virtual int getNRows() const { return _padRowLayout->getNRows(); }
141 
144  virtual double getRowHeight(int rowNumber) const { return _padRowLayout->getRowHeight(rowNumber); }
145 
148  virtual double getPadWidth(int padIndex) const { return _padRowLayout->getPadWidth(padIndex); }
149 
152  virtual double getPadPitch(int padIndex) const { return _padRowLayout->getPadPitch(padIndex); }
153 
156  virtual gear::Vector2D getPadCenter(int padIndex) const;
157 
160  virtual double getPadHeight(int padIndex) const { return _padRowLayout->getPadHeight(padIndex); }
161 
165  virtual const std::vector<int>& getPadsInRow(int rowNumber) const { return _padRowLayout->getPadsInRow(rowNumber); }
166 
172  virtual const std::vector<double>& getPlaneExtent() const ;
173 
179  virtual const std::vector<double>& getModuleExtent() const {return _moduleExtent; }
180 
189  virtual const std::vector<double>& getLocalModuleExtent() const {return _localModuleExtent; }
190 
195  virtual int getRowNumber(int padIndex) const { return _padRowLayout->getRowNumber(padIndex) ; }
196 
199  virtual int getPadNumber(int padIndex) const { return _padRowLayout->getPadNumber(padIndex) ; }
200 
203  virtual int getPadIndex(int rowNum, int padNum) const { return _padRowLayout->getPadIndex(rowNum, padNum) ; }
204 
208  virtual int getNearestPad(double x, double y) const;
209 
212  virtual int getRightNeighbour(int padIndex) const{ return _padRowLayout->getRightNeighbour(padIndex) ; }
213 
216  virtual int getLeftNeighbour(int padIndex) const{ return _padRowLayout->getLeftNeighbour(padIndex) ; }
217 
220  virtual bool isInsidePad(double c0, double c1, int padIndex) const;
221 
224  virtual bool isInsidePad(double c0, double c1) const;
225 
229  virtual bool isInsideModule(double c0, double c1) const;
230 
233  virtual double getReadoutFrequency() const {return _readoutFrequency; }
234 
238  virtual const gear::Vector2D & getOffset() const { return _offset; }
239 
248  virtual double getZPosition() const ;
249 
253  virtual double getAngle() const { return _angle; }
254 
258  virtual double getDistanceToPad(double c0, double c1, int index) const;
259 
263  virtual double getDistanceToModule(double c0, double c1) const;
264 
267  virtual int getModuleID() const { return _moduleID; }
268 
273  virtual bool isOverlapping(TPCModule * testThisModule) const;
274 
287  virtual double getBorderWidth() const { return _border;}
288 
294 
298  void setOffset(double x_r, double y_phi);
299 
301  void setZPosition(double z);
302 
303  void setAngle(double angle);
304 
305  void setBorderWidth(double border) ;
306 
308  void setReadoutFrequency(double frequency);
309 
310  const PadRowLayout2D & getLocalPadLayout() const {return *_padRowLayout;}
311 
312 
313  gear::Vector2D globalToLocal(double c0,double c1) const;
314  gear::Vector2D localToGlobal(double c0,double c1) const;
315 
316 
317  }; // class
318 
319 } // namespace gear
320 #endif // ifndef TPCModuleImpl_h
virtual int getRightNeighbour(int padIndex) const
The index of the right neighbour pad.
bool _zPositionIsSet
Flag to show whether the setZPosition() function had been called.
Definition: TPCModuleImpl.h:43
Implementation of GearParameters - a set off parameters that can be used to describe the geometrical ...
virtual bool isInsideModule(double c0, double c1) const
True if global coordinate (c0,c1) is within this modules area of amplification/interest.
virtual int getNearestPad(double x, double y) const
The index of the pad nearest to the given point in Global 2d coordinates (x,y,) or (r...
virtual int getPadIndex(int rowNum, int padNum) const =0
Create a padIndex for the given row and pad ( column ) number.
std::vector< double > calculateGlobalExtentPolarPolar(std::vector< double > localExtent)
Calculate the global extent for a given local extent if both local and global coordinate system are p...
void setOffset(double x_r, double y_phi)
Set the offset of the local pad plane wrt.
Abstract description of a planar subdetector with pads (cells) that are positioned in rows (circular ...
virtual int getPadIndex(int rowNum, int padNum) const
Create a padIndex for the given row and pad ( column ) number.
virtual int getNRows() const
The number of rows.
int getTPCCoordinateType() const
Returns the TPCs coordinate type.
virtual int getPadLayoutImplType() const
The type of the row layout implementation: PadRowLayout2D.TPCMODULE.
std::vector< double > _localModuleExtent
The module extend in the pad plane&#39;s coordinate system.
Definition: TPCModuleImpl.h:28
virtual bool isOverlapping(TPCModule *testThisModule) const
Returns True if this and The given module * overlap pad regions Note: overlaping sensitive regions is...
virtual int getPadLayoutType() const
virtual double getDistanceToPad(double c0, double c1, int index) const
Returns the distance from a global coodinate (c0,c1), to a given pad&#39;s nearest boundery; (c0...
std::vector< double > calculateGlobalExtentCartesianPolar(std::vector< double > localExtent)
Calculate the global extent for a given local extent if the global coordinates are cartesian and the ...
virtual const std::vector< double > & getModuleExtent() const
Extent of the sensitive plane in TPC&#39;s coordinate system, with extended region just outside module fr...
virtual double getReadoutFrequency() const
The readout frequency in Hz.
void checkLocalIsGlobal()
Function to set the _localIsGlobal flag in case both coordinate systems are identical.
int _momsCoordinateType
AKA coordinate type of the TPC which contains this module.
Definition: TPCModuleImpl.h:37
gear::Vector2D _offset
The offset in cordinates described by _momsCoordinateType.
Definition: TPCModuleImpl.h:31
virtual int getPadShape() const
The shape of the pads: PadRowLayout2D::RECTANGLE (i.e.
virtual int getPadNumber(int padIndex) const
The pad number (column) within the row - numbering starts at x==0 (left).
virtual int getNPads() const
The total number of pads in the TPC.
virtual int getNPads() const =0
The total number of pads.
TPCModuleImpl(int moduleID, PadRowLayout2D *padRowLayout, int TPCCoordinateType, double readoutFrequency=0)
Construct the empty RectangularPadRowLayout with the width and x position specified through xMin and ...
virtual double getRowHeight(int rowNumber) const =0
The row height in mm.
void setReadoutFrequency(double frequency)
kept for backward compatibility, please set readout frequency in constructor
void setZPosition(double z)
Set the z position of the module.
virtual double getBorderWidth() const
Returns the amount by which the pad plane has been extended to produce the module plane...
virtual double getZPosition() const
Returns the z position of the module.
virtual int getModuleID() const
Returns module ID.
PadRowLayout2D * clone() const
Returns a copy (clone) of this class.
double _sin_angle
For performance: cache the sine of the angle.
Definition: TPCModuleImpl.h:36
virtual const std::vector< double > & getPlaneExtent() const
Inherited from PadRowLayout2D.
TPCModuleImpl & operator=(const TPCModuleImpl &)
The assignment operator.
virtual double getPadHeight(int padIndex) const
The height of the pad in mm.
virtual ~TPCModuleImpl()
Destructor.
virtual double getRowHeight(int rowNumber) const
The row height in mm.
void cleanup()
function to delete all the objects pointed to and owned by the TPCModule.
virtual int getNRows() const =0
The number of rows.
void copy_and_assign(const TPCModuleImpl &)
function to copy all internal variables, incl.
double _cos_angle
For performance: cache the cosine of the angle.
Definition: TPCModuleImpl.h:35
virtual const std::vector< double > & getLocalModuleExtent() const
The module extent in local coordinates.
virtual double getPadHeight(int padIndex) const =0
The height of the pad in mm.
gear::Vector2D localToGlobal(double c0, double c1) const
Returns the global coordinates for a point in local coordinates.
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 gear::Vector2D getPadCenter(int padIndex) const
The center of the pad in mother&#39;s 2d coordinates, (x,y) or (r,phi).
virtual double getPadPitch(int padIndex) const
The pitch of the pad in mm.
double _angle
The angle wrt. the local coordinate system.
Definition: TPCModuleImpl.h:34
virtual double getPadWidth(int padIndex) const =0
The width of the pad at padIndex in mm (CARTESIAN) or radians (POLAR).
virtual int getRowNumber(int padIndex) const
The number of the row, for the given module(all modules restart at 0), that contains the pad at padIn...
virtual double getAngle() const
Returns the rotation of the module, in Rads, with respect to the modules internal origin...
virtual double getDistanceToModule(double c0, double c1) const
Returns distastance from a global coodinate (c0,c1), to the module&#39;s nearest boundery; (c0...
void convertLocalPlaneToGlobalPlaneExtend(void)
Transforms the local planeExtend to a global planeExtend, global moduleExtend and localModuleExtend...
virtual double getPadPitch(int padIndex) const =0
The pitch (i.
gear::Vector2D _offset_cartesian
The offset in cartesian cordinates.
Definition: TPCModuleImpl.h:32
double _zPosition
The z positon of the module.
Definition: TPCModuleImpl.h:33
virtual int getRightNeighbour(int padIndex) const =0
The index of the right neighbour pad.
virtual bool isInsidePad(double c0, double c1, int padIndex) const
True if coordinate (x,y) is within the given pad.
double _border
Area around a pad Plane to extend the amplification reagion so that the outmost pads don&#39;t loose elec...
Definition: TPCModuleImpl.h:39
virtual int getPadNumber(int padIndex) const =0
The pad number (column) within the row - numbering starts at phi/x == 0.
virtual double getPadWidth(int padIndex) const
The width of the pad in mm.
virtual int getRowNumber(int padIndex) const =0
The number of the row that contains the pad at padIndex - numbering starts at r/y==0.
virtual const std::vector< int > & getPadsInRow(int rowNumber) const =0
Indices of all pads in row rowNumber (row indices start from 0 at the bottom (CARTESIAN) or at the ce...
std::vector< double > calculateGlobalExtentCartesianCartesian(std::vector< double > localExtent)
Calculate the global extent for a given local extent if both local and global coordinate system are c...
virtual int getPadShape() const =0
The shape of the pads, one of PadRowLayout2D.RECTANGLE (Keystone), PadRowLayout2D.DIAMOND, PadRowLayout2D.HEXAGON, PadRowLayout2D.CHEVRON.
virtual int getLeftNeighbour(int padIndex) const =0
The index of the left neighbour pad.
A wrapper Class for PadRowLayout2D which converts between the actual pad layouts local coodinate syst...
Definition: TPCModule.h:41
A wrapper Class for PadRowLayout2D, allowing which converts between local and global coordinate syste...
Definition: TPCModuleImpl.h:23
gear::Vector2D globalToLocal(double c0, double c1) const
Returns the local coordinates for a point in global coordinates.
virtual int getLeftNeighbour(int padIndex) const
The index of the left neighbour pad.
virtual const gear::Vector2D & getOffset() const
Returns the offest of Modules origin from the global origin A vector from Global (0,0) to module (0,0)
virtual int getCoordinateType() const
Identical to getTPCCoordinateType(), because this is the type of coordinates which are returned...
const PadRowLayout2D & getLocalPadLayout() const
Returns a reference to the instance of the underlaying pad layout.