9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
43 #include <type_traits>
48 using namespace Acts::UnitLiterals;
54 using Linearizer = HelicalTrackLinearizer<Propagator<EigenStepper<>>>;
62 std::uniform_real_distribution<>
vXYDist(-0.1_mm, 0.1_mm);
64 std::uniform_real_distribution<>
vZDist(-20_mm, 20_mm);
66 std::uniform_real_distribution<>
vTDist(-1_ns, 1_ns);
70 std::uniform_real_distribution<>
d0Dist(-0.01_mm, 0.01_mm);
72 std::uniform_real_distribution<>
z0Dist(-0.2_mm, 0.2_mm);
74 std::uniform_real_distribution<>
pTDist(0.4_GeV, 10_GeV);
76 std::uniform_real_distribution<>
phiDist(-M_PI, M_PI);
78 std::uniform_real_distribution<>
thetaDist(1.0, M_PI - 1.0);
80 std::uniform_real_distribution<>
qDist(-1, 1);
82 std::uniform_real_distribution<>
tDist(-0.002_ns, 0.002_ns);
86 std::uniform_real_distribution<>
resIPDist(0., 100_um);
88 std::uniform_real_distribution<>
resAngDist(0., 0.1);
90 std::uniform_real_distribution<>
resQoPDist(-0.1, 0.1);
92 std::uniform_real_distribution<>
resTDist(0.1_ns, 0.2_ns);
116 std::mt19937
gen(seed);
118 auto bField = std::make_shared<ConstantBField>(
Vector3{0.0, 0.0, 1_T});
123 auto propagator = std::make_shared<Propagator<EigenStepper<>>>(
stepper);
134 covMatVtx(0, 0) = 30_mm2;
135 covMatVtx(1, 1) = 30_mm2;
136 covMatVtx(2, 2) = 30_mm2;
137 covMatVtx(3, 3) = 30 * ns2;
147 VertexFitter billoirFitter(vertexFitterCfg);
156 std::function<BoundTrackParameters(InputTrack)> extractParameters =
157 [](
const InputTrack& params) {
return params.parameters(); };
162 CustomVertexFitter customBilloirFitter(customVertexFitterCfg,
171 "Testing FullBilloirVertexFitter when input track vector is empty.") {
172 const std::vector<const BoundTrackParameters*> emptyVector;
176 billoirFitter.fit(emptyVector, linearizer, vfOptions,
state).value();
185 billoirFitter.fit(emptyVector, linearizer, vfOptionsConstr,
state)
188 BOOST_CHECK_EQUAL(fittedVertex.position(),
origin);
189 BOOST_CHECK_EQUAL(fittedVertex.fullCovariance(), zeroMat);
194 for (
int eventIdx = 0; eventIdx <
nEvents; ++eventIdx) {
204 Vector4 trueVertex(x, y, z, t);
205 std::shared_ptr<PerigeeSurface> perigeeSurface =
206 Surface::makeShared<PerigeeSurface>(
Vector3(0., 0., 0.));
209 double d0V = std::hypot(x, y);
213 std::vector<BoundTrackParameters>
tracks;
214 std::vector<InputTrack> customTracks;
217 for (
unsigned int iTrack = 0; iTrack < nTracks; iTrack++) {
219 double q =
qDist(gen) < 0 ? -1. : 1.;
237 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0.,
238 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh,
239 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0.,
243 customTracks.emplace_back(
248 std::vector<const BoundTrackParameters*> tracksPtr;
249 for (
const auto& trk : tracks) {
250 tracksPtr.push_back(&trk);
253 std::vector<const InputTrack*> customTracksPtr;
254 for (
const auto& trk : customTracks) {
255 customTracksPtr.push_back(&trk);
258 auto fit = [&trueVertex, &nTracks](
const auto& fitter,
const auto& trksPtr,
259 const auto& lin,
const auto& vfOpts,
261 auto fittedVertex = fitter.fit(trksPtr, lin, vfOpts, vfState).value();
262 if (!fittedVertex.tracks().empty()) {
264 auto tracksAtVtx = fittedVertex.tracks();
265 auto trackAtVtx = tracksAtVtx[0];
269 std::cout <<
"\nFitting " << nTracks <<
" tracks" << std::endl;
270 std::cout <<
"True Vertex:\n" << trueVertex << std::endl;
271 std::cout <<
"Fitted Vertex:\n"
272 << fittedVertex.fullPosition() << std::endl;
276 "Testing FullBilloirVertexFitter without vertex constraint.") {
277 fit(billoirFitter, tracksPtr, linearizer, vfOptions,
state);
280 "Testing FullBilloirVertexFitter with vertex constraint.") {
281 fit(billoirFitter, tracksPtr, linearizer, vfOptionsConstr,
state);
284 "Testing FullBilloirVertexFitter with custom tracks (no vertex "
286 fit(customBilloirFitter, customTracksPtr, linearizer, customVfOptions,
290 "Testing FullBilloirVertexFitter with custom tracks (with vertex "
292 fit(customBilloirFitter, customTracksPtr, linearizer,
293 customVfOptionsConstr, customState);