CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/DataFormats/L1CaloTrigger/src/L1CaloEmCand.cc

Go to the documentation of this file.
00001 #include "DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h"
00002 
00003 #include <iostream>
00004 
00005 using std::ostream;
00006 using std::endl;
00007 using std::hex;
00008 using std::dec;
00009 
00010 // default constructor
00011 L1CaloEmCand::L1CaloEmCand() :
00012   m_data(0),
00013   m_rctCrate(0),
00014   m_iso(false),
00015   m_index(0),
00016   m_bx(0)
00017 { 
00018 
00019 }
00020 
00021 // construct from raw data (for use in unpacking)
00022 // last bool argument is a hack to distinguish this constructor from the next one!
00023 L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso) :
00024    m_data(data),
00025    m_rctCrate(crate),
00026    m_iso(iso),
00027    m_index(0),
00028    m_bx(0)
00029  {
00030  }
00031 
00032 // construct from raw data (for use in unpacking)
00033 // last bool argument is a hack to distinguish this constructor from the next one!
00034  L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy) :
00035    m_data(data),
00036    m_rctCrate(crate),
00037    m_iso(iso),
00038    m_index(index),
00039    m_bx(bx)
00040  {
00041  }
00042 
00043 // construct from content (for use in emulator)
00044 L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso) : 
00045   m_data(0), // over-ridden below
00046   m_rctCrate(crate),
00047   m_iso(iso),
00048   m_index(0),
00049   m_bx(0)
00050 
00051 {
00052   m_data = (rank & 0x3f) + ((region & 0x1)<<6) + ((card & 0x7)<<7); 
00053 }
00054 
00055 // construct from content (for use in emulator)
00056 L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx) : 
00057   m_data(0), // over-ridden below
00058   m_rctCrate(crate),
00059   m_iso(iso),
00060   m_index(index),
00061   m_bx(bx)
00062 {
00063   m_data = (rank & 0x3f) + ((region & 0x1)<<6) + ((card & 0x7)<<7); 
00064 }
00065 
00066 // destructor
00067 L1CaloEmCand::~L1CaloEmCand() { } 
00068 
00069 void L1CaloEmCand::setBx(int16_t bx) {
00070   m_bx = bx;
00071 }
00072 
00073 // pretty print
00074 ostream& operator<<(ostream& s, const L1CaloEmCand& cand) {
00075   s << "L1CaloEmCand : ";
00076   s << "rank=" << cand.rank();
00077   s << ", region=" << cand.rctRegion() << ", card=" << cand.rctCard() << ", crate=" << cand.rctCrate();
00078   s << ", iso=" << cand.isolated();
00079   s << ", index=" << cand.index() << ", BX=" << cand.bx();
00080   return s;
00081 }