Project

General

Profile

Support #9768

Updated by Christopher Green over 4 years ago

Dear artists,

I use the following code to get showers and hits associated with showers:<pre><code class="cplusplus">// ShowerList showers:
//ShowerList
handle

art::Handle< std::vector<recob::Shower> > showerListHandle;

std::vector<art::Ptr<recob::Shower> > showerlist;

if (evt.getByLabel(fShowerModuleLabel,showerListHandle))

art::fill_ptr_vector(showerlist, showerListHandle);


art::FindManyP<recob::Hit> fmsht(showerListHandle,evt, fShowerModuleLabel);</code></pre> fShowerModuleLabel);

@FindManyP@ FindManyP will show an exception of @ProductNotFound@ ProductNoFound if @showerListHandle@ showerListHandle is invalid. If I insert <pre><code class="cplusplus">if
if
(!showerListHandle.isValid()) showerListHandle.clear();</code></pre> showerListHandle.clear();
before @FindManyP@, FindManyP, I do not get the exception.

Would it be ok to make @FindManyP@ FindManyP (and others Find*) not show when @art::Handle@ art::Handle is invalid? One can check if the association is valid later.

Tingjun

Back