00001
00014
00015 #include "CondFormats/L1TObjects/interface/L1GtDefinitions.h"
00016
00017
00018 #include <cstring>
00019
00020
00021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00022
00023
00024
00025
00026 L1GtBoardType l1GtBoardTypeStringToEnum(const std::string& label) {
00027
00028 static L1GtBoardTypeStringToEnum l1GtBoardTypeStringToEnumMap[] = {
00029 {"GTFE", GTFE},
00030 {"FDL", FDL},
00031 {"PSB", PSB},
00032 {"GMT", GMT},
00033 {"TCS", TCS},
00034 {"TIM", TIM},
00035 {"BoardNull", BoardNull},
00036 {0, (L1GtBoardType) - 1}
00037 };
00038
00039 L1GtBoardType value = (L1GtBoardType) - 1;
00040
00041 bool found = false;
00042 for (int i = 0; l1GtBoardTypeStringToEnumMap[i].label && (!found); ++i)
00043 if (!std::strcmp(label.c_str(), l1GtBoardTypeStringToEnumMap[i].label)) {
00044 found = true;
00045 value = l1GtBoardTypeStringToEnumMap[i].value;
00046 }
00047
00048
00049
00050 if (!found) {
00051 edm::LogInfo("L1GtDefinitions") << "\n '" << label
00052 << "' is not a recognized L1GtBoardType. \n Return BoardNull.";
00053
00054 value = BoardNull;
00055 }
00056
00057 if (value == BoardNull) {
00058 edm::LogInfo("L1GtDefinitions")
00059 << "\n BoardNull means no valid board type defined!";
00060 }
00061
00062 return value;
00063 }
00064
00065 std::string l1GtBoardTypeEnumToString(const L1GtBoardType& boardType) {
00066
00067 std::string boardTypeString;
00068
00069 switch (boardType) {
00070
00071 case GTFE: {
00072 boardTypeString = "GTFE";
00073 }
00074 break;
00075 case FDL: {
00076 boardTypeString = "FDL";
00077 }
00078 break;
00079 case PSB: {
00080 boardTypeString = "PSB";
00081 }
00082 break;
00083 case GMT: {
00084 boardTypeString = "GMT";
00085 }
00086 break;
00087 case TCS: {
00088 boardTypeString = "TCS";
00089 }
00090 break;
00091 case TIM: {
00092 boardTypeString = "TIM";
00093 }
00094 break;
00095 case BoardNull: {
00096 boardTypeString = "BoardNull";
00097 edm::LogInfo("L1GtDefinitions")
00098 << "\n BoardNull means no valid board type defined!";
00099 }
00100 break;
00101 default: {
00102 boardTypeString = "BoardNull";
00103 edm::LogInfo("L1GtDefinitions") << "\n '" << boardType
00104 << "' is not a recognized L1GtBoardType. "
00105 << "\n Return BoardNull, which means no valid board type defined!";
00106
00107 }
00108 break;
00109 }
00110
00111 return boardTypeString;
00112
00113 }
00114
00115
00116
00117
00118 L1GtPsbQuad l1GtPsbQuadStringToEnum(const std::string& label) {
00119
00120 static L1GtPsbQuadStringToEnum l1GtPsbQuadStringToEnumMap[] = {
00121 {"Free", Free},
00122 {"TechTr", TechTr},
00123 {"IsoEGQ", IsoEGQ},
00124 {"NoIsoEGQ", NoIsoEGQ},
00125 {"CenJetQ", CenJetQ},
00126 {"ForJetQ", ForJetQ},
00127 {"TauJetQ", TauJetQ},
00128 {"ESumsQ", ESumsQ},
00129 {"JetCountsQ", JetCountsQ},
00130 {"MQB1", MQB1},
00131 {"MQB2", MQB2},
00132 {"MQF3", MQF3},
00133 {"MQF4", MQF4},
00134 {"MQB5", MQB5},
00135 {"MQB6", MQB6},
00136 {"MQF7", MQF7},
00137 {"MQF8", MQF8},
00138 {"MQB9", MQB9},
00139 {"MQB10", MQB10},
00140 {"MQF11", MQF11},
00141 {"MQF12", MQF12},
00142 {"CastorQ", CastorQ},
00143 {"HfQ", HfQ},
00144 {"BptxQ", BptxQ},
00145 {"GtExternalQ", GtExternalQ},
00146 {"PsbQuadNull", PsbQuadNull},
00147 {0, (L1GtPsbQuad) - 1}
00148 };
00149
00150 L1GtPsbQuad value = (L1GtPsbQuad) - 1;
00151
00152 bool found = false;
00153 for (int i = 0; l1GtPsbQuadStringToEnumMap[i].label && (!found); ++i)
00154 if (!std::strcmp(label.c_str(), l1GtPsbQuadStringToEnumMap[i].label)) {
00155 found = true;
00156 value = l1GtPsbQuadStringToEnumMap[i].value;
00157 }
00158
00159
00160
00161 if (!found) {
00162 edm::LogInfo("L1GtDefinitions") << "\n '" << label
00163 << "' is not a recognized L1GtPsbQuad. \n Return PsbQuadNull.";
00164
00165 value = PsbQuadNull;
00166 }
00167
00168 if (value == PsbQuadNull) {
00169 edm::LogInfo("L1GtDefinitions")
00170 << "\n PsbQuadNull means no valid PSB quadruplet defined!";
00171 }
00172
00173 return value;
00174 }
00175
00176 std::string l1GtPsbQuadEnumToString(const L1GtPsbQuad& psbQuad) {
00177
00178 std::string psbQuadString;
00179
00180 switch (psbQuad) {
00181
00182 case Free: {
00183 psbQuadString = "Free";
00184 }
00185 break;
00186 case TechTr: {
00187 psbQuadString = "TechTr";
00188 }
00189 break;
00190 case IsoEGQ: {
00191 psbQuadString = "IsoEGQ";
00192 }
00193 break;
00194 case NoIsoEGQ: {
00195 psbQuadString = "NoIsoEGQ";
00196 }
00197 break;
00198 case CenJetQ: {
00199 psbQuadString = "CenJetQ";
00200 }
00201 break;
00202 case ForJetQ: {
00203 psbQuadString = "ForJetQ";
00204 }
00205 break;
00206 case TauJetQ: {
00207 psbQuadString = "TauJetQ";
00208 }
00209 break;
00210 case ESumsQ: {
00211 psbQuadString = "ESumsQ";
00212 }
00213 break;
00214 case JetCountsQ: {
00215 psbQuadString = "JetCountsQ";
00216 }
00217 break;
00218 case MQB1: {
00219 psbQuadString = "MQB1";
00220 }
00221 break;
00222 case MQB2: {
00223 psbQuadString = "MQB2";
00224 }
00225 break;
00226 case MQF3: {
00227 psbQuadString = "MQF3";
00228 }
00229 break;
00230 case MQF4: {
00231 psbQuadString = "MQF4";
00232 }
00233 break;
00234 case MQB5: {
00235 psbQuadString = "MQB5";
00236 }
00237 break;
00238 case MQB6: {
00239 psbQuadString = "MQB6";
00240 }
00241 break;
00242 case MQF7: {
00243 psbQuadString = "MQF7";
00244 }
00245 break;
00246 case MQF8: {
00247 psbQuadString = "MQF9";
00248 }
00249 break;
00250 case MQB9: {
00251 psbQuadString = "MQB9";
00252 }
00253 break;
00254 case MQB10: {
00255 psbQuadString = "MQB10";
00256 }
00257 break;
00258 case MQF11: {
00259 psbQuadString = "MQF11";
00260 }
00261 break;
00262 case MQF12: {
00263 psbQuadString = "MQF12";
00264 }
00265 break;
00266 case CastorQ: {
00267 psbQuadString = "CastorQ";
00268 }
00269 break;
00270 case HfQ: {
00271 psbQuadString = "HfQ";
00272 }
00273 break;
00274 case BptxQ: {
00275 psbQuadString = "BptxQ";
00276 }
00277 break;
00278 case GtExternalQ: {
00279 psbQuadString = "GtExternalQ";
00280 }
00281 break;
00282 case PsbQuadNull: {
00283 psbQuadString = "PsbQuadNull";
00284 edm::LogInfo("L1GtDefinitions")
00285 << "\n PsbQuadNull means no valid PSB quadruplet defined!";
00286 }
00287 break;
00288 default: {
00289 psbQuadString = "PsbQuadNull";
00290 edm::LogInfo("L1GtDefinitions") << "\n '" << psbQuad
00291 << "' is not a recognized L1GtPsbQuad. "
00292 << "\n Return PsbQuadNull, which means no valid PSB quadruplet defined!";
00293
00294 }
00295 break;
00296 }
00297
00298 return psbQuadString;
00299
00300 }
00301
00302
00303
00304 L1GtConditionType l1GtConditionTypeStringToEnum(const std::string& label) {
00305
00306 static L1GtConditionTypeStringToEnum l1GtConditionTypeStringToEnumMap[] = {
00307 {"TypeNull", TypeNull},
00308 {"Type1s", Type1s},
00309 {"Type2s", Type2s},
00310 {"Type2wsc", Type2wsc},
00311 {"Type2cor", Type2cor},
00312 {"Type3s", Type3s},
00313 {"Type4s", Type4s},
00314 {"TypeETM", TypeETM},
00315 {"TypeETT", TypeETT},
00316 {"TypeHTT", TypeHTT},
00317 {"TypeHTM", TypeHTM},
00318 {"TypeJetCounts", TypeJetCounts},
00319 {"TypeCastor", TypeCastor},
00320 {"TypeHfBitCounts", TypeHfBitCounts},
00321 {"TypeHfRingEtSums", TypeHfRingEtSums},
00322 {"TypeBptx", TypeBptx},
00323 {"TypeExternal", TypeExternal},
00324 {0, (L1GtConditionType) - 1}
00325 };
00326
00327 L1GtConditionType value = (L1GtConditionType) - 1;
00328
00329 bool found = false;
00330 for (int i = 0; l1GtConditionTypeStringToEnumMap[i].label && (!found); ++i)
00331 if (!std::strcmp(label.c_str(), l1GtConditionTypeStringToEnumMap[i].label)) {
00332 found = true;
00333 value = l1GtConditionTypeStringToEnumMap[i].value;
00334 }
00335
00336
00337
00338 if (!found) {
00339 edm::LogInfo("L1GtDefinitions") << "\n '" << label
00340 << "' is not a recognized L1GtConditionType. \n Return TypeNull.";
00341
00342 value = TypeNull;
00343 }
00344
00345 if (value == TypeNull) {
00346 edm::LogInfo("L1GtDefinitions")
00347 << "\n TypeNull means no valid condition type defined!";
00348 }
00349
00350 return value;
00351 }
00352
00353 std::string l1GtConditionTypeEnumToString(
00354 const L1GtConditionType& conditionType) {
00355
00356 std::string conditionTypeString;
00357
00358 switch (conditionType) {
00359
00360 case TypeNull: {
00361 conditionTypeString = "TypeNull";
00362 edm::LogInfo("L1GtDefinitions")
00363 << "\n TypeNull means no valid condition type defined!";
00364 }
00365
00366 break;
00367 case Type1s: {
00368 conditionTypeString = "Type1s";
00369 }
00370
00371 break;
00372 case Type2s: {
00373 conditionTypeString = "Type2s";
00374 }
00375
00376 break;
00377 case Type2wsc: {
00378 conditionTypeString = "Type2wsc";
00379 }
00380
00381 break;
00382 case Type2cor: {
00383 conditionTypeString = "Type2cor";
00384 }
00385
00386 break;
00387 case Type3s: {
00388 conditionTypeString = "Type3s";
00389 }
00390
00391 break;
00392 case Type4s: {
00393 conditionTypeString = "Type4s";
00394 }
00395
00396 break;
00397 case TypeETM: {
00398 conditionTypeString = "TypeETM";
00399 }
00400
00401 break;
00402 case TypeETT: {
00403 conditionTypeString = "TypeETT";
00404 }
00405
00406 break;
00407 case TypeHTT: {
00408 conditionTypeString = "TypeHTT";
00409 }
00410
00411 break;
00412 case TypeHTM: {
00413 conditionTypeString = "TypeHTM";
00414 }
00415
00416 break;
00417 case TypeJetCounts: {
00418 conditionTypeString = "TypeJetCounts";
00419 }
00420
00421 break;
00422 case TypeCastor: {
00423 conditionTypeString = "TypeCastor";
00424 }
00425
00426 break;
00427 case TypeHfBitCounts: {
00428 conditionTypeString = "TypeHfBitCounts";
00429 }
00430
00431 break;
00432 case TypeHfRingEtSums: {
00433 conditionTypeString = "TypeHfRingEtSums";
00434 }
00435
00436 break;
00437 case TypeBptx: {
00438 conditionTypeString = "TypeBptx";
00439 }
00440
00441 break;
00442 case TypeExternal: {
00443 conditionTypeString = "TypeExternal";
00444 }
00445
00446 break;
00447 default: {
00448 conditionTypeString = "TypeNull";
00449 edm::LogInfo("L1GtDefinitions") << "\n '" << conditionType
00450 << "' is not a recognized L1GtConditionType. "
00451 << "\n Return TypeNull, which means no valid condition type defined!";
00452 }
00453 break;
00454 }
00455
00456 return conditionTypeString;
00457 }
00458
00459
00460
00461 L1GtConditionCategory l1GtConditionCategoryStringToEnum(const std::string& label) {
00462
00463 static L1GtConditionCategoryStringToEnum l1GtConditionCategoryStringToEnumMap[] = {
00464 {"CondNull", CondNull},
00465 {"CondMuon", CondMuon},
00466 {"CondCalo", CondCalo},
00467 {"CondEnergySum", CondEnergySum},
00468 {"CondJetCounts", CondJetCounts},
00469 {"CondCorrelation", CondCorrelation},
00470 {"CondCastor", CondCastor},
00471 {"CondHfBitCounts", CondHfBitCounts},
00472 {"CondHfRingEtSums", CondHfRingEtSums},
00473 {"CondBptx", CondBptx},
00474 {"CondExternal", CondExternal},
00475 {0, (L1GtConditionCategory) - 1}
00476 };
00477
00478 L1GtConditionCategory value = (L1GtConditionCategory) - 1;
00479
00480 bool found = false;
00481 for (int i = 0; l1GtConditionCategoryStringToEnumMap[i].label && (!found); ++i)
00482 if (!std::strcmp(label.c_str(),
00483 l1GtConditionCategoryStringToEnumMap[i].label)) {
00484 found = true;
00485 value = l1GtConditionCategoryStringToEnumMap[i].value;
00486 }
00487
00488
00489
00490 if (!found) {
00491 edm::LogInfo("L1GtDefinitions") << "\n '" << label
00492 << "' is not a recognized L1GtConditionCategory. \n Return CondNull.";
00493
00494 value = CondNull;
00495 }
00496
00497 if (value == CondNull) {
00498 edm::LogInfo("L1GtDefinitions")
00499 << "\n CondNull means no valid condition category defined!";
00500 }
00501
00502 return value;
00503 }
00504
00505 std::string l1GtConditionCategoryEnumToString(
00506 const L1GtConditionCategory& conditionCategory) {
00507
00508 std::string conditionCategoryString;
00509
00510 switch (conditionCategory) {
00511
00512 case CondNull: {
00513 conditionCategoryString = "CondNull";
00514 edm::LogInfo("L1GtDefinitions")
00515 << "\n CondNull means no valid condition category defined!";
00516 }
00517
00518 break;
00519 case CondMuon: {
00520 conditionCategoryString = "CondMuon";
00521 }
00522
00523 break;
00524 case CondCalo: {
00525 conditionCategoryString = "CondCalo";
00526 }
00527
00528 break;
00529 case CondEnergySum: {
00530 conditionCategoryString = "CondEnergySum";
00531 }
00532
00533 break;
00534 case CondJetCounts: {
00535 conditionCategoryString = "CondJetCounts";
00536 }
00537
00538 break;
00539 case CondCorrelation: {
00540 conditionCategoryString = "CondCorrelation";
00541 }
00542
00543 break;
00544 case CondCastor: {
00545 conditionCategoryString = "CondCastor";
00546 }
00547
00548 break;
00549 case CondHfBitCounts: {
00550 conditionCategoryString = "CondHfBitCounts";
00551 }
00552
00553 break;
00554 case CondHfRingEtSums: {
00555 conditionCategoryString = "CondHfRingEtSums";
00556 }
00557
00558 break;
00559 case CondBptx: {
00560 conditionCategoryString = "CondBptx";
00561 }
00562
00563 break;
00564 case CondExternal: {
00565 conditionCategoryString = "CondExternal";
00566 }
00567
00568 break;
00569 default: {
00570 conditionCategoryString = "CondNull";
00571 edm::LogInfo("L1GtDefinitions") << "\n '" << conditionCategory
00572 << "' is not a recognized L1GtConditionCategory. "
00573 << "\n Return CondNull, which means no valid condition category defined!";
00574
00575 }
00576 break;
00577 }
00578
00579 return conditionCategoryString;
00580 }
00581