File indexing completed on 2025-08-05 08:16:07
0001 #ifndef FUN4ALLRAW_CALOPACKETV1_H
0002 #define FUN4ALLRAW_CALOPACKETV1_H
0003
0004 #include "CaloPacket.h"
0005
0006 #include <array>
0007 #include <limits>
0008
0009 static const int MAX_NUM_CHANNELS = 256;
0010 static const int MAX_NUM_MODULES = 4;
0011 static const int MAX_NUM_SAMPLES = 31;
0012
0013 class CaloPacketv1 : public CaloPacket
0014 {
0015 public:
0016 CaloPacketv1();
0017 ~CaloPacketv1() override = default;
0018
0019 void Reset() override;
0020 void identify(std::ostream &os = std::cout) const override;
0021
0022 int getMaxNumChannels() const override { return MAX_NUM_CHANNELS; }
0023 int getMaxNumSamples() const override { return MAX_NUM_SAMPLES; }
0024 int getMaxNumModules() const override { return MAX_NUM_MODULES; }
0025
0026 void setFemClock(int i, uint32_t clk) override { femclock.at(i) = clk; }
0027 uint32_t getFemClock(int i) const override { return femclock.at(i); }
0028 void setFemEvtSequence(int i, int evtno) override { femevt.at(i) = evtno; }
0029 int getFemEvtSequence(int i) const override { return femevt.at(i); }
0030 void setFemSlot(int i, int islot) override { femslot.at(i) = islot; }
0031 int getFemSlot(int i) const override { return femslot.at(i); }
0032 void setChecksumLsb(int i, int ival) override { checksumlsb.at(i) = ival; }
0033 int getChecksumLsb(int i) const override { return checksumlsb.at(i); }
0034 void setChecksumMsb(int i, int ival) override { checksummsb.at(i) = ival; }
0035 int getChecksumMsb(int i) const override { return checksummsb.at(i); }
0036
0037 void setCalcChecksumLsb(int i, int ival) override { calcchecksumlsb.at(i) = ival; }
0038 int getCalcChecksumLsb(int i) const override { return calcchecksumlsb.at(i); }
0039 void setCalcChecksumMsb(int i, int ival) override { calcchecksummsb.at(i) = ival; }
0040 int getCalcChecksumMsb(int i) const override { return calcchecksummsb.at(i); }
0041
0042 void setNrChannels(int i) override { NrChannels = i; }
0043 int getNrChannels() const override { return NrChannels; }
0044 void setNrSamples(int i) override { NrSamples = i; }
0045 int getNrSamples() const override { return NrSamples; }
0046 void setNrModules(int i) override { NrModules = i; }
0047 int getNrModules() const override { return NrModules; }
0048 void setEvenChecksum(int i) override { event_checksum = i; }
0049 int getEvenChecksum() const override { return event_checksum; }
0050 void setOddChecksum(int i) override { odd_checksum = i; }
0051 int getOddChecksum() const override { return odd_checksum; }
0052 void setCalcEvenChecksum(int i) override { calc_event_checksum = i; }
0053 int getCalcEvenChecksum() const override { return calc_event_checksum; }
0054 void setCalcOddChecksum(int i) override { calc_odd_checksum = i; }
0055 int getCalcOddChecksum() const override { return calc_odd_checksum; }
0056 void setModuleAddress(int i) override { module_address = i; }
0057 int getModuleAddress() const override { return module_address; }
0058 void setDetId(int i) override { detid = i; }
0059 int getDetId() const override { return detid; }
0060 bool getSuppressed(int channel) const override { return isZeroSuppressed.at(channel); }
0061 void setSuppressed(int channel, bool bb) override { isZeroSuppressed.at(channel) = bb; }
0062 void setPre(int channel, uint32_t ival) override { pre.at(channel) = ival; }
0063 uint32_t getPre(int channel) const override { return pre.at(channel); }
0064 void setPost(int channel, uint32_t ival) override { post.at(channel) = ival; }
0065 uint32_t getPost(int channel) const override { return post.at(channel); }
0066
0067 void setSample(int ipmt, int isamp, uint32_t val) override { samples.at(isamp).at(ipmt) = val; }
0068 uint32_t getSample(int ipmt, int isamp) const override { return samples.at(isamp).at(ipmt); }
0069 void setPacketEvtSequence(int i) override { PacketEvtSequence = i; }
0070 int getPacketEvtSequence() const override { return PacketEvtSequence; }
0071 int iValue(const int n, const std::string &what) const override;
0072 int iValue(const int channel, const int sample) const override;
0073 void dump(std::ostream &os = std::cout) const override;
0074 void dump_iddigitizer(std::ostream &os = std::cout) const;
0075
0076 uint32_t getFemStatus(const int i) const override { return femstatus.at(i); }
0077 void setFemStatus(const int i, const uint32_t ival) override { femstatus.at(i) = ival; }
0078
0079 protected:
0080 int PacketEvtSequence{0};
0081 int NrChannels{0};
0082 int NrSamples{0};
0083 int NrModules{0};
0084 int event_checksum{0};
0085 int odd_checksum{0};
0086 int calc_event_checksum{0};
0087 int calc_odd_checksum{0};
0088 int module_address{0};
0089 int detid{0};
0090
0091 std::array<uint32_t, MAX_NUM_MODULES> femclock{};
0092 std::array<uint32_t, MAX_NUM_MODULES> femevt{};
0093 std::array<uint32_t, MAX_NUM_MODULES> femslot{};
0094 std::array<uint32_t, MAX_NUM_MODULES> femstatus{};
0095 std::array<uint32_t, MAX_NUM_MODULES> checksumlsb{};
0096 std::array<uint32_t, MAX_NUM_MODULES> checksummsb{};
0097 std::array<uint32_t, MAX_NUM_MODULES> calcchecksumlsb{};
0098 std::array<uint32_t, MAX_NUM_MODULES> calcchecksummsb{};
0099
0100 std::array<std::array<uint32_t, MAX_NUM_CHANNELS>, MAX_NUM_SAMPLES> samples{};
0101 std::array<bool, MAX_NUM_CHANNELS> isZeroSuppressed{};
0102 std::array<uint32_t, MAX_NUM_CHANNELS> pre{};
0103 std::array<uint32_t, MAX_NUM_CHANNELS> post{};
0104
0105 private:
0106 ClassDefOverride(CaloPacketv1, 3)
0107 };
0108
0109 #endif