File indexing completed on 2024-05-04 04:04:19
0001 #ifndef DataFormats_HGCalDigis_HGCalElectronicsId_h
0002 #define DataFormats_HGCalDigis_HGCalElectronicsId_h
0003
0004 #include <iostream>
0005 #include <ostream>
0006 #include <cstdint>
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 class HGCalElectronicsId {
0022 public:
0023 enum HGCalElectronicsIdMask {
0024 kZsideMask = 0x1,
0025 kLocalFEDIDMask = 0x3ff,
0026 kCaptureBlockMask = 0xf,
0027 kECONDIdxMask = 0xf,
0028 kECONDeRxMask = 0xf,
0029 kHalfROCChannelMask = 0x3f
0030 };
0031 enum HGCalElectronicsIdShift {
0032 kZsideShift = 28,
0033 kLocalFEDIDShift = 18,
0034 kCaptureBlockShift = 14,
0035 kECONDIdxShift = 10,
0036 kECONDeRxShift = 6,
0037 kHalfROCChannelShift = 0
0038 };
0039
0040
0041
0042
0043 HGCalElectronicsId() : value_(0) {}
0044 explicit HGCalElectronicsId(
0045 bool zside, uint16_t localfedid, uint8_t captureblock, uint8_t econdidx, uint8_t econderx, uint8_t halfrocch);
0046 explicit HGCalElectronicsId(uint32_t value) : value_(value) {}
0047
0048
0049
0050
0051
0052 uint32_t operator()() const { return value_; }
0053 bool operator<(const HGCalElectronicsId& oth) const { return value_ < oth.value_; }
0054 bool operator==(const HGCalElectronicsId& oth) const { return value_ == oth.value_; }
0055 uint32_t raw() const { return value_; }
0056 bool zSide() const;
0057 uint16_t localFEDId() const;
0058 uint8_t captureBlock() const;
0059 uint8_t econdIdx() const;
0060 uint8_t econdeRx() const;
0061 uint8_t halfrocChannel() const;
0062 uint8_t rocChannel() const;
0063 uint8_t cmWord() const;
0064 bool isCM() const;
0065 void print(std::ostream& out = std::cout) const {
0066 out << "Raw=0x" << std::hex << raw() << std::dec << std::endl
0067 << "\tLocal FED-ID: " << (uint32_t)localFEDId() << " Capture Block: " << (uint32_t)captureBlock()
0068 << " ECON-D idx: " << (uint32_t)econdIdx() << " eRx: " << (uint32_t)econdeRx()
0069 << " 1/2 ROC ch.: " << (uint32_t)halfrocChannel() << " isCM=" << isCM() << " zSide=" << zSide() << std::endl;
0070 }
0071
0072 private:
0073
0074 uint32_t value_;
0075 };
0076
0077 #endif