From 47c8b21195768752976b13ec48013f14a7d2d0fd Mon Sep 17 00:00:00 2001 From: lynnt20 Date: Wed, 12 Nov 2025 16:31:56 -0600 Subject: [PATCH 1/2] first commit of software trigger additions --- sbncode/CAFMaker/CAFMakerParams.h | 6 ++++++ sbncode/CAFMaker/CAFMaker_module.cc | 11 +++++++++++ sbncode/CAFMaker/CMakeLists.txt | 3 ++- sbncode/CAFMaker/FillTrigger.cxx | 6 +++++- sbncode/CAFMaker/FillTrigger.h | 3 +++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/sbncode/CAFMaker/CAFMakerParams.h b/sbncode/CAFMaker/CAFMakerParams.h index a7740263e..bb089b0e4 100644 --- a/sbncode/CAFMaker/CAFMakerParams.h +++ b/sbncode/CAFMaker/CAFMakerParams.h @@ -357,6 +357,12 @@ namespace caf "" // sbnd }; + Atom SBNDSoftwareTriggerLabel{ + Name("SBNDSoftwareTriggerLabel"), + Comment("Label for software trigger producer"), + "" // sbnd + }; + Atom CRTPMTLabel { Name("CRTPMTLabel"), Comment("Label for the CRTPMT Matched variables from the crtpmt data product"), diff --git a/sbncode/CAFMaker/CAFMaker_module.cc b/sbncode/CAFMaker/CAFMaker_module.cc index 7baf6ef0c..b9410b4f8 100644 --- a/sbncode/CAFMaker/CAFMaker_module.cc +++ b/sbncode/CAFMaker/CAFMaker_module.cc @@ -1715,6 +1715,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { std::vector srsbndcrttracks; caf::SRSBNDFrameShiftInfo srsbndframeshiftinfo; caf::SRSBNDTimingInfo srsbndtiminginfo; + caf::SRSoftwareTrigger srsbndsofttrig; // Mapping of (feb, channel) to truth information (AuxDetSimChannel) -- filled for ICARUS std::map, sim::AuxDetSimChannel> crtsimchanmap; @@ -1799,6 +1800,15 @@ void CAFMaker::produce(art::Event& evt) noexcept { sbnd::timing::TimingInfo const& sbndtiminginfo(*sbndtiminginfo_handle); FillSBNDTimingInfo(sbndtiminginfo, srsbndtiminginfo); } + + art::Handle> sbndsofttrig_handle; + GetByLabelStrict(evt, fParams.SBNDSoftwareTriggerLabel(), sbndsofttrig_handle); + if (sbndsofttrig_handle.isValid()){ + const std::vector &sbndsofttrig = *sbndsofttrig_handle; + if (sbndsofttrig.size()==1){ + FillSoftwareTrigger(sbndsofttrig.at(0), srsbndsofttrig); + } + } } // Get all of the CRTPMT Matches @@ -2545,6 +2555,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { rec.nopflashes = srflashes.size(); rec.sbnd_frames = srsbndframeshiftinfo; rec.sbnd_timings = srsbndtiminginfo; + rec.soft_trig = srsbndsofttrig; if (fParams.FillTrueParticles()) { rec.true_particles = true_particles; diff --git a/sbncode/CAFMaker/CMakeLists.txt b/sbncode/CAFMaker/CMakeLists.txt index aa42cba8a..5dd4f2a8f 100644 --- a/sbncode/CAFMaker/CMakeLists.txt +++ b/sbncode/CAFMaker/CMakeLists.txt @@ -43,12 +43,13 @@ art_make_library( LIBRARY_NAME sbncode_CAFMaker art::Framework_Services_System_TriggerNamesService_service sbncode_Metadata_MetadataSBN_service larsim::Utils - larevt::SpaceCharge + larevt::SpaceCharge systematicstools::interface systematicstools::interpreters systematicstools::utility ${GENIE_LIB_LIST} nugen::EventGeneratorBase_GENIE + sbndaq_artdaq_core::sbndaq-artdaq-core_Obj_SBND ) cet_build_plugin ( CAFMaker art::module diff --git a/sbncode/CAFMaker/FillTrigger.cxx b/sbncode/CAFMaker/FillTrigger.cxx index 908bf6559..17f1dbe8d 100644 --- a/sbncode/CAFMaker/FillTrigger.cxx +++ b/sbncode/CAFMaker/FillTrigger.cxx @@ -59,7 +59,11 @@ namespace caf triggerInfo.monpulse_sizes = *monpulseSizes; triggerInfo.num_pairs_over_threshold = *numPairs; triggerInfo.passed_trigger = *passedTrig; - } + void FillSoftwareTrigger(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo){ + caf_softInfo.npmts = softInfo.nAboveThreshold; + caf_softInfo.flash_peakpe = softInfo.peakPE; + caf_softInfo.flash_peaktime = softInfo.peaktime + softInfo.trig_ts*1e-3; + } } diff --git a/sbncode/CAFMaker/FillTrigger.h b/sbncode/CAFMaker/FillTrigger.h index 1988b6876..848b9dac2 100644 --- a/sbncode/CAFMaker/FillTrigger.h +++ b/sbncode/CAFMaker/FillTrigger.h @@ -4,9 +4,11 @@ #include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" #include "sbnobj/Common/Trigger/BeamBits.h" #include "sbnanaobj/StandardRecord/SRTrigger.h" +#include "sbnanaobj/StandardRecord/SRSoftwareTrigger.h" #include "sbnanaobj/StandardRecord/SRSBNDTimingInfo.h" #include "lardataobj/RawData/TriggerData.h" #include "art/Framework/Principal/Handle.h" +#include "sbndaq-artdaq-core/Obj/SBND/pmtSoftwareTrigger.hh" #include @@ -27,6 +29,7 @@ namespace caf art::Handle const& numPairs, art::Handle const& passedTrig, caf::SRTrigger& triggerInfo); + void FillSoftwareTrigger(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo); } #endif From 1ef7e9c9ab12a585a88f94fd17a31425e62643c9 Mon Sep 17 00:00:00 2001 From: lynnt20 Date: Thu, 13 Nov 2025 09:52:44 -0600 Subject: [PATCH 2/2] add SBND to fill function name --- sbncode/CAFMaker/CAFMaker_module.cc | 2 +- sbncode/CAFMaker/FillTrigger.cxx | 2 +- sbncode/CAFMaker/FillTrigger.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sbncode/CAFMaker/CAFMaker_module.cc b/sbncode/CAFMaker/CAFMaker_module.cc index b9410b4f8..64393320c 100644 --- a/sbncode/CAFMaker/CAFMaker_module.cc +++ b/sbncode/CAFMaker/CAFMaker_module.cc @@ -1806,7 +1806,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { if (sbndsofttrig_handle.isValid()){ const std::vector &sbndsofttrig = *sbndsofttrig_handle; if (sbndsofttrig.size()==1){ - FillSoftwareTrigger(sbndsofttrig.at(0), srsbndsofttrig); + FillSoftwareTriggerSBND(sbndsofttrig.at(0), srsbndsofttrig); } } } diff --git a/sbncode/CAFMaker/FillTrigger.cxx b/sbncode/CAFMaker/FillTrigger.cxx index 17f1dbe8d..093f78ebe 100644 --- a/sbncode/CAFMaker/FillTrigger.cxx +++ b/sbncode/CAFMaker/FillTrigger.cxx @@ -61,7 +61,7 @@ namespace caf triggerInfo.passed_trigger = *passedTrig; } - void FillSoftwareTrigger(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo){ + void FillSoftwareTriggerSBND(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo){ caf_softInfo.npmts = softInfo.nAboveThreshold; caf_softInfo.flash_peakpe = softInfo.peakPE; caf_softInfo.flash_peaktime = softInfo.peaktime + softInfo.trig_ts*1e-3; diff --git a/sbncode/CAFMaker/FillTrigger.h b/sbncode/CAFMaker/FillTrigger.h index 848b9dac2..bacdd8cd6 100644 --- a/sbncode/CAFMaker/FillTrigger.h +++ b/sbncode/CAFMaker/FillTrigger.h @@ -29,7 +29,7 @@ namespace caf art::Handle const& numPairs, art::Handle const& passedTrig, caf::SRTrigger& triggerInfo); - void FillSoftwareTrigger(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo); + void FillSoftwareTriggerSBND(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo); } #endif