File indexing completed on 2025-02-26 04:25:37
0001 #ifndef SimCalorimetry_HGCalSimAlgos_HGCalECONDEmulatorInfo_h
0002 #define SimCalorimetry_HGCalSimAlgos_HGCalECONDEmulatorInfo_h
0003
0004 #include <bitset>
0005 #include <vector>
0006 #include <cstdint>
0007
0008 class HGCalECONDEmulatorInfo {
0009 public:
0010 HGCalECONDEmulatorInfo() = default;
0011 explicit HGCalECONDEmulatorInfo(
0012 bool obit, bool bbit, bool ebit, bool tbit, bool hbit, bool sbit, std::vector<uint64_t> enabled_channels = {}) {
0013 header_bits_[StatusBits::O] = obit;
0014 header_bits_[StatusBits::B] = bbit;
0015 header_bits_[StatusBits::E] = ebit;
0016 header_bits_[StatusBits::T] = tbit;
0017 header_bits_[StatusBits::H] = hbit;
0018 header_bits_[StatusBits::S] = sbit;
0019 for (const auto& ch_en : enabled_channels)
0020 pois_.emplace_back(ch_en);
0021 }
0022
0023 void addChannelsEnable(uint64_t poi) { pois_.emplace_back(poi); }
0024 std::vector<bool> channelsEnabled(size_t ch_id) const {
0025 std::vector<bool> ch_en;
0026 for (const auto& poi : pois_)
0027 ch_en.emplace_back(poi.test(ch_id));
0028 return ch_en;
0029 }
0030
0031 enum HGCROCEventRecoStatus { PerfectReco = 0, GoodReco = 1, FailedReco = 2, AmbiguousReco = 3 };
0032 HGCROCEventRecoStatus eventRecoStatus() const { return static_cast<HGCROCEventRecoStatus>(bitH() << 1 | bitT()); }
0033
0034 bool bitO() const { return header_bits_.test(StatusBits::O); }
0035 bool bitB() const { return header_bits_.test(StatusBits::B); }
0036 bool bitE() const { return header_bits_.test(StatusBits::E); }
0037 bool bitT() const { return header_bits_.test(StatusBits::T); }
0038 bool bitH() const { return header_bits_.test(StatusBits::H); }
0039 bool bitS() const { return header_bits_.test(StatusBits::S); }
0040
0041 private:
0042 enum StatusBits { O = 0, B, E, T, H, S };
0043 std::bitset<6> header_bits_;
0044 std::vector<std::bitset<37> > pois_;
0045 };
0046
0047 #endif