Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 07:53:09

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