8#include <vxd/geometry/SensorInfoBase.h>
9#include <vxd/geometry/SensorPlane.h>
10#include <framework/utilities/TestHelpers.h>
11#include <gtest/gtest.h>
48 for (
double u = -1.0 + 0.05; u <= 1.0; u += 0.1) {
49 EXPECT_EQ(rect.
getUCellID(u), (
int)((u / 1.0 + 0.5) * 2));
50 if (u < -0.5) {EXPECT_EQ(rect.
getUCellID(u, 0,
true), 0); }
52 for (
double v = -2.0 + 0.11; v <= 2.0; v += 0.2) {
53 EXPECT_EQ(rect.
getVCellID(v), (
int)((v / 2.0 + 0.5) * 4));
54 if (v < -1.0) {EXPECT_EQ(rect.
getVCellID(v,
true), 0);}
56 EXPECT_EQ(rect.
inside(u, v), fabs(u) <= 0.5 && fabs(v) <= 1.0);
72 for (
double v = -1.0; v < 1.0; v += 0.1) {
73 EXPECT_DOUBLE_EQ(rect.
getWidth(v), 2.0 - (v / 2.0 + 0.5) * 1.0);
84 for (
double u = -2.0 + 0.1; u <= 2.0; u += 0.2) {
85 for (
double v = -2.0 + 0.11; v <= 2.0; v += 0.2) {
87 EXPECT_EQ(rect.
getVCellID(v), (
int)((v / 2.0 + 0.5) * 4));
88 EXPECT_EQ(rect.
inside(u, v), fabs(u) <= rect.
getWidth(v) / 2.0 && fabs(v) <= 1.0);
101 SensorInfoBase rect(
SensorInfoBase::PXD,
VxdID(3, 2, 1), 2.0, 2.0, 1.0, 2, 2, 1.0, 1.0, 4);
102 for (
double v = -1.0; v < 1.0; v += 0.1) {
103 EXPECT_DOUBLE_EQ(rect.
getWidth(v), 2.0 - (v / 2.0 + 0.5) * 1.0);
105 EXPECT_EQ(rect.
getVPitch(v), v >= 0 ? 0.25 : 0.5);
120 for (
double u = -2.0 + 0.1; u <= 2.0; u += 0.2) {
121 for (
double v = -2.0 + 0.11; v <= 2.0; v += 0.2) {
124 EXPECT_EQ(rect.
getVCellID(v), (
int)((v / 2.0 + 0.5) * 4));
126 EXPECT_EQ(rect.
getVCellID(v), (
int)((v / 2.0 + 0.5) * 8) - 2);
128 EXPECT_EQ(rect.
inside(u, v), fabs(u) <= rect.
getWidth(v) / 2.0 && fabs(v) <= 1.0);
131 EXPECT_TRUE(rect.
inside(iu, iv));
146 EXPECT_B2FATAL(plane.isInActive(0, 0));
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.
double getWSize() const
Return the thickness of the sensor.
SensorType getType() const
Return the Type of the Sensor.
int getVCells() const
Return number of pixel/strips in v direction.
int getUCells() const
Return number of pixel/strips in u direction.
bool inside(double u, double v, double uTolerance=DBL_EPSILON, double vTolerance=DBL_EPSILON) const
Check whether a given point is inside the active area.
double getWidth(double v=0) const
Return the width of the sensor.
VxdID getID() const
Return the ID of the Sensor.
double getVPitch(double v=0) const
Return the pitch of the sensor.
double getThickness() const
Return the thickness of the sensor.
double getUSize(double v=0) const
Return the width of the sensor.
int getVCellID(double v, bool clamp=false) const
Return the corresponding pixel/strip ID of a given v coordinate.
int getUCellID(double u, double v=0, bool clamp=false) const
Return the corresponding pixel/strip ID of a given u coordinate.
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.
A Finite plane of one VXD Sensor.
Class to uniquely identify a any structure of the PXD and SVD.
Namespace to provide code needed by both Vertex Detectors, PXD and SVD, and also testbeam telescopes.
TEST(SensorInfoBase, Rectangular)
Check whether all the getters work for a normal, rectangular sensor with only one pixel/strip size.
Abstract base class for different kinds of events.