Project

General

Profile

Bug #23159

Cannot get hit handle

Added by Tingjun Yang 28 days ago. Updated 16 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
08/22/2019
Due date:
% Done:

100%

Estimated time:
Spent time:
Occurs In:
Experiment:
DUNE
Co-Assignees:
Duration:

Description

Dear LArSoft experts,

I am getting a strange error when I run an analyzer on the attached art file:

%MSG-s ArtException:  PostEndJob 22-Aug-2019 14:37:10 CDT ModuleEndJob
cet::exception caught in art
---- OtherArt BEGIN
  ---- EventProcessorFailure BEGIN
    EventProcessor: an exception occurred during current event processing
    ---- EventProcessorFailure BEGIN
      EndPathExecutor: an exception occurred during current event processing
      ---- ScheduleExecutionFailure BEGIN
        Path: ProcessingStopped.
        ---- LogicError BEGIN
          Product retrieval via Handle<T> succeeded for product:
          Branch Type = Event
          Process Name = Reco
          ModuleLabel = trajcluster
          Product ID = 1982930578
          Class Name = std::vector<recob::Hit>
          Friendly Class Name = recob::Hits
          Product Instance Name = 
          but an attempt to interpret it as an object of type 'std::vector<recob::Hit, std::allocator<recob::Hit> >' failed.
          cet::exception going through module NeutrinoTrackingEff/pmtrajfittceff run: 20000001 subRun: 0 event: 21
        ---- LogicError END
        Exception going through path end_path
      ---- ScheduleExecutionFailure END
    ---- EventProcessorFailure END
  ---- EventProcessorFailure END
---- OtherArt END
%MSG

The command to reproduce this error is:

lar -c standard_ana_dune10kt_1x2x6.fcl prodgenie_nu_dune10kt_1x2x6_detsim_072_reco.root

The analyzer module is NeutrinoTrackingEff_module.cc in larreco. Here are the offending lines:

    std::vector<art::Ptr<recob::Hit>> tmp_all_trackHits = track_hits.at(0);
    std::vector<art::Ptr<recob::Hit>> all_hits;
    art::Handle<std::vector<recob::Hit>> hithandle;
    if(event.get(tmp_all_trackHits[0].id(), hithandle))  art::fill_ptr_vector(all_hits, hithandle);

The exception is thrown on the last line.

Any help/suggestion on solving this problem is highly appreciated.

Thanks,
Tingjun

History

#1 Updated by Kyle Knoepfel 25 days ago

  • Status changed from New to Feedback

Tingjun, which release/branch of LArSoft are you using and what experiment code/version?

#2 Updated by Tingjun Yang 25 days ago

Hi Kyle, this is for dunetpc and develop branch can be used to reproduce this problem. Thanks.

#3 Updated by Kyle Knoepfel 25 days ago

  • Assignee set to Kyle Knoepfel
  • Status changed from Feedback to Assigned

#4 Updated by Kyle Knoepfel 25 days ago

  • % Done changed from 0 to 100
  • Status changed from Assigned to Resolved
  • Tracker changed from Support to Bug

The problem is understood. The code referenced above uses the Event::get(ProductID) interface, which will only return the product successfully if the data product has already been read into memory. This is in contrast to Event::getByLabel, which will read the product off disk if it has not already been read. In this particular workflow, the product in question has not been read off disk, so the Event::get fails. The art documentation will be updated to better describe the behavior.

The solution is to use Event::getByLabel instead:

art::Handle<std::vector<recob::Hit>> hithandle;
auto const pd = event.getProductDescription(tmp_all_trackHits[0].id());
if (pd && 
    event.getByLabel(pd->inputTag(), hithandle))  
  ...

I have pushed this fix to larreco's HEAD of develop (larreco:fae497b0).

#5 Updated by Tingjun Yang 25 days ago

Thanks Kyle.

#6 Updated by Kyle Knoepfel 16 days ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF