50 if (!gtObjectMapRecord.
isValid()) {
58 std::vector<int> algoBitNumbers;
59 std::vector<L1GlobalTriggerObjectMap>
const& vectorInRecord = gtObjectMapRecord->
gtObjectMap();
60 algoBitNumbers.reserve(vectorInRecord.size());
61 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
i = vectorInRecord.begin(),
62 iEnd = vectorInRecord.end();
64 algoBitNumbers.push_back(
i->algoBitNumber());
68 gtObjectMaps->reserveForAlgorithms(algoBitNumbers.size());
70 if (!algoBitNumbers.empty() && algoBitNumbers[0] < 0) {
72 ex <<
"Negative algorithm bit number";
73 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
77 unsigned sizeOfNamesVector = 0;
78 if (!algoBitNumbers.empty()) {
79 sizeOfNamesVector =
static_cast<unsigned>(algoBitNumbers.back()) + 1;
81 std::vector<std::string> savedNames(sizeOfNamesVector);
86 unsigned startIndexOfConditions = 0;
87 unsigned nIndexes = 0;
89 for (std::vector<int>::const_iterator iBit = algoBitNumbers.begin(), endBits = algoBitNumbers.end();
90 iBit != endBits; ++iBit) {
93 gtObjectMaps->pushBackAlgorithm(startIndexOfConditions,
97 savedNames.at(static_cast<unsigned>(*iBit)) = objMap->
algoName();
99 std::vector<L1GtLogicParser::OperandToken>
const& operandTokens =
102 startIndexOfConditions += operandTokens.size();
104 int tokenCounter = 0;
105 for (std::vector<L1GtLogicParser::OperandToken>::const_iterator iToken = operandTokens.begin(),
106 endTokens = operandTokens.end();
108 ++iToken, ++tokenCounter) {
110 if (tokenCounter != iToken->tokenNumber) {
112 ex <<
"Token numbers not sequential";
113 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
118 for (CombinationsInCond::const_iterator iCombo = combos->begin(),
119 endCombos = combos->end();
120 iCombo != endCombos; ++iCombo) {
121 for (std::vector<int>::const_iterator iIndex = iCombo->begin(),
122 endIndexes = iCombo->end();
123 iIndex != endIndexes; ++iIndex) {
129 gtObjectMaps->reserveForConditions(startIndexOfConditions);
130 gtObjectMaps->reserveForObjectIndexes(nIndexes);
137 unsigned startIndexOfCombinations = 0;
138 for (std::vector<int>::const_iterator iBit = algoBitNumbers.begin(), endBits = algoBitNumbers.end();
139 iBit != endBits; ++iBit) {
142 std::vector<L1GtLogicParser::OperandToken>
const& operandTokens =
146 if (savedNames.capacity() < operandTokens.size()) {
147 savedNames.reserve(operandTokens.size());
150 for (std::vector<L1GtLogicParser::OperandToken>::const_iterator iToken = operandTokens.begin(),
151 endTokens = operandTokens.end();
152 iToken != endTokens; ++iToken) {
154 savedNames.push_back(iToken->tokenName);
156 unsigned short nObjectsPerCombination = 0;
158 unsigned nIndexesInCombination = 0;
161 for (CombinationsInCond::const_iterator iCombo = combos->begin(),
162 endCombos = combos->end();
163 iCombo != endCombos; ++iCombo) {
167 ex <<
"Number of objects per combination out of range";
168 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
171 nObjectsPerCombination = iCombo->size();
174 if (nObjectsPerCombination != iCombo->size()) {
176 ex <<
"inconsistent number of objects per condition";
177 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
182 for (std::vector<int>::const_iterator iIndex = iCombo->begin(),
183 endIndexes = iCombo->end();
184 iIndex != endIndexes; ++iIndex) {
188 ex <<
"object index too large, out of range";
189 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
192 gtObjectMaps->pushBackObjectIndex(*iIndex);
193 ++nIndexesInCombination;
196 gtObjectMaps->pushBackCondition(startIndexOfCombinations,
197 nObjectsPerCombination,
198 iToken->tokenResult);
199 startIndexOfCombinations += nIndexesInCombination;
204 gtObjectMaps->setNamesParameterSetID(namesPset.
id());
206 gtObjectMaps->consistencyCheck();
ParameterSetID id() const
const std::vector< L1GtLogicParser::OperandToken > & operandTokenVector() const
bool algoGtlResult() const
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
const std::string & algoName() const
get / set name for algorithm in the object map
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal ...
void addParameter(std::string const &name, T const &value)
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > m_l1GtObjectMapToken
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
int algoBitNumber() const
get / set bit number for algorithm in the object map
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
ParameterSet const & registerIt()
const L1GlobalTriggerObjectMap * getObjectMap(const std::string &algoNameVal) const
return the object map for the algorithm algoNameVal