50 if (!gtObjectMapRecord.
isValid()) {
55 std::unique_ptr<L1GlobalTriggerObjectMaps> gtObjectMaps(
59 std::vector<int> algoBitNumbers;
60 std::vector<L1GlobalTriggerObjectMap>
const &vectorInRecord =
62 algoBitNumbers.reserve(vectorInRecord.size());
63 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
64 i = vectorInRecord.begin(),
65 iEnd = vectorInRecord.end();
67 algoBitNumbers.push_back(
i->algoBitNumber());
71 gtObjectMaps->reserveForAlgorithms(algoBitNumbers.size());
73 if (!algoBitNumbers.empty() && algoBitNumbers[0] < 0) {
75 ex <<
"Negative algorithm bit number";
76 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
80 unsigned sizeOfNamesVector = 0;
81 if (!algoBitNumbers.empty()) {
82 sizeOfNamesVector =
static_cast<unsigned>(algoBitNumbers.back()) + 1;
84 std::vector<std::string> savedNames(sizeOfNamesVector);
89 unsigned startIndexOfConditions = 0;
90 unsigned nIndexes = 0;
92 for (std::vector<int>::const_iterator iBit = algoBitNumbers.begin(),
93 endBits = algoBitNumbers.end();
94 iBit != endBits; ++iBit) {
98 gtObjectMaps->pushBackAlgorithm(startIndexOfConditions,
102 savedNames.at(static_cast<unsigned>(*iBit)) = objMap->
algoName();
104 std::vector<L1GtLogicParser::OperandToken>
const &operandTokens =
107 startIndexOfConditions += operandTokens.size();
109 int tokenCounter = 0;
110 for (std::vector<L1GtLogicParser::OperandToken>::const_iterator
111 iToken = operandTokens.begin(),
112 endTokens = operandTokens.end();
113 iToken != endTokens; ++iToken, ++tokenCounter) {
115 if (tokenCounter != iToken->tokenNumber) {
117 ex <<
"Token numbers not sequential";
118 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
124 for (CombinationsInCond::const_iterator iCombo = combos->begin(),
125 endCombos = combos->end();
126 iCombo != endCombos; ++iCombo) {
127 for (std::vector<int>::const_iterator iIndex = iCombo->begin(),
128 endIndexes = iCombo->end();
129 iIndex != endIndexes; ++iIndex) {
135 gtObjectMaps->reserveForConditions(startIndexOfConditions);
136 gtObjectMaps->reserveForObjectIndexes(nIndexes);
144 unsigned startIndexOfCombinations = 0;
145 for (std::vector<int>::const_iterator iBit = algoBitNumbers.begin(),
146 endBits = algoBitNumbers.end();
147 iBit != endBits; ++iBit) {
151 std::vector<L1GtLogicParser::OperandToken>
const &operandTokens =
155 if (savedNames.capacity() < operandTokens.size()) {
156 savedNames.reserve(operandTokens.size());
159 for (std::vector<L1GtLogicParser::OperandToken>::const_iterator
160 iToken = operandTokens.begin(),
161 endTokens = operandTokens.end();
162 iToken != endTokens; ++iToken) {
164 savedNames.push_back(iToken->tokenName);
166 unsigned short nObjectsPerCombination = 0;
168 unsigned nIndexesInCombination = 0;
172 for (CombinationsInCond::const_iterator iCombo = combos->begin(),
173 endCombos = combos->end();
174 iCombo != endCombos; ++iCombo) {
178 ex <<
"Number of objects per combination out of range";
179 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
182 nObjectsPerCombination = iCombo->size();
185 if (nObjectsPerCombination != iCombo->size()) {
187 ex <<
"inconsistent number of objects per condition";
188 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
193 for (std::vector<int>::const_iterator iIndex = iCombo->begin(),
194 endIndexes = iCombo->end();
195 iIndex != endIndexes; ++iIndex) {
200 ex <<
"object index too large, out of range";
201 ex.addContext(
"Calling ConvertObjectMapRecord::produce");
204 gtObjectMaps->pushBackObjectIndex(*iIndex);
205 ++nIndexesInCombination;
208 gtObjectMaps->pushBackCondition(startIndexOfCombinations,
209 nObjectsPerCombination,
210 iToken->tokenResult);
211 startIndexOfCombinations += nIndexesInCombination;
217 gtObjectMaps->setNamesParameterSetID(namesPset.
id());
219 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