Performs the actual test.
189 auto expectedTracksHandle
190 =
event.getValidHandle<std::vector<recob::Track>>(
tracksTag);
191 auto const& expectedTracks = *expectedTracksHandle;
193 mf::LogInfo(
"TrackProxyTest")
194 <<
"Starting test on " << expectedTracks.size() <<
" tracks from '"
197 art::FindManyP<recob::Hit> hitsPerTrack
198 (expectedTracksHandle, event,
tracksTag);
200 art::FindOneP<recob::TrackTrajectory> trajectoryPerTrack
201 (expectedTracksHandle, event,
tracksTag);
203 auto const& expectedTrackFitHitInfo
204 = *(
event.getValidHandle<std::vector<std::vector<recob::TrackFitHitInfo>>>
208 , proxy::withAssociatedAs<recob::Hit, tag::SpecialHits>()
217 "Track proxy does NOT have space points available!!!");
221 "recob::TrackFitHitInfo not found!!!"
225 BOOST_TEST(
tracks.empty() == expectedTracks.empty());
226 BOOST_TEST(
tracks.size() == expectedTracks.size());
228 BOOST_TEST(
tracks.size() == expectedTrackFitHitInfo.size());
229 decltype(
auto) allFitHitInfo =
tracks.
get<recob::TrackFitHitInfo>();
231 std::is_lvalue_reference<decltype(allFitHitInfo)>(),
232 "Copy of parallel data!"
235 (allFitHitInfo.data() ==
std::addressof(expectedTrackFitHitInfo));
239 BOOST_TEST(fitHitInfoSize == expectedTrackFitHitInfo.
size());
241 std::
size_t iExpectedTrack = 0;
243 BOOST_TEST_CHECKPOINT(
"Track #" << trackProxy.index());
245 auto const& expectedTrack = expectedTracks[iExpectedTrack];
246 auto const& expectedHits = hitsPerTrack.at(iExpectedTrack);
247 auto const& expectedFitHitInfo = expectedTrackFitHitInfo[iExpectedTrack];
248 auto const& expectedTrajPtr = trajectoryPerTrack.at(iExpectedTrack);
250 = expectedTrajPtr.isNull()?
nullptr: expectedTrajPtr.get();
255 (std::addressof(trackRef) == std::addressof(expectedTrack));
257 (std::addressof(trackProxy.track()) == std::addressof(expectedTrack));
258 BOOST_TEST(trackProxy.nHits() == expectedHits.size());
259 BOOST_TEST(trackProxy.index() == iExpectedTrack);
261 decltype(
auto) fitHitInfo = trackProxy.
get<recob::TrackFitHitInfo>();
263 std::is_lvalue_reference<decltype(fitHitInfo)>(),
264 "Copy of parallel data
element!"
267 (
std::addressof(fitHitInfo),
std::addressof(expectedFitHitInfo));
268 BOOST_TEST(fitHitInfo.size() == expectedFitHitInfo.size());
271 (trackProxy.
get<tag::SpecialHits>().size(), expectedHits.size());
275 (trackProxy.hasOriginalTrajectory() == !expectedTrajPtr.isNull());
276 if (expectedTrajCPtr) {
277 BOOST_TEST(trackProxy.originalTrajectoryPtr() == expectedTrajPtr);
278 BOOST_TEST(&trackProxy.originalTrajectory() == expectedTrajPtr.get());
281 BOOST_TEST(!(trackProxy.originalTrajectoryPtr()));
286 std::addressof(expectedTrack.Trajectory())
292 BOOST_TEST(trackProxy->NPoints() == expectedTrack.NPoints());
295 std::array<unsigned int, recob::TrajectoryPointFlagTraits::maxFlags()>
298 std::size_t iPoint = 0;
299 for (
auto const& pointInfo: trackProxy.points()) {
300 BOOST_TEST_CHECKPOINT(
" point #" << pointInfo.index());
302 decltype(
auto) expectedPointFlags = expectedTrack.FlagsAtPoint(iPoint);
304 BOOST_TEST(pointInfo.index() == iPoint);
306 pointInfo.position() ==
307 expectedTrack.Trajectory().LocationAtPoint(iPoint)
310 (pointInfo.momentum() == expectedTrack.MomentumVectorAtPoint(iPoint));
311 BOOST_TEST(pointInfo.flags() == expectedPointFlags);
312 if (expectedPointFlags.hasOriginalHitIndex()) {
314 (pointInfo.hitPtr().key() == expectedPointFlags.fromHit());
317 BOOST_TEST(!pointInfo.hitPtr());
328 if (!expectedPointFlags.isDefined(
flag))
continue;
329 if (expectedPointFlags.isSet(
flag)) ++flagCounts[
flag.index()];
333 (fitHitInfo[iPoint].WireId() == expectedFitHitInfo[iPoint].WireId());
335 (pointInfo.fitInfoPtr() == std::addressof(expectedFitHitInfo[iPoint]));
337 std::addressof(fitHitInfo[iPoint]) ==
338 std::addressof(expectedFitHitInfo[iPoint])
343 BOOST_TEST(iPoint == expectedTrack.NPoints());
353 BOOST_TEST_CHECKPOINT(
" flag: " <<
flag);
354 unsigned int flagCount = 0U;
355 for (
auto const& pointInfo: trackProxy.pointsWithFlags(
flag)) {
357 BOOST_TEST_CHECKPOINT(
" point #" << pointInfo.index());
358 BOOST_TEST(pointInfo.flags().isDefined(
flag));
359 BOOST_TEST(pointInfo.flags().isSet(
flag));
363 BOOST_TEST(flagCount == flagCounts[
flag.index()]);
368 BOOST_TEST(iExpectedTrack == expectedTracks.size());
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
auto withOriginalTrajectory(art::InputTag const &inputTag)
Adds recob::TrackTrajectory information to the proxy.
then if[["$THISISATEST"==1]]
static constexpr Flag_t Suspicious
The point reconstruction is somehow questionable.
ClusterModuleLabel join with tracks
static constexpr Flag_t NoPoint
The trajectory point is not defined.
then echo unknown compiler flag
std::size_t size(FixedBins< T, C > const &) noexcept
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
A trajectory in space reconstructed from hits.
Object storing per-hit information from a track fit.
for($it=0;$it< $RaceTrack_number;$it++)
auto end(FixedBins< T, C > const &) noexcept
static constexpr Flag_t HitIgnored
Hit was not included for the computation of the trajectory.
auto begin(FixedBins< T, C > const &) noexcept
Represents a track trajectory before the final fit.
art::InputTag tracksTag
Tag for the input tracks.
static constexpr Flag_t DetectorIssue
The hit is associated to a problematic channel.
auto withFitHitInfo(art::InputTag const &inputTag)
Adds recob::TrackFitHitInfo information to the proxy.
Represents a track trajectory from the final fit.
Number of supported track types.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: