Skip to content

Commit

Permalink
Merge pull request #267 from DUNE-DAQ/mrigan/ttcm_prescale
Browse files Browse the repository at this point in the history
Adding prescaling for ttcm
  • Loading branch information
MRiganSUSX authored Feb 7, 2024
2 parents 879ead3 + 9ea50f4 commit a4993a5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion plugins/TimingTriggerCandidateMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ TimingTriggerCandidateMaker::do_conf(const nlohmann::json& config)
m_hsi_passthrough = params.hsi_trigger_type_passthrough;
m_hsi_pt_before = params.s0.time_before;
m_hsi_pt_after = params.s0.time_after;
m_prescale = params.prescale;
m_prescale_flag = (m_prescale > 1) ? true : false;
TLOG_DEBUG(2) << get_name() + " configured.";
if (m_prescale_flag){
TLOG(2) << "Running with prescale at: " << m_prescale;
}
}

void
Expand Down Expand Up @@ -129,7 +134,13 @@ TimingTriggerCandidateMaker::receive_hsievent(dfmessages::HSIEvent& data)
}

++m_tsd_received_count;


if (m_prescale_flag) {
if (m_tsd_received_count % m_prescale != 0){
return;
}
}

if (m_hsi_passthrough == true){
TLOG_DEBUG(3) << "Signal_map: " << data.signal_map << ", trigger bits: " << (std::bitset<16>)data.signal_map;
try {
Expand Down
4 changes: 4 additions & 0 deletions plugins/TimingTriggerCandidateMaker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class TimingTriggerCandidateMaker : public dunedaq::appfwk::DAQModule

std::string m_hsievent_receive_connection;

// Prescale functionality
bool m_prescale_flag;
int m_prescale;

// HSI Passthrough changes
std::atomic<bool> m_hsi_passthrough;
int m_hsi_pt_before;
Expand Down
5 changes: 4 additions & 1 deletion schema/trigger/timingtriggercandidatemaker.jsonnet
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
local moo = import "moo.jsonnet";
local ns = "dunedaq.trigger.timingtriggercandidatemaker";
local s = moo.oschema.schema(ns);
local nc = moo.oschema.numeric_constraints;

local types = {
time_t : s.number("time_t", "i8", doc="Time"),
signal_type_t : s.number("signal_type_t", "u4", doc="Signal type"),
hsi_tt_pt : s.boolean("hsi_tt_pt"),
count_t : s.number("count_t", "i8", nc(minimum=1), doc="Counter"),
map_t : s.record("map_t", [
s.field("signal_type",
self.signal_type_t,
Expand Down Expand Up @@ -45,7 +47,8 @@ local types = {
time_after: 2000000
},
doc="Example 2"),
s.field("hsi_trigger_type_passthrough", self.hsi_tt_pt, doc="Option to override the trigger type values")
s.field("hsi_trigger_type_passthrough", self.hsi_tt_pt, doc="Option to override the trigger type values"),
s.field("prescale", self.count_t, default=1, doc="Option to prescale TTCM TCs")
], doc="Configuration of the different readout time maps"),

};
Expand Down

0 comments on commit a4993a5

Please sign in to comment.