diff --git a/sbncode/CAFMaker/CAFMakerParams.h b/sbncode/CAFMaker/CAFMakerParams.h index 4fc80a207..53589b2ac 100644 --- a/sbncode/CAFMaker/CAFMakerParams.h +++ b/sbncode/CAFMaker/CAFMakerParams.h @@ -363,6 +363,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 4c926ede4..c59aa8193 100644 --- a/sbncode/CAFMaker/CAFMaker_module.cc +++ b/sbncode/CAFMaker/CAFMaker_module.cc @@ -1741,6 +1741,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { caf::SRSBNDCRTVeto srsbndcrtveto; 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; @@ -1843,6 +1844,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){ + FillSoftwareTriggerSBND(sbndsofttrig.at(0), srsbndsofttrig); + } + } } // Get all of the CRTPMT Matches @@ -2590,6 +2600,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 4a34f5045..fab6ae074 100644 --- a/sbncode/CAFMaker/FillTrigger.cxx +++ b/sbncode/CAFMaker/FillTrigger.cxx @@ -66,7 +66,11 @@ namespace caf triggerInfo.monpulse_sizes = *monpulseSizes; triggerInfo.num_pairs_over_threshold = *numPairs; triggerInfo.passed_trigger = *passedTrig; - } + 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 51e8a8bf6..2c2ada243 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" namespace caf { @@ -27,6 +29,7 @@ namespace caf art::Handle const& numPairs, art::Handle const& passedTrig, caf::SRTrigger& triggerInfo); + void FillSoftwareTriggerSBND(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo); } #endif