Skip to content

Commit 33f56fb

Browse files
committed
ensure CAF works if NuGraph2 products are not found
1 parent eade067 commit 33f56fb

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,19 @@ namespace caf
343343
Atom<art::InputTag> NuGraphSliceHitLabel {
344344
Name("NuGraphSliceHitLabel"),
345345
Comment("Label of NuGraph slice hit map."),
346-
art::InputTag("nuslhits")
346+
"" //Empty by default, please set to e.g. art::InputTag("nuslhits")
347347
};
348348

349349
Atom<art::InputTag> NuGraphFilterLabel {
350350
Name("NuGraphFilterLabel"),
351351
Comment("Label of NuGraph filter."),
352-
art::InputTag("NuGraph","filter")
352+
"" //Empty by default, please set to e.g. art::InputTag("NuGraph","filter")
353353
};
354354

355355
Atom<art::InputTag> NuGraphSemanticLabel {
356356
Name("NuGraphSemanticLabel"),
357357
Comment("Label of NuGraph semantic."),
358-
art::InputTag("NuGraph","semantic")
358+
"" //Empty by default, please set to e.g. art::InputTag("NuGraph","semantic")
359359
};
360360

361361
Atom<string> OpFlashLabel {

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,9 +1766,15 @@ void CAFMaker::produce(art::Event& evt) noexcept {
17661766

17671767
std::vector<art::Ptr<anab::FeatureVector<1>>> ng2_filter_vec;
17681768
std::vector<art::Ptr<anab::FeatureVector<5>>> ng2_semantic_vec;
1769-
art::fill_ptr_vector(ng2_filter_vec,ng2_filter_handle[producer]);
1770-
art::fill_ptr_vector(ng2_semantic_vec,ng2_semantic_handle[producer]);
1771-
FillSliceNuGraph(slcHits,*ng2_slice_hit_map_handle[producer],ng2_filter_vec,ng2_semantic_vec,recslc);
1769+
if (ng2_filter_handle[producer].isValid()) {
1770+
art::fill_ptr_vector(ng2_filter_vec,ng2_filter_handle[producer]);
1771+
}
1772+
if (ng2_semantic_handle[producer].isValid()) {
1773+
art::fill_ptr_vector(ng2_semantic_vec,ng2_semantic_handle[producer]);
1774+
}
1775+
if (ng2_slice_hit_map_handle[producer].isValid()) {
1776+
FillSliceNuGraph(slcHits,*ng2_slice_hit_map_handle[producer],ng2_filter_vec,ng2_semantic_vec,recslc);
1777+
}
17721778

17731779
art::FindManyP<sbn::OpT0Finder> fmOpT0 =
17741780
FindManyPStrict<sbn::OpT0Finder>(sliceList, evt, fParams.OpT0Label() + slice_tag_suff);
@@ -2142,7 +2148,9 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21422148
FillCNNScores(thisParticle, cnnScores, pfp);
21432149
}
21442150

2145-
FillPPFNuGraph(*ng2_slice_hit_map_handle[producer], ng2_filter_vec, ng2_semantic_vec, fmPFPartHits.at(iPart), pfp);
2151+
if (ng2_slice_hit_map_handle[producer].isValid()) {
2152+
FillPPFNuGraph(*ng2_slice_hit_map_handle[producer], ng2_filter_vec, ng2_semantic_vec, fmPFPartHits.at(iPart), pfp);
2153+
}
21462154

21472155
if (!thisTrack.empty()) { // it has a track!
21482156
assert(thisTrack.size() == 1);

sbncode/CAFMaker/FillReco.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ namespace caf
553553
{
554554

555555
//need to double check that the slice processed by NuGraph is the same under consideration
556-
std::cout << "sizes=" << inputHits.size() << " " << sliceHitsMap.size() << " " << ngFilterResult.size() << " " << ngSemanticResult.size() << std::endl;
556+
//std::cout << "sizes=" << inputHits.size() << " " << sliceHitsMap.size() << " " << ngFilterResult.size() << " " << ngSemanticResult.size() << std::endl;
557557
unsigned int nHits = inputHits.size();
558558
if (nHits==0 || nHits!=sliceHitsMap.size() || inputHits[0].key()!=sliceHitsMap[0]) return;//not the same slice!
559559

0 commit comments

Comments
 (0)