33 std::vector<AlgorithmResult>::const_iterator
i =
44 std::vector<AlgorithmResult>::const_iterator
i =
50 ex <<
"algorithmBitNumber not found";
51 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::algorithmResult");
54 return i->algorithmResult();
59 std::vector<L1GtLogicParser::OperandToken>& operandTokenVector)
const {
60 unsigned startIndex = 0;
61 unsigned endIndex = 0;
64 unsigned length = endIndex - startIndex;
65 if (length != operandTokenVector.size()) {
67 ex <<
"operand token vector size does not match number of conditions";
68 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::updateOperandTokenVector");
72 for (
unsigned i = 0;
i < length; ++
i) {
79 algorithmBitNumbers.clear();
82 algorithmBitNumbers.push_back(
i->algorithmBitNumber());
89 unsigned startIndex = 0;
90 unsigned endIndex = 0;
92 return endIndex - startIndex;
97 unsigned startIndex = 0;
98 unsigned endIndex = 0;
105 unsigned conditionNumber)
const {
106 unsigned startIndex = 0;
107 unsigned endIndex = 0;
110 if (endIndex <= startIndex + conditionNumber) {
112 ex <<
"Condition number is out of range";
113 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
118 unsigned nextConditionIndex = startIndex + conditionNumber + 1U;
122 unsigned beginObjectIndex =
m_conditionResults[startIndex + conditionNumber].startIndexOfCombinations();
123 unsigned short nObjectsPerCombination =
m_conditionResults[startIndex + conditionNumber].nObjectsPerCombination();
125 if (endObjectIndex == beginObjectIndex) {
128 if (endObjectIndex < beginObjectIndex ||
130 nObjectsPerCombination == 0 ||
131 (endObjectIndex - beginObjectIndex) % nObjectsPerCombination != 0) {
133 ex <<
"Indexes to combinations are invalid";
134 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition");
138 (endObjectIndex - beginObjectIndex) / nObjectsPerCombination,
139 nObjectsPerCombination);
149 int algorithmBitNumber,
150 bool algorithmResult) {
161 std::vector<AlgorithmResult>::const_iterator
j =
i;
163 if (j != iEnd && !(*
i < *j)) {
165 ex <<
"AlgorithmResults should be sorted in increasing order of bit number with no duplicates. It is not.";
166 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
172 if (endIndex < i->startIndexOfConditions()) {
174 ex <<
"startIndexOfConditions decreases or exceeds the size of m_conditionResults";
175 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
181 std::vector<ConditionResult>::const_iterator
j =
i;
184 (j != iEnd) ? j->startIndexOfCombinations() :
m_combinations.size();
186 if (endIndex < i->startIndexOfCombinations()) {
188 ex <<
"startIndexOfCombinations decreases or exceeds the size of m_conditionResults";
189 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
192 unsigned length = endIndex -
i->startIndexOfCombinations();
194 if (
i->nObjectsPerCombination() != 0U) {
196 ex <<
"Length is zero and nObjectsInCombination is not zero";
197 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
201 if (
i->nObjectsPerCombination() == 0 || length %
i->nObjectsPerCombination() != 0) {
203 ex <<
"Size indicated by startIndexOfCombinations is not a multiple of nObjectsInCombination";
204 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::consistencyCheck");
218 unsigned short nObjectsPerCombination,
219 bool conditionResult) {
221 nObjectsPerCombination,
242 m_startIndexOfConditions(0),
243 m_algorithmBitNumber(0),
244 m_algorithmResult(
false) {
249 int algorithmBitNumber,
251 m_startIndexOfConditions(startIndexOfConditions),
252 m_algorithmResult(algorithmResult) {
266 ex <<
"algorithmBitNumber out of range of a short int";
267 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::AlgorithmResult::AlgorithmResult");
275 m_startIndexOfCombinations(0),
276 m_nObjectsPerCombination(0),
277 m_conditionResult(
false) {
282 unsigned short nObjectsPerCombination,
283 bool conditionResult) :
284 m_startIndexOfCombinations(startIndexOfCombinations),
285 m_nObjectsPerCombination(nObjectsPerCombination),
286 m_conditionResult(conditionResult) {
291 unsigned nConditions) :
293 m_nConditions(nConditions) {
298 if (condition >= m_nConditions) {
300 ex <<
"argument out of range";
301 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult");
309 unsigned nCombinations,
310 unsigned short nObjectsPerCombination) :
311 m_startOfObjectIndexes(startOfObjectIndexes),
312 m_nCombinations(nCombinations),
313 m_nObjectsPerCombination(nObjectsPerCombination) {
318 unsigned object)
const {
319 if (combination >= m_nCombinations ||
320 object >= m_nObjectsPerCombination) {
322 ex <<
"arguments out of range";
323 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex");
326 return m_startOfObjectIndexes[combination * m_nObjectsPerCombination +
object];
331 std::vector<AlgorithmResult>::const_iterator iAlgo =
336 if (iAlgo ==
m_algorithmResults.end() || iAlgo->algorithmBitNumber() != algorithmBitNumber) {
338 ex <<
"algorithmBitNumber not found";
339 ex.
addContext(
"Calling L1GlobalTriggerObjectMaps::getStartEndIndex");
343 startIndex = iAlgo->startIndexOfConditions();
350 ex <<
"index out of order or out of range";
351 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
const T & max(const T &a, const T &b)
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
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
void getStartEndIndex(int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const