00001 00017 // this class header 00018 #include "CondFormats/L1TObjects/interface/L1GtBoard.h" 00019 00020 // system include files 00021 #include <iostream> 00022 #include <iomanip> 00023 00024 00025 00026 // user include files 00027 // base class 00028 00029 // forward declarations 00030 00031 // constructors 00032 L1GtBoard::L1GtBoard() 00033 { 00034 00035 // empty 00036 00037 } 00038 00039 L1GtBoard::L1GtBoard(const L1GtBoardType& gtBoardTypeValue) 00040 { 00041 00042 m_gtBoardType = gtBoardTypeValue; 00043 00044 m_gtBoardIndex = -1; 00045 00046 m_gtPositionDaqRecord = -1; 00047 m_gtPositionEvmRecord = -1; 00048 00049 m_gtBitDaqActiveBoards = -1; 00050 m_gtBitEvmActiveBoards = -1; 00051 00052 m_gtBoardSlot = -1; 00053 m_gtBoardHexName = 0; 00054 00055 m_gtQuadInPsb.reserve(NumberCablesBoard); 00056 00057 } 00058 00059 L1GtBoard::L1GtBoard(const L1GtBoardType& gtBoardTypeValue, const int& gtBoardIndexValue) 00060 { 00061 00062 m_gtBoardType = gtBoardTypeValue; 00063 m_gtBoardIndex = gtBoardIndexValue; 00064 00065 m_gtPositionDaqRecord = -1; 00066 m_gtPositionEvmRecord = -1; 00067 00068 m_gtBitDaqActiveBoards = -1; 00069 m_gtBitEvmActiveBoards = -1; 00070 00071 m_gtBoardSlot = -1; 00072 m_gtBoardHexName = 0; 00073 00074 m_gtQuadInPsb.reserve(NumberCablesBoard); 00075 00076 } 00077 00078 // destructor 00079 L1GtBoard::~L1GtBoard() 00080 { 00081 // empty 00082 } 00083 00084 // copy constructor 00085 L1GtBoard::L1GtBoard(const L1GtBoard& gtb) 00086 { 00087 00088 m_gtBoardType = gtb.gtBoardType(); 00089 m_gtBoardIndex = gtb.gtBoardIndex(); 00090 00091 m_gtPositionDaqRecord = gtb.gtPositionDaqRecord(); 00092 m_gtPositionEvmRecord = gtb.gtPositionEvmRecord(); 00093 00094 m_gtBitDaqActiveBoards = gtb.gtBitDaqActiveBoards(); 00095 m_gtBitEvmActiveBoards = gtb.gtBitEvmActiveBoards(); 00096 00097 m_gtBoardSlot = gtb.gtBoardSlot(); 00098 m_gtBoardHexName = gtb.gtBoardHexName(); 00099 00100 m_gtQuadInPsb = gtb.gtQuadInPsb(); 00101 00102 } 00103 00104 // assignment operator 00105 L1GtBoard::L1GtBoard& L1GtBoard::operator=(const L1GtBoard& gtb) 00106 { 00107 00108 if ( this != >b ) { 00109 00110 m_gtBoardType = gtb.gtBoardType(); 00111 m_gtBoardIndex = gtb.gtBoardIndex(); 00112 00113 m_gtPositionDaqRecord = gtb.gtPositionDaqRecord(); 00114 m_gtPositionEvmRecord = gtb.gtPositionEvmRecord(); 00115 00116 m_gtBitDaqActiveBoards = gtb.gtBitDaqActiveBoards(); 00117 m_gtBitEvmActiveBoards = gtb.gtBitEvmActiveBoards(); 00118 00119 m_gtBoardSlot = gtb.gtBoardSlot(); 00120 m_gtBoardHexName = gtb.gtBoardHexName(); 00121 00122 m_gtQuadInPsb = gtb.gtQuadInPsb(); 00123 00124 } 00125 00126 return *this; 00127 00128 } 00129 00130 // equal operator 00131 bool L1GtBoard::operator==(const L1GtBoard& gtb) const 00132 { 00133 00134 if (m_gtBoardType != gtb.gtBoardType()) { 00135 return false; 00136 } 00137 00138 if (m_gtBoardIndex != gtb.gtBoardIndex()) { 00139 return false; 00140 } 00141 00142 if (m_gtPositionDaqRecord != gtb.gtPositionDaqRecord()) { 00143 return false; 00144 } 00145 00146 if (m_gtPositionEvmRecord != gtb.gtPositionEvmRecord()) { 00147 return false; 00148 } 00149 00150 if (m_gtBitDaqActiveBoards != gtb.gtBitDaqActiveBoards()) { 00151 return false; 00152 } 00153 00154 if (m_gtBitEvmActiveBoards != gtb.gtBitEvmActiveBoards()) { 00155 return false; 00156 } 00157 00158 if (m_gtBoardSlot != gtb.gtBoardSlot()) { 00159 return false; 00160 } 00161 00162 if (m_gtBoardHexName != gtb.gtBoardHexName()) { 00163 return false; 00164 } 00165 00166 if (m_gtQuadInPsb != gtb.gtQuadInPsb()) { 00167 return false; 00168 } 00169 00170 // all members identical 00171 return true; 00172 00173 } 00174 00175 00176 00177 // unequal operator 00178 bool L1GtBoard::operator!=(const L1GtBoard& result) const 00179 { 00180 00181 return !( result == *this); 00182 00183 } 00184 00185 // less than operator 00186 bool L1GtBoard::operator< (const L1GtBoard& gtb) const 00187 { 00188 if (m_gtBoardType < gtb.gtBoardType()) { 00189 return true; 00190 } else { 00191 if (m_gtBoardType == gtb.gtBoardType()) { 00192 00193 if (m_gtBoardIndex < gtb.gtBoardIndex()) { 00194 return true; 00195 } 00196 } 00197 } 00198 00199 return false; 00200 } 00201 00202 // set board type 00203 void L1GtBoard::setGtBoardType(const L1GtBoardType& gtBoardTypeValue) 00204 { 00205 m_gtBoardType = gtBoardTypeValue; 00206 } 00207 00208 // set board index 00209 void L1GtBoard::setGtBoardIndex(const int& gtBoardIndexValue) 00210 { 00211 m_gtBoardIndex = gtBoardIndexValue; 00212 } 00213 00214 // set the position of board data block 00215 // in the GT DAQ readout record 00216 void L1GtBoard::setGtPositionDaqRecord(const int& gtPositionDaqRecordValue) 00217 { 00218 m_gtPositionDaqRecord = gtPositionDaqRecordValue; 00219 } 00220 00221 // set the position of board data block 00222 // in the GT EVM readout record 00223 void L1GtBoard::setGtPositionEvmRecord(const int& gtPositionEvmRecordValue) 00224 { 00225 m_gtPositionEvmRecord = gtPositionEvmRecordValue; 00226 } 00227 00228 // set the bit of board in the GTFE ACTIVE_BOARDS 00229 // for the GT DAQ readout record 00230 void L1GtBoard::setGtBitDaqActiveBoards(const int& gtBitDaqActiveBoardsValue) 00231 { 00232 m_gtBitDaqActiveBoards = gtBitDaqActiveBoardsValue; 00233 } 00234 00235 00236 // set the bit of board in the GTFE ACTIVE_BOARDS 00237 // for the GT EVM readout record 00238 void L1GtBoard::setGtBitEvmActiveBoards(const int& gtBitEvmActiveBoardsValue) 00239 { 00240 m_gtBitEvmActiveBoards = gtBitEvmActiveBoardsValue; 00241 } 00242 00243 // set board slot 00244 void L1GtBoard::setGtBoardSlot(const int& gtBoardSlotValue) 00245 { 00246 m_gtBoardSlot = gtBoardSlotValue; 00247 } 00248 00249 // set board hex fragment name in hw record 00250 void L1GtBoard::setGtBoardHexName(const int& gtBoardHexNameValue) 00251 { 00252 m_gtBoardHexName = gtBoardHexNameValue; 00253 } 00254 00255 00256 // set L1 quadruplet (4x16 bits)(cable) in the PSB input 00257 // valid for PSB only 00258 void L1GtBoard::setGtQuadInPsb(const std::vector<L1GtPsbQuad>& gtQuadInPsbValue) 00259 { 00260 m_gtQuadInPsb = gtQuadInPsbValue; 00261 } 00262 00263 // get the board ID 00264 const boost::uint16_t L1GtBoard::gtBoardId() const 00265 { 00266 00267 boost::uint16_t boardIdValue = 0; 00268 00269 if (m_gtBoardType == GTFE) { 00270 boardIdValue = boardIdValue | m_gtBoardSlot; 00271 } else { 00272 boardIdValue = boardIdValue | (m_gtBoardHexName << 8) | m_gtBoardSlot; 00273 } 00274 00275 return boardIdValue; 00276 } 00277 00278 // return board name - it depends on L1GtBoardType enum!!! 00279 std::string L1GtBoard::gtBoardName() const 00280 { 00281 00282 std::string gtBoardNameValue; 00283 00284 // active board, add its size 00285 switch (m_gtBoardType) { 00286 00287 case GTFE: { 00288 gtBoardNameValue = "GTFE"; 00289 } 00290 break; 00291 case FDL: { 00292 gtBoardNameValue = "FDL"; 00293 } 00294 break; 00295 case PSB: { 00296 gtBoardNameValue = "PSB"; 00297 } 00298 break; 00299 case GMT: { 00300 gtBoardNameValue = "GMT"; 00301 } 00302 break; 00303 case TCS: { 00304 gtBoardNameValue = "TCS"; 00305 } 00306 break; 00307 case TIM: { 00308 gtBoardNameValue = "TIM"; 00309 } 00310 break; 00311 default: { 00312 00313 // do nothing here 00314 // TODO throw exception instead of returning empty string? 00315 } 00316 break; 00317 } 00318 00319 00320 return gtBoardNameValue; 00321 00322 } 00323 00325 void L1GtBoard::print(std::ostream& myCout) const 00326 { 00327 00328 boost::uint16_t boardId = gtBoardId(); 00329 std::string boardName = gtBoardName(); 00330 00331 myCout 00332 << "Board ID: " << std::hex << boardId << std::dec << std::endl 00333 << "Board Name: " << boardName << "_" << m_gtBoardIndex << std::endl 00334 << "Position in DAQ Record: " << m_gtPositionDaqRecord << std::endl 00335 << "Position in EVM Record: " << m_gtPositionEvmRecord << std::endl 00336 << "Active_Boards bit in DAQ Record: " << m_gtBitDaqActiveBoards << std::endl 00337 << "Active_Boards bit in EVM Record: " << m_gtBitEvmActiveBoards << std::endl 00338 << "Board HexName: " << std::hex << m_gtBoardHexName << std::dec 00339 << std::endl; 00340 00341 if (m_gtBoardType == PSB) { 00342 myCout 00343 << "PSB Input per Cable: " 00344 << std::endl; 00345 } 00346 00347 00348 for (std::vector<L1GtPsbQuad>::const_iterator 00349 cIt = m_gtQuadInPsb.begin(); cIt != m_gtQuadInPsb.end(); ++cIt) { 00350 00351 std::string objType; 00352 00353 if ( *cIt == TechTr ) { 00354 objType = "TechTr"; 00355 } else if ( *cIt == IsoEGQ ) { 00356 objType = "IsoEGQ"; 00357 } else if ( *cIt == NoIsoEGQ ) { 00358 objType = "NoIsoEGQ"; 00359 } else if ( *cIt == CenJetQ ) { 00360 objType = "CenJetQ"; 00361 } else if ( *cIt == ForJetQ ) { 00362 objType = "ForJetQ"; 00363 } else if ( *cIt == TauJetQ ) { 00364 objType = "TauJetQ"; 00365 } else if ( *cIt == ESumsQ ) { 00366 objType = "ESumsQ"; 00367 } else if ( *cIt == JetCountsQ ) { 00368 objType = "JetCountsQ"; 00369 } else if ( *cIt == MQB1 ) { 00370 objType = "MQB1"; 00371 } else if ( *cIt == MQB2 ) { 00372 objType = "MQB2"; 00373 } else if ( *cIt == MQF3 ) { 00374 objType = "MQF3"; 00375 } else if ( *cIt == MQF4 ) { 00376 objType = "MQF4"; 00377 } else if ( *cIt == MQB5 ) { 00378 objType = "MQB5"; 00379 } else if ( *cIt == MQB6 ) { 00380 objType = "MQB6"; 00381 } else if ( *cIt == MQF7 ) { 00382 objType = "MQF7"; 00383 } else if ( *cIt == MQF8 ) { 00384 objType = "MQF8"; 00385 } else if ( *cIt == MQB9 ) { 00386 objType = "MQB9"; 00387 } else if ( *cIt == MQB10 ) { 00388 objType = "MQB10"; 00389 } else if ( *cIt == MQF11 ) { 00390 objType = "MQF11"; 00391 } else if ( *cIt == MQF12 ) { 00392 objType = "MQF12"; 00393 } else if ( *cIt == Free ) { 00394 objType = "Free"; 00395 } else { 00396 // do nothing, return empty string 00397 } 00398 00399 00400 myCout << " " << objType << " "; 00401 } 00402 00403 myCout << std::endl; 00404 } 00405 00406 // number of InfiniCables per board 00407 const int L1GtBoard::NumberCablesBoard = 4;