Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:34

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(GeometryIdentifier().setVolume(searchVolume));
0074   auto otherSurface = Surface::makeShared<PerigeeSurface>(Vector3(0, 0, 0));
0075   otherSurface->assignGeometryId(GeometryIdentifier().setVolume(otherVolume));
0076 
0077   VectorMultiTrajectory traj;
0078 
0079   auto ts = traj.makeTrackState(TrackStatePropMask::None);
0080   ts.typeFlags().set(MeasurementFlag);
0081   ts.setReferenceSurface(searchSurface);
0082 
0083   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0084   ts.typeFlags().set(OutlierFlag);
0085   ts.setReferenceSurface(searchSurface);
0086 
0087   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0088   ts.typeFlags().set(MeasurementFlag);
0089   ts.typeFlags().set(SharedHitFlag);
0090   ts.setReferenceSurface(searchSurface);
0091 
0092   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0093   ts.typeFlags().set(HoleFlag);
0094   ts.setReferenceSurface(searchSurface);
0095 
0096   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0097   ts.typeFlags().set(OutlierFlag);
0098   ts.setReferenceSurface(searchSurface);
0099 
0100   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0101   ts.typeFlags().set(HoleFlag);
0102   ts.setReferenceSurface(searchSurface);
0103 
0104   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0105   ts.typeFlags().set(MeasurementFlag);
0106   ts.typeFlags().set(SharedHitFlag);
0107   ts.setReferenceSurface(otherSurface);
0108 
0109   ts = traj.makeTrackState(TrackStatePropMask::None, ts.index());
0110   ts.typeFlags().set(OutlierFlag);
0111   ts.setReferenceSurface(otherSurface);
0112 
0113   auto state =
0114       Acts::MultiTrajectoryHelpers::trajectoryState(traj, ts.index(), volumes);
0115   BOOST_CHECK_EQUAL(state.at(searchVolume).nHoles, 2);
0116   BOOST_CHECK_EQUAL(state.at(searchVolume).nMeasurements, 2);
0117   BOOST_CHECK_EQUAL(state.at(searchVolume).nOutliers, 2);
0118   BOOST_CHECK_EQUAL(state.at(searchVolume).nSharedHits, 1);
0119 }
0120 
0121 BOOST_AUTO_TEST_SUITE_END()
0122 
0123 }  // namespace Acts::Test