Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 07:46:16

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/EventData/MultiTrajectoryHelpers.hpp"
0012 #include "Acts/EventData/VectorMultiTrajectory.hpp"
0013 #include "Acts/Geometry/GeometryIdentifier.hpp"
0014 #include "Acts/Surfaces/PerigeeSurface.hpp"
0015 
0016 using namespace Acts;
0017 
0018 namespace ActsTests {
0019 
0020 BOOST_AUTO_TEST_SUITE(EventDataSuite)
0021 
0022 BOOST_AUTO_TEST_CASE(trajectoryState) {
0023   auto surface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0024 
0025   VectorMultiTrajectory traj;
0026 
0027   auto ts = traj.makeTrackState(TrackStatePropMask::None);
0028   ts.typeFlags().setIsMeasurement();
0029   ts.setReferenceSurface(surface);
0030 
0031   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0032   ts.typeFlags().setIsOutlier();
0033   ts.setReferenceSurface(surface);
0034 
0035   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0036   ts.typeFlags().setIsMeasurement();
0037   ts.typeFlags().setIsSharedHit();
0038   ts.setReferenceSurface(surface);
0039 
0040   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0041   ts.typeFlags().setIsHole();
0042   ts.setReferenceSurface(surface);
0043 
0044   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0045   ts.typeFlags().setIsOutlier();
0046   ts.setReferenceSurface(surface);
0047 
0048   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0049   ts.typeFlags().setIsHole();
0050   ts.setReferenceSurface(surface);
0051 
0052   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0053   ts.typeFlags().setIsMeasurement();
0054   ts.typeFlags().setIsSharedHit();
0055   ts.setReferenceSurface(surface);
0056 
0057   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0058   ts.typeFlags().setIsOutlier();
0059   ts.setReferenceSurface(surface);
0060 
0061   auto state = MultiTrajectoryHelpers::trajectoryState(traj, ts.index());
0062   BOOST_CHECK_EQUAL(state.nHoles, 2);
0063   BOOST_CHECK_EQUAL(state.nMeasurements, 3);
0064   BOOST_CHECK_EQUAL(state.nOutliers, 3);
0065   BOOST_CHECK_EQUAL(state.nSharedHits, 2);
0066   BOOST_CHECK_EQUAL(state.nStates, 8);
0067 }
0068 
0069 BOOST_AUTO_TEST_CASE(trajectoryStateVolume) {
0070   GeometryIdentifier::Value searchVolume = 1;
0071   GeometryIdentifier::Value otherVolume = 2;
0072   std::vector<GeometryIdentifier::Value> volumes = {searchVolume};
0073 
0074   auto searchSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0075   searchSurface->assignGeometryId(
0076       GeometryIdentifier().withVolume(searchVolume));
0077   auto otherSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0078   otherSurface->assignGeometryId(GeometryIdentifier().withVolume(otherVolume));
0079 
0080   VectorMultiTrajectory traj;
0081 
0082   auto ts = traj.makeTrackState(TrackStatePropMask::None);
0083   ts.typeFlags().setIsMeasurement();
0084   ts.setReferenceSurface(searchSurface);
0085 
0086   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0087   ts.typeFlags().setIsOutlier();
0088   ts.setReferenceSurface(searchSurface);
0089 
0090   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0091   ts.typeFlags().setIsMeasurement();
0092   ts.typeFlags().setIsSharedHit();
0093   ts.setReferenceSurface(searchSurface);
0094 
0095   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0096   ts.typeFlags().setIsHole();
0097   ts.setReferenceSurface(searchSurface);
0098 
0099   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0100   ts.typeFlags().setIsOutlier();
0101   ts.setReferenceSurface(searchSurface);
0102 
0103   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0104   ts.typeFlags().setIsHole();
0105   ts.setReferenceSurface(searchSurface);
0106 
0107   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0108   ts.typeFlags().setIsMeasurement();
0109   ts.typeFlags().setIsSharedHit();
0110   ts.setReferenceSurface(otherSurface);
0111 
0112   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0113   ts.typeFlags().setIsOutlier();
0114   ts.setReferenceSurface(otherSurface);
0115 
0116   auto state =
0117       MultiTrajectoryHelpers::trajectoryState(traj, ts.index(), volumes);
0118   BOOST_CHECK_EQUAL(state.at(searchVolume).nHoles, 2);
0119   BOOST_CHECK_EQUAL(state.at(searchVolume).nMeasurements, 2);
0120   BOOST_CHECK_EQUAL(state.at(searchVolume).nOutliers, 2);
0121   BOOST_CHECK_EQUAL(state.at(searchVolume).nSharedHits, 1);
0122 }
0123 
0124 BOOST_AUTO_TEST_SUITE_END()
0125 
0126 }  // namespace ActsTests