Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlanarSurfaceDriftTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PlanarSurfaceDriftTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2021 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
11 
19 
20 #include <array>
21 #include <memory>
22 
23 namespace bdata = boost::unit_test::data;
24 
25 namespace ActsFatras {
26 
27 BOOST_AUTO_TEST_SUITE(Digitization)
28 
31 
33 
34  Acts::Vector3 cPosition = Acts::Vector3(10., 50., 12.);
35  Acts::Vector3 cNormal = Acts::Vector3(1., 1., 1.).normalized();
36 
37  auto planeSurface =
38  Acts::Surface::makeShared<Acts::PlaneSurface>(cPosition, cNormal);
39 
40  double depletion = 0.250;
41 
42  // Nominal intersection
43  Acts::Vector3 noDrift(0., 0., 0.);
44  Acts::Vector3 holeDrift = Acts::Vector3(0.5, 0., 1.).normalized();
45  Acts::Vector3 chargeDrift = Acts::Vector3(0.5, 0., -1.).normalized();
46 
47  // Intersect surface at normal direction and no drift
48  //
49  // -> resulting segment must have entry & exit at (0,0) local coordinates
50  auto noDriftSegment = psd.toReadout(geoCtx, *planeSurface, depletion,
51  cPosition, cNormal, noDrift);
52 
53  CHECK_CLOSE_ABS(noDriftSegment[0].x(), 0., Acts::s_epsilon);
54  CHECK_CLOSE_ABS(noDriftSegment[0].y(), 0., Acts::s_epsilon);
55  CHECK_CLOSE_ABS(noDriftSegment[1].x(), 0., Acts::s_epsilon);
56  CHECK_CLOSE_ABS(noDriftSegment[1].y(), 0., Acts::s_epsilon);
57 
58  Acts::Vector3 particleDir = Acts::Vector3(2., 1., 1.).normalized();
59 
60  // Intersect surface at particleDirection != normal and no drift
61  //
62  // -> local segment must be symmetric around (0,0)
63  noDriftSegment = psd.toReadout(geoCtx, *planeSurface, depletion, cPosition,
64  particleDir, noDrift);
65 
66  CHECK_CLOSE_ABS(noDriftSegment[0].x(), -noDriftSegment[1].x(),
68  CHECK_CLOSE_ABS(noDriftSegment[0].y(), -noDriftSegment[1].y(),
70 
71  // Intersect surface at particleDirection != normal and a drift somewhat along
72  // the normal and x
73  //
74  // -> local segment must not be symmetric around (0,0)
75  // -> segment exit at pos local z remains unchanged
76  // -> segment entry at neg local z changes in x, remains unchanged in y
77  auto driftedSegment = psd.toReadout(geoCtx, *planeSurface, depletion,
78  cPosition, particleDir, holeDrift);
79 
80  BOOST_CHECK(std::abs(driftedSegment[0].x() - driftedSegment[1].x()) >
82  BOOST_CHECK(std::abs(driftedSegment[0].y() - driftedSegment[1].y()) >
84  CHECK_CLOSE_ABS(noDriftSegment[1].x(), driftedSegment[1].x(),
86  CHECK_CLOSE_ABS(noDriftSegment[1].y(), driftedSegment[1].y(),
88  BOOST_CHECK(std::abs(driftedSegment[0].x() - noDriftSegment[0].x()) >
90  CHECK_CLOSE_ABS(driftedSegment[0].y(), noDriftSegment[0].y(),
92 
93  // Intersect surface at particleDirection != normal and a drift somewhat
94  // opposite the normal and y
95  //
96  // -> local segment must not be symmetric around (0,0)
97  // -> segment entry at neg local z remains unchanged
98  // -> segment exit at pos local z changes in x, remains unchanged in y
99  driftedSegment = psd.toReadout(geoCtx, *planeSurface, depletion, cPosition,
100  particleDir, chargeDrift);
101 
102  BOOST_CHECK(std::abs(driftedSegment[0].x() - driftedSegment[1].x()) >
104  BOOST_CHECK(std::abs(driftedSegment[0].y() - driftedSegment[1].y()) >
106  CHECK_CLOSE_ABS(noDriftSegment[0].x(), driftedSegment[0].x(),
108  CHECK_CLOSE_ABS(noDriftSegment[0].y(), driftedSegment[0].y(),
110  BOOST_CHECK(std::abs(driftedSegment[1].x() - noDriftSegment[1].x()) >
112  CHECK_CLOSE_ABS(driftedSegment[1].y(), noDriftSegment[1].y(),
114 }
115 
116 BOOST_AUTO_TEST_SUITE_END()
117 
118 } // namespace ActsFatras