@@ -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
0 commit comments