Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-16 08:49:43

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   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0062   ts.typeFlags().setIsMeasurement();
0063   ts.typeFlags().setIsSplitHit();
0064   ts.setReferenceSurface(surface);
0065 
0066   auto state = MultiTrajectoryHelpers::trajectoryState(traj, ts.index());
0067   BOOST_CHECK_EQUAL(state.nHoles, 2);
0068   BOOST_CHECK_EQUAL(state.nMeasurements, 4);
0069   BOOST_CHECK_EQUAL(state.nOutliers, 3);
0070   BOOST_CHECK_EQUAL(state.nSharedHits, 2);
0071   BOOST_CHECK_EQUAL(state.nSplitHits, 1);
0072   BOOST_CHECK_EQUAL(state.nStates, 9);
0073 }
0074 
0075 BOOST_AUTO_TEST_CASE(trajectoryStateVolume) {
0076   GeometryIdentifier::Value searchVolume = 1;
0077   GeometryIdentifier::Value otherVolume = 2;
0078   std::vector<GeometryIdentifier::Value> volumes = {searchVolume};
0079 
0080   auto searchSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0081   searchSurface->assignGeometryId(
0082       GeometryIdentifier().withVolume(searchVolume));
0083   auto otherSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0084   otherSurface->assignGeometryId(GeometryIdentifier().withVolume(otherVolume));
0085 
0086   VectorMultiTrajectory traj;
0087 
0088   auto ts = traj.makeTrackState(TrackStatePropMask::None);
0089   ts.typeFlags().setIsMeasurement();
0090   ts.setReferenceSurface(searchSurface);
0091 
0092   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0093   ts.typeFlags().setIsOutlier();
0094   ts.setReferenceSurface(searchSurface);
0095 
0096   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0097   ts.typeFlags().setIsMeasurement();
0098   ts.typeFlags().setIsSharedHit();
0099   ts.setReferenceSurface(searchSurface);
0100 
0101   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0102   ts.typeFlags().setIsHole();
0103   ts.setReferenceSurface(searchSurface);
0104 
0105   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0106   ts.typeFlags().setIsOutlier();
0107   ts.setReferenceSurface(searchSurface);
0108 
0109   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0110   ts.typeFlags().setIsHole();
0111   ts.setReferenceSurface(searchSurface);
0112 
0113   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0114   ts.typeFlags().setIsMeasurement();
0115   ts.typeFlags().setIsSharedHit();
0116   ts.setReferenceSurface(otherSurface);
0117 
0118   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0119   ts.typeFlags().setIsOutlier();
0120   ts.setReferenceSurface(otherSurface);
0121 
0122   auto state =
0123       MultiTrajectoryHelpers::trajectoryState(traj, ts.index(), volumes);
0124   BOOST_CHECK_EQUAL(state.at(searchVolume).nHoles, 2);
0125   BOOST_CHECK_EQUAL(state.at(searchVolume).nMeasurements, 2);
0126   BOOST_CHECK_EQUAL(state.at(searchVolume).nOutliers, 2);
0127   BOOST_CHECK_EQUAL(state.at(searchVolume).nSharedHits, 1);
0128 }
0129 
0130 BOOST_AUTO_TEST_SUITE_END()
0131 
0132 }  // namespace ActsTests