9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
31 using namespace Acts::UnitLiterals;
43 constexpr
size_t mainGridSize = 400;
44 constexpr
size_t trkGridSize = 15;
49 double zMinMax = mainGridSize / 2 * binSize;
57 covMat << 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0,
58 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1;
61 paramVec1 << 0.01, 0.15, 0, 0, 0, 0;
64 paramVec2 << trkGridSize * binSize - 0.1, 0.15, 0, 0, 0, 0;
67 paramVec3 << trkGridSize * binSize + 0.01, 0.15, 0, 0, 0, 0;
70 paramVec3_1 << -(trkGridSize * binSize + 0.01), 0.15, 0, 0, 0, 0;
73 paramVec4 << 0.01, 19.95, 0, 0, 0, 0;
76 paramVec5 << 0.01, -19.95, 0, 0, 0, 0;
79 paramVec6 << 0.01, -100.0, 0, 0, 0, 0;
82 paramVec7 << 0.01, +100.0, 0, 0, 0, 0;
85 std::shared_ptr<PerigeeSurface> perigeeSurface =
86 Surface::makeShared<PerigeeSurface>(
Vector3(0., 0., 0.));
106 Grid::MainGridVector mainGrid = Grid::MainGridVector::Zero();
110 std::pair<int, Grid::TrackGridVector> binAndTrackGrid;
113 binAndTrackGrid = grid.addTrack(params3, mainGrid);
114 binAndTrackGrid = grid.addTrack(params3_1, mainGrid);
116 binAndTrackGrid = grid.addTrack(params6, mainGrid);
117 binAndTrackGrid = grid.addTrack(params7, mainGrid);
121 auto zeroGrid = Grid::MainGridVector::Zero();
122 BOOST_CHECK_EQUAL(mainGrid, zeroGrid);
125 binAndTrackGrid = grid.addTrack(params1, mainGrid);
126 auto gridCopy = mainGrid;
128 mainGrid = Grid::MainGridVector::Zero();
129 binAndTrackGrid = grid.addTrack(params2, mainGrid);
133 BOOST_CHECK(gridCopy.sum() > mainGrid.sum());
137 binAndTrackGrid = grid.addTrack(params1, mainGrid);
138 BOOST_CHECK_EQUAL(gridCopy.sum(), mainGrid.sum());
140 binAndTrackGrid = grid.addTrack(params4, mainGrid);
143 BOOST_CHECK_EQUAL(mainGrid(mainGridSize -
int((trkGridSize - 1) / 2) - 2),
145 BOOST_CHECK(mainGrid(mainGridSize -
int((trkGridSize - 1) / 2) - 1) > 0.);
146 BOOST_CHECK(mainGrid(mainGridSize - 1) > 0.);
148 binAndTrackGrid = grid.addTrack(params5, mainGrid);
150 BOOST_CHECK_EQUAL(mainGrid(
int((trkGridSize - 1) / 2) + 1), 0.);
151 BOOST_CHECK(mainGrid(
int((trkGridSize - 1) / 2)) > 0.);
152 BOOST_CHECK(mainGrid(0) > 0.);
155 auto maxRes = grid.getMaxZPosition(mainGrid);
156 int maxBin =
static_cast<int>((*maxRes / binSize) + mainGridSize / 2);
157 BOOST_CHECK_EQUAL(maxBin, 0);
160 mainGrid = Grid::MainGridVector::Zero();
161 auto maxResErr = grid.getMaxZPosition(mainGrid);
162 BOOST_CHECK(!maxResErr.ok());
165 binAndTrackGrid = grid.addTrack(params1, mainGrid);
166 binAndTrackGrid = grid.addTrack(params2, mainGrid);
169 binAndTrackGrid = grid.addTrack(params4, mainGrid);
171 BOOST_CHECK(gridCopy != mainGrid);
173 int zBin = binAndTrackGrid.first;
174 auto trackGrid = binAndTrackGrid.second;
175 grid.removeTrackGridFromMainGrid(zBin, trackGrid, mainGrid);
177 BOOST_CHECK_EQUAL(gridCopy, mainGrid);
183 constexpr
int mainGridSize = 50;
184 constexpr
int trkGridSize = 11;
188 double binSize = 0.1;
189 double zMinMax = mainGridSize / 2 * binSize;
193 cfg.useHighestSumZPosition =
true;
198 covMat << 1
e-2, 0, 0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0,
199 0, 1e-2, 0, 0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 1e-2;
201 const double posZ1 = -1.75;
202 const double posZ2 = 1.75;
207 paramVec1 << 0.01, posZ1, 0, 0, 0, 0;
209 paramVec2 << 0.015, posZ2, 0, 0, 0, 0;
212 std::shared_ptr<PerigeeSurface> perigeeSurface =
213 Surface::makeShared<PerigeeSurface>(
Vector3(0., 0., 0.));
221 Grid::MainGridVector mainGrid = Grid::MainGridVector::Zero();
225 std::pair<int, Grid::TrackGridVector> binAndTrackGrid;
227 binAndTrackGrid = grid.addTrack(params1, mainGrid);
228 binAndTrackGrid = grid.addTrack(params2, mainGrid);
231 int maxZbin =
static_cast<int>((posZ2 / binSize + mainGridSize / 2.));
232 mainGrid(maxZbin - 1) += 1;
233 mainGrid(maxZbin + 1) += 1;
238 auto maxRes = grid.getMaxZPosition(mainGrid);
239 BOOST_CHECK(maxRes.ok());
240 BOOST_CHECK_EQUAL(*maxRes, posZ2);
246 constexpr
int mainGridSize = 50;
247 constexpr
int trkGridSize = 11;
251 double binSize = 0.1;
252 double zMinMax = mainGridSize / 2 * binSize;
256 cfg.useHighestSumZPosition =
true;
261 covMat << 1
e-2, 0, 0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0,
262 0, 1e-2, 0, 0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 1e-2;
264 const double posZ1 = -1.75;
265 const double posZ2 = 1.75;
270 paramVec1 << 0.01, posZ1, 0, 0, 0, 0;
272 paramVec2 << 0.015, posZ2, 0, 0, 0, 0;
275 std::shared_ptr<PerigeeSurface> perigeeSurface =
276 Surface::makeShared<PerigeeSurface>(
Vector3(0., 0., 0.));
284 Grid::MainGridVector mainGrid = Grid::MainGridVector::Zero();
288 std::pair<int, Grid::TrackGridVector> binAndTrackGrid;
290 binAndTrackGrid = grid.addTrack(params1, mainGrid);
291 binAndTrackGrid = grid.addTrack(params2, mainGrid);
294 int maxZbin =
static_cast<int>((posZ2 / binSize + mainGridSize / 2.));
295 mainGrid(maxZbin - 1) += 1;
296 mainGrid(maxZbin + 1) += 1;
302 auto maxRes = grid.getMaxZPositionAndWidth(mainGrid);
303 BOOST_CHECK(maxRes.ok());
304 double z = (*maxRes).first;
305 double width = (*maxRes).second;
307 BOOST_CHECK_EQUAL(z, posZ2);
309 BOOST_CHECK(width != 0.);