9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
30 using namespace Acts::UnitLiterals;
36 using Propagator = Propagator<EigenStepper<ConstantBField>>;
37 using Linearizer = HelicalTrackLinearizer<Propagator>;
48 std::uniform_real_distribution<>
d0Dist(-0.01
_mm, 0.01
_mm);
50 std::uniform_real_distribution<>
z0Dist(-0.2
_mm, 0.2
_mm);
58 std::uniform_real_distribution<>
qDist(-1, 1);
62 std::uniform_real_distribution<>
resAngDist(0., 0.1);
64 std::uniform_real_distribution<>
resQoPDist(-0.01, 0.01);
90 std::mt19937 gen(mySeed);
95 for (
unsigned int iEvent = 0; iEvent <
nEvents; ++iEvent) {
103 auto propagator = std::make_shared<Propagator>(
stepper);
114 BilloirFitter bFitter(vertexFitterCfg);
120 IPEstimator ipEstimator(ipEstimatorCfg);
124 static_assert(VertexFinderConcept<ZScanSeedFinder>,
125 "Vertex finder does not fulfill vertex finder concept.");
129 ZScanSeedFinder sFinder(seedFinderCfg);
134 static_assert(VertexFinderConcept<VertexFinder>,
135 "Vertex finder does not fulfill vertex finder concept.");
140 cfg.reassignTracksAfterFirstFit =
true;
145 std::vector<std::unique_ptr<const BoundParameters>> tracks;
147 std::vector<const BoundParameters*> tracksPtr;
150 std::vector<Vertex<BoundParameters>> trueVertices;
154 for (
unsigned int iVertex = 0; iVertex < nVertices; ++iVertex) {
159 std::cout <<
"Event " << iEvent <<
", Vertex " << iVertex <<
"/"
160 << nVertices <<
" with " << nTracks <<
" tracks."
164 std::shared_ptr<PerigeeSurface> perigeeSurface =
165 Surface::makeShared<PerigeeSurface>(
Vector3D(0., 0., 0.));
174 std::vector<TrackAtVertex<BoundParameters>> tracksAtTrueVtx;
177 double d0_v = sqrt(x * x + y * y);
182 for (
unsigned int iTrack = 0; iTrack < nTracks; iTrack++) {
184 double q =
qDist(gen) < 0 ? -1. : 1.;
188 double z0track = z0_v +
z0Dist(gen);
201 covMat << res_d0 * res_d0, 0., 0., 0., 0., 0., 0., res_z0 * res_z0, 0.,
202 0., 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0.,
203 res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0.,
208 tracks.push_back(std::make_unique<BoundParameters>(params));
211 tracksAtTrueVtx.push_back(trAtVt);
215 trueVertices.push_back(trueV);
220 std::shuffle(std::begin(tracks), std::end(tracks), gen);
222 for (
const auto& trk : tracks) {
223 tracksPtr.push_back(trk.get());
230 auto res = finder.find(tracksPtr, vertexingOptions);
232 BOOST_CHECK(res.ok());
235 std::cout << res.error().message() << std::endl;
239 auto vertexCollection = *res;
245 std::cout <<
"########## RESULT: ########## Event " << iEvent
247 std::cout <<
"Number of true vertices: " << nVertices << std::endl;
248 std::cout <<
"Number of reco vertices: " << vertexCollection.size()
252 std::cout <<
"----- True vertices -----" << std::endl;
253 for (
const auto& vertex : trueVertices) {
255 std::cout << count <<
". True Vertex:\t Position:"
256 <<
"(" << pos[
eX] <<
"," << pos[
eY] <<
"," << pos[
eZ] <<
")"
258 std::cout <<
"Number of tracks: " << vertex.tracks().size() << std::endl
262 std::cout <<
"----- Reco vertices -----" << std::endl;
264 for (
const auto& vertex : vertexCollection) {
266 std::cout << count <<
". Reco Vertex:\t Position:"
267 <<
"(" << pos[
eX] <<
"," << pos[
eY] <<
"," << pos[
eZ] <<
")"
269 std::cout <<
"Number of tracks: " << vertex.tracks().size() << std::endl
276 bool allVerticesFound =
true;
277 for (
const auto& trueVertex : trueVertices) {
279 bool currentVertexFound =
false;
280 for (
const auto& recoVertex : vertexCollection) {
284 if (zDistance < 2
_mm) {
285 currentVertexFound =
true;
288 if (!currentVertexFound) {
289 allVerticesFound =
false;
294 BOOST_TEST(allVerticesFound);
307 std::mt19937 gen(mySeed);
312 for (
unsigned int iEvent = 0; iEvent <
nEvents; ++iEvent) {
320 auto propagator = std::make_shared<Propagator>(
stepper);
331 std::function<BoundParameters(InputTrack)> extractParameters =
332 [](
InputTrack params) {
return params.parameters(); };
337 BilloirFitter bFitter(vertexFitterCfg, extractParameters);
343 IPEstimator ipEstimator(ipEstimatorCfg);
348 ZScanSeedFinder sFinder(seedFinderCfg, extractParameters);
354 cfg.reassignTracksAfterFirstFit =
true;
359 std::vector<std::unique_ptr<const InputTrack>> tracks;
361 std::vector<const InputTrack*> tracksPtr;
364 std::vector<Vertex<InputTrack>> trueVertices;
368 for (
unsigned int iVertex = 0; iVertex < nVertices; ++iVertex) {
373 std::cout <<
"Event " << iEvent <<
", Vertex " << iVertex <<
"/"
374 << nVertices <<
" with " << nTracks <<
" tracks."
378 std::shared_ptr<PerigeeSurface> perigeeSurface =
379 Surface::makeShared<PerigeeSurface>(
Vector3D(0., 0., 0.));
388 std::vector<TrackAtVertex<InputTrack>> tracksAtTrueVtx;
391 double d0_v = sqrt(x * x + y * y);
396 for (
unsigned int iTrack = 0; iTrack < nTracks; iTrack++) {
398 double q =
qDist(gen) < 0 ? -1. : 1.;
402 double z0track = z0_v +
z0Dist(gen);
416 covMat << res_d0 * res_d0, 0., 0., 0., 0., 0., 0., res_z0 * res_z0, 0.,
417 0., 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0.,
418 res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0.,
421 geoContext, std::move(covMat), paramVec, perigeeSurface));
423 tracks.push_back(std::make_unique<InputTrack>(paramsUT));
425 auto params = extractParameters(paramsUT);
428 tracksAtTrueVtx.push_back(trAtVt);
432 trueVertices.push_back(trueV);
437 std::shuffle(std::begin(tracks), std::end(tracks), gen);
439 for (
const auto& trk : tracks) {
440 tracksPtr.push_back(trk.get());
447 auto res = finder.find(tracksPtr, vertexingOptionsUT);
449 BOOST_CHECK(res.ok());
452 std::cout << res.error().message() << std::endl;
456 auto vertexCollectionUT = *res;
462 std::cout <<
"########## RESULT: ########## Event " << iEvent
464 std::cout <<
"Number of true vertices: " << nVertices << std::endl;
465 std::cout <<
"Number of reco vertices: " << vertexCollectionUT.size()
469 std::cout <<
"----- True vertices -----" << std::endl;
470 for (
const auto& vertex : trueVertices) {
472 std::cout << count <<
". True Vertex:\t Position:"
473 <<
"(" << pos[
eX] <<
"," << pos[
eY] <<
"," << pos[
eZ] <<
")"
475 std::cout <<
"Number of tracks: " << vertex.tracks().size() << std::endl
479 std::cout <<
"----- Reco vertices -----" << std::endl;
481 for (
const auto& vertex : vertexCollectionUT) {
483 std::cout << count <<
". Reco Vertex:\t Position:"
484 <<
"(" << pos[
eX] <<
"," << pos[
eY] <<
"," << pos[
eZ] <<
")"
486 std::cout <<
"Number of tracks: " << vertex.tracks().size() << std::endl
493 bool allVerticesFound =
true;
494 for (
const auto& trueVertex : trueVertices) {
496 bool currentVertexFound =
false;
497 for (
const auto& recoVertex : vertexCollectionUT) {
501 if (zDistance < 2
_mm) {
502 currentVertexFound =
true;
505 if (!currentVertexFound) {
506 allVerticesFound =
false;
511 BOOST_TEST(allVerticesFound);