Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:20

0001 /**
0002  * \class L1GtPsbConfig
0003  *
0004  *
0005  * Description: class for L1 GT PSB board configuration.
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *
0010  * \author: Vasile Mihai Ghete - HEPHY Vienna
0011  *
0012  * $Date$
0013  * $Revision$
0014  *
0015  */
0016 
0017 // this class header
0018 #include "CondFormats/L1TObjects/interface/L1GtPsbConfig.h"
0019 
0020 // system include files
0021 #include <iostream>
0022 #include <iomanip>
0023 
0024 // user include files
0025 //   base class
0026 
0027 // forward declarations
0028 
0029 // constructors
0030 L1GtPsbConfig::L1GtPsbConfig() {
0031   m_gtBoardSlot = -1;
0032 
0033   m_gtPsbCh0SendLvds = false;
0034   m_gtPsbCh1SendLvds = false;
0035 
0036   m_gtPsbEnableRecLvds.reserve(PsbNumberLvdsGroups);
0037   m_gtPsbEnableRecSerLink.reserve(PsbSerLinkNumberChannels);
0038 }
0039 
0040 // constructor using board slot
0041 L1GtPsbConfig::L1GtPsbConfig(const int& psbSlot) : m_gtBoardSlot(psbSlot) {
0042   m_gtPsbCh0SendLvds = false;
0043   m_gtPsbCh1SendLvds = false;
0044 
0045   m_gtPsbEnableRecLvds.reserve(PsbNumberLvdsGroups);
0046   m_gtPsbEnableRecSerLink.reserve(PsbSerLinkNumberChannels);
0047 }
0048 
0049 // destructor
0050 L1GtPsbConfig::~L1GtPsbConfig() {
0051   // empty
0052 }
0053 
0054 // copy constructor
0055 L1GtPsbConfig::L1GtPsbConfig(const L1GtPsbConfig& gtb) {
0056   m_gtBoardSlot = gtb.m_gtBoardSlot;
0057 
0058   m_gtPsbCh0SendLvds = gtb.m_gtPsbCh0SendLvds;
0059   m_gtPsbCh1SendLvds = gtb.m_gtPsbCh1SendLvds;
0060 
0061   m_gtPsbEnableRecLvds = gtb.m_gtPsbEnableRecLvds;
0062   m_gtPsbEnableRecSerLink = gtb.m_gtPsbEnableRecSerLink;
0063 }
0064 
0065 // assignment operator
0066 L1GtPsbConfig& L1GtPsbConfig::operator=(const L1GtPsbConfig& gtb) {
0067   if (this != &gtb) {
0068     m_gtBoardSlot = gtb.m_gtBoardSlot;
0069 
0070     m_gtPsbCh0SendLvds = gtb.m_gtPsbCh0SendLvds;
0071     m_gtPsbCh1SendLvds = gtb.m_gtPsbCh1SendLvds;
0072 
0073     m_gtPsbEnableRecLvds = gtb.m_gtPsbEnableRecLvds;
0074     m_gtPsbEnableRecSerLink = gtb.m_gtPsbEnableRecSerLink;
0075   }
0076 
0077   return *this;
0078 }
0079 
0080 // equal operator
0081 bool L1GtPsbConfig::operator==(const L1GtPsbConfig& gtb) const {
0082   if (m_gtBoardSlot != gtb.m_gtBoardSlot) {
0083     return false;
0084   }
0085 
0086   if (m_gtPsbCh0SendLvds != gtb.m_gtPsbCh0SendLvds) {
0087     return false;
0088   }
0089 
0090   if (m_gtPsbCh1SendLvds != gtb.m_gtPsbCh1SendLvds) {
0091     return false;
0092   }
0093 
0094   if (m_gtPsbEnableRecLvds != gtb.m_gtPsbEnableRecLvds) {
0095     return false;
0096   }
0097 
0098   if (m_gtPsbEnableRecSerLink != gtb.m_gtPsbEnableRecSerLink) {
0099     return false;
0100   }
0101 
0102   // all members identical
0103   return true;
0104 }
0105 
0106 // unequal operator
0107 bool L1GtPsbConfig::operator!=(const L1GtPsbConfig& result) const { return !(result == *this); }
0108 
0109 // less than operator
0110 bool L1GtPsbConfig::operator<(const L1GtPsbConfig& gtb) const {
0111   if (m_gtBoardSlot < gtb.m_gtBoardSlot) {
0112     return true;
0113   } else {
0114     return false;
0115   }
0116 
0117   return false;
0118 }
0119 
0120 // set board slot
0121 void L1GtPsbConfig::setGtBoardSlot(const int& gtBoardSlotValue) { m_gtBoardSlot = gtBoardSlotValue; }
0122 
0123 // set CH0_SEND_LVDS_NOT_DS92LV16
0124 void L1GtPsbConfig::setGtPsbCh0SendLvds(const bool& gtPsbCh0SendLvdsValue) {
0125   m_gtPsbCh0SendLvds = gtPsbCh0SendLvdsValue;
0126 }
0127 
0128 // set CH1_SEND_LVDS_NOT_DS92LV16
0129 void L1GtPsbConfig::setGtPsbCh1SendLvds(const bool& gtPsbCh1SendLvdsValue) {
0130   m_gtPsbCh1SendLvds = gtPsbCh1SendLvdsValue;
0131 }
0132 
0133 // set enable LVDS
0134 void L1GtPsbConfig::setGtPsbEnableRecLvds(const std::vector<bool>& gtPsbEnableRecLvdsValue) {
0135   m_gtPsbEnableRecLvds = gtPsbEnableRecLvdsValue;
0136 }
0137 
0138 // set enable channels for receiving signal via serial links
0139 void L1GtPsbConfig::setGtPsbEnableRecSerLink(const std::vector<bool>& gtPsbEnableRecSerLinkValue) {
0140   m_gtPsbEnableRecSerLink = gtPsbEnableRecSerLinkValue;
0141 }
0142 
0143 // print board
0144 void L1GtPsbConfig::print(std::ostream& myCout) const {
0145   myCout << "PSB Board slot " << m_gtBoardSlot << " ( 0x" << std::hex << m_gtBoardSlot << std::dec
0146          << " ):" << std::endl;
0147 
0148   myCout << "    CH0_SEND_LVDS_NOT_DS92LV16 = " << (m_gtPsbCh0SendLvds ? "True" : "False") << std::endl;
0149   myCout << "    CH1_SEND_LVDS_NOT_DS92LV16 = " << (m_gtPsbCh1SendLvds ? "True" : "False") << std::endl;
0150   myCout << std::endl;
0151 
0152   int iLvds = -1;
0153   for (std::vector<bool>::const_iterator cIt = m_gtPsbEnableRecLvds.begin(); cIt != m_gtPsbEnableRecLvds.end(); ++cIt) {
0154     iLvds++;
0155     myCout << "\n    Enable_Rec_LVDS [" << iLvds << "] = " << ((*cIt) ? "True" : "False");
0156   }
0157   myCout << std::endl;
0158 
0159   int iCh = -1;
0160   for (std::vector<bool>::const_iterator cIt = m_gtPsbEnableRecSerLink.begin(); cIt != m_gtPsbEnableRecSerLink.end();
0161        ++cIt) {
0162     iCh++;
0163     myCout << "\n    SerLink_Ch" << iCh << "_Rec_Enable = " << ((*cIt) ? "True" : "False");
0164   }
0165   myCout << std::endl;
0166 }
0167 
0168 // output stream operator
0169 std::ostream& operator<<(std::ostream& os, const L1GtPsbConfig& result) {
0170   result.print(os);
0171   return os;
0172 }
0173 
0174 // number of LVDS groups per board
0175 const int L1GtPsbConfig::PsbNumberLvdsGroups = 16;
0176 
0177 // number of channels per board
0178 const int L1GtPsbConfig::PsbSerLinkNumberChannels = 8;