9 #include <boost/test/unit_test.hpp>
42 using namespace Acts::UnitLiterals;
53 return meas == rhs.
meas;
77 std::normal_distribution<double>
gauss(0., 1.);
96 struct MeasurementCreator {
98 MeasurementCreator() =
default;
112 template <
typename propagator_state_t,
typename stepper_t>
113 void operator()(propagator_state_t& state,
const stepper_t&
stepper,
116 auto surface = state.navigation.currentSurface;
119 auto volumeID = geoID.volume();
120 auto layerID = geoID.layer();
122 auto vResolution = detectorResolution.find(volumeID);
123 if (vResolution != detectorResolution.end()) {
125 auto lResolution = vResolution->second.find(layerID);
126 if (lResolution != vResolution->second.end()) {
129 surface->globalToLocal(state.geoContext,
130 stepper.position(state.stepping),
131 stepper.direction(state.stepping), lPos);
132 if (lResolution->second.size() == 1) {
133 double sp = lResolution->second[0].second;
136 if (lResolution->second[0].first ==
eLOC_0) {
140 result.push_back(std::move(m0));
145 result.push_back(std::move(m1));
147 }
else if (lResolution->second.size() == 2) {
149 double sx = lResolution->second[
eLOC_0].second;
150 double sy = lResolution->second[
eLOC_1].second;
151 cov2D << sx * sx, 0., 0., sy * sy;
158 result.push_back(std::move(m01));
188 MeasurementPropagator mPropagator(mStepper, mNavigator);
204 pixelVolumeRes[2] = pixelElementRes;
205 pixelVolumeRes[4] = pixelElementRes;
208 stripVolumeRes[2] = stripElementResI;
209 stripVolumeRes[4] = stripElementResO;
210 stripVolumeRes[6] = stripElementResI;
211 stripVolumeRes[8] = stripElementResO;
214 detRes[2] = pixelVolumeRes;
215 detRes[3] = stripVolumeRes;
225 std::multimap<size_t, FittableMeasurement<SourceLink>> measurements;
228 std::vector<SourceLink> sourcelinks;
232 std::map<size_t, Vector3D> startingPos;
233 startingPos.emplace(0,
Vector3D{-3
_m, 0., 0.});
234 startingPos.emplace(1,
Vector3D{-3
_m, -1.0 *
eps, -1.0 * eps});
241 for (
const auto& [trackID, mPos] : startingPos) {
245 auto mResult = mPropagator.propagate(mStart, mOptions).value();
247 const auto debugString =
248 mResult.template get<DebugOutput::result_type>().debugString;
249 std::cout <<
">>>> Measurement creation: " << std::endl;
250 std::cout << debugString;
254 auto measurementsCreated =
255 std::move(mResult.template get<MeasurementCreator::result_type>());
256 for (
auto& meas : measurementsCreated) {
257 measurements.emplace(trackID, std::move(meas));
263 std::back_inserter(sourcelinks), [](
const auto&
m) {
268 BOOST_CHECK_EQUAL(sourcelinks.size(), 18);
273 rNavigator.resolvePassive =
false;
274 rNavigator.resolveMaterial =
true;
275 rNavigator.resolveSensitive =
true;
280 RecoStepper rStepper(bField);
282 RecoPropagator rPropagator(rStepper, rNavigator);
292 SourceLinkSelectorConfig sourcelinkSelectorConfig;
297 sourcelinkSelectorConfig.layerMaxChi2 = {{2, {{2, 8}, {4, 7}}}};
302 sourcelinkSelectorConfig.volumeMaxChi2 = {{2, 7}, {3, 8}};
303 sourcelinkSelectorConfig.maxChi2 = 8;
305 sourcelinkSelectorConfig.maxNumSourcelinksOnSurface = 100;
313 for (
const auto& [trackID,
pos] : startingPos) {
316 cov << pow(10
_um, 2), 0., 0., 0., 0., 0., 0., pow(10
_um, 2), 0., 0., 0., 0.,
317 0., 0., pow(0.0002, 2), 0., 0., 0., 0., 0., 0., pow(0.0002, 2), 0., 0.,
318 0., 0., 0., 0., 0.0001, 0., 0., 0., 0., 0., 0., 1.;
325 1
_GeV * cos(rTheta) * sin(rPhi), 1
_GeV * sin(rTheta));
336 auto combKalmanFilterRes = cKF.
findTracks(sourcelinks, rStart, ckfOptions);
337 BOOST_CHECK(combKalmanFilterRes.ok());
338 auto foundTrack = *combKalmanFilterRes;
339 auto& fittedStates = foundTrack.fittedStates;
340 auto& trackTips = foundTrack.trackTips;
342 for (
const auto& tip : trackTips) {
343 std::vector<size_t> sourceIds;
344 fittedStates.visitBackwards(tip, [&](
const auto& trackState) {
345 sourceIds.push_back(trackState.uncalibrated().sourceID);
348 BOOST_CHECK_EQUAL(sourceIds.size(), 6);
350 size_t numFakeHit = 0;
351 for (
const auto&
id : sourceIds) {
352 numFakeHit = numFakeHit + (
id != trackID ? 1 : 0);
356 BOOST_CHECK_EQUAL(numFakeHit, 0);