Performs the actual test.
316 auto expectedTracksHandle
317 =
event.getValidHandle<std::vector<recob::Track>>(
tracksTag);
318 auto const& expectedTracks = *expectedTracksHandle;
320 auto const& expectedTrackHitAssns = *(
322 <art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>(
tracksTag)
325 mf::LogInfo(
"ProxyBaseTest")
326 <<
"Starting test on " << expectedTracks.size() <<
" tracks from '"
329 art::FindManyP<recob::Hit, recob::TrackHitMeta> hitsPerTrack
330 (expectedTracksHandle, event,
tracksTag);
332 art::FindOneP<recob::TrackTrajectory> trajectoryPerTrack
333 (expectedTracksHandle, event,
tracksTag);
335 auto const& expectedTrackFitHitInfo
336 = *(
event.getValidHandle<std::vector<std::vector<recob::TrackFitHitInfo>>>
339 auto directTracks = proxy::getCollection<std::vector<recob::Track>>(
341 proxy::withParallelData<std::vector<recob::TrackFitHitInfo>>()
344 auto tracks = proxy::getCollection<std::vector<recob::Track>>(
346 , proxy::withAssociated<recob::Hit>()
347 , proxy::withAssociatedAs<recob::Hit, tag::SpecialHits>()
354 , proxy::wrapAssociatedAs<tag::DirectHitAssns>(expectedTrackHitAssns)
355 , proxy::wrapParallelDataAs<tag::DirectFitInfo>(expectedTrackFitHitInfo)
356 , proxy::wrapParallelDataAs<tag::TrackSubproxy>(directTracks)
357 , proxy::withZeroOrOne<recob::TrackTrajectory>(tracksTag)
364 "Track proxy does NOT have space points available!!!");
367 tracks.has<std::vector<recob::TrackFitHitInfo>>(),
368 "recob::TrackFitHitInfo not found!!!"
372 BOOST_TEST(
tracks.empty() == expectedTracks.empty());
373 BOOST_TEST(
tracks.size() == expectedTracks.size());
375 BOOST_TEST(
tracks.size() == expectedTrackFitHitInfo.size());
376 decltype(
auto) allFitHitInfo
379 std::is_lvalue_reference<decltype(allFitHitInfo)>(),
380 "Copy of parallel data!"
383 (allFitHitInfo.data() ==
std::addressof(expectedTrackFitHitInfo));
386 tracks.
get<tag::DirectFitInfo>().data() ==
387 std::addressof(expectedTrackFitHitInfo)
391 directTracks.
get<
std::
vector<recob::TrackFitHitInfo>>().data() ==
392 std::addressof(expectedTrackFitHitInfo)
396 tracks.
get<tag::TrackSubproxy>().data() ==
397 std::addressof(directTracks)
402 BOOST_TEST(fitHitInfoSize == expectedTrackFitHitInfo.
size());
405 std::
size_t iExpectedTrack = 0;
407 auto const& expectedTrack = expectedTracks[iExpectedTrack];
408 art::Ptr<recob::Track>
const expectedTrackPtr
409 { expectedTracksHandle, iExpectedTrack };
410 auto const& expectedHits = hitsPerTrack.at(iExpectedTrack);
411 auto const& expectedHitMeta = hitsPerTrack.data(iExpectedTrack);
412 auto const& expectedFitHitInfo = expectedTrackFitHitInfo[iExpectedTrack];
413 art::Ptr<recob::TrackTrajectory>
const expectedTrajPtr
414 = trajectoryPerTrack.at(iExpectedTrack);
419 (!areSameObject(tracks[iExpectedTrack], tracks[iExpectedTrack]));
423 auto const trackProxyCopy = trackProxy;
424 BOOST_TEST(std::addressof(trackProxyCopy) != std::addressof(trackProxy));
427 (std::addressof(trackRef) == std::addressof(expectedTrack));
429 (std::addressof(*trackProxy) == std::addressof(expectedTrack));
432 BOOST_TEST(trackProxy.get<recob::Hit>().size() == expectedHits.size());
433 for (art::Ptr<recob::Hit>
const& hitPtr: trackProxy.get<recob::Hit>()) {
438 indexOf(expectedHits, hitPtr) !=
439 std::numeric_limits<std::size_t>::max()
444 BOOST_TEST(trackProxy.index() == iExpectedTrack);
446 std::vector<recob::TrackFitHitInfo>
const& fitHitInfo
447 = trackProxy.get<std::vector<recob::TrackFitHitInfo>>();
449 std::is_lvalue_reference<decltype(fitHitInfo)>(),
450 "Copy of parallel data element!"
453 (std::addressof(fitHitInfo) == std::addressof(expectedFitHitInfo));
454 BOOST_TEST(fitHitInfo.size() == expectedFitHitInfo.size());
458 std::addressof(expectedTrackFitHitInfo[iExpectedTrack])
474 (std::addressof(*directTrackProxy) == std::addressof(expectedTrack));
475 BOOST_TEST(directTrackProxy->ID() == expectedTrack.ID());
476 BOOST_TEST(directTrackProxy->Length() == expectedTrack.Length());
479 (directTrackProxy.get<std::vector<recob::TrackFitHitInfo>>()) ==
480 std::addressof(fitHitInfo)
491 !std::decay_t<decltype(hitPtr)>::hasMetadata(),
492 "Expected no metadata for tag::SpecialHits"
495 BOOST_TEST(!hitPtr.hasMetadata());
500 indexOf(expectedHits, hitPtr) !=
501 std::numeric_limits<std::size_t>::max()
508 BOOST_TEST(hits.size() == expectedHits.size());
510 unsigned int nSpecialHits = 0U;
511 for (
auto const& hitInfo: hits) {
518 std::decay_t<decltype(hitInfo)>::hasMetadata(),
519 "Expected metadata for tag::MetadataHits"
521 BOOST_TEST(hitInfo.hasMetadata());
524 art::Ptr<recob::Hit>
const& hitPtr = hitInfo;
528 auto const index = indexOf(expectedHits, hitPtr);
529 BOOST_TEST(index != std::numeric_limits<std::size_t>::max());
531 BOOST_TEST(&(hitInfo.main()) == &expectedTrack);
532 BOOST_TEST(hitInfo.mainPtr() == expectedTrackPtr);
534 if (index < expectedHitMeta.size()) {
535 art::Ptr<recob::Hit>
const& expectedHitPtr = expectedHits.at(index);
536 auto const& expectedMetadata = expectedHitMeta.at(index);
538 BOOST_TEST(hitInfo.valuePtr() == hitPtr);
540 (std::addressof(hitInfo.value()) == std::addressof(*hitPtr));
541 BOOST_TEST(hitInfo.key() == hitPtr.key());
542 BOOST_TEST(hitInfo.id() == hitPtr.id());
544 if (expectedHitPtr) {
546 BOOST_TEST(hitInfo.operator->() == hitPtr);
547 recob::Hit
const&
hit = *expectedHitPtr;
548 BOOST_TEST(std::addressof(*hitInfo) == std::addressof(hit));
551 BOOST_TEST(hitInfo.dataPtr() == expectedMetadata);
552 BOOST_TEST(&(hitInfo.data()) == expectedMetadata);
554 auto hitInfoCopy = hitInfo;
556 (
static_cast<art::Ptr<recob::Hit>
const&
>(hitInfo) == hitPtr);
558 (&(
static_cast<art::Ptr<recob::Hit>
const&
>(hitInfo)) == &hitPtr);
560 art::Ptr<recob::Hit> hitPtrMoved = std::move(hitInfoCopy);
561 BOOST_TEST(hitPtrMoved == hitPtr);
566 BOOST_TEST(nSpecialHits == expectedHits.size());
569 for (
auto iHit = hits.begin(); iHit != hits.end(); ++iHit) {
572 (iHit.hasMetadata(),
"Expected metadata for tag::MetadataHits");
575 art::Ptr<recob::Hit>
const& hitPtr = *iHit;
579 auto const index = indexOf(expectedHits, hitPtr);
580 BOOST_TEST(index != std::numeric_limits<std::size_t>::max());
582 BOOST_TEST(&(iHit.main()) == &expectedTrack);
583 BOOST_TEST(iHit.mainPtr() == expectedTrackPtr);
585 if (index < expectedHitMeta.size()) {
586 art::Ptr<recob::Hit>
const& expectedHitPtr = expectedHits.at(index);
587 auto const* expectedMetadata = expectedHitMeta.at(index);
589 BOOST_TEST(iHit.valuePtr() == hitPtr);
591 (std::addressof(iHit.value()) == std::addressof(*hitPtr));
593 BOOST_TEST(iHit.dataPtr() == expectedMetadata);
594 BOOST_TEST(std::addressof(iHit.data()) == expectedMetadata);
596 BOOST_TEST(iHit.valuePtr() == expectedHitPtr);
597 BOOST_TEST(iHit.dataPtr() == expectedMetadata);
602 BOOST_TEST(nSpecialHits == expectedHits.size());
608 BOOST_TEST(trackProxy->NPoints() == expectedTrack.NPoints());
613 if (expectedTrajPtr.isNull()) {
622 BOOST_TEST(iExpectedTrack == expectedTracks.size());
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
ClusterModuleLabel join with tracks
auto withAssociatedMetaAs(Args &&...args)
Helper function to merge associated data with metadata.
std::size_t size(FixedBins< T, C > const &) noexcept
art::InputTag tracksTag
Tag for the input tracks.
auto withParallelData(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
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.
for($it=0;$it< $RaceTrack_number;$it++)
auto end(FixedBins< T, C > const &) noexcept
auto begin(FixedBins< T, C > const &) noexcept
2D representation of charge deposited in the TDC/wire plane
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: