Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /**
0002  * \class L1GtBoard
0003  *
0004  *
0005  * Description: class for L1 GT board.
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/L1GtBoard.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 L1GtBoard::L1GtBoard() {
0031   // empty
0032 }
0033 
0034 L1GtBoard::L1GtBoard(const L1GtBoardType& gtBoardTypeValue) : m_gtBoardType(gtBoardTypeValue) {
0035   m_gtBoardIndex = -1;
0036 
0037   m_gtPositionDaqRecord = -1;
0038   m_gtPositionEvmRecord = -1;
0039 
0040   m_gtBitDaqActiveBoards = -1;
0041   m_gtBitEvmActiveBoards = -1;
0042 
0043   m_gtBoardSlot = -1;
0044   m_gtBoardHexName = 0;
0045 
0046   m_gtQuadInPsb.reserve(NumberCablesBoard);
0047 }
0048 
0049 L1GtBoard::L1GtBoard(const L1GtBoardType& gtBoardTypeValue, const int& gtBoardIndexValue)
0050     : m_gtBoardType(gtBoardTypeValue), m_gtBoardIndex(gtBoardIndexValue) {
0051   m_gtPositionDaqRecord = -1;
0052   m_gtPositionEvmRecord = -1;
0053 
0054   m_gtBitDaqActiveBoards = -1;
0055   m_gtBitEvmActiveBoards = -1;
0056 
0057   m_gtBoardSlot = -1;
0058   m_gtBoardHexName = 0;
0059 
0060   m_gtQuadInPsb.reserve(NumberCablesBoard);
0061 }
0062 
0063 // destructor
0064 L1GtBoard::~L1GtBoard() {
0065   // empty
0066 }
0067 
0068 // copy constructor
0069 L1GtBoard::L1GtBoard(const L1GtBoard& gtb) {
0070   m_gtBoardType = gtb.m_gtBoardType;
0071   m_gtBoardIndex = gtb.m_gtBoardIndex;
0072 
0073   m_gtPositionDaqRecord = gtb.m_gtPositionDaqRecord;
0074   m_gtPositionEvmRecord = gtb.m_gtPositionEvmRecord;
0075 
0076   m_gtBitDaqActiveBoards = gtb.m_gtBitDaqActiveBoards;
0077   m_gtBitEvmActiveBoards = gtb.m_gtBitEvmActiveBoards;
0078 
0079   m_gtBoardSlot = gtb.m_gtBoardSlot;
0080   m_gtBoardHexName = gtb.m_gtBoardHexName;
0081 
0082   m_gtQuadInPsb = gtb.m_gtQuadInPsb;
0083 
0084   m_gtInputPsbChannels = gtb.m_gtInputPsbChannels;
0085 }
0086 
0087 // assignment operator
0088 L1GtBoard& L1GtBoard::operator=(const L1GtBoard& gtb) {
0089   if (this != &gtb) {
0090     m_gtBoardType = gtb.m_gtBoardType;
0091     m_gtBoardIndex = gtb.m_gtBoardIndex;
0092 
0093     m_gtPositionDaqRecord = gtb.m_gtPositionDaqRecord;
0094     m_gtPositionEvmRecord = gtb.m_gtPositionEvmRecord;
0095 
0096     m_gtBitDaqActiveBoards = gtb.m_gtBitDaqActiveBoards;
0097     m_gtBitEvmActiveBoards = gtb.m_gtBitEvmActiveBoards;
0098 
0099     m_gtBoardSlot = gtb.m_gtBoardSlot;
0100     m_gtBoardHexName = gtb.m_gtBoardHexName;
0101 
0102     m_gtQuadInPsb = gtb.m_gtQuadInPsb;
0103     m_gtInputPsbChannels = gtb.m_gtInputPsbChannels;
0104   }
0105 
0106   return *this;
0107 }
0108 
0109 // equal operator
0110 bool L1GtBoard::operator==(const L1GtBoard& gtb) const {
0111   if (m_gtBoardType != gtb.m_gtBoardType) {
0112     return false;
0113   }
0114 
0115   if (m_gtBoardIndex != gtb.m_gtBoardIndex) {
0116     return false;
0117   }
0118 
0119   if (m_gtPositionDaqRecord != gtb.m_gtPositionDaqRecord) {
0120     return false;
0121   }
0122 
0123   if (m_gtPositionEvmRecord != gtb.m_gtPositionEvmRecord) {
0124     return false;
0125   }
0126 
0127   if (m_gtBitDaqActiveBoards != gtb.m_gtBitDaqActiveBoards) {
0128     return false;
0129   }
0130 
0131   if (m_gtBitEvmActiveBoards != gtb.m_gtBitEvmActiveBoards) {
0132     return false;
0133   }
0134 
0135   if (m_gtBoardSlot != gtb.m_gtBoardSlot) {
0136     return false;
0137   }
0138 
0139   if (m_gtBoardHexName != gtb.m_gtBoardHexName) {
0140     return false;
0141   }
0142 
0143   if (m_gtQuadInPsb != gtb.m_gtQuadInPsb) {
0144     return false;
0145   }
0146 
0147   if (m_gtInputPsbChannels != gtb.m_gtInputPsbChannels) {
0148     return false;
0149   }
0150 
0151   // all members identical
0152   return true;
0153 }
0154 
0155 // unequal operator
0156 bool L1GtBoard::operator!=(const L1GtBoard& result) const { return !(result == *this); }
0157 
0158 // less than operator
0159 bool L1GtBoard::operator<(const L1GtBoard& gtb) const {
0160   if (m_gtBoardType < gtb.gtBoardType()) {
0161     return true;
0162   } else {
0163     if (m_gtBoardType == gtb.gtBoardType()) {
0164       if (m_gtBoardIndex < gtb.gtBoardIndex()) {
0165         return true;
0166       }
0167     }
0168   }
0169 
0170   return false;
0171 }
0172 
0173 // set board type
0174 void L1GtBoard::setGtBoardType(const L1GtBoardType& gtBoardTypeValue) { m_gtBoardType = gtBoardTypeValue; }
0175 
0176 // set board index
0177 void L1GtBoard::setGtBoardIndex(const int& gtBoardIndexValue) { m_gtBoardIndex = gtBoardIndexValue; }
0178 
0179 // set the position of board data block
0180 // in the GT DAQ readout record
0181 void L1GtBoard::setGtPositionDaqRecord(const int& gtPositionDaqRecordValue) {
0182   m_gtPositionDaqRecord = gtPositionDaqRecordValue;
0183 }
0184 
0185 // set the position of board data block
0186 // in the GT EVM readout record
0187 void L1GtBoard::setGtPositionEvmRecord(const int& gtPositionEvmRecordValue) {
0188   m_gtPositionEvmRecord = gtPositionEvmRecordValue;
0189 }
0190 
0191 // set the bit of board in the GTFE ACTIVE_BOARDS
0192 // for the GT DAQ readout record
0193 void L1GtBoard::setGtBitDaqActiveBoards(const int& gtBitDaqActiveBoardsValue) {
0194   m_gtBitDaqActiveBoards = gtBitDaqActiveBoardsValue;
0195 }
0196 
0197 // set the bit of board in the GTFE ACTIVE_BOARDS
0198 // for the GT EVM readout record
0199 void L1GtBoard::setGtBitEvmActiveBoards(const int& gtBitEvmActiveBoardsValue) {
0200   m_gtBitEvmActiveBoards = gtBitEvmActiveBoardsValue;
0201 }
0202 
0203 // set board slot
0204 void L1GtBoard::setGtBoardSlot(const int& gtBoardSlotValue) { m_gtBoardSlot = gtBoardSlotValue; }
0205 
0206 // set board hex fragment name in hw record
0207 void L1GtBoard::setGtBoardHexName(const int& gtBoardHexNameValue) { m_gtBoardHexName = gtBoardHexNameValue; }
0208 
0209 // set L1 quadruplet (4x16 bits)(cable) in the PSB input
0210 // valid for PSB only
0211 void L1GtBoard::setGtQuadInPsb(const std::vector<L1GtPsbQuad>& gtQuadInPsbValue) { m_gtQuadInPsb = gtQuadInPsbValue; }
0212 
0213 // set detailed input configuration for PSB (objects pro channel)
0214 // int: channel number
0215 void L1GtBoard::setGtInputPsbChannels(const std::map<int, std::vector<L1GtObject> >& gtInputPsbChannelsValue) {
0216   m_gtInputPsbChannels = gtInputPsbChannelsValue;
0217 }
0218 
0219 // get the board ID
0220 const uint16_t L1GtBoard::gtBoardId() const {
0221   uint16_t boardIdValue = 0;
0222 
0223   if (m_gtBoardType == GTFE) {
0224     boardIdValue = boardIdValue | m_gtBoardSlot;
0225   } else {
0226     boardIdValue = boardIdValue | (m_gtBoardHexName << 8) | m_gtBoardSlot;
0227   }
0228 
0229   return boardIdValue;
0230 }
0231 
0232 // return board name - it depends on L1GtBoardType enum!!!
0233 std::string L1GtBoard::gtBoardName() const {
0234   std::string gtBoardNameValue;
0235 
0236   // active board, add its size
0237   switch (m_gtBoardType) {
0238     case GTFE: {
0239       gtBoardNameValue = "GTFE";
0240     } break;
0241     case FDL: {
0242       gtBoardNameValue = "FDL";
0243     } break;
0244     case PSB: {
0245       gtBoardNameValue = "PSB";
0246     } break;
0247     case GMT: {
0248       gtBoardNameValue = "GMT";
0249     } break;
0250     case TCS: {
0251       gtBoardNameValue = "TCS";
0252     } break;
0253     case TIM: {
0254       gtBoardNameValue = "TIM";
0255     } break;
0256     default: {
0257       //edm::LogWarning("L1GtBoard") << "\n\nError: no such board type" <<  m_gtBoardType
0258       //<< " in enum L1GtBoardType from L1GtFwd\n\n" << std::endl;
0259       gtBoardNameValue = "ERROR";
0260     } break;
0261   }
0262 
0263   return gtBoardNameValue;
0264 }
0265 
0266 /// print board
0267 void L1GtBoard::print(std::ostream& myCout) const {
0268   uint16_t boardId = gtBoardId();
0269   std::string boardName = gtBoardName();
0270 
0271   myCout << "Board ID:                        " << std::hex << boardId << std::dec << std::endl
0272          << "Board Name:                      " << boardName << "_" << m_gtBoardIndex << std::endl
0273          << "Position in DAQ Record:          " << m_gtPositionDaqRecord << std::endl
0274          << "Position in EVM Record:          " << m_gtPositionEvmRecord << std::endl
0275          << "Active_Boards bit in DAQ Record: " << m_gtBitDaqActiveBoards << std::endl
0276          << "Active_Boards bit in EVM Record: " << m_gtBitEvmActiveBoards << std::endl
0277          << "Board HexName:                   " << std::hex << m_gtBoardHexName << std::dec << std::endl;
0278 
0279   if (m_gtBoardType == PSB) {
0280     myCout << "PSB Input per Cable: DEPRECATED" << std::endl;
0281   }
0282 
0283   for (std::vector<L1GtPsbQuad>::const_iterator cIt = m_gtQuadInPsb.begin(); cIt != m_gtQuadInPsb.end(); ++cIt) {
0284     std::string objType;
0285 
0286     if (*cIt == TechTr) {
0287       objType = "TechTr";
0288     } else if (*cIt == IsoEGQ) {
0289       objType = "IsoEGQ";
0290     } else if (*cIt == NoIsoEGQ) {
0291       objType = "NoIsoEGQ";
0292     } else if (*cIt == CenJetQ) {
0293       objType = "CenJetQ";
0294     } else if (*cIt == ForJetQ) {
0295       objType = "ForJetQ";
0296     } else if (*cIt == TauJetQ) {
0297       objType = "TauJetQ";
0298     } else if (*cIt == ESumsQ) {
0299       objType = "ESumsQ";
0300     } else if (*cIt == JetCountsQ) {
0301       objType = "JetCountsQ";
0302     } else if (*cIt == MQB1) {
0303       objType = "MQB1";
0304     } else if (*cIt == MQB2) {
0305       objType = "MQB2";
0306     } else if (*cIt == MQF3) {
0307       objType = "MQF3";
0308     } else if (*cIt == MQF4) {
0309       objType = "MQF4";
0310     } else if (*cIt == MQB5) {
0311       objType = "MQB5";
0312     } else if (*cIt == MQB6) {
0313       objType = "MQB6";
0314     } else if (*cIt == MQF7) {
0315       objType = "MQF7";
0316     } else if (*cIt == MQF8) {
0317       objType = "MQF8";
0318     } else if (*cIt == MQB9) {
0319       objType = "MQB9";
0320     } else if (*cIt == MQB10) {
0321       objType = "MQB10";
0322     } else if (*cIt == MQF11) {
0323       objType = "MQF11";
0324     } else if (*cIt == MQF12) {
0325       objType = "MQF12";
0326     } else if (*cIt == Free) {
0327       objType = "Free";
0328     } else if (*cIt == HfQ) {
0329       objType = "HfQ";
0330     } else {
0331       myCout << "\n\nError: no such member " << (*cIt) << " in enum L1GtPsbQuad\n\n" << std::endl;
0332       objType = "ERROR";
0333     }
0334 
0335     myCout << "       " << objType << " ";
0336   }
0337   myCout << std::endl;
0338 
0339   if (m_gtBoardType == PSB) {
0340     myCout << "Input objects pro channel:";
0341   }
0342 
0343   for (std::map<int, std::vector<L1GtObject> >::const_iterator cIt = m_gtInputPsbChannels.begin();
0344        cIt != m_gtInputPsbChannels.end();
0345        ++cIt) {
0346     myCout << "\n  Channel " << cIt->first << " (" << (cIt->second).size() << " objects): ";
0347 
0348     for (std::vector<L1GtObject>::const_iterator itObj = (cIt->second).begin(); itObj != (cIt->second).end(); ++itObj) {
0349       switch (*itObj) {
0350         case Mu: {
0351           myCout << " Mu ";
0352         }
0353 
0354         break;
0355         case NoIsoEG: {
0356           myCout << " NoIsoEG ";
0357         }
0358 
0359         break;
0360         case IsoEG: {
0361           myCout << " IsoEG ";
0362         }
0363 
0364         break;
0365         case CenJet: {
0366           myCout << " CenJet ";
0367         }
0368 
0369         break;
0370         case ForJet: {
0371           myCout << " ForJet ";
0372         }
0373 
0374         break;
0375         case TauJet: {
0376           myCout << " TauJet ";
0377         }
0378 
0379         break;
0380         case ETM: {
0381           myCout << " ETM ";
0382         }
0383 
0384         break;
0385         case ETT: {
0386           myCout << " ETT ";
0387         }
0388 
0389         break;
0390         case HTT: {
0391           myCout << " HTT ";
0392         }
0393 
0394         break;
0395         case HTM: {
0396           myCout << " HTM ";
0397         }
0398 
0399         break;
0400         case JetCounts: {
0401           myCout << " JetCounts ";
0402         }
0403 
0404         break;
0405         case HfBitCounts: {
0406           myCout << " HfBitCounts ";
0407         }
0408 
0409         break;
0410         case HfRingEtSums: {
0411           myCout << " HfRingEtSums ";
0412         }
0413 
0414         break;
0415         case TechTrig: {
0416           myCout << " TechTrig ";
0417         }
0418 
0419         break;
0420         case Castor: {
0421           myCout << " Castor ";
0422         }
0423 
0424         break;
0425         case BPTX: {
0426           myCout << " BPTX ";
0427         }
0428 
0429         break;
0430         case GtExternal: {
0431           myCout << " GtExternal ";
0432         }
0433 
0434         break;
0435         default: {
0436           myCout << " ERROR: Unknown type " << (*itObj);
0437         } break;
0438       }
0439     }
0440   }
0441 
0442   myCout << std::endl;
0443 }
0444 
0445 // output stream operator
0446 std::ostream& operator<<(std::ostream& os, const L1GtBoard& result) {
0447   result.print(os);
0448   return os;
0449 }
0450 
0451 // number of InfiniCables per board
0452 const int L1GtBoard::NumberCablesBoard = 4;