11#include <vxd/dataobjects/VxdID.h>
14#include <Math/Vector3D.h>
15#include <TGeoMatrix.h>
61 int uCells,
int vCells,
double width2 = -1,
double splitLength = -1,
int vCells2 = 0):
193 int getUCellID(
double u,
double v = 0,
bool clamp =
false)
const
229 bool inside(
double u,
double v,
double uTolerance = DBL_EPSILON,
double vTolerance = DBL_EPSILON)
const
231 double nu = u / (
getWidth(v) + 2 * uTolerance) + 0.5;
232 double nv = v / (
getLength() + 2 * vTolerance) + 0.5;
233 return 0 <= nu && nu <= 1 && 0 <= nv && nv <= 1;
243 bool inside(
const ROOT::Math::XYZVector& local,
double uTolerance = DBL_EPSILON,
double vTolerance = DBL_EPSILON,
244 double wTolerance = DBL_EPSILON)
const
246 double nw = local.Z() / (
getThickness() + 2 * wTolerance) + 0.5;
248 return inside(local.X(), local.Y(), uTolerance, vTolerance) && 0 <= nw && nw <= 1;
258 v = std::min(length, std::max(-length, v));
260 u = std::min(width, std::max(-width, u));
267 void forceInside(ROOT::Math::XYZVector& local)
const;
274 ROOT::Math::XYZVector
pointToGlobal(
const ROOT::Math::XYZVector& local,
bool reco =
false)
const;
281 ROOT::Math::XYZVector
vectorToGlobal(
const ROOT::Math::XYZVector& local,
bool reco =
false)
const;
288 ROOT::Math::XYZVector
pointToLocal(
const ROOT::Math::XYZVector& global,
bool reco =
false)
const;
295 ROOT::Math::XYZVector
vectorToLocal(
const ROOT::Math::XYZVector& global,
bool reco =
false)
const;
360 double u = local.X();
361 double v = local.Y();
366 local.SetZ(std::min(thickness, std::max(-thickness, local.Z())));
373 local.GetCoordinates(clocal);
376 return ROOT::Math::XYZVector(cmaster[0], cmaster[1], cmaster[2]);
383 local.GetCoordinates(clocal);
385 else m_transform.LocalToMasterVect(clocal, cmaster);
386 return ROOT::Math::XYZVector(cmaster[0], cmaster[1], cmaster[2]);
393 global.GetCoordinates(cmaster);
396 return ROOT::Math::XYZVector(clocal[0], clocal[1], clocal[2]);
403 global.GetCoordinates(cmaster);
405 else m_transform.MasterToLocalVect(cmaster, clocal);
406 return ROOT::Math::XYZVector(clocal[0], clocal[1], clocal[2]);
Base class to provide Sensor Information for PXD and SVD.
double getVCellPosition(int vID) const
Return the position of a specific strip/pixel in v direction.
double getUPitch(double v=0) const
Return the pitch of the sensor.
double getVSize() const
Return the length of the sensor.
double getUCellPosition(int uID, int vID=-1) const
Return the position of a specific strip/pixel in u direction.
SensorInfoBase(SensorType type, VxdID id, double width, double length, double thickness, int uCells, int vCells, double width2=-1, double splitLength=-1, int vCells2=0)
Constructor for a SensorInfo instance.
ROOT::Math::XYZVector pointToLocal(const ROOT::Math::XYZVector &global, bool reco=false) const
Convert a point from global to local coordinates.
double getWSize() const
Return the thickness of the sensor.
SensorType getType() const
Return the Type of the Sensor.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
virtual ~SensorInfoBase()
Default constructor to make class polymorph.
TGeoHMatrix m_recoTransform
Alignment-corrected transformation matrix of the Sensor for use in reconstruction.
int getVCells() const
Return number of pixel/strips in v direction.
SensorType
Enum specifing the type of sensor the SensorInfo represents.
@ VXD
Any type of VXD Sensor.
@ TEL
Testbeam telescope sensor.
int getUCells() const
Return number of pixel/strips in u direction.
ROOT::Math::XYZVector vectorToLocal(const ROOT::Math::XYZVector &global, bool reco=false) const
Convert a vector from global to local coordinates.
bool inside(double u, double v, double uTolerance=DBL_EPSILON, double vTolerance=DBL_EPSILON) const
Check wether a given point is inside the active area.
double getWidth(double v=0) const
Return the width of the sensor.
bool inside(const ROOT::Math::XYZVector &local, double uTolerance=DBL_EPSILON, double vTolerance=DBL_EPSILON, double wTolerance=DBL_EPSILON) const
Check wether a given point is inside the active area.
double getForwardWidth() const
Convinience Wrapper to return width at forward side.
VxdID getID() const
Return the ID of the Sensor.
double getVPitch(double v=0) const
Return the pitch of the sensor.
double getBackwardWidth() const
Convinience Wrapper to return width at backward side.
double m_width
Width of the sensor.
std::vector< double > m_surfaceDeformationParameters
Vector contains all parameter needed for description planar deformation of sensors.
double m_thickness
Thickness of the Sensor.
void setTransformation(const TGeoHMatrix &transform, bool reco=false)
Set the transformation matrix of the Sensor.
int m_vCells
Number of strips/pixels in v direction (up to splitLength for two pixel sizes)
double getThickness() const
Return the thickness of the sensor.
unsigned short m_id
ID of the Sensor.
int getVPitchID(double v=0) const
Return the pitch ID of the sensor.
double m_deltaWidth
Difference between backward and forward width, 0 for rectangular sensors.
double getUSize(double v=0) const
Return the width of the sensor.
SensorType m_type
Type of the Sensor.
int getVCellID(double v, bool clamp=false) const
Return the corresponding pixel/strip ID of a given v coordinate.
const TGeoHMatrix & getTransformation(bool reco=false) const
Return the transformation matrix of the Sensor.
ROOT::Math::XYZVector vectorToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a vector from local to global coordinates.
int getVCells2() const
Return number of pixel/strips in v direction up to change pitch.
TGeoHMatrix m_transform
Nominal transformation matrix of the Sensor.
double m_length
Length of the Sensor.
void setSurfaceParameters(const std::vector< double > &planarParameters)
Fill parameters of planar deformation to vector.
int m_vCells2
Number of strips/pixels in v direction after splitLength, 0 for only one pixel size.
int getUCellID(double u, double v=0, bool clamp=false) const
Return the corresponding pixel/strip ID of a given u coordinate.
int m_uCells
Number of strips/pixels in u direction.
double m_splitLength
Relative length at which second pixel size starts, 0 for only one pixel size.
const std::vector< double > & getSurfaceParameters() const
Return parameters of planar deformation.
double getLength() const
Return the length of the sensor.
void forceInside(double &u, double &v) const
Force a position to be inside the active area.
Class to uniquely identify a any structure of the PXD and SVD.
Abstract base class for different kinds of events.