CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/CondFormats/L1TObjects/src/L1GtBoard.cc

Go to the documentation of this file.
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     m_gtBoardType(gtBoardTypeValue)
00041 {
00042 
00043     m_gtBoardIndex = -1;
00044 
00045     m_gtPositionDaqRecord = -1;
00046     m_gtPositionEvmRecord = -1;
00047 
00048     m_gtBitDaqActiveBoards = -1;
00049     m_gtBitEvmActiveBoards = -1;
00050 
00051     m_gtBoardSlot = -1;
00052     m_gtBoardHexName = 0;
00053 
00054     m_gtQuadInPsb.reserve(NumberCablesBoard);
00055 
00056 }
00057 
00058 L1GtBoard::L1GtBoard(const L1GtBoardType& gtBoardTypeValue,
00059         const int& gtBoardIndexValue) :
00060     m_gtBoardType(gtBoardTypeValue), m_gtBoardIndex(gtBoardIndexValue)
00061 {
00062 
00063     m_gtPositionDaqRecord = -1;
00064     m_gtPositionEvmRecord = -1;
00065 
00066     m_gtBitDaqActiveBoards = -1;
00067     m_gtBitEvmActiveBoards = -1;
00068 
00069     m_gtBoardSlot = -1;
00070     m_gtBoardHexName = 0;
00071 
00072     m_gtQuadInPsb.reserve(NumberCablesBoard);
00073 
00074 }
00075 
00076 // destructor
00077 L1GtBoard::~L1GtBoard()
00078 {
00079     // empty
00080 }
00081 
00082 // copy constructor
00083 L1GtBoard::L1GtBoard(const L1GtBoard& gtb)
00084 {
00085 
00086     m_gtBoardType = gtb.m_gtBoardType;
00087     m_gtBoardIndex = gtb.m_gtBoardIndex;
00088 
00089     m_gtPositionDaqRecord = gtb.m_gtPositionDaqRecord;
00090     m_gtPositionEvmRecord = gtb.m_gtPositionEvmRecord;
00091 
00092     m_gtBitDaqActiveBoards = gtb.m_gtBitDaqActiveBoards;
00093     m_gtBitEvmActiveBoards = gtb.m_gtBitEvmActiveBoards;
00094 
00095     m_gtBoardSlot = gtb.m_gtBoardSlot;
00096     m_gtBoardHexName = gtb.m_gtBoardHexName;
00097 
00098     m_gtQuadInPsb = gtb.m_gtQuadInPsb;
00099 
00100     m_gtInputPsbChannels = gtb.m_gtInputPsbChannels;
00101 
00102 }
00103 
00104 // assignment operator
00105 L1GtBoard& L1GtBoard::operator=(const L1GtBoard& gtb)
00106 {
00107 
00108     if ( this != &gtb ) {
00109 
00110         m_gtBoardType = gtb.m_gtBoardType;
00111         m_gtBoardIndex = gtb.m_gtBoardIndex;
00112 
00113         m_gtPositionDaqRecord = gtb.m_gtPositionDaqRecord;
00114         m_gtPositionEvmRecord = gtb.m_gtPositionEvmRecord;
00115 
00116         m_gtBitDaqActiveBoards = gtb.m_gtBitDaqActiveBoards;
00117         m_gtBitEvmActiveBoards = gtb.m_gtBitEvmActiveBoards;
00118 
00119         m_gtBoardSlot = gtb.m_gtBoardSlot;
00120         m_gtBoardHexName = gtb.m_gtBoardHexName;
00121 
00122         m_gtQuadInPsb = gtb.m_gtQuadInPsb;
00123         m_gtInputPsbChannels = gtb.m_gtInputPsbChannels;
00124 
00125     }
00126 
00127     return *this;
00128 
00129 }
00130 
00131 // equal operator
00132 bool L1GtBoard::operator==(const L1GtBoard& gtb) const
00133 {
00134 
00135     if (m_gtBoardType != gtb.m_gtBoardType) {
00136         return false;
00137     }
00138 
00139     if (m_gtBoardIndex != gtb.m_gtBoardIndex) {
00140         return false;
00141     }
00142 
00143     if (m_gtPositionDaqRecord != gtb.m_gtPositionDaqRecord) {
00144         return false;
00145     }
00146 
00147     if (m_gtPositionEvmRecord != gtb.m_gtPositionEvmRecord) {
00148         return false;
00149     }
00150 
00151     if (m_gtBitDaqActiveBoards != gtb.m_gtBitDaqActiveBoards) {
00152         return false;
00153     }
00154 
00155     if (m_gtBitEvmActiveBoards != gtb.m_gtBitEvmActiveBoards) {
00156         return false;
00157     }
00158 
00159     if (m_gtBoardSlot != gtb.m_gtBoardSlot) {
00160         return false;
00161     }
00162 
00163     if (m_gtBoardHexName != gtb.m_gtBoardHexName) {
00164         return false;
00165     }
00166 
00167     if (m_gtQuadInPsb != gtb.m_gtQuadInPsb) {
00168         return false;
00169     }
00170 
00171     if (m_gtInputPsbChannels != gtb.m_gtInputPsbChannels) {
00172         return false;
00173     }
00174 
00175     // all members identical
00176     return true;
00177 
00178 }
00179 
00180 
00181 
00182 // unequal operator
00183 bool L1GtBoard::operator!=(const L1GtBoard& result) const
00184 {
00185 
00186     return !( result == *this);
00187 
00188 }
00189 
00190 // less than operator
00191 bool L1GtBoard::operator< (const L1GtBoard& gtb) const
00192 {
00193     if (m_gtBoardType < gtb.gtBoardType()) {
00194         return true;
00195     } else {
00196         if (m_gtBoardType == gtb.gtBoardType()) {
00197 
00198             if (m_gtBoardIndex < gtb.gtBoardIndex()) {
00199                 return true;
00200             }
00201         }
00202     }
00203 
00204     return false;
00205 }
00206 
00207 // set board type
00208 void L1GtBoard::setGtBoardType(const L1GtBoardType& gtBoardTypeValue)
00209 {
00210     m_gtBoardType = gtBoardTypeValue;
00211 }
00212 
00213 // set board index
00214 void L1GtBoard::setGtBoardIndex(const int& gtBoardIndexValue)
00215 {
00216     m_gtBoardIndex = gtBoardIndexValue;
00217 }
00218 
00219 // set the position of board data block
00220 // in the GT DAQ readout record
00221 void L1GtBoard::setGtPositionDaqRecord(const int& gtPositionDaqRecordValue)
00222 {
00223     m_gtPositionDaqRecord = gtPositionDaqRecordValue;
00224 }
00225 
00226 // set the position of board data block
00227 // in the GT EVM readout record
00228 void L1GtBoard::setGtPositionEvmRecord(const int& gtPositionEvmRecordValue)
00229 {
00230     m_gtPositionEvmRecord = gtPositionEvmRecordValue;
00231 }
00232 
00233 // set the bit of board in the GTFE ACTIVE_BOARDS
00234 // for the GT DAQ readout record
00235 void L1GtBoard::setGtBitDaqActiveBoards(const int& gtBitDaqActiveBoardsValue)
00236 {
00237     m_gtBitDaqActiveBoards = gtBitDaqActiveBoardsValue;
00238 }
00239 
00240 
00241 // set the bit of board in the GTFE ACTIVE_BOARDS
00242 // for the GT EVM readout record
00243 void L1GtBoard::setGtBitEvmActiveBoards(const int& gtBitEvmActiveBoardsValue)
00244 {
00245     m_gtBitEvmActiveBoards = gtBitEvmActiveBoardsValue;
00246 }
00247 
00248 // set board slot
00249 void L1GtBoard::setGtBoardSlot(const int& gtBoardSlotValue)
00250 {
00251     m_gtBoardSlot = gtBoardSlotValue;
00252 }
00253 
00254 // set board hex fragment name in hw record
00255 void L1GtBoard::setGtBoardHexName(const int& gtBoardHexNameValue)
00256 {
00257     m_gtBoardHexName = gtBoardHexNameValue;
00258 }
00259 
00260 
00261 // set L1 quadruplet (4x16 bits)(cable) in the PSB input
00262 // valid for PSB only
00263 void L1GtBoard::setGtQuadInPsb(const std::vector<L1GtPsbQuad>& gtQuadInPsbValue)
00264 {
00265     m_gtQuadInPsb = gtQuadInPsbValue;
00266 }
00267 
00268 // set detailed input configuration for PSB (objects pro channel)
00269 // int: channel number
00270 void L1GtBoard::setGtInputPsbChannels(const std::map<int, std::vector<L1GtObject> >& gtInputPsbChannelsValue) {
00271     m_gtInputPsbChannels = gtInputPsbChannelsValue;
00272 }
00273 
00274 // get the board ID
00275 const boost::uint16_t L1GtBoard::gtBoardId() const
00276 {
00277 
00278     boost::uint16_t boardIdValue = 0;
00279 
00280     if (m_gtBoardType == GTFE) {
00281         boardIdValue = boardIdValue | m_gtBoardSlot;
00282     } else {
00283         boardIdValue = boardIdValue | (m_gtBoardHexName << 8) | m_gtBoardSlot;
00284     }
00285 
00286     return boardIdValue;
00287 }
00288 
00289 // return board name - it depends on L1GtBoardType enum!!!
00290 std::string L1GtBoard::gtBoardName() const
00291 {
00292 
00293     std::string gtBoardNameValue;
00294 
00295     // active board, add its size
00296     switch (m_gtBoardType) {
00297 
00298         case GTFE: {
00299                 gtBoardNameValue = "GTFE";
00300             }
00301             break;
00302         case FDL: {
00303                 gtBoardNameValue = "FDL";
00304             }
00305             break;
00306         case PSB: {
00307                 gtBoardNameValue = "PSB";
00308             }
00309             break;
00310         case GMT: {
00311                 gtBoardNameValue = "GMT";
00312             }
00313             break;
00314         case TCS: {
00315                 gtBoardNameValue = "TCS";
00316             }
00317             break;
00318         case TIM: {
00319                 gtBoardNameValue = "TIM";
00320             }
00321             break;
00322         default: {
00323             //edm::LogWarning("L1GtBoard") << "\n\nError: no such board type" <<  m_gtBoardType
00324             //<< " in enum L1GtBoardType from L1GtFwd\n\n" << std::endl;
00325             gtBoardNameValue = "ERROR";
00326             }
00327             break;
00328     }
00329 
00330 
00331     return gtBoardNameValue;
00332 
00333 }
00334 
00336 void L1GtBoard::print(std::ostream& myCout) const
00337 {
00338 
00339     boost::uint16_t boardId = gtBoardId();
00340     std::string boardName = gtBoardName();
00341 
00342     myCout
00343     << "Board ID:                        " << std::hex << boardId << std::dec << std::endl
00344     << "Board Name:                      " << boardName << "_" << m_gtBoardIndex << std::endl
00345     << "Position in DAQ Record:          " << m_gtPositionDaqRecord << std::endl
00346     << "Position in EVM Record:          " << m_gtPositionEvmRecord << std::endl
00347     << "Active_Boards bit in DAQ Record: " << m_gtBitDaqActiveBoards << std::endl
00348     << "Active_Boards bit in EVM Record: " << m_gtBitEvmActiveBoards << std::endl
00349     << "Board HexName:                   " << std::hex << m_gtBoardHexName << std::dec
00350     << std::endl;
00351 
00352     if (m_gtBoardType == PSB) {
00353         myCout
00354         << "PSB Input per Cable: DEPRECATED"
00355         << std::endl;
00356     }
00357 
00358 
00359     for (std::vector<L1GtPsbQuad>::const_iterator
00360             cIt = m_gtQuadInPsb.begin(); cIt != m_gtQuadInPsb.end(); ++cIt) {
00361 
00362         std::string objType;
00363 
00364         if ( *cIt == TechTr ) {
00365             objType = "TechTr";
00366         } else if ( *cIt == IsoEGQ ) {
00367             objType = "IsoEGQ";
00368         } else if ( *cIt == NoIsoEGQ ) {
00369             objType = "NoIsoEGQ";
00370         } else if ( *cIt == CenJetQ ) {
00371             objType = "CenJetQ";
00372         } else if ( *cIt == ForJetQ ) {
00373             objType = "ForJetQ";
00374         } else if ( *cIt == TauJetQ ) {
00375             objType = "TauJetQ";
00376         } else if ( *cIt == ESumsQ ) {
00377             objType = "ESumsQ";
00378         } else if ( *cIt == JetCountsQ ) {
00379             objType = "JetCountsQ";
00380         } else if ( *cIt == MQB1 ) {
00381             objType = "MQB1";
00382         } else if ( *cIt == MQB2 ) {
00383             objType = "MQB2";
00384         } else if ( *cIt == MQF3 ) {
00385             objType = "MQF3";
00386         } else if ( *cIt == MQF4 ) {
00387             objType = "MQF4";
00388         } else if ( *cIt == MQB5 ) {
00389             objType = "MQB5";
00390         } else if ( *cIt == MQB6 ) {
00391             objType = "MQB6";
00392         } else if ( *cIt == MQF7 ) {
00393             objType = "MQF7";
00394         } else if ( *cIt == MQF8 ) {
00395             objType = "MQF8";
00396         } else if ( *cIt == MQB9 ) {
00397             objType = "MQB9";
00398         } else if ( *cIt == MQB10 ) {
00399             objType = "MQB10";
00400         } else if ( *cIt == MQF11 ) {
00401             objType = "MQF11";
00402         } else if ( *cIt == MQF12 ) {
00403             objType = "MQF12";
00404         } else if ( *cIt == Free ) {
00405             objType = "Free";
00406         } else if ( *cIt == HfQ ) {
00407             objType = "HfQ";
00408         } else {
00409             myCout << "\n\nError: no such member " <<  (*cIt)
00410             << " in enum L1GtPsbQuad\n\n" << std::endl;
00411             objType = "ERROR";
00412         }
00413 
00414 
00415         myCout << "       " << objType << " ";
00416     }
00417     myCout << std::endl;
00418 
00419     if (m_gtBoardType == PSB) {
00420         myCout
00421         << "Input objects pro channel:";
00422     }
00423 
00424     for (std::map<int, std::vector<L1GtObject> >::const_iterator cIt =
00425             m_gtInputPsbChannels.begin(); cIt != m_gtInputPsbChannels.end(); ++cIt) {
00426 
00427         myCout << "\n  Channel " << cIt->first << " (" << (cIt->second).size() << " objects): ";
00428 
00429         for (std::vector<L1GtObject>::const_iterator itObj =
00430                 (cIt->second).begin(); itObj != (cIt->second).end(); ++itObj) {
00431 
00432             switch (*itObj) {
00433                 case Mu: {
00434                     myCout << " Mu ";
00435                 }
00436 
00437                     break;
00438                 case NoIsoEG: {
00439                     myCout << " NoIsoEG ";
00440                 }
00441 
00442                     break;
00443                 case IsoEG: {
00444                     myCout << " IsoEG ";
00445                 }
00446 
00447                     break;
00448                 case CenJet: {
00449                     myCout << " CenJet ";
00450                 }
00451 
00452                     break;
00453                 case ForJet: {
00454                     myCout << " ForJet ";
00455                 }
00456 
00457                     break;
00458                 case TauJet: {
00459                     myCout << " TauJet ";
00460                 }
00461 
00462                     break;
00463                 case ETM: {
00464                     myCout << " ETM ";
00465                 }
00466 
00467                     break;
00468                 case ETT: {
00469                     myCout << " ETT ";
00470                 }
00471 
00472                     break;
00473                 case HTT: {
00474                     myCout << " HTT ";
00475                 }
00476 
00477                     break;
00478                 case HTM: {
00479                     myCout << " HTM ";
00480                 }
00481 
00482                     break;
00483                 case JetCounts: {
00484                     myCout << " JetCounts ";
00485                 }
00486 
00487                     break;
00488                 case HfBitCounts: {
00489                     myCout << " HfBitCounts ";
00490                 }
00491 
00492                     break;
00493                 case HfRingEtSums: {
00494                     myCout << " HfRingEtSums ";
00495                 }
00496 
00497                     break;
00498                 case TechTrig: {
00499                     myCout << " TechTrig ";
00500                 }
00501 
00502                     break;
00503                 case Castor: {
00504                     myCout << " Castor ";
00505                 }
00506 
00507                     break;
00508                 case BPTX: {
00509                     myCout << " BPTX ";
00510                 }
00511 
00512                     break;
00513                 case GtExternal: {
00514                     myCout << " GtExternal ";
00515                 }
00516 
00517                     break;
00518                 default: {
00519                     myCout << " ERROR: Unknown type " << (*itObj);
00520                 }
00521                     break;
00522             }
00523         }
00524 
00525     }
00526 
00527 
00528     myCout << std::endl;
00529 }
00530 
00531 // output stream operator
00532 std::ostream& operator<<(std::ostream& os, const L1GtBoard& result)
00533 {
00534     result.print(os);
00535     return os;
00536 
00537 }
00538 
00539 // number of InfiniCables per board
00540 const int L1GtBoard::NumberCablesBoard = 4;