Project

General

Profile

Bug #16781

recob::HitAndAssociationsWriterBase ignores instance names when writing to events.

Added by Leigh Whitehead over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Library
Target version:
-
Start date:
06/07/2017
Due date:
% Done:

100%

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

Description

The function recob::HitAndAssociationsWriterBase::put_into(art::Event& event) does not use the instance name when putting objects into the events.

In this case I am creating two hit selections, separating the track and shower outputs from the CNN. I first declare them in the module constructor.

recob::HitCollectionCreator::declare_products(*this,"showerhits",true,true);
recob::HitCollectionCreator::declare_products(*this,"trackhits",true,true);

Then define them in the produces function:

recob::HitCollectionCreator showerHits(*this,evt,"showerhits",true,true);
recob::HitCollectionCreator trackHits(*this,evt,"trackhits",true,true);

Then once filled I try to use "put_into" to place them into the event.
showerHits.put_into(evt);
trackHits.put_into(evt);

This produces an error since the put_into function ignores the instance name and then art can't find the product registered without an instance name.

No product is registered for
process name: 'Reco'
module label: 'showerhitseparator'
product friendly class name: 'recob::Hits'
product instance name: ''
branch type: 'Event'

It does however dump the two products that it is expecting to find:

-----
Branch Type = Event
Process Name = Reco
ModuleLabel = showerhitseparator
Branch ID = 3571616109
Class Name = std::vector<recob::Hit>
Friendly Class Name = recob::Hits
Product Instance Name = showerhits
-----
Branch Type = Event
Process Name = Reco
ModuleLabel = showerhitseparator
Branch ID = 2547416057
Class Name = std::vector<recob::Hit>
Friendly Class Name = recob::Hits
Product Instance Name = tracksuits

For now I can just put these objects into the event manually, but it would be nice if this bug could be addressed. I think it could just call the evt.put function with the instance name in the case that it isn't an empty string.

Associated revisions

Revision 2df71371 (diff)
Added by Gianluca Petrillo over 3 years ago

Bug fix: HitAndAssociationsWriterBase does not ignore instance name any more.

This solves issue #16781.

Revision 35e6d44e
Added by Gianluca Petrillo over 3 years ago

Merge branch 'feature/gp_Issue16781' into develop

- solution to issue #16781
- documentation improvements
- interface improvements

History

#1 Updated by Leigh Whitehead over 3 years ago

  • Category set to Reconstruction

#2 Updated by Gianluca Petrillo over 3 years ago

  • Status changed from New to Assigned
  • Assignee set to Gianluca Petrillo
  • Estimated time set to 1.00 h

Assigned to the author of the code.

#3 Updated by Leigh Whitehead over 3 years ago

Just looking at the code, this version of art::Event::put just calls the other one with a default string constructor.

template<typename PROD > ProductID art::Event::put(std::unique_ptr< PROD > && product) {return put<PROD>(std::move(product), std::string());}

Hence just changing the function calls to include prod_instance in recon::HitAndAssociationsWriterBase should fix the issue?

{
if (hits) event.put(std::move(hits),prod_instance);
if (WireAssns) event.put(std::move(WireAssns),prod_instance);
if (RawDigitAssns) event.put(std::move(RawDigitAssns),prod_instance);
} // HitAndAssociationsWriterBase::put_into()

#4 Updated by Gianluca Petrillo over 3 years ago

That is correct. It was a slip on my part.
I was in the process of writing a test for that change.

#5 Updated by Gianluca Petrillo over 3 years ago

  • Category changed from Reconstruction to Library
  • % Done changed from 0 to 60

Since I am failing to find time to write that test, I have uploaded a branch feature/gp_Issue16781 in lardata with the solution.
I could not test it yet.

#6 Updated by Gianluca Petrillo over 3 years ago

  • % Done changed from 60 to 100

The bug fix is now merged into develop branch of lardata. It will be in the next release (after v06_40_01).

It includes a unit test that would have caught the bug, plus interface improvements in separate commits.
The new interface options are illustrated in the unit test, also good as example: lardata:source:test/ArtDataHelper/HitCollectionCreatorTest_module.cc.

#7 Updated by Gianluca Petrillo over 3 years ago

  • Status changed from Assigned to Resolved

#8 Updated by Gianluca Petrillo about 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF