From 805020e6d45cfa7b0e81a6fad281358ddcce23b9 Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Wed, 21 Jan 2026 15:54:23 -0600 Subject: [PATCH] update GaussHitFinderSBN_module to take per plane hit finding parameters --- sbncode/CAFMaker/RecoUtils/CMakeLists.txt | 2 ++ sbncode/HitFinder/GaussHitFinderSBN_module.cc | 16 ++++++------ sbncode/HitFinder/hitfindermodules_sbn.fcl | 26 ++++++++++--------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sbncode/CAFMaker/RecoUtils/CMakeLists.txt b/sbncode/CAFMaker/RecoUtils/CMakeLists.txt index a992d7c63..545bdad69 100644 --- a/sbncode/CAFMaker/RecoUtils/CMakeLists.txt +++ b/sbncode/CAFMaker/RecoUtils/CMakeLists.txt @@ -11,4 +11,6 @@ art_make_library( LIBRARY_NAME caf_RecoUtils larsim::MCCheater_BackTrackerService_service larsim::MCCheater_ParticleInventoryService_service larcorealg::Geometry + sbnanaobj::StandardRecord + sbnanaobj::StandardRecordFlat ) diff --git a/sbncode/HitFinder/GaussHitFinderSBN_module.cc b/sbncode/HitFinder/GaussHitFinderSBN_module.cc index c0a91cc91..b7e952206 100644 --- a/sbncode/HitFinder/GaussHitFinderSBN_module.cc +++ b/sbncode/HitFinder/GaussHitFinderSBN_module.cc @@ -79,11 +79,11 @@ namespace hit { const std::vector fLongMaxHitsVec; /// fLongPulseWidthVec; /// fMaxMultiHit; /// fAreaNormsVec; /// fChi2NDF; ///maximum Chisquared / NDF allowed for a hit to be saved const std::vector fPulseHeightCuts; const std::vector fPulseWidthCuts; @@ -116,10 +116,10 @@ namespace hit { , fLongMaxHitsVec(pset.get>("LongMaxHits", std::vector() = {25, 25, 25})) , fLongPulseWidthVec( pset.get>("LongPulseWidth", std::vector() = {16, 16, 16})) - , fMaxMultiHit(pset.get("MaxMultiHit")) + , fMaxMultiHit(pset.get>("MaxMultiHitPerPlane", std::vector() = {5, 5, 5})) , fAreaMethod(pset.get("AreaMethod")) , fAreaNormsVec(FillOutHitParameterVector(pset.get>("AreaNorms"))) - , fChi2NDF(pset.get("Chi2NDF")) + , fChi2NDF(pset.get>("Chi2NDFPerPlane", std::vector() = {500.0, 500.0, 500.0})) , fPulseHeightCuts( pset.get>("PulseHeightCuts", std::vector() = {3.0, 3.0, 3.0})) , fPulseWidthCuts( @@ -365,13 +365,13 @@ namespace hit { // ####################################################### // ### If # requested Gaussians is too large then punt ### // ####################################################### - if (mergedCands.size() <= fMaxMultiHit) { + if (mergedCands.size() <= fMaxMultiHit.at(plane)) { fPeakFitterTool->findPeakParameters( range.data(), mergedCands, peakParamsVec, chi2PerNDF, NDF); // If the chi2 is infinite then there is a real problem so we bail if (!(chi2PerNDF < std::numeric_limits::infinity())) { - chi2PerNDF = 2. * fChi2NDF; + chi2PerNDF = 2. * fChi2NDF.at(plane); NDF = 2; } @@ -384,7 +384,7 @@ namespace hit { // ### depend on the fhicl parameter fLongPulseWidth ### // ### Also do this if chi^2 is too large ### // ####################################################### - if (mergedCands.size() > fMaxMultiHit || nGausForFit * chi2PerNDF > fChi2NDF) { + if (mergedCands.size() > fMaxMultiHit.at(plane) || nGausForFit * chi2PerNDF > fChi2NDF.at(plane)) { int longPulseWidth = fLongPulseWidthVec.at(plane); int nHitsThisPulse = (endT - startT) / longPulseWidth; @@ -401,7 +401,7 @@ namespace hit { peakParamsVec.clear(); nGausForFit = nHitsThisPulse; NDF = 1.; - chi2PerNDF = chi2PerNDF > fChi2NDF ? chi2PerNDF : -1.; + chi2PerNDF = chi2PerNDF > fChi2NDF.at(plane) ? chi2PerNDF : -1.; for (int hitIdx = 0; hitIdx < nHitsThisPulse; hitIdx++) { // This hit parameters diff --git a/sbncode/HitFinder/hitfindermodules_sbn.fcl b/sbncode/HitFinder/hitfindermodules_sbn.fcl index 868e5a2b8..099e784b4 100644 --- a/sbncode/HitFinder/hitfindermodules_sbn.fcl +++ b/sbncode/HitFinder/hitfindermodules_sbn.fcl @@ -11,17 +11,19 @@ gauss_hitfinder: { module_type: "GaussHitFinderSBN" CalDataModuleLabel: "caldata" - MaxMultiHit: 5 # maximum hits for multi gaussia fit attempt - AreaMethod: 0 # 0 = area by integral, 1 = area by gaussian area formula - AreaNorms: [ 1.0, 1.0, 1.0 ] # normalizations that put signal area in - # same scale as peak height. - TryNplus1Fits: false # Don't try to refit with extra peak if bad chisq - LongMaxHits: [ 25, 25, 25] # max number hits in long pulse trains - LongPulseWidth: [ 10, 10, 10] # max widths for hits in long pulse trains - Chi2NDF: 500. # maximum Chisquared / NDF allowed to store fit, if fail - # will use "long" pulse method to return hit - AllHitsInstanceName: "" # If non-null then this will be the instance name of all hits output to event - # in this case there will be two hit collections, one filtered and one containing all hits + MaxMultiHit: 5 # maximum hits for multi gaussian fit attempt + MaxMultiHitPerPlane: [ 10, 10, 8 ] # maximum hits per plane for multi gaussia fit attempt + AreaMethod: 0 # 0 = area by integral, 1 = area by gaussian area formula + AreaNorms: [ 1.0, 1.0, 1.0 ] # normalizations that put signal area in + # same scale as peak height. + TryNplus1Fits: false # Don't try to refit with extra peak if bad chisq + LongMaxHits: [ 25, 25, 25] # max number hits in long pulse trains + LongPulseWidth: [ 5, 5, 5] # max widths for hits in long pulse trains + Chi2NDF: 500. # maximum Chisquared / NDF allowed to store fit + Chi2NDFPerPlane: [ 2500., 1750., 2500.] # maximum Chisquared / NDF allowed per plane to store, if fail + # will use "long" pulse method to return hit + AllHitsInstanceName: "" # If non-null then this will be the instance name of all hits output to event + # in this case there will be two hit collections, one filtered and one containing all hits # Candididate peak finding done by tool, one tool instantiated per plane (but could be other divisions too) HitFinderToolVec: @@ -39,7 +41,7 @@ gauss_hitfinder: HitFilterAlg: { AlgName: "HitFilterAlg" - MinPulseHeight: [5.0, 5.0, 5.0] #minimum hit peak amplitude per plane + MinPulseHeight: [2.0, 2.0, 2.0] #minimum hit peak amplitude per plane MinPulseSigma: [1.0, 1.0, 1.0] #minimum hit rms per plane } # In addition to the filter alg we can also filter hits on the same pulse train