31 std::vector<AlgorithmResult>::const_iterator
i = std::lower_bound(
40 std::vector<AlgorithmResult>::const_iterator
i = std::lower_bound(
44 ex <<
"algorithmBitNumber not found";
45 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::algorithmResult");
48 return i->algorithmResult();
52 int algorithmBitNumber, std::vector<L1GtLogicParser::OperandToken>& operandTokenVector)
const {
53 unsigned startIndex = 0;
54 unsigned endIndex = 0;
57 unsigned length = endIndex - startIndex;
58 if (length != operandTokenVector.size()) {
60 ex <<
"operand token vector size does not match number of conditions";
61 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::updateOperandTokenVector");
65 for (
unsigned i = 0;
i < length; ++
i) {
71 algorithmBitNumbers.clear();
75 algorithmBitNumbers.push_back(
i->algorithmBitNumber());
80 unsigned startIndex = 0;
81 unsigned endIndex = 0;
83 return endIndex - startIndex;
87 int algorithmBitNumber)
const {
88 unsigned startIndex = 0;
89 unsigned endIndex = 0;
95 int algorithmBitNumber,
unsigned conditionNumber)
const {
96 unsigned startIndex = 0;
97 unsigned endIndex = 0;
100 if (endIndex <= startIndex + conditionNumber) {
102 ex <<
"Condition number is out of range";
103 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
108 unsigned nextConditionIndex = startIndex + conditionNumber + 1
U;
112 unsigned beginObjectIndex =
m_conditionResults[startIndex + conditionNumber].startIndexOfCombinations();
113 unsigned short nObjectsPerCombination =
m_conditionResults[startIndex + conditionNumber].nObjectsPerCombination();
115 if (endObjectIndex == beginObjectIndex) {
118 if (endObjectIndex < beginObjectIndex ||
m_combinations.size() < endObjectIndex || nObjectsPerCombination == 0 ||
119 (endObjectIndex - beginObjectIndex) % nObjectsPerCombination != 0) {
121 ex <<
"Indexes to combinations are invalid";
122 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
126 (endObjectIndex - beginObjectIndex) / nObjectsPerCombination,
127 nObjectsPerCombination);
133 int algorithmBitNumber,
144 std::vector<AlgorithmResult>::const_iterator
j =
i;
146 if (j != iEnd && !(*
i < *j)) {
148 ex <<
"AlgorithmResults should be sorted in increasing order of bit number with no duplicates. It is not.";
149 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
152 unsigned endIndex = (j != iEnd) ? j->startIndexOfConditions() :
m_conditionResults.size();
154 if (endIndex < i->startIndexOfConditions()) {
156 ex <<
"startIndexOfConditions decreases or exceeds the size of m_conditionResults";
157 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
164 std::vector<ConditionResult>::const_iterator
j =
i;
166 unsigned endIndex = (j != iEnd) ? j->startIndexOfCombinations() :
m_combinations.size();
168 if (endIndex < i->startIndexOfCombinations()) {
170 ex <<
"startIndexOfCombinations decreases or exceeds the size of m_conditionResults";
171 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
174 unsigned length = endIndex -
i->startIndexOfCombinations();
176 if (
i->nObjectsPerCombination() != 0
U) {
178 ex <<
"Length is zero and nObjectsInCombination is not zero";
179 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
183 if (
i->nObjectsPerCombination() == 0 || length %
i->nObjectsPerCombination() != 0) {
185 ex <<
"Size indicated by startIndexOfCombinations is not a multiple of nObjectsInCombination";
186 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
196 unsigned short nObjectsPerCombination,
197 bool conditionResult) {
212 : m_startIndexOfConditions(0), m_algorithmBitNumber(0), m_algorithmResult(
false) {}
230 ex <<
"algorithmBitNumber out of range of a short int";
231 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::AlgorithmResult::AlgorithmResult");
238 : m_startIndexOfCombinations(0), m_nObjectsPerCombination(0), m_conditionResult(
false) {}
248 unsigned nConditions)
254 ex <<
"argument out of range";
255 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult");
262 unsigned nCombinations,
263 unsigned short nObjectsPerCombination)
264 : m_startOfObjectIndexes(startOfObjectIndexes),
265 m_nCombinations(nCombinations),
266 m_nObjectsPerCombination(nObjectsPerCombination) {}
269 unsigned object)
const {
272 ex <<
"arguments out of range";
273 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex");
280 unsigned& startIndex,
281 unsigned& endIndex)
const {
282 std::vector<AlgorithmResult>::const_iterator iAlgo = std::lower_bound(
285 if (iAlgo ==
m_algorithmResults.end() || iAlgo->algorithmBitNumber() != algorithmBitNumber) {
287 ex <<
"algorithmBitNumber not found";
288 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getStartEndIndex");
292 startIndex = iAlgo->startIndexOfConditions();
298 ex <<
"index out of order or out of range";
299 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)
unsigned short nObjectsPerCombination() const
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
unsigned short m_nObjectsPerCombination
unsigned char const * m_startOfObjectIndexes
unsigned short m_nObjectsPerCombination
bool conditionResult() const
short m_algorithmBitNumber
std::vector< unsigned char > m_combinations
std::vector< ConditionResult > m_conditionResults
CombinationsInCondition(unsigned char const *startOfObjectIndexes, unsigned nCombinations, unsigned short nObjectsPerCombination)
bool algorithmResult() const
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)
unsigned startIndexOfCombinations() const
void addContext(std::string const &context)
unsigned m_startIndexOfConditions
ConditionResult const * m_conditionResults
bool getConditionResult(unsigned condition) const
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
unsigned startIndexOfConditions() const
unsigned m_startIndexOfCombinations
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const