From 0873611a6cd3b704239333fddd1ca870e97b4290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez=20Castillo?= Date: Mon, 20 Jan 2025 10:53:04 -0600 Subject: [PATCH 1/3] Add option for using OpHitFinder with multiple threshold --- .../OpDetReco/OpHit/SBNDOpHitFinder_module.cc | 16 ++++++++++++++-- ups/product_deps | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc b/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc index 3f9f66236..df1f9e0b2 100644 --- a/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc +++ b/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc @@ -91,7 +91,8 @@ namespace opdet { std::vector _pd_to_use; ///< PDS to use (ex: "pmt", "barepmt") std::string fElectronics; ///< PDS readouts to use (ex: "CAEN", "Daphne") std::vector _opch_to_use; ///< List of of opch (will be infered from _pd_to_use) - + std::vector fADCThresholdVector; + bool fUseIndividualHitThreshold; pmtana::PulseRecoManager fPulseRecoMgr; pmtana::PMTPulseRecoBase* fThreshAlg; pmtana::PMTPedestalBase* fPedAlg; @@ -131,6 +132,9 @@ namespace opdet { fElectronics = pset.get< std::string >("Electronics"); _opch_to_use = this->PDNamesToList(_pd_to_use); + + fADCThresholdVector = pset.get< std::vector>("ADCThresholdVector", {0}); + fUseIndividualHitThreshold = pset.get< bool>("UseIndividualHitThreshold", false); fDaphne_Freq = pset.get< float >("DaphneFreq"); fHitThreshold = pset.get< float >("HitThreshold"); bool useCalibrator = pset.get< bool > ("UseCalibrator", false); @@ -164,7 +168,9 @@ namespace opdet { auto const rise_alg_pset = pset.get_if_present("RiseTimeCalculator"); // Initialize the hit finder algorithm - auto const hit_alg_pset = pset.get("HitAlgoPset"); + // If we need to apply and individual threshold for each channel, set the algorithm threhsold to the lowest value + auto hit_alg_pset = pset.get("HitAlgoPset"); + if(fUseIndividualHitThreshold) hit_alg_pset.put("ADCThreshold", *min_element(fADCThresholdVector.begin(), fADCThresholdVector.end())); std::string threshAlgName = hit_alg_pset.get("Name"); if (threshAlgName == "Threshold") fThreshAlg = thresholdAlgorithm(hit_alg_pset, rise_alg_pset); @@ -318,6 +324,12 @@ namespace opdet { // Now correct the time. Unfortunately, there are no setter methods for OpHits, // so we have to make a new OpHit vector. for (auto h : *HitPtr) { + + // Apply individual threshold + int channelNumber = h.OpChannel(); + int PeakAmplitude = h.Amplitude(); + if(fUseIndividualHitThreshold && (PeakAmplitude < fADCThresholdVector[channelNumber]) ) continue; + (*HitPtrFinal).emplace_back(h.OpChannel(), h.PeakTime() + clockData.TriggerTime(), h.PeakTimeAbs(), diff --git a/ups/product_deps b/ups/product_deps index 18ebbdd67..c5c16e298 100644 --- a/ups/product_deps +++ b/ups/product_deps @@ -253,7 +253,7 @@ wpdir product_dir wire-cell-cfg # #################################### product version qual flags -sbncode v09_93_01_01 - +sbncode v09_93_01_02 - cetmodules v3_24_01 - only_for_build sbnd_data v01_25_00 - optional sbndutil v09_93_01_01 - optional From 6eca5731f112d581018b80181781abbcc3460994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez=20Castillo?= Date: Mon, 20 Jan 2025 11:06:58 -0600 Subject: [PATCH 2/3] Fix bug --- sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc b/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc index df1f9e0b2..670b6ba62 100644 --- a/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc +++ b/sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc @@ -170,7 +170,7 @@ namespace opdet { // Initialize the hit finder algorithm // If we need to apply and individual threshold for each channel, set the algorithm threhsold to the lowest value auto hit_alg_pset = pset.get("HitAlgoPset"); - if(fUseIndividualHitThreshold) hit_alg_pset.put("ADCThreshold", *min_element(fADCThresholdVector.begin(), fADCThresholdVector.end())); + if(fUseIndividualHitThreshold) hit_alg_pset.put_or_replace("ADCThreshold", *min_element(fADCThresholdVector.begin(), fADCThresholdVector.end())); std::string threshAlgName = hit_alg_pset.get("Name"); if (threshAlgName == "Threshold") fThreshAlg = thresholdAlgorithm(hit_alg_pset, rise_alg_pset); From 221bd58537f9c397ac321a10f7f0edf13633831e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez=20Castillo?= Date: Wed, 22 Jan 2025 11:12:32 -0600 Subject: [PATCH 3/3] Revert sbncode dependency to match develop --- ups/product_deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ups/product_deps b/ups/product_deps index c5c16e298..18ebbdd67 100644 --- a/ups/product_deps +++ b/ups/product_deps @@ -253,7 +253,7 @@ wpdir product_dir wire-cell-cfg # #################################### product version qual flags -sbncode v09_93_01_02 - +sbncode v09_93_01_01 - cetmodules v3_24_01 - only_for_build sbnd_data v01_25_00 - optional sbndutil v09_93_01_01 - optional