#include <L1GlobalTriggerObjectMaps.h>
Classes | |
class | AlgorithmResult |
class | CombinationsInCondition |
class | ConditionResult |
class | ConditionsInAlgorithm |
Public Member Functions | |
bool | algorithmExists (int algorithmBitNumber) const |
Returns true if there is an entry for this algorithm bit number. | |
bool | algorithmResult (int algorithmBitNumber) const |
Returns whether an algorithm trigger passed or failed. | |
void | consistencyCheck () const |
void | getAlgorithmBitNumbers (std::vector< int > &algorithmBitNumbers) const |
Fills the vector with all the algorithm bit numbers. | |
CombinationsInCondition | getCombinationsInCondition (int algorithmBitNumber, unsigned conditionNumber) const |
ConditionsInAlgorithm | getConditionsInAlgorithm (int algorithmBitNumber) const |
unsigned | getNumberOfConditions (int algorithmBitNumber) const |
Number of conditions associated with an algorithm. | |
L1GlobalTriggerObjectMaps () | |
edm::ParameterSetID const & | namesParameterSetID () const |
void | pushBackAlgorithm (unsigned startIndexOfConditions, int algorithmBitNumber, bool algorithmResult) |
void | pushBackCondition (unsigned startIndexOfCombinations, unsigned short nObjectsPerCombination, bool conditionResult) |
void | pushBackObjectIndex (unsigned char objectIndex) |
void | reserveForAlgorithms (unsigned n) |
void | reserveForConditions (unsigned n) |
void | reserveForObjectIndexes (unsigned n) |
void | setNamesParameterSetID (edm::ParameterSetID const &psetID) |
void | swap (L1GlobalTriggerObjectMaps &rh) |
void | updateOperandTokenVector (int algorithmBitNumber, std::vector< L1GtLogicParser::OperandToken > &operandTokenVector) const |
Update the condition result in the operandTokenVector. | |
~L1GlobalTriggerObjectMaps () | |
Private Member Functions | |
void | getStartEndIndex (int algorithmBitNumber, unsigned &startIndex, unsigned &endIndex) const |
Private Attributes | |
std::vector< AlgorithmResult > | m_algorithmResults |
std::vector< unsigned char > | m_combinations |
std::vector< ConditionResult > | m_conditionResults |
edm::ParameterSetID | m_namesParameterSetID |
Description: map trigger objects to algorithms and conditions.
Implementation: <TODO: enter implementation details>
Definition at line 26 of file L1GlobalTriggerObjectMaps.h.
L1GlobalTriggerObjectMaps::L1GlobalTriggerObjectMaps | ( | ) | [inline] |
Definition at line 31 of file L1GlobalTriggerObjectMaps.h.
{}
L1GlobalTriggerObjectMaps::~L1GlobalTriggerObjectMaps | ( | ) | [inline] |
Definition at line 33 of file L1GlobalTriggerObjectMaps.h.
{}
bool L1GlobalTriggerObjectMaps::algorithmExists | ( | int | algorithmBitNumber | ) | const |
Returns true if there is an entry for this algorithm bit number.
Definition at line 32 of file L1GlobalTriggerObjectMaps.cc.
References i, and m_algorithmResults.
{ std::vector<AlgorithmResult>::const_iterator i = std::lower_bound(m_algorithmResults.begin(), m_algorithmResults.end(), AlgorithmResult(0, algorithmBitNumber, false)); if (i == m_algorithmResults.end() || i->algorithmBitNumber() != algorithmBitNumber) { return false; } return true; }
bool L1GlobalTriggerObjectMaps::algorithmResult | ( | int | algorithmBitNumber | ) | const |
Returns whether an algorithm trigger passed or failed.
Definition at line 43 of file L1GlobalTriggerObjectMaps.cc.
References cms::Exception::addContext(), i, and m_algorithmResults.
{ std::vector<AlgorithmResult>::const_iterator i = std::lower_bound(m_algorithmResults.begin(), m_algorithmResults.end(), AlgorithmResult(0, algorithmBitNumber, false)); if (i == m_algorithmResults.end() || i->algorithmBitNumber() != algorithmBitNumber) { cms::Exception ex("L1GlobalTrigger"); ex << "algorithmBitNumber not found"; ex.addContext("Calling L1GlobalTriggerObjectMaps::algorithmResult"); throw ex; } return i->algorithmResult(); }
void L1GlobalTriggerObjectMaps::consistencyCheck | ( | ) | const |
Definition at line 156 of file L1GlobalTriggerObjectMaps.cc.
References cms::Exception::addContext(), i, j, m_algorithmResults, m_combinations, and m_conditionResults.
{ // None of these checks should ever fail unless there // is a bug in the code filling this object for (std::vector<AlgorithmResult>::const_iterator i = m_algorithmResults.begin(), iEnd = m_algorithmResults.end(); i != iEnd; ++i) { std::vector<AlgorithmResult>::const_iterator j = i; ++j; if (j != iEnd && !(*i < *j)) { cms::Exception ex("L1GlobalTrigger"); ex << "AlgorithmResults should be sorted in increasing order of bit number with no duplicates. It is not."; ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck"); throw ex; } unsigned endIndex = (j != iEnd) ? j->startIndexOfConditions() : m_conditionResults.size(); if (endIndex < i->startIndexOfConditions()) { cms::Exception ex("L1GlobalTrigger"); ex << "startIndexOfConditions decreases or exceeds the size of m_conditionResults"; ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck"); throw ex; } } for (std::vector<ConditionResult>::const_iterator i = m_conditionResults.begin(), iEnd = m_conditionResults.end(); i != iEnd; ++i) { std::vector<ConditionResult>::const_iterator j = i; ++j; unsigned endIndex = (j != iEnd) ? j->startIndexOfCombinations() : m_combinations.size(); if (endIndex < i->startIndexOfCombinations()) { cms::Exception ex("L1GlobalTrigger"); ex << "startIndexOfCombinations decreases or exceeds the size of m_conditionResults"; ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck"); throw ex; } unsigned length = endIndex - i->startIndexOfCombinations(); if (length == 0U) { if (i->nObjectsPerCombination() != 0U) { cms::Exception ex("L1GlobalTrigger"); ex << "Length is zero and nObjectsInCombination is not zero"; ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck"); throw ex; } } else { if (i->nObjectsPerCombination() == 0 || length % i->nObjectsPerCombination() != 0) { cms::Exception ex("L1GlobalTrigger"); ex << "Size indicated by startIndexOfCombinations is not a multiple of nObjectsInCombination"; ex.addContext("Calling L1GlobalTriggerObjectMaps::consistencyCheck"); throw ex; } } } }
void L1GlobalTriggerObjectMaps::getAlgorithmBitNumbers | ( | std::vector< int > & | algorithmBitNumbers | ) | const |
Fills the vector with all the algorithm bit numbers.
Definition at line 78 of file L1GlobalTriggerObjectMaps.cc.
References i, and m_algorithmResults.
{ algorithmBitNumbers.clear(); for (std::vector<AlgorithmResult>::const_iterator i = m_algorithmResults.begin(), iEnd = m_algorithmResults.end(); i != iEnd; ++i) { algorithmBitNumbers.push_back(i->algorithmBitNumber()); } }
L1GlobalTriggerObjectMaps::CombinationsInCondition L1GlobalTriggerObjectMaps::getCombinationsInCondition | ( | int | algorithmBitNumber, |
unsigned | conditionNumber | ||
) | const |
Each condition can be satisfied by multiple combinations of L1 objects. The number, order, and type of objects associated with each condition is defined in the L1 Trigger Menu. The following function returns an object which has a function that returns the index into the L1 Object Collections of each object in each combination.
Definition at line 104 of file L1GlobalTriggerObjectMaps.cc.
References cms::Exception::addContext(), getStartEndIndex(), m_combinations, and m_conditionResults.
{ unsigned startIndex = 0; unsigned endIndex = 0; getStartEndIndex(algorithmBitNumber, startIndex, endIndex); if (endIndex <= startIndex + conditionNumber) { cms::Exception ex("L1GlobalTrigger"); ex << "Condition number is out of range"; ex.addContext("Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition"); throw ex; } unsigned endObjectIndex = m_combinations.size(); unsigned nextConditionIndex = startIndex + conditionNumber + 1U; if (nextConditionIndex < m_conditionResults.size()) { endObjectIndex = m_conditionResults[nextConditionIndex].startIndexOfCombinations(); } unsigned beginObjectIndex = m_conditionResults[startIndex + conditionNumber].startIndexOfCombinations(); unsigned short nObjectsPerCombination = m_conditionResults[startIndex + conditionNumber].nObjectsPerCombination(); if (endObjectIndex == beginObjectIndex) { return CombinationsInCondition(0, 0, 0); } if (endObjectIndex < beginObjectIndex || m_combinations.size() < endObjectIndex || nObjectsPerCombination == 0 || (endObjectIndex - beginObjectIndex) % nObjectsPerCombination != 0) { cms::Exception ex("L1GlobalTrigger"); ex << "Indexes to combinations are invalid"; ex.addContext("Calling L1GlobalTriggerObjectMaps::getCombinationsInCondition"); throw ex; } return CombinationsInCondition(&m_combinations[beginObjectIndex], (endObjectIndex - beginObjectIndex) / nObjectsPerCombination, nObjectsPerCombination); }
L1GlobalTriggerObjectMaps::ConditionsInAlgorithm L1GlobalTriggerObjectMaps::getConditionsInAlgorithm | ( | int | algorithmBitNumber | ) | const |
Return an object which has a function that returns the results of the conditions associated with an algorithm.
Definition at line 96 of file L1GlobalTriggerObjectMaps.cc.
References getStartEndIndex(), and m_conditionResults.
{ unsigned startIndex = 0; unsigned endIndex = 0; getStartEndIndex(algorithmBitNumber, startIndex, endIndex); return ConditionsInAlgorithm(&m_conditionResults[startIndex], endIndex - startIndex); }
unsigned L1GlobalTriggerObjectMaps::getNumberOfConditions | ( | int | algorithmBitNumber | ) | const |
Number of conditions associated with an algorithm.
Definition at line 87 of file L1GlobalTriggerObjectMaps.cc.
References getStartEndIndex().
{ unsigned startIndex = 0; unsigned endIndex = 0; getStartEndIndex(algorithmBitNumber, startIndex, endIndex); return endIndex - startIndex; }
void L1GlobalTriggerObjectMaps::getStartEndIndex | ( | int | algorithmBitNumber, |
unsigned & | startIndex, | ||
unsigned & | endIndex | ||
) | const [private] |
Definition at line 330 of file L1GlobalTriggerObjectMaps.cc.
References cms::Exception::addContext(), m_algorithmResults, and m_conditionResults.
Referenced by getCombinationsInCondition(), getConditionsInAlgorithm(), getNumberOfConditions(), and updateOperandTokenVector().
{ std::vector<AlgorithmResult>::const_iterator iAlgo = std::lower_bound(m_algorithmResults.begin(), m_algorithmResults.end(), AlgorithmResult(0, algorithmBitNumber, false)); if (iAlgo == m_algorithmResults.end() || iAlgo->algorithmBitNumber() != algorithmBitNumber) { cms::Exception ex("L1GlobalTrigger"); ex << "algorithmBitNumber not found"; ex.addContext("Calling L1GlobalTriggerObjectMaps::getStartEndIndex"); throw ex; } startIndex = iAlgo->startIndexOfConditions(); ++iAlgo; endIndex = (iAlgo != m_algorithmResults.end()) ? iAlgo->startIndexOfConditions() : m_conditionResults.size(); if (endIndex < startIndex || m_conditionResults.size() < endIndex) { cms::Exception ex("L1GlobalTrigger"); ex << "index out of order or out of range"; ex.addContext("Calling L1GlobalTriggerObjectMaps::getStartEndIndex"); throw ex; } }
edm::ParameterSetID const& L1GlobalTriggerObjectMaps::namesParameterSetID | ( | ) | const [inline] |
Returns the ID of the ParameterSet containing the algorithm names and condition names.
Definition at line 70 of file L1GlobalTriggerObjectMaps.h.
References m_namesParameterSetID.
{ return m_namesParameterSetID; }
void L1GlobalTriggerObjectMaps::pushBackAlgorithm | ( | unsigned | startIndexOfConditions, |
int | algorithmBitNumber, | ||
bool | algorithmResult | ||
) |
Definition at line 148 of file L1GlobalTriggerObjectMaps.cc.
References m_algorithmResults.
{ m_algorithmResults.push_back(AlgorithmResult(startIndexOfConditions, algorithmBitNumber, algorithmResult)); }
void L1GlobalTriggerObjectMaps::pushBackCondition | ( | unsigned | startIndexOfCombinations, |
unsigned short | nObjectsPerCombination, | ||
bool | conditionResult | ||
) |
Definition at line 217 of file L1GlobalTriggerObjectMaps.cc.
References m_conditionResults.
{ m_conditionResults.push_back(ConditionResult(startIndexOfCombinations, nObjectsPerCombination, conditionResult)); }
void L1GlobalTriggerObjectMaps::pushBackObjectIndex | ( | unsigned char | objectIndex | ) |
Definition at line 231 of file L1GlobalTriggerObjectMaps.cc.
References m_combinations.
{ m_combinations.push_back(objectIndex); }
void L1GlobalTriggerObjectMaps::reserveForAlgorithms | ( | unsigned | n | ) |
Definition at line 143 of file L1GlobalTriggerObjectMaps.cc.
References m_algorithmResults.
{ m_algorithmResults.reserve(n); }
void L1GlobalTriggerObjectMaps::reserveForConditions | ( | unsigned | n | ) |
Definition at line 212 of file L1GlobalTriggerObjectMaps.cc.
References m_conditionResults.
{ m_conditionResults.reserve(n); }
void L1GlobalTriggerObjectMaps::reserveForObjectIndexes | ( | unsigned | n | ) |
Definition at line 226 of file L1GlobalTriggerObjectMaps.cc.
References m_combinations.
{ m_combinations.reserve(n); }
void L1GlobalTriggerObjectMaps::setNamesParameterSetID | ( | edm::ParameterSetID const & | psetID | ) |
Definition at line 236 of file L1GlobalTriggerObjectMaps.cc.
References m_namesParameterSetID.
{ m_namesParameterSetID = psetID; }
void L1GlobalTriggerObjectMaps::swap | ( | L1GlobalTriggerObjectMaps & | rh | ) |
Definition at line 25 of file L1GlobalTriggerObjectMaps.cc.
References m_algorithmResults, m_combinations, m_conditionResults, m_namesParameterSetID, and edm::Hash< I >::swap().
Referenced by swap().
{ m_algorithmResults.swap(rh.m_algorithmResults); m_conditionResults.swap(rh.m_conditionResults); m_combinations.swap(rh.m_combinations); m_namesParameterSetID.swap(rh.m_namesParameterSetID); }
void L1GlobalTriggerObjectMaps::updateOperandTokenVector | ( | int | algorithmBitNumber, |
std::vector< L1GtLogicParser::OperandToken > & | operandTokenVector | ||
) | const |
Update the condition result in the operandTokenVector.
Definition at line 58 of file L1GlobalTriggerObjectMaps.cc.
References cms::Exception::addContext(), getStartEndIndex(), i, and m_conditionResults.
{ unsigned startIndex = 0; unsigned endIndex = 0; getStartEndIndex(algorithmBitNumber, startIndex, endIndex); unsigned length = endIndex - startIndex; if (length != operandTokenVector.size()) { cms::Exception ex("L1GlobalTrigger"); ex << "operand token vector size does not match number of conditions"; ex.addContext("Calling L1GlobalTriggerObjectMaps::updateOperandTokenVector"); throw ex; } for (unsigned i = 0; i < length; ++i) { operandTokenVector[i].tokenResult = m_conditionResults[startIndex + i].conditionResult(); } }
std::vector<AlgorithmResult> L1GlobalTriggerObjectMaps::m_algorithmResults [private] |
Definition at line 171 of file L1GlobalTriggerObjectMaps.h.
Referenced by algorithmExists(), algorithmResult(), consistencyCheck(), getAlgorithmBitNumbers(), getStartEndIndex(), pushBackAlgorithm(), reserveForAlgorithms(), and swap().
std::vector<unsigned char> L1GlobalTriggerObjectMaps::m_combinations [private] |
Definition at line 173 of file L1GlobalTriggerObjectMaps.h.
Referenced by consistencyCheck(), getCombinationsInCondition(), pushBackObjectIndex(), reserveForObjectIndexes(), and swap().
std::vector<ConditionResult> L1GlobalTriggerObjectMaps::m_conditionResults [private] |
Definition at line 172 of file L1GlobalTriggerObjectMaps.h.
Referenced by consistencyCheck(), getCombinationsInCondition(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult(), getConditionsInAlgorithm(), getStartEndIndex(), pushBackCondition(), reserveForConditions(), swap(), and updateOperandTokenVector().
Definition at line 174 of file L1GlobalTriggerObjectMaps.h.
Referenced by namesParameterSetID(), setNamesParameterSetID(), and swap().