31 std::vector<AlgorithmResult>::const_iterator
i =
42 std::vector<AlgorithmResult>::const_iterator
i =
48 ex <<
"algorithmBitNumber not found";
49 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::algorithmResult");
52 return i->algorithmResult();
57 std::vector<L1GtLogicParser::OperandToken>& operandTokenVector)
const {
58 unsigned startIndex = 0;
59 unsigned endIndex = 0;
62 unsigned length = endIndex - startIndex;
63 if (length != operandTokenVector.size()) {
65 ex <<
"operand token vector size does not match number of conditions";
66 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::updateOperandTokenVector");
70 for (
unsigned i = 0;
i < length; ++
i) {
77 algorithmBitNumbers.clear();
80 algorithmBitNumbers.push_back(
i->algorithmBitNumber());
87 unsigned startIndex = 0;
88 unsigned endIndex = 0;
90 return endIndex - startIndex;
95 unsigned startIndex = 0;
96 unsigned endIndex = 0;
103 unsigned conditionNumber)
const {
104 unsigned startIndex = 0;
105 unsigned endIndex = 0;
108 if (endIndex <= startIndex + conditionNumber) {
110 ex <<
"Condition number is out of range";
111 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
116 unsigned nextConditionIndex = startIndex + conditionNumber + 1U;
120 unsigned beginObjectIndex =
m_conditionResults[startIndex + conditionNumber].startIndexOfCombinations();
121 unsigned short nObjectsPerCombination =
m_conditionResults[startIndex + conditionNumber].nObjectsPerCombination();
123 if (endObjectIndex == beginObjectIndex) {
126 if (endObjectIndex < beginObjectIndex ||
128 nObjectsPerCombination == 0 ||
129 (endObjectIndex - beginObjectIndex) % nObjectsPerCombination != 0) {
131 ex <<
"Indexes to combinations are invalid";
132 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
136 (endObjectIndex - beginObjectIndex) / nObjectsPerCombination,
137 nObjectsPerCombination);
147 int algorithmBitNumber,
148 bool algorithmResult) {
159 std::vector<AlgorithmResult>::const_iterator
j =
i;
161 if (j != iEnd && !(*
i < *j)) {
163 ex <<
"AlgorithmResults should be sorted in increasing order of bit number with no duplicates. It is not.";
164 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
170 if (endIndex < i->startIndexOfConditions()) {
172 ex <<
"startIndexOfConditions decreases or exceeds the size of m_conditionResults";
173 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
179 std::vector<ConditionResult>::const_iterator
j =
i;
182 (j != iEnd) ? j->startIndexOfCombinations() :
m_combinations.size();
184 if (endIndex < i->startIndexOfCombinations()) {
186 ex <<
"startIndexOfCombinations decreases or exceeds the size of m_conditionResults";
187 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
190 unsigned length = endIndex -
i->startIndexOfCombinations();
192 if (
i->nObjectsPerCombination() != 0U) {
194 ex <<
"Length is zero and nObjectsInCombination is not zero";
195 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
199 if (
i->nObjectsPerCombination() == 0 || length %
i->nObjectsPerCombination() != 0) {
201 ex <<
"Size indicated by startIndexOfCombinations is not a multiple of nObjectsInCombination";
202 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
216 unsigned short nObjectsPerCombination,
217 bool conditionResult) {
219 nObjectsPerCombination,
240 m_startIndexOfConditions(0),
241 m_algorithmBitNumber(0),
242 m_algorithmResult(
false) {
247 int algorithmBitNumber,
249 m_startIndexOfConditions(startIndexOfConditions),
250 m_algorithmResult(algorithmResult) {
264 ex <<
"algorithmBitNumber out of range of a short int";
265 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::AlgorithmResult::AlgorithmResult");
273 m_startIndexOfCombinations(0),
274 m_nObjectsPerCombination(0),
275 m_conditionResult(
false) {
280 unsigned short nObjectsPerCombination,
281 bool conditionResult) :
282 m_startIndexOfCombinations(startIndexOfCombinations),
283 m_nObjectsPerCombination(nObjectsPerCombination),
284 m_conditionResult(conditionResult) {
289 unsigned nConditions) :
291 m_nConditions(nConditions) {
296 if (condition >= m_nConditions) {
298 ex <<
"argument out of range";
299 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult");
307 unsigned nCombinations,
308 unsigned short nObjectsPerCombination) :
309 m_startOfObjectIndexes(startOfObjectIndexes),
310 m_nCombinations(nCombinations),
311 m_nObjectsPerCombination(nObjectsPerCombination) {
316 unsigned object)
const {
317 if (combination >= m_nCombinations ||
318 object >= m_nObjectsPerCombination) {
320 ex <<
"arguments out of range";
321 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex");
324 return m_startOfObjectIndexes[combination * m_nObjectsPerCombination + object];
329 std::vector<AlgorithmResult>::const_iterator iAlgo =
334 if (iAlgo ==
m_algorithmResults.end() || iAlgo->algorithmBitNumber() != algorithmBitNumber) {
336 ex <<
"algorithmBitNumber not found";
337 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getStartEndIndex");
341 startIndex = iAlgo->startIndexOfConditions();
348 ex <<
"index out of order or out of range";
349 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getStartEndIndex");
unsigned char getObjectIndex(unsigned combination, unsigned object) const
void pushBackCondition(unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult)
void reserveForAlgorithms(unsigned n)
void reserveForObjectIndexes(unsigned n)
void pushBackObjectIndex(unsigned char objectIndex)
ConditionsInAlgorithm(ConditionResult const *conditionResults, unsigned nConditions)
edm::ParameterSetID m_namesParameterSetID
void swap(Hash< I > &other)
void consistencyCheck() const
void reserveForConditions(unsigned n)
void getAlgorithmBitNumbers(std::vector< int > &algorithmBitNumbers) const
Fills the vector with all the algorithm bit numbers.
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
void swap(L1GlobalTriggerObjectMaps &rh)
std::vector< AlgorithmResult > m_algorithmResults
short m_algorithmBitNumber
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults
CombinationsInCondition(unsigned char const *startOfObjectIndexes, unsigned nCombinations, unsigned short nObjectsPerCombination)
short algorithmBitNumber() const
void updateOperandTokenVector(int algorithmBitNumber, std::vector< L1GtLogicParser::OperandToken > &operandTokenVector) const
Update the condition result in the operandTokenVector.
void pushBackAlgorithm(unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult)
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
unsigned getNumberOfConditions(int algorithmBitNumber) const
Number of conditions associated with an algorithm.
void setNamesParameterSetID(edm::ParameterSetID const &psetID)
void addContext(std::string const &context)
bool getConditionResult(unsigned condition) const
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
volatile std::atomic< bool > shutdown_flag false
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const