Skip to content

Commit ccea6c6

Browse files
Addition to accommodate ICARUS adder trigger
1 parent 66e9900 commit ccea6c6

2 files changed

Lines changed: 39 additions & 9 deletions

File tree

sbnobj/Common/Trigger/BeamBits.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ namespace sbn {
137137

138138
/// Trigger window mode
139139
enum class triggerWindowMode: unsigned int {
140-
Separated, ///< Separated, non-overlapping contigous window
141-
Overlapping, ///< Overlaping windows
140+
Separated, ///< Separated, non-overlapping contiguous window.
141+
Overlapping, ///< Overlapping windows.
142+
SeparatedPlusAdders, ///< OR of `Separated` and `Adders`.
143+
OverlappingPlusAdders, ///< OR of `Overlapping` and `Adders`.
144+
Adders, ///< Trigger from adders.
142145
//==> add here if more are needed <==
143146
NBits ///< Number of Bits currently supported
144147
};
@@ -315,8 +318,11 @@ inline std::string sbn::bits::bitName(triggerWindowMode bit) {
315318

316319
using namespace std::string_literals;
317320
switch (bit) {
318-
case sbn::bits::triggerWindowMode::Separated: return "Separated Window"s;
319-
case sbn::bits::triggerWindowMode::Overlapping: return "Overlapping Window"s;
321+
case sbn::bits::triggerWindowMode::Separated: return "Separated Window"s;
322+
case sbn::bits::triggerWindowMode::Overlapping: return "Overlapping Window"s;
323+
case sbn::bits::triggerWindowMode::SeparatedPlusAdders: return "Separated Both"s;
324+
case sbn::bits::triggerWindowMode::OverlappingPlusAdders: return "Overlapping Both"s;
325+
case sbn::bits::triggerWindowMode::Adders: return "Adders"s;
320326
case sbn::bits::triggerWindowMode::NBits: return "<invalid>"s;
321327
} // switch
322328
throw std::runtime_error("sbn::bits::bitName(triggerWindowMode{ "s

sbnobj/Common/Trigger/ExtraTriggerInfo.h

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,16 @@ struct sbn::ExtraTriggerInfo {
243243
/// Returns whether there is some recorded LVDS activity.
244244
constexpr bool hasLVDS() const;
245245

246+
/// Returns whether there is some recorded sector activity.
247+
constexpr bool hasSectors() const;
248+
249+
/// Returns whether there is some recorded activity (LVDS or sector).
250+
constexpr bool hasAnyActivity() const;
251+
246252
}; // CryostatInfo
247253

248254

249-
/// Bits for the trigger location (@see `triggerLocation()`).
255+
/// Bits for the trigger location (see `triggerLocation()`).
250256
unsigned int triggerLocationBits { 0U };
251257
//sbn::triggerLocation triggerLocationBits { sbn::triggerSource::NBits }
252258
/// Status of each LVDS channel in each PMT wall at trigger time.
@@ -321,16 +327,34 @@ namespace sbn {
321327
std::ostream& operator<< (std::ostream& out, ExtraTriggerInfo const& info);
322328
}
323329

324-
// -----------------------------------------------------------------------------
325330

326-
constexpr bool sbn::ExtraTriggerInfo::CryostatInfo::hasLVDS() const {
331+
// -----------------------------------------------------------------------------
332+
inline constexpr bool sbn::ExtraTriggerInfo::CryostatInfo::hasLVDS() const {
327333
// C++20:
328-
// return std::ranges::any_of(LVDSstatus, std::identity{});
334+
// return std::ranges::any_of(LVDSstatus, std::identity{});
329335
for (std::uint64_t bits: LVDSstatus) if (bits) return true;
330336
return false;
331-
} // sbn::ExtraTriggerInfo::CryostatInfo::empty()
337+
} // sbn::ExtraTriggerInfo::CryostatInfo::hasLVDS()
332338

333339

340+
// -----------------------------------------------------------------------------
341+
inline constexpr bool sbn::ExtraTriggerInfo::CryostatInfo::hasSectors() const {
342+
// C++20:
343+
// return std::ranges::any_of(SectorStatus, std::identity{});
344+
for (std::uint64_t bits: SectorStatus) if (bits) return true;
345+
return false;
346+
} // sbn::ExtraTriggerInfo::CryostatInfo::hasSectors()
347+
348+
349+
// -----------------------------------------------------------------------------
350+
inline constexpr bool sbn::ExtraTriggerInfo::CryostatInfo::hasAnyActivity()
351+
const
352+
{
353+
return hasLVDS() || hasSectors();
354+
} // sbn::ExtraTriggerInfo::CryostatInfo::hasAnyActivity()
355+
356+
357+
// -----------------------------------------------------------------------------
334358

335359

336360
#endif // SBNOBJ_COMMON_TRIGGER_EXTRATRIGGERINFO_H

0 commit comments

Comments
 (0)