00001 00017 // this class header 00018 #include "CondFormats/L1TObjects/interface/L1GtPsbConfig.h" 00019 00020 // system include files 00021 #include <iostream> 00022 #include <iomanip> 00023 00024 // user include files 00025 // base class 00026 00027 // forward declarations 00028 00029 // constructors 00030 L1GtPsbConfig::L1GtPsbConfig() 00031 { 00032 00033 m_gtBoardSlot = -1; 00034 00035 m_gtPsbCh0SendLvds = false; 00036 m_gtPsbCh1SendLvds = false; 00037 00038 m_gtPsbEnableRecLvds.reserve(PsbNumberLvdsGroups); 00039 m_gtPsbEnableRecSerLink.reserve(PsbSerLinkNumberChannels); 00040 00041 } 00042 00043 // constructor using board slot 00044 L1GtPsbConfig::L1GtPsbConfig(const int& psbSlot) : 00045 m_gtBoardSlot(psbSlot) 00046 { 00047 00048 m_gtPsbCh0SendLvds = false; 00049 m_gtPsbCh1SendLvds = false; 00050 00051 m_gtPsbEnableRecLvds.reserve(PsbNumberLvdsGroups); 00052 m_gtPsbEnableRecSerLink.reserve(PsbSerLinkNumberChannels); 00053 00054 } 00055 00056 // destructor 00057 L1GtPsbConfig::~L1GtPsbConfig() 00058 { 00059 // empty 00060 } 00061 00062 // copy constructor 00063 L1GtPsbConfig::L1GtPsbConfig(const L1GtPsbConfig& gtb) 00064 { 00065 00066 m_gtBoardSlot = gtb.m_gtBoardSlot; 00067 00068 m_gtPsbCh0SendLvds = gtb.m_gtPsbCh0SendLvds; 00069 m_gtPsbCh1SendLvds = gtb.m_gtPsbCh1SendLvds; 00070 00071 m_gtPsbEnableRecLvds = gtb.m_gtPsbEnableRecLvds; 00072 m_gtPsbEnableRecSerLink = gtb.m_gtPsbEnableRecSerLink; 00073 00074 } 00075 00076 // assignment operator 00077 L1GtPsbConfig& L1GtPsbConfig::operator=(const L1GtPsbConfig& gtb) 00078 { 00079 00080 if (this != >b) { 00081 00082 m_gtBoardSlot = gtb.m_gtBoardSlot; 00083 00084 m_gtPsbCh0SendLvds = gtb.m_gtPsbCh0SendLvds; 00085 m_gtPsbCh1SendLvds = gtb.m_gtPsbCh1SendLvds; 00086 00087 m_gtPsbEnableRecLvds = gtb.m_gtPsbEnableRecLvds; 00088 m_gtPsbEnableRecSerLink = gtb.m_gtPsbEnableRecSerLink; 00089 } 00090 00091 return *this; 00092 00093 } 00094 00095 // equal operator 00096 bool L1GtPsbConfig::operator==(const L1GtPsbConfig& gtb) const 00097 { 00098 00099 if (m_gtBoardSlot != gtb.m_gtBoardSlot) { 00100 return false; 00101 } 00102 00103 if (m_gtPsbCh0SendLvds != gtb.m_gtPsbCh0SendLvds) { 00104 return false; 00105 } 00106 00107 if (m_gtPsbCh1SendLvds != gtb.m_gtPsbCh1SendLvds) { 00108 return false; 00109 } 00110 00111 if (m_gtPsbEnableRecLvds != gtb.m_gtPsbEnableRecLvds) { 00112 return false; 00113 } 00114 00115 if (m_gtPsbEnableRecSerLink != gtb.m_gtPsbEnableRecSerLink) { 00116 return false; 00117 } 00118 00119 // all members identical 00120 return true; 00121 00122 } 00123 00124 // unequal operator 00125 bool L1GtPsbConfig::operator!=(const L1GtPsbConfig& result) const 00126 { 00127 00128 return !(result == *this); 00129 00130 } 00131 00132 // less than operator 00133 bool L1GtPsbConfig::operator<(const L1GtPsbConfig& gtb) const 00134 { 00135 if (m_gtBoardSlot < gtb.m_gtBoardSlot) { 00136 return true; 00137 } 00138 else { 00139 return false; 00140 } 00141 00142 return false; 00143 } 00144 00145 // set board slot 00146 void L1GtPsbConfig::setGtBoardSlot(const int& gtBoardSlotValue) 00147 { 00148 m_gtBoardSlot = gtBoardSlotValue; 00149 } 00150 00151 // set CH0_SEND_LVDS_NOT_DS92LV16 00152 void L1GtPsbConfig::setGtPsbCh0SendLvds(const bool& gtPsbCh0SendLvdsValue) 00153 { 00154 m_gtPsbCh0SendLvds = gtPsbCh0SendLvdsValue; 00155 } 00156 00157 // set CH1_SEND_LVDS_NOT_DS92LV16 00158 void L1GtPsbConfig::setGtPsbCh1SendLvds(const bool& gtPsbCh1SendLvdsValue) 00159 { 00160 m_gtPsbCh1SendLvds = gtPsbCh1SendLvdsValue; 00161 } 00162 00163 // set enable LVDS 00164 void L1GtPsbConfig::setGtPsbEnableRecLvds( 00165 const std::vector<bool>& gtPsbEnableRecLvdsValue) 00166 { 00167 00168 m_gtPsbEnableRecLvds = gtPsbEnableRecLvdsValue; 00169 } 00170 00171 // set enable channels for receiving signal via serial links 00172 void L1GtPsbConfig::setGtPsbEnableRecSerLink( 00173 const std::vector<bool>& gtPsbEnableRecSerLinkValue) 00174 { 00175 m_gtPsbEnableRecSerLink = gtPsbEnableRecSerLinkValue; 00176 } 00177 00178 // print board 00179 void L1GtPsbConfig::print(std::ostream& myCout) const 00180 { 00181 00182 myCout << "PSB Board slot " << m_gtBoardSlot << " ( 0x" << std::hex 00183 << m_gtBoardSlot << std::dec << " ):" << std::endl; 00184 00185 myCout << " CH0_SEND_LVDS_NOT_DS92LV16 = " 00186 << (m_gtPsbCh0SendLvds ? "True" : "False") << std::endl; 00187 myCout << " CH1_SEND_LVDS_NOT_DS92LV16 = " 00188 << (m_gtPsbCh1SendLvds ? "True" : "False") << std::endl; 00189 myCout << std::endl; 00190 00191 int iLvds = -1; 00192 for (std::vector<bool>::const_iterator cIt = m_gtPsbEnableRecLvds.begin(); cIt 00193 != m_gtPsbEnableRecLvds.end(); ++cIt) { 00194 00195 iLvds++; 00196 myCout << "\n Enable_Rec_LVDS [" << iLvds << "] = " 00197 << ((*cIt) ? "True" : "False"); 00198 } 00199 myCout << std::endl; 00200 00201 int iCh = -1; 00202 for (std::vector<bool>::const_iterator cIt = 00203 m_gtPsbEnableRecSerLink.begin(); cIt 00204 != m_gtPsbEnableRecSerLink.end(); ++cIt) { 00205 00206 iCh++; 00207 myCout << "\n SerLink_Ch" << iCh << "_Rec_Enable = " 00208 << ((*cIt) ? "True" : "False"); 00209 } 00210 myCout << std::endl; 00211 } 00212 00213 // output stream operator 00214 std::ostream& operator<<(std::ostream& os, const L1GtPsbConfig& result) 00215 { 00216 result.print(os); 00217 return os; 00218 00219 } 00220 00221 // number of LVDS groups per board 00222 const int L1GtPsbConfig::PsbNumberLvdsGroups = 16; 00223 00224 // number of channels per board 00225 const int L1GtPsbConfig::PsbSerLinkNumberChannels = 8;