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