diff --git a/sbncode/HitFinder/GaussHitFinderSBN_module.cc b/sbncode/HitFinder/GaussHitFinderSBN_module.cc index 6d5147043..e02ee448a 100644 --- a/sbncode/HitFinder/GaussHitFinderSBN_module.cc +++ b/sbncode/HitFinder/GaussHitFinderSBN_module.cc @@ -388,8 +388,8 @@ namespace hit { 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())) { + // If the chi2 is not finite then there is a real problem so we bail + if (!std::isfinite(chi2PerNDF)) { chi2PerNDF = 2. * fChi2NDF.at(plane); NDF = 2; } @@ -464,14 +464,13 @@ namespace hit { float nsigmaADC(2.0); float newright(0); float newleft(0); + for (const auto& peakParams : peakParamsVec) { // Extract values for this hit float peakAmp = peakParams.peakAmplitude; float peakMean = peakParams.peakCenter; float peakWidth = peakParams.peakSigma; - //std::cout<<" ans hits "< 0) { prevpeak = (peakParamsVec.at(numHits - 1)).peakCenter; prevpeakSig = (peakParamsVec.at(numHits - 1)).peakSigma; - //std::cout<<" ans size "<= endT)) continue; + // Extract errors float peakAmpErr = peakParams.peakAmplitudeError; float peakMeanErr = peakParams.peakCenterError; @@ -550,6 +551,9 @@ namespace hit { if (HitsumEndItr > sumEndItr) HitsumEndItr = sumEndItr; + // This prevents L577 and L579 to make any possible boundaty flip + if (HitsumStartItr > HitsumEndItr) continue; + // ### Sum of ADC counts float ROIsumADC = std::accumulate(sumStartItr, sumEndItr, 0.); float HitsumADC = std::accumulate(HitsumStartItr, HitsumEndItr, 0.); @@ -588,6 +592,11 @@ namespace hit { numHits++; } // <---End loop over gaussians + // THIS IS NOT USED + // THIS IS NOT USED + // THIS IS NOT USED + // THIS IS NOT USED + // Should we filter hits? if (filteredHitCol && !filteredHitVec.empty()) { // ####################################################################### @@ -646,11 +655,11 @@ namespace hit { // if (fFillHists) fChi2->Fill(chi2PerNDF); } - } //<---End loop over merged candidate hits - } //<---End looping over ROI's - ); //end tbb parallel for - } //<---End looping over all the wires - ); //end tbb parallel for + } //< End loop over merged candidate hits + } //< End looping over ROI's + ); //< End tbb::parallel_for(ROI) + } //< End looping over all the wires + ); //< End tbb::parallel_for(channelROI) for (size_t i = 0; i < hitstruct_vec.size(); i++) { allHitCol.emplace_back(hitstruct_vec[i].hit_tbb, hitstruct_vec[i].channelROI_tbb); diff --git a/sbncode/HitFinder/hitfindermodules_sbn.fcl b/sbncode/HitFinder/hitfindermodules_sbn.fcl index f6def3d0a..6e175148b 100644 --- a/sbncode/HitFinder/hitfindermodules_sbn.fcl +++ b/sbncode/HitFinder/hitfindermodules_sbn.fcl @@ -51,4 +51,4 @@ gauss_hitfinder: # Define sbn version of gaushit finder gausshit_sbn: @local::gauss_hitfinder -END_PROLOG +END_PROLOG \ No newline at end of file