Performs the actual test.
316 auto expectedTracksHandle
317 =
event.getValidHandle<std::vector<recob::Track>>(
tracksTag);
318 auto const& expectedTracks = *expectedTracksHandle;
320 auto const& expectedTrackHitAssns = *(
326 <<
"Starting test on " << expectedTracks.size() <<
" tracks from '" 329 art::FindManyP<recob::Hit, recob::TrackHitMeta> hitsPerTrack
332 art::FindOneP<recob::TrackTrajectory> trajectoryPerTrack
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));
387 std::addressof(expectedTrackFitHitInfo)
392 std::addressof(expectedTrackFitHitInfo)
397 std::addressof(directTracks)
402 BOOST_TEST(fitHitInfoSize == expectedTrackFitHitInfo.
size());
405 std::
size_t iExpectedTrack = 0;
407 auto const& expectedTrack = expectedTracks[iExpectedTrack];
409 { expectedTracksHandle, iExpectedTrack };
410 auto const& expectedHits = hitsPerTrack.at(iExpectedTrack);
411 auto const& expectedHitMeta = hitsPerTrack.data(iExpectedTrack);
412 auto const& expectedFitHitInfo = expectedTrackFitHitInfo[iExpectedTrack];
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());
438 indexOf(expectedHits, hitPtr) !=
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) !=
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());
528 auto const index = indexOf(expectedHits, hitPtr);
531 BOOST_TEST(&(hitInfo.main()) == &expectedTrack);
532 BOOST_TEST(hitInfo.mainPtr() == expectedTrackPtr);
534 if (
index < expectedHitMeta.size()) {
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;
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");
579 auto const index = indexOf(expectedHits, hitPtr);
582 BOOST_TEST(&(iHit.main()) == &expectedTrack);
583 BOOST_TEST(iHit.mainPtr() == expectedTrackPtr);
585 if (
index < expectedHitMeta.size()) {
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());
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Reconstruction base classes.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
auto withAssociatedMetaAs(Args &&...args)
Helper function to merge associated data with metadata.
art::InputTag tracksTag
Tag for the input tracks.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
auto withParallelData(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.
A trajectory in space reconstructed from hits.
bool isNull() const noexcept
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static int max(int a, int b)
Detector simulation of raw signals on wires.
for(std::string line;std::getline(inFile, line);)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
auto const & get(AssnsNode< L, R, D > const &r)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Event finding and building.