File indexing completed on 2025-08-06 08:18:38
0001 #include <phool/PHObject.h>
0002
0003 #include <array>
0004 #include <cstdint>
0005 #include <iostream>
0006 #include <string>
0007
0008 class TriggerRunInfo : public PHObject
0009 {
0010 public:
0011 TriggerRunInfo()
0012 : trigger_names{}
0013 , trigger_bits{}
0014 , trigger_prescales{}
0015 {
0016 }
0017
0018 void set(int index, const std::string& name, int bit, int prescale)
0019 {
0020 if (index >= 0 && index < 64)
0021 {
0022 trigger_names[index] = name;
0023 trigger_bits[index] = bit;
0024 trigger_prescales[index] = prescale;
0025 }
0026 else
0027 {
0028 std::cout << "Index out of bounds: " << index << std::endl;
0029 }
0030 }
0031
0032 int getPrescaleByName(const std::string& name) const
0033 {
0034 for (int i = 0; i < 64; ++i)
0035 {
0036 if (trigger_names[i] == name)
0037 {
0038 return trigger_prescales[i];
0039 }
0040 }
0041 std::cout << "Trigger name not found: " << name << std::endl;
0042 return 0;
0043 }
0044
0045 void printTriggers() const
0046 {
0047 for (int i = 0; i < 64; ++i)
0048 {
0049 std::cout << "Trigger " << i << ": Name = " << trigger_names[i]
0050 << ", Bit = " << trigger_bits[i]
0051 << ", Prescale = " << trigger_prescales[i] << std::endl;
0052 }
0053 }
0054
0055 private:
0056 std::array<int, 64> trigger_live_bits;
0057 std::array<int, 64> trigger_live_bits;
0058 };