Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:45

0001 #include "DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h"
0002 
0003 #include <iostream>
0004 
0005 using std::dec;
0006 using std::endl;
0007 using std::hex;
0008 using std::ostream;
0009 
0010 // default constructor
0011 L1CaloEmCand::L1CaloEmCand() : m_data(0), m_rctCrate(0), m_iso(false), m_index(0), m_bx(0) {}
0012 
0013 // construct from raw data (for use in unpacking)
0014 // last bool argument is a hack to distinguish this constructor from the next one!
0015 L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso)
0016     : m_data(data), m_rctCrate(crate), m_iso(iso), m_index(0), m_bx(0) {}
0017 
0018 // construct from raw data (for use in unpacking)
0019 // last bool argument is a hack to distinguish this constructor from the next one!
0020 L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy)
0021     : m_data(data), m_rctCrate(crate), m_iso(iso), m_index(index), m_bx(bx) {}
0022 
0023 // construct from content (for use in emulator)
0024 L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso)
0025     : m_data(0),  // over-ridden below
0026       m_rctCrate(crate),
0027       m_iso(iso),
0028       m_index(0),
0029       m_bx(0)
0030 
0031 {
0032   m_data = (rank & 0x3f) + ((region & 0x1) << 6) + ((card & 0x7) << 7);
0033 }
0034 
0035 // construct from content (for use in emulator)
0036 L1CaloEmCand::L1CaloEmCand(
0037     unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx)
0038     : m_data(0),  // over-ridden below
0039       m_rctCrate(crate),
0040       m_iso(iso),
0041       m_index(index),
0042       m_bx(bx) {
0043   m_data = (rank & 0x3f) + ((region & 0x1) << 6) + ((card & 0x7) << 7);
0044 }
0045 
0046 // destructor
0047 L1CaloEmCand::~L1CaloEmCand() {}
0048 
0049 void L1CaloEmCand::setBx(int16_t bx) { m_bx = bx; }
0050 
0051 // pretty print
0052 ostream& operator<<(ostream& s, const L1CaloEmCand& cand) {
0053   s << "L1CaloEmCand : ";
0054   s << "rank=" << cand.rank();
0055   s << ", region=" << cand.rctRegion() << ", card=" << cand.rctCard() << ", crate=" << cand.rctCrate();
0056   s << ", iso=" << cand.isolated();
0057   s << ", index=" << cand.index() << ", BX=" << cand.bx();
0058   return s;
0059 }