Commit 56cbb04c authored by Kendrick, Coleman's avatar Kendrick, Coleman
Browse files

Fixed angle test for 45deg, others still WIP

parent fad72abc
......@@ -948,24 +948,34 @@ public:
void testTracksForSolidCylinderAngle() {
// solid cylinder at origin with symmetry along y axis
// using PAC06 dimensions: 2.95mm radius x 5.68mm height
// using PAC06 dimensions: 2.95mm radius x 5.68cm height
// Beam is hitting surface at 45 degree angle from the y-z axis
constexpr double RADIUS{0.00295};
constexpr double HEIGHT{0.00568};
// constexpr double RADIUS{0.00295};
// constexpr double HEIGHT{0.05680};
constexpr double RADIUS{0.003};
constexpr double HEIGHT{0.006};
constexpr double TOLERANCE{1.0e-10};
V3D BOTTOM_CENTRE{0., -.5 * HEIGHT, 0.};
V3D AXIS_SYMM{0., 1., 0.};
auto cylinder = ComponentCreationHelper::createCappedCylinder(
RADIUS, HEIGHT, BOTTOM_CENTRE, AXIS_SYMM, "cyl");
double ANGLE_SIN{sqrt(2.0) * 0.5}; // sin(PI/4)
const V3D BEAM_DIRECTION{0., ANGLE_SIN, ANGLE_SIN}; // unit vector at angle
V3D BEAM_DIRECTION{0.0, sin(45.0 * (M_PI / 180.0)),
cos(45.0 * (M_PI / 180.0))};
BEAM_DIRECTION.normalize();
double ANGLE{atan((BEAM_DIRECTION.Y()) / BEAM_DIRECTION.Z())};
// centre of sample
Track origin(V3D{0., 0., 0.}, BEAM_DIRECTION);
int nsegments = cylinder->interceptSurface(origin);
TS_ASSERT_EQUALS(nsegments, 1);
TS_ASSERT_EQUALS(origin.totalDistInsideObject(),
(0.5 * HEIGHT) / ANGLE_SIN);
TS_ASSERT_DELTA(origin.totalDistInsideObject(),
sqrt(pow(0.5 * HEIGHT, 2) + pow(RADIUS, 2)), TOLERANCE);
TS_ASSERT_EQUALS(BEAM_DIRECTION.zenith(V3D{0.0, 0.0, 0.0}) * (180.0 / M_PI),
ANGLE * (180.0 / M_PI));
}
void testTracksForHollowCylinder() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment