File indexing completed on 2025-01-14 23:16:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "DataFormats/L1TGlobal/interface/GlobalObjectMap.h"
0016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0017
0018 #include <iostream>
0019 #include <iomanip>
0020 #include <iterator>
0021 #include <algorithm>
0022
0023
0024 const CombinationsWithBxInCond* GlobalObjectMap::getCombinationsInCond(const std::string& condNameVal) const {
0025 for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
0026 if ((m_operandTokenVector[i]).tokenName == condNameVal) {
0027 return &(m_combinationWithBxVector.at((m_operandTokenVector[i]).tokenNumber));
0028 }
0029 }
0030
0031
0032 edm::LogError("GlobalObjectMap") << "\n\n ERROR: The requested condition with tokenName = " << condNameVal
0033 << "\n does not exists in the operand token vector."
0034 << "\n Returning zero pointer for getCombinationsInCond\n\n";
0035
0036 return nullptr;
0037 }
0038
0039
0040 const CombinationsWithBxInCond* GlobalObjectMap::getCombinationsInCond(const int condNumberVal) const {
0041 for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
0042 if ((m_operandTokenVector[i]).tokenNumber == condNumberVal) {
0043 return &(m_combinationWithBxVector.at((m_operandTokenVector[i]).tokenNumber));
0044 }
0045 }
0046
0047
0048 edm::LogError("GlobalObjectMap") << "\n\n ERROR: The requested condition with tokenNumber = " << condNumberVal
0049 << "\n does not exists in the operand token vector."
0050 << "\n Returning zero pointer for getCombinationsInCond\n\n";
0051
0052 return nullptr;
0053 }
0054
0055
0056 const bool GlobalObjectMap::getConditionResult(const std::string& condNameVal) const {
0057 for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
0058 if ((m_operandTokenVector[i]).tokenName == condNameVal) {
0059 return (m_operandTokenVector[i]).tokenResult;
0060 }
0061 }
0062
0063
0064 edm::LogError("GlobalObjectMap") << "\n\n ERROR: The requested condition with name = " << condNameVal
0065 << "\n does not exists in the operand token vector."
0066 << "\n Returning false for getConditionResult\n\n";
0067
0068 return false;
0069 }
0070
0071 void GlobalObjectMap::reset() {
0072
0073 m_algoName.clear();
0074
0075
0076 m_algoBitNumber = -1;
0077
0078
0079 m_algoGtlResult = false;
0080
0081
0082 m_operandTokenVector.clear();
0083
0084
0085 m_combinationWithBxVector.clear();
0086 }
0087
0088 void GlobalObjectMap::print(std::ostream& myCout) const {
0089 myCout << "GlobalObjectMap: print " << std::endl;
0090
0091 myCout << " Algorithm name: " << m_algoName << std::endl;
0092 myCout << " Bit number: " << m_algoBitNumber << std::endl;
0093 myCout << " GTL result: " << m_algoGtlResult << std::endl;
0094
0095 int operandTokenVectorSize = m_operandTokenVector.size();
0096
0097 myCout << " Operand token vector size: " << operandTokenVectorSize;
0098
0099 if (operandTokenVectorSize == 0) {
0100 myCout << " - not properly initialized! " << std::endl;
0101 } else {
0102 myCout << std::endl;
0103
0104 for (int i = 0; i < operandTokenVectorSize; ++i) {
0105 myCout << " " << std::setw(5) << (m_operandTokenVector[i]).tokenNumber << "\t" << std::setw(25)
0106 << (m_operandTokenVector[i]).tokenName << "\t" << (m_operandTokenVector[i]).tokenResult << std::endl;
0107 }
0108 }
0109
0110 myCout << " CombinationWithBxVector size: " << m_combinationWithBxVector.size() << std::endl;
0111
0112 myCout << " conditions: " << std::endl;
0113
0114 for (size_t i1 = 0; i1 < m_combinationWithBxVector.size(); ++i1) {
0115 auto const& condName = m_operandTokenVector[i1].tokenName;
0116 auto const condResult = m_operandTokenVector[i1].tokenResult;
0117 myCout << " Condition " << condName << " evaluated to " << condResult << std::endl;
0118 myCout << " List of combinations passing all requirements for this condition:" << std::endl;
0119 myCout << " ";
0120
0121 if (m_combinationWithBxVector[i1].empty()) {
0122 myCout << "(none)";
0123 } else {
0124 for (size_t i2 = 0; i2 < m_combinationWithBxVector[i1].size(); ++i2) {
0125 myCout << "( ";
0126 for (size_t i3 = 0; i3 < m_combinationWithBxVector[i1][i2].size(); ++i3) {
0127 myCout << m_combinationWithBxVector[i1][i2][i3].first << ":";
0128 myCout << m_combinationWithBxVector[i1][i2][i3].second << " ";
0129 }
0130 myCout << "); ";
0131 }
0132 }
0133 myCout << "\n\n";
0134 }
0135 }