File indexing completed on 2024-04-06 12:04:27
0001
0002 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h"
0003
0004
0005
0006
0007
0008 L1GctHFRingEtSums::L1GctHFRingEtSums() : capBlock_(0), capIndex_(0), bx_(0), data_(0) {}
0009
0010
0011 L1GctHFRingEtSums::~L1GctHFRingEtSums() {}
0012
0013
0014 L1GctHFRingEtSums L1GctHFRingEtSums::fromConcRingSums(const uint16_t capBlock,
0015 const uint16_t capIndex,
0016 const int16_t bx,
0017 const uint32_t data) {
0018 L1GctHFRingEtSums s;
0019 s.setCapBlock(capBlock);
0020 s.setCapIndex(capIndex);
0021 s.setBx(bx);
0022 s.setEtSum(0, (data >> 12) & 0x7);
0023 s.setEtSum(1, (data >> 16) & 0x7);
0024 s.setEtSum(2, (data >> 19) & 0x7);
0025 s.setEtSum(3, (data >> 22) & 0x7);
0026 return s;
0027 }
0028
0029
0030 L1GctHFRingEtSums L1GctHFRingEtSums::fromGctEmulator(const int16_t bx,
0031 const uint16_t etSumPosEtaRing1,
0032 const uint16_t etSumNegEtaRing1,
0033 const uint16_t etSumPosEtaRing2,
0034 const uint16_t etSumNegEtaRing2) {
0035 L1GctHFRingEtSums s;
0036 s.setBx(bx);
0037 s.setEtSum(0, etSumPosEtaRing1);
0038 s.setEtSum(1, etSumNegEtaRing1);
0039 s.setEtSum(2, etSumPosEtaRing2);
0040 s.setEtSum(3, etSumNegEtaRing2);
0041 return s;
0042 }
0043
0044
0045
0046
0047
0048
0049
0050 uint16_t L1GctHFRingEtSums::etSum(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; }
0051
0052
0053 bool L1GctHFRingEtSums::operator==(const L1GctHFRingEtSums& c) const { return (this->raw() == c.raw()); }
0054
0055
0056 void L1GctHFRingEtSums::setEtSum(unsigned i, uint16_t et) {
0057 data_ &= ~(0x7 << (i * 3));
0058 data_ |= (et & 0x7) << (i * 3);
0059 }
0060
0061 std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand) {
0062 s << "L1GctHFRingEtSums :";
0063
0064 if (cand.empty()) {
0065 s << " empty";
0066 } else {
0067 s << " ring1 eta+=" << cand.etSum(0);
0068 s << " ring1 eta-=" << cand.etSum(1);
0069 s << " ring2 eta+=" << cand.etSum(2);
0070 s << " ring2 eta-=" << cand.etSum(3);
0071 s << std::endl;
0072 }
0073
0074 s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
0075
0076 return s;
0077 }