GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gear::TPCModuleImpl Class Reference

A wrapper Class for PadRowLayout2D, allowing which converts between local and global coordinate systems, and adds module appropriate functionality. More...

#include <TPCModuleImpl.h>

Inheritance diagram for gear::TPCModuleImpl:
gear::GearParametersImpl gear::TPCModule gear::GearParameters gear::GearParameters gear::PadRowLayout2D

Public Member Functions

 TPCModuleImpl (int moduleID, PadRowLayout2D *padRowLayout, int TPCCoordinateType, double readoutFrequency=0)
 Construct the empty RectangularPadRowLayout with the width and x position specified through xMin and xMax and an optional yMin - yMax will be computed from the rows that are added with addRow().
 
 TPCModuleImpl (const TPCModuleImpl &)
 The copy constructor.
 
TPCModuleImploperator= (const TPCModuleImpl &)
 The assignment operator.
 
virtual ~TPCModuleImpl ()
 Destructor.
 
PadRowLayout2Dclone () const
 Returns a copy (clone) of this class. More...
 
virtual int getPadLayoutType () const
 
virtual int getPadLayoutImplType () const
 The type of the row layout implementation: PadRowLayout2D.TPCMODULE.
 
virtual int getCoordinateType () const
 Identical to getTPCCoordinateType(), because this is the type of coordinates which are returned, so you need this to interpret what you are getting.
 
virtual int getPadShape () const
 The shape of the pads: PadRowLayout2D::RECTANGLE (i.e. More...
 
virtual int getNPads () const
 The total number of pads in the TPC.
 
virtual int getNRows () const
 The number of rows.
 
virtual double getRowHeight (int rowNumber) const
 The row height in mm.
 
virtual double getPadWidth (int padIndex) const
 The width of the pad in mm. More...
 
virtual double getPadPitch (int padIndex) const
 The pitch of the pad in mm. More...
 
virtual gear::Vector2D getPadCenter (int padIndex) const
 The center of the pad in mother's 2d coordinates, (x,y) or (r,phi). More...
 
virtual double getPadHeight (int padIndex) const
 The height of the pad in mm.
 
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 center (POLAR)).
 
virtual const std::vector
< double > & 
getPlaneExtent () const
 Inherited from PadRowLayout2D. More...
 
virtual const std::vector
< double > & 
getModuleExtent () const
 Extent of the sensitive plane in TPC's coordinate system, with extended region just outside module from _enlargeBy, - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR, also may contain additional deadspace due to mismatch of offset's and coordinate types.
 
virtual const std::vector
< double > & 
getLocalModuleExtent () const
 The module extent in local coordinates. More...
 
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 padIndex - numbering starts at r/y==0.
 
virtual int getPadNumber (int padIndex) const
 The pad number (column) within the row - numbering starts at x==0 (left).
 
virtual int getPadIndex (int rowNum, int padNum) const
 Create a padIndex for the given row and pad ( column ) number.
 
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,phi).
 
virtual int getRightNeighbour (int padIndex) const
 The index of the right neighbour pad.
 
virtual int getLeftNeighbour (int padIndex) const
 The index of the left neighbour pad.
 
virtual bool isInsidePad (double c0, double c1, int padIndex) const
 True if coordinate (x,y) is within the given pad.
 
virtual bool isInsidePad (double c0, double c1) const
 True if coordinate (x,y) is within any pad.
 
virtual bool isInsideModule (double c0, double c1) const
 True if global coordinate (c0,c1) is within this modules area of amplification/interest.
 
virtual double getReadoutFrequency () const
 The readout frequency in Hz.
 
virtual const gear::Vector2DgetOffset () const
 Returns the offest of Modules origin from the global origin A vector from Global (0,0) to module (0,0)
 
virtual double getZPosition () const
 Returns the z position of the module. More...
 
virtual double getAngle () const
 Returns the rotation of the module, in Rads, with respect to the modules internal origin.
 
virtual double getDistanceToPad (double c0, double c1, int index) const
 Returns the distance from a global coodinate (c0,c1), to a given pad's nearest boundery; (c0,c1,index)
 
virtual double getDistanceToModule (double c0, double c1) const
 Returns distastance from a global coodinate (c0,c1), to the module's nearest boundery; (c0,c1)
 
virtual int getModuleID () const
 Returns module ID.
 
virtual bool isOverlapping (TPCModule *testThisModule) const
 Returns True if this and The given module * overlap pad regions Note: overlaping sensitive regions is ok, Just no two pads with shared physicsal space.
 
virtual double getBorderWidth () const
 Returns the amount by which the pad plane has been extended to produce the module plane. More...
 
int getTPCCoordinateType () const
 Returns the TPCs coordinate type. More...
 
void setOffset (double x_r, double y_phi)
 Set the offset of the local pad plane wrt. More...
 
void setZPosition (double z)
 Set the z position of the module.
 
void setAngle (double angle)
 
void setBorderWidth (double border)
 
void setReadoutFrequency (double frequency)
 kept for backward compatibility, please set readout frequency in constructor
 
const PadRowLayout2DgetLocalPadLayout () const
 Returns a reference to the instance of the underlaying pad layout. More...
 
gear::Vector2D globalToLocal (double c0, double c1) const
 Returns the local coordinates for a point in global coordinates. More...
 
gear::Vector2D localToGlobal (double c0, double c1) const
 Returns the global coordinates for a point in local coordinates. More...
 
- Public Member Functions inherited from gear::GearParametersImpl
virtual ~GearParametersImpl ()
 Destructor.
 
virtual int getIntVal (const std::string &key) const
 Integer value for key. More...
 
virtual double getDoubleVal (const std::string &key) const
 Double value for key. More...
 
virtual const std::string & getStringVal (const std::string &key) const
 String value for key. More...
 
virtual const std::vector< int > & getIntVals (const std::string &key) const
 Integer values for key. More...
 
virtual const std::vector
< double > & 
getDoubleVals (const std::string &key) const
 Double values for key. More...
 
virtual const std::vector
< std::string > & 
getStringVals (const std::string &key) const
 String values for key. More...
 
virtual void setIntVal (const std::string &key, int val)
 Set Integer value for key.
 
virtual void setDoubleVal (const std::string &key, double val)
 Double value for key.
 
virtual void setStringVal (const std::string &key, const std::string &val)
 String value for key.
 
virtual void setIntVals (const std::string &key, const std::vector< int > &vals)
 Integer values for key.
 
virtual void setDoubleVals (const std::string &key, const std::vector< double > &vals)
 Double values for key.
 
virtual void setStringVals (const std::string &key, const std::vector< std::string > &vals)
 String values for key.
 
virtual const std::vector
< std::string > & 
getIntKeys () const
 All keys of int variables. More...
 
virtual const std::vector
< std::string > & 
getDoubleKeys () const
 All keys of double variables. More...
 
virtual const std::vector
< std::string > & 
getStringKeys () const
 All keys of string variables. More...
 
virtual const std::vector
< std::string > & 
getIntVecKeys () const
 All keys of IntVec variables. More...
 
virtual const std::vector
< std::string > & 
getDoubleVecKeys () const
 All keys of DoubleVec variables. More...
 
virtual const std::vector
< std::string > & 
getStringVecKeys () const
 All keys of StringVec variables. More...
 
- Public Member Functions inherited from gear::GearParameters
virtual ~GearParameters ()
 Destructor.
 
- Public Member Functions inherited from gear::TPCModule
virtual ~TPCModule ()
 Destructor.
 
- Public Member Functions inherited from gear::PadRowLayout2D
virtual ~PadRowLayout2D ()
 Destructor.
 

Protected Member Functions

void convertLocalPlaneToGlobalPlaneExtend (void)
 Transforms the local planeExtend to a global planeExtend, global moduleExtend and localModuleExtend. More...
 
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 cartesian.
 
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 polar.
 
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 module is polar.
 
void copy_and_assign (const TPCModuleImpl &)
 function to copy all internal variables, incl. More...
 
void cleanup ()
 function to delete all the objects pointed to and owned by the TPCModule. More...
 
void checkLocalIsGlobal ()
 Function to set the _localIsGlobal flag in case both coordinate systems are identical.
 

Protected Attributes

std::vector< double > _planeExtent {}
 
std::vector< double > _moduleExtent {}
 
std::vector< double > _localModuleExtent {}
 The module extend in the pad plane's coordinate system.
 
PadRowLayout2D_padRowLayout = nullptr
 
double _readoutFrequency {}
 
gear::Vector2D _offset {}
 The offset in cordinates described by _momsCoordinateType.
 
gear::Vector2D _offset_cartesian {}
 The offset in cartesian cordinates.
 
double _zPosition {}
 The z positon of the module.
 
double _angle {}
 The angle wrt. the local coordinate system.
 
double _cos_angle {}
 For performance: cache the cosine of the angle.
 
double _sin_angle {}
 For performance: cache the sine of the angle.
 
int _momsCoordinateType {}
 AKA coordinate type of the TPC which contains this module.
 
int _moduleID {}
 
double _border {}
 Area around a pad Plane to extend the amplification reagion so that the outmost pads don't loose elecetrons.
 
bool _localIsGlobal {}
 
bool _zPositionIsSet {}
 Flag to show whether the setZPosition() function had been called. More...
 
- Protected Attributes inherited from gear::GearParametersImpl
std::map< std::string, int > _intMap {}
 
std::map< std::string, double > _doubleMap {}
 
std::map< std::string,
std::string > 
_stringMap {}
 
std::map< std::string, IntVec > _intVecMap {}
 
std::map< std::string, DoubleVec > _doubleVecMap {}
 
std::map< std::string, StringVec > _stringVecMap {}
 
StringVec _intKeys {}
 
StringVec _doubleKeys {}
 
StringVec _stringKeys {}
 
StringVec _intVecKeys {}
 
StringVec _doubleVecKeys {}
 
StringVec _stringVecKeys {}
 

Additional Inherited Members

- Public Types inherited from gear::GearParametersImpl
typedef std::map< std::string,
int > 
IntMap
 
typedef std::map< std::string,
double > 
DoubleMap
 
typedef std::map< std::string,
std::string > 
StringMap
 
typedef std::map< std::string,
IntVec > 
IntVecMap
 
typedef std::map< std::string,
DoubleVec > 
DoubleVecMap
 
typedef std::map< std::string,
StringVec > 
StringVecMap
 
- Static Public Attributes inherited from gear::PadRowLayout2D
static const int RECTANGULARPADROWLAYOUT = 1
 
static const int FIXEDPADSIZEDISKLAYOUT = 2
 
static const int FIXEDPADANGLEDISKLAYOUT = 3
 
static const int VERSATILEDISKROWLAYOUT = 4
 
static const int TPCMODULE = 100
 
static const int CARTESIAN = 1
 
static const int POLAR = 2
 
static const int RECTANGLE = 1
 
static const int DIAMOND = 2
 
static const int HEXAGON = 3
 
static const int CHEVRON = 4
 

Detailed Description

A wrapper Class for PadRowLayout2D, allowing which converts between local and global coordinate systems, and adds module appropriate functionality.

New in v00-15: The z position of the module can be set to distinguish the two end plates.

Attention
For the "negative" half TPC (the half with drift direction in negative z direction) the x coodinate of global system is mirrored. The reason is that in case of two identical end plates, the one mounted on the negative side is rotated by 180 degrees around the y axis, which changes the z coordinate (drift direction) and the x coordinate. The prototype case, which is described by zPosition = 0, also has the drift direction in negative z direction.
Author
M. Killenberg, (Bonn) S. Turnbull, (Saclay/Carleton)

Definition at line 23 of file TPCModuleImpl.h.

Member Function Documentation

void gear::TPCModuleImpl::cleanup ( )
protected

function to delete all the objects pointed to and owned by the TPCModule.

Used by desctructor and assigment operator to avoid code duplication

Definition at line 1244 of file TPCModuleImpl.cc.

Referenced by operator=(), and ~TPCModuleImpl().

PadRowLayout2D * gear::TPCModuleImpl::clone ( ) const
virtual

Returns a copy (clone) of this class.

As PadRowLayout2D is an abstract interface with several implementation, this is used get a copy of the actual implementation without having to know what the actual implementation is.

Implements gear::PadRowLayout2D.

Definition at line 1239 of file TPCModuleImpl.cc.

References TPCModuleImpl().

void gear::TPCModuleImpl::convertLocalPlaneToGlobalPlaneExtend ( void  )
protected

Transforms the local planeExtend to a global planeExtend, global moduleExtend and localModuleExtend.

Transforms a local plane Extend to a global Plane extend.

Definition at line 195 of file TPCModuleImpl.cc.

References _border, _localModuleExtent, _momsCoordinateType, calculateGlobalExtentCartesianCartesian(), calculateGlobalExtentCartesianPolar(), calculateGlobalExtentPolarPolar(), gear::PadRowLayout2D::getCoordinateType(), and gear::PadRowLayout2D::getPlaneExtent().

Referenced by setOffset().

void gear::TPCModuleImpl::copy_and_assign ( const TPCModuleImpl right)
protected

function to copy all internal variables, incl.

the objects pointed to and owned by the TPCModule. Used by constructor and assigment operator to avoid code duplication

Definition at line 1211 of file TPCModuleImpl.cc.

References _angle, _border, _cos_angle, _localModuleExtent, _momsCoordinateType, _offset, _offset_cartesian, _sin_angle, _zPosition, _zPositionIsSet, and gear::PadRowLayout2D::clone().

Referenced by operator=(), and TPCModuleImpl().

virtual double gear::TPCModuleImpl::getBorderWidth ( ) const
inlinevirtual

Returns the amount by which the pad plane has been extended to produce the module plane.

In cartesian coordinates the plane is extended in x and y by this ammount on all sides.

In polar coordinates the r-coordinate is extended by the borderwidth, in $\varphi$ it is extended by an angle corresponding to borderWidth/rMin, so that the border is at least boderWidth at the inner radius and somewhat wider for larger r.

Implements gear::TPCModule.

Definition at line 287 of file TPCModuleImpl.h.

References _border.

virtual const std::vector<double>& gear::TPCModuleImpl::getLocalModuleExtent ( ) const
inlinevirtual

The module extent in local coordinates.

This is the (local) pad plane, enlarged by the border. As the plane extent in global coordinates does not correspond to the actual shape, this is the only way to describe the module extent without dead space (everything in the module extent is considerred active, for instance due to a resistive coating which causes signals even if there is no pad at the specific position).

Attention
Returns LOCAL coordinates!

Implements gear::TPCModule.

Definition at line 189 of file TPCModuleImpl.h.

References _localModuleExtent.

const PadRowLayout2D& gear::TPCModuleImpl::getLocalPadLayout ( ) const
inlinevirtual

Returns a reference to the instance of the underlaying pad layout.

Attention
This pad layout has it's own, local coordinate system! Usually it is not necessary to deal with the pad layout directly. It is preferred to use the modules memberfunctions, since the module is an implementation of PadRowLayout2D which is implemented such that all coordinates are delivered in global coordinates. However there are cases it can be handy to have the local coordinates available, for instance for debugging or to perform the coordinate transformations on the graphics processor for an event display.

Implements gear::TPCModule.

Definition at line 310 of file TPCModuleImpl.h.

gear::Vector2D gear::TPCModuleImpl::getPadCenter ( int  padIndex) const
virtual

The center of the pad in mother's 2d coordinates, (x,y) or (r,phi).

/ AKA the TPC's coordinates.

Implements gear::TPCModule.

Definition at line 1249 of file TPCModuleImpl.cc.

References gear::PadRowLayout2D::getPadCenter(), and localToGlobal().

int gear::TPCModuleImpl::getPadLayoutType ( ) const
virtual
Deprecated:
{ As there now is more than one implementation for each coordinate type this is not sufficient to distinguish the implementations any more. Use getPadLayoutImplType() to get the implementation type. Use getCoordinateType() to get the type of the coordinate system.

For backward compatibility this function returns getCoordinateType().}

Implements gear::TPCModule.

Definition at line 1254 of file TPCModuleImpl.cc.

References getCoordinateType().

virtual double gear::TPCModuleImpl::getPadPitch ( int  padIndex) const
inlinevirtual

The pitch of the pad in mm.

(metal + gap)

Implements gear::PadRowLayout2D.

Definition at line 152 of file TPCModuleImpl.h.

References gear::PadRowLayout2D::getPadPitch().

virtual int gear::TPCModuleImpl::getPadShape ( ) const
inlinevirtual

The shape of the pads: PadRowLayout2D::RECTANGLE (i.e.

keystone).

Implements gear::TPCModule.

Definition at line 132 of file TPCModuleImpl.h.

References gear::PadRowLayout2D::getPadShape().

virtual double gear::TPCModuleImpl::getPadWidth ( int  padIndex) const
inlinevirtual

The width of the pad in mm.

(only the metal)

Implements gear::TPCModule.

Definition at line 148 of file TPCModuleImpl.h.

References gear::PadRowLayout2D::getPadWidth().

const std::vector< double > & gear::TPCModuleImpl::getPlaneExtent ( ) const
virtual

Inherited from PadRowLayout2D.

It gives the minimal set of global coodinates that contains the pad plane. In general this does not mean that the global plane extent if fully covered with avtive area, but only that there is no active area outside the plane extent.

Implements gear::TPCModule.

Definition at line 1272 of file TPCModuleImpl.cc.

int gear::TPCModuleImpl::getTPCCoordinateType ( ) const
inlinevirtual

Returns the TPCs coordinate type.

Note that this is NOT the coordinate type of the (local) pad plane on the module but of the end plate this module is mounted in.

Implements gear::TPCModule.

Definition at line 293 of file TPCModuleImpl.h.

References _momsCoordinateType.

double gear::TPCModuleImpl::getZPosition ( ) const
virtual

Returns the z position of the module.

This is the position of the anode surface terminating the drift volume. For prototypes this will typically be 0 so z is propotional to the drift distance. For a full detector positive and negative values correspond to modules on the first and second end cap, resepctively. It throws a gear::TPCModule::NoZPositionException in case setZPosition has not been called before.

Implements gear::TPCModule.

Definition at line 1545 of file TPCModuleImpl.cc.

References _zPosition, and _zPositionIsSet.

gear::Vector2D gear::TPCModuleImpl::globalToLocal ( double  c0,
double  c1 
) const
virtual

Returns the local coordinates for a point in global coordinates.

It performs a complete coordinate transformation, applying the translation, rotation and coordinate conversion to the coordinate type of the local pad layout. Use getLocalPadLayout()->getCoordinateType() to interpret the return value correctly.

Usally you don't need this function since all member functions of the module use global coordinates only.

Implements gear::TPCModule.

Definition at line 10 of file TPCModuleImpl.cc.

References _angle, _cos_angle, _momsCoordinateType, _offset_cartesian, _sin_angle, _zPosition, and gear::PadRowLayout2D::getCoordinateType().

Referenced by calculateGlobalExtentCartesianPolar(), calculateGlobalExtentPolarPolar(), getDistanceToModule(), getDistanceToPad(), getNearestPad(), isInsideModule(), and isInsidePad().

gear::Vector2D gear::TPCModuleImpl::localToGlobal ( double  c0,
double  c1 
) const
virtual

Returns the global coordinates for a point in local coordinates.

It performs a complete coordinate transformation, applying the coordinate conversion from the coordinate type of the local pad layout to the global coordinate type, rotation and translation. Use getLocalPadLayout()->getCoordinateType() to produce the input in the correct coordinate type.

Usally you don't need this fuction since all member functions of the module use global coordinates only.

Implements gear::TPCModule.

Definition at line 108 of file TPCModuleImpl.cc.

References _angle, _cos_angle, _momsCoordinateType, _offset_cartesian, _sin_angle, _zPosition, and gear::PadRowLayout2D::getCoordinateType().

Referenced by calculateGlobalExtentCartesianCartesian(), calculateGlobalExtentCartesianPolar(), calculateGlobalExtentPolarPolar(), and getPadCenter().

void gear::TPCModuleImpl::setOffset ( double  x_r,
double  y_phi 
)

Set the offset of the local pad plane wrt.

the local coordinate system. This value is in global coordinates (cartesian or polar, depeding on the TPC coordinate type).

Definition at line 1476 of file TPCModuleImpl.cc.

References _momsCoordinateType, _offset, _offset_cartesian, checkLocalIsGlobal(), and convertLocalPlaneToGlobalPlaneExtend().

Referenced by gear::TPCModuleXML::fromXML().

Member Data Documentation

bool gear::TPCModuleImpl::_zPositionIsSet {}
protected

Flag to show whether the setZPosition() function had been called.

A default value of 0 would cause a minus sign on the returned x coordinate, which is not backward compatible. So we need a flag and only invert x if the coordinate has really been set.

Definition at line 43 of file TPCModuleImpl.h.

Referenced by copy_and_assign(), getZPosition(), setZPosition(), and TPCModuleImpl().


The documentation for this class was generated from the following files: