Skip to content

Commit 98a4654

Browse files
committed
more shower vars
1 parent cf283cb commit 98a4654

3 files changed

Lines changed: 35 additions & 10 deletions

File tree

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21272127
}
21282128

21292129
if (ng2_filter_vec.size() > 0 || ng2_semantic_vec.size() > 0) {
2130-
FillSliceNuGraph(slcHits, ng2_filter_vec, ng2_semantic_vec, vtx_wire, vtx_tick, recslc);
2130+
FillSliceNuGraph(slcHits, ng2_filter_vec, ng2_semantic_vec, fmPFPartHits, vtx_wire, vtx_tick, recslc);
21312131
}
21322132
}
21332133

sbncode/CAFMaker/FillReco.cxx

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,13 @@ namespace caf
583583
void FillSliceNuGraph(const std::vector<art::Ptr<recob::Hit>> &inputHits,
584584
const std::vector<art::Ptr<anab::FeatureVector<1>>> &ngFilterResult,
585585
const std::vector<art::Ptr<anab::FeatureVector<5>>> &ngSemanticResult,
586+
const std::vector<std::vector<art::Ptr<recob::Hit>>> &fmPFPartHits,
586587
const float vtx_wire[3],
587588
const float vtx_tick[3],
588589
caf::SRSlice &slice)
589590
{
590591

591-
// nugraph filter fraction
592+
// NuGraph2 filter fraction
592593
unsigned int nHits = inputHits.size();
593594
unsigned int npass = 0;
594595

@@ -597,10 +598,20 @@ namespace caf
597598
}
598599
slice.ng_filt_pass_frac = float(npass)/nHits;
599600

600-
// nugraph HIP vertex tagging
601+
// look-up between hits and PFPs
602+
std::set<art::Ptr<recob::Hit>> pfpHitSet;
603+
for (const auto& pfpHits : fmPFPartHits) {
604+
for (const auto& hit : pfpHits) {
605+
if (hit) pfpHitSet.insert(hit);
606+
}
607+
}
608+
609+
// NuGraph2 plane-by-plane slice variables
601610
for (unsigned int plane = 0; plane < 3; ++plane) {
602611

603-
int nHIPHits = 0;
612+
int nHIPHits = 0; ///< HIP tagging at interaction vertex
613+
int nShrHits = 0; ///< shower hits in the slice
614+
int nUnclusteredShrHits = 0; ///< shower hits in the slice not belonging to a PFP
604615

605616
for ( unsigned int i = 0; i < nHits; i++ ) {
606617
const recob::Hit& hit = *inputHits.at(i);
@@ -613,18 +624,30 @@ namespace caf
613624
semVec.begin(),
614625
std::max_element(semVec.begin(), semVec.end())
615626
);
616-
if (highestScoreIdx != 1) continue; // look for HIP hits
617627

628+
// HIP tagging
618629
float dwire = std::abs(float(hit.WireID().Wire) - vtx_wire[plane]);
619-
if (dwire > 10) continue;
620-
621630
float dtick = std::abs(hit.PeakTime() - vtx_tick[plane]);
622-
if (dtick > 50) continue;
631+
if ((highestScoreIdx == 1) && (dwire <= 10) && (dtick <= 50))
632+
nHIPHits += 1;
623633

624-
nHIPHits += 1;
634+
// shower hits
635+
if (highestScoreIdx == 2) {
636+
637+
// all shower hits
638+
nShrHits += 1;
639+
640+
// unclustered shower hits
641+
art::Ptr<recob::Hit> hitPtr = inputHits.at(i);
642+
if (pfpHitSet.find(hitPtr) == pfpHitSet.end()) {
643+
nUnclusteredShrHits += 1;
644+
}
645+
}
625646
}
626647

627648
slice.ng_plane[plane].ng_vtx_hip_hits = nHIPHits;
649+
slice.ng_plane[plane].shr_hits = nShrHits;
650+
slice.ng_plane[plane].unclustered_shr_hits = nUnclusteredShrHits;
628651
}
629652
}
630653

sbncode/CAFMaker/FillReco.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ namespace caf
110110
* @brief Fills the results from NuGraph at slice level
111111
* @param inputHits (pointers to) the hits associated to the slice
112112
* @param ngFilterResult NuGraph filter result, for each hit
113-
* @param ngSemanticResult NuGraph semnatic result, for each hit (MIP track, HIP, shower, Michel electron, diffuse activity)
113+
* @param ngSemanticResult NuGraph semantic result, for each hit (MIP track, HIP, shower, Michel electron, diffuse activity)
114+
* @param fmPFPartHits vector of pointers-to-hits lists, for each PFP
114115
* @param vtx_wire vertex coordinates projected onto wires, per plane
115116
* @param vtx_tick vertex coordinates projected onto ticks, per plane
116117
* @param[out] slice the destination slice object
@@ -120,6 +121,7 @@ namespace caf
120121
void FillSliceNuGraph(const std::vector<art::Ptr<recob::Hit>> &inputHits,
121122
const std::vector<art::Ptr<anab::FeatureVector<1>>> &ngFilterResult,
122123
const std::vector<art::Ptr<anab::FeatureVector<5>>> &ngSemanticResult,
124+
const std::vector<std::vector<art::Ptr<recob::Hit>>> &fmPFPartHits,
123125
const float vtx_wire[3],
124126
const float vtx_tick[3],
125127
caf::SRSlice &slice);

0 commit comments

Comments
 (0)