Go to the documentation of this file.00001
00002 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHFData.h"
00003
00004 L1GctInternHFData::L1GctInternHFData() :
00005 type_(null),
00006 capBlock_(0),
00007 capIndex_(0),
00008 bx_(0),
00009 data_(0)
00010 { }
00011
00013 L1GctInternHFData::~L1GctInternHFData() { }
00014
00015 L1GctInternHFData L1GctInternHFData::fromConcRingSums(const uint16_t capBlock,
00016 const uint16_t capIndex,
00017 const int16_t bx,
00018 const uint32_t data) {
00019 L1GctInternHFData d;
00020 d.setType(conc_hf_ring_et_sums);
00021 d.setCapIndex(capIndex);
00022 d.setCapBlock(capBlock);
00023 d.setBx(bx);
00024 d.setData(data);
00025 return d;
00026 }
00027
00028 L1GctInternHFData L1GctInternHFData::fromConcBitCounts(const uint16_t capBlock,
00029 const uint16_t capIndex,
00030 const int16_t bx,
00031 const uint32_t data) {
00032 L1GctInternHFData d;
00033 d.setType(conc_hf_bit_counts);
00034 d.setCapIndex(capIndex);
00035 d.setCapBlock(capBlock);
00036 d.setBx(bx);
00037 for (unsigned i=0; i<4; ++i) {
00038 d.setCount(i, (data>>(6*i))&0x3f);
00039 }
00040 return d;
00041 }
00042
00043 L1GctInternHFData L1GctInternHFData::fromWheelRingSums(const uint16_t capBlock,
00044 const uint16_t capIndex,
00045 const int16_t bx,
00046 const uint32_t data) {
00047 L1GctInternHFData d;
00048 d.setType(wheel_hf_ring_et_sums);
00049 d.setCapIndex(capIndex);
00050 d.setCapBlock(capBlock);
00051 d.setBx(bx);
00052 d.setData(data & 0xff);
00053 return d;
00054 }
00055
00056 L1GctInternHFData L1GctInternHFData::fromWheelBitCounts(const uint16_t capBlock,
00057 const uint16_t capIndex,
00058 const int16_t bx,
00059 const uint32_t data) {
00060 L1GctInternHFData d;
00061 d.setType(wheel_hf_bit_counts);
00062 d.setCapIndex(capIndex);
00063 d.setCapBlock(capBlock);
00064 d.setBx(bx);
00065 d.setCount(0,data & 0x3f);
00066 return d;
00067 }
00068
00069
00070
00071 uint16_t L1GctInternHFData::value(unsigned i) const {
00072 return (data_>>(i*8)) & 0xff;
00073 }
00074
00076 uint16_t L1GctInternHFData::et(unsigned i) const {
00077 return value(i);
00078 }
00079
00081 uint16_t L1GctInternHFData::count(unsigned i) const {
00082 return value(i);
00083 }
00084
00085
00087 bool L1GctInternHFData::operator==(const L1GctInternHFData& c) const {
00088 return ( this->raw() == c.raw() );
00089 }
00090
00091
00092
00093 void L1GctInternHFData::setValue(unsigned i, uint16_t val) {
00094 data_ &= ~(0xff<<(i*8));
00095 data_ |= (val&0xff)<<(i*8);
00096 }
00097
00099 void L1GctInternHFData::setEt(unsigned i, uint16_t et) {
00100 setValue(i, et);
00101 }
00102
00104 void L1GctInternHFData::setCount(unsigned i, uint16_t count) {
00105 setValue(i, count);
00106 }
00107
00108
00109 std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand)
00110 {
00111 s << "L1GctInternHFData :";
00112
00113 if (cand.empty()) {
00114 s << " empty";
00115 } else {
00116 if (cand.type()==L1GctInternHFData::conc_hf_ring_et_sums){
00117 s << " type=conc_hf_ring_et_sums";
00118 s << " ring1 eta+=" << cand.et(0);
00119 s << " ring1 eta-=" << cand.et(1);
00120 s << " ring2 eta+=" << cand.et(2);
00121 s << " ring2 eta-=" << cand.et(3);
00122 } else if (cand.type()==L1GctInternHFData::conc_hf_bit_counts){
00123 s << " type=conc_hf_bit_counts";
00124 s << " ring1 eta+=" << cand.count(0);
00125 s << " ring1 eta-=" << cand.count(1);
00126 s << " ring2 eta+=" << cand.count(2);
00127 s << " ring2 eta-=" << cand.count(3);
00128 } else if (cand.type()==L1GctInternHFData::wheel_hf_ring_et_sums){
00129 s << " type=conc_hf_ring_et_sums";
00130 s << " Et sum=" << cand.et(0);
00131 } else if (cand.type()==L1GctInternHFData::wheel_hf_bit_counts){
00132 s << " type=wheel_hf_bit_counts";
00133 s << " Bit count=" << cand.et(0);
00134 }
00135 }
00136 s << std::endl;
00137
00138 s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
00139
00140 return s;
00141
00142 }
00143