Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:21:45

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 #include "Acts/Surfaces/PlaneSurface.hpp"
0016 
0017 using namespace Acts;
0018 
0019 namespace ActsTests {
0020 
0021 BOOST_AUTO_TEST_SUITE(EventDataSuite)
0022 
0023 BOOST_AUTO_TEST_CASE(trajectoryState) {
0024   auto surface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0025 
0026   VectorMultiTrajectory traj;
0027 
0028   auto ts = traj.makeTrackState(TrackStatePropMask::None);
0029   ts.typeFlags().set(MeasurementFlag);
0030   ts.setReferenceSurface(surface);
0031 
0032   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0033   ts.typeFlags().set(OutlierFlag);
0034   ts.setReferenceSurface(surface);
0035 
0036   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0037   ts.typeFlags().set(MeasurementFlag);
0038   ts.typeFlags().set(SharedHitFlag);
0039   ts.setReferenceSurface(surface);
0040 
0041   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0042   ts.typeFlags().set(HoleFlag);
0043   ts.setReferenceSurface(surface);
0044 
0045   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0046   ts.typeFlags().set(OutlierFlag);
0047   ts.setReferenceSurface(surface);
0048 
0049   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0050   ts.typeFlags().set(HoleFlag);
0051   ts.setReferenceSurface(surface);
0052 
0053   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0054   ts.typeFlags().set(MeasurementFlag);
0055   ts.typeFlags().set(SharedHitFlag);
0056   ts.setReferenceSurface(surface);
0057 
0058   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0059   ts.typeFlags().set(OutlierFlag);
0060   ts.setReferenceSurface(surface);
0061 
0062   auto state = MultiTrajectoryHelpers::trajectoryState(traj, ts.index());
0063   BOOST_CHECK_EQUAL(state.nHoles, 2);
0064   BOOST_CHECK_EQUAL(state.nMeasurements, 3);
0065   BOOST_CHECK_EQUAL(state.nOutliers, 3);
0066   BOOST_CHECK_EQUAL(state.nSharedHits, 2);
0067   BOOST_CHECK_EQUAL(state.nStates, 8);
0068 }
0069 
0070 BOOST_AUTO_TEST_CASE(trajectoryStateVolume) {
0071   GeometryIdentifier::Value searchVolume = 1;
0072   GeometryIdentifier::Value otherVolume = 2;
0073   std::vector<GeometryIdentifier::Value> volumes = {searchVolume};
0074 
0075   auto searchSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0076   searchSurface->assignGeometryId(
0077       GeometryIdentifier().withVolume(searchVolume));
0078   auto otherSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0079   otherSurface->assignGeometryId(GeometryIdentifier().withVolume(otherVolume));
0080 
0081   VectorMultiTrajectory traj;
0082 
0083   auto ts = traj.makeTrackState(TrackStatePropMask::None);
0084   ts.typeFlags().set(MeasurementFlag);
0085   ts.setReferenceSurface(searchSurface);
0086 
0087   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0088   ts.typeFlags().set(OutlierFlag);
0089   ts.setReferenceSurface(searchSurface);
0090 
0091   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0092   ts.typeFlags().set(MeasurementFlag);
0093   ts.typeFlags().set(SharedHitFlag);
0094   ts.setReferenceSurface(searchSurface);
0095 
0096   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0097   ts.typeFlags().set(HoleFlag);
0098   ts.setReferenceSurface(searchSurface);
0099 
0100   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0101   ts.typeFlags().set(OutlierFlag);
0102   ts.setReferenceSurface(searchSurface);
0103 
0104   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0105   ts.typeFlags().set(HoleFlag);
0106   ts.setReferenceSurface(searchSurface);
0107 
0108   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0109   ts.typeFlags().set(MeasurementFlag);
0110   ts.typeFlags().set(SharedHitFlag);
0111   ts.setReferenceSurface(otherSurface);
0112 
0113   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0114   ts.typeFlags().set(OutlierFlag);
0115   ts.setReferenceSurface(otherSurface);
0116 
0117   auto state =
0118       MultiTrajectoryHelpers::trajectoryState(traj, ts.index(), volumes);
0119   BOOST_CHECK_EQUAL(state.at(searchVolume).nHoles, 2);
0120   BOOST_CHECK_EQUAL(state.at(searchVolume).nMeasurements, 2);
0121   BOOST_CHECK_EQUAL(state.at(searchVolume).nOutliers, 2);
0122   BOOST_CHECK_EQUAL(state.at(searchVolume).nSharedHits, 1);
0123 }
0124 
0125 BOOST_AUTO_TEST_SUITE_END()
0126 
0127 }  // namespace ActsTests