Skip to content

Commit ba13126

Browse files
committed
additions to keep offline same as online
- changing padding value for sum function - add check for empty container
1 parent a3810cd commit ba13126

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

sbndcode/Trigger/PMTSoftware/PMTMetricProducer_module.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
// Output: sbnd::trigger::pmtSoftwareTrigger data product
1616

17-
// More information can be found at:
18-
// https://sbnsoftware.github.io/sbndcode_wiki/SBND_Trigger
17+
// ! NOTE! this needs to be kept up to date with the latest
18+
// ! version of this module that is running in the DAQ!
19+
// ! sbndaq-artdaq/ArtModules/SBND/SoftwareTrigger/PMTMetricProducer_module.cc
1920
////////////////////////////////////////////////////////////////////////
2021

2122
#include "art/Framework/Core/EDProducer.h"
@@ -350,13 +351,13 @@ void sbnd::trigger::pmtSoftwareTriggerProducer::produce(art::Event& e)
350351
// # of containers = # of boards
351352
// # of entries inside the container = # of triggers
352353
if (fragmentHandle->front().type() == artdaq::Fragment::ContainerFragmentType) {
353-
foundfragments = true;
354354
for (auto cont : *fragmentHandle) {
355355
artdaq::ContainerFragment contf(cont);
356356
if (contf.fragment_type()==sbndaq::detail::FragmentType::CAENV1730) {
357+
if (contf.block_count()==0) continue;
357358
if (std::find(fFragIDs.begin(), fFragIDs.end(), contf[0].get()->fragmentID()) == fFragIDs.end()) continue;
358359
if (fVerbose>=3) TLOG(TLVL_INFO) << "Found " << contf.block_count() << " CAEN1730 fragments in container with fragID " << contf[0].get()->fragmentID();
359-
// std::cout << "Found " << contf.block_count() << " CAEN1730 fragments in container with fragID " << contf[0].get()->fragmentID() << std::endl;
360+
foundfragments = true;
360361

361362
if (etrig_frag_dt==1e9){
362363
for (size_t ii = 0; ii < contf.block_count(); ++ii){
@@ -612,10 +613,11 @@ int8_t sbnd::trigger::pmtSoftwareTriggerProducer::getClosestFTrig(double refTime
612613
std::vector<uint32_t> sbnd::trigger::pmtSoftwareTriggerProducer::sumWvfms(const std::vector<uint32_t>& v1, const std::vector<uint16_t>& v2)
613614
{
614615
size_t result_len = (v1.size() > v2.size()) ? v1.size() : v2.size();
615-
std::vector<uint32_t> result(result_len,0);
616+
std::vector<uint32_t> result(result_len, 0);
616617
for (size_t i = 0; i < result_len; i++){
617-
auto value1 = (i < v1.size()) ? v1[i] : 0;
618-
auto value2 = (i < v2.size()) ? v2[i] : 0;
618+
// padding with 2e4 (for baseline ~14e3, 2e4 is safe value)
619+
auto value1 = (i < v1.size()) ? v1[i] : 2e4;
620+
auto value2 = (i < v2.size()) ? v2[i] : 2e4;
619621
result.at(i) = value1 + value2;
620622
}
621623
return result;

0 commit comments

Comments
 (0)