Go to the documentation of this file.00001
00002 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h"
00003
00005
00006
00007
00009 L1GctHFRingEtSums::L1GctHFRingEtSums() :
00010 capBlock_(0),
00011 capIndex_(0),
00012 bx_(0),
00013 data_(0)
00014 { }
00015
00016
00018 L1GctHFRingEtSums::~L1GctHFRingEtSums()
00019 { }
00020
00021
00022
00023 L1GctHFRingEtSums L1GctHFRingEtSums::fromConcRingSums(const uint16_t capBlock,
00024 const uint16_t capIndex,
00025 const int16_t bx,
00026 const uint32_t data)
00027 {
00028 L1GctHFRingEtSums s;
00029 s.setCapBlock(capBlock);
00030 s.setCapIndex(capIndex);
00031 s.setBx(bx);
00032 s.setEtSum(0, (data>>12)&0x7 );
00033 s.setEtSum(1, (data>>16)&0x7 );
00034 s.setEtSum(2, (data>>19)&0x7 );
00035 s.setEtSum(3, (data>>22)&0x7 );
00036 return s;
00037 }
00038
00039
00040 L1GctHFRingEtSums L1GctHFRingEtSums::fromGctEmulator(const int16_t bx,
00041 const uint16_t etSumPosEtaRing1,
00042 const uint16_t etSumNegEtaRing1,
00043 const uint16_t etSumPosEtaRing2,
00044 const uint16_t etSumNegEtaRing2)
00045 {
00046 L1GctHFRingEtSums s;
00047 s.setBx(bx);
00048 s.setEtSum(0, etSumPosEtaRing1);
00049 s.setEtSum(1, etSumNegEtaRing1);
00050 s.setEtSum(2, etSumPosEtaRing2);
00051 s.setEtSum(3, etSumNegEtaRing2);
00052 return s;
00053 }
00054
00061 uint16_t L1GctHFRingEtSums::etSum(unsigned const i) const {
00062 return (data_>>(i*3)) & 0x7;
00063 }
00064
00065
00067 bool L1GctHFRingEtSums::operator==(const L1GctHFRingEtSums& c) const {
00068 return (this->raw() == c.raw());
00069 }
00070
00072 void L1GctHFRingEtSums::setEtSum(unsigned i, uint16_t et) {
00073 data_ &= ~(0x7<<(i*3));
00074 data_ |= (et&0x7)<<(i*3);
00075 }
00076
00077 std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand)
00078 {
00079 s << "L1GctHFRingEtSums :";
00080
00081 if (cand.empty()) {
00082 s << " empty";
00083 } else {
00084 s << " ring1 eta+=" << cand.etSum(0);
00085 s << " ring1 eta-=" << cand.etSum(1);
00086 s << " ring2 eta+=" << cand.etSum(2);
00087 s << " ring2 eta-=" << cand.etSum(3);
00088 s << std::endl;
00089 }
00090
00091 s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
00092
00093 return s;
00094 }