Bug #23159

Cannot get hit handle

Added by Tingjun Yang over 1 year ago. Updated about 1 year ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Spent time:
Occurs In:


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

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 in larreco. Here are the offending lines:

    std::vector<art::Ptr<recob::Hit>> tmp_all_trackHits =;
    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.



#1 Updated by Kyle Knoepfel over 1 year 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 over 1 year ago

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

#3 Updated by Kyle Knoepfel over 1 year ago

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

#4 Updated by Kyle Knoepfel over 1 year 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 over 1 year ago

Thanks Kyle.

#6 Updated by Kyle Knoepfel about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF