38 : m_l1GtObjectMapTag(pset.getParameter<
edm::InputTag>(
"L1GtObjectMapTag")),
40 pset.getParameter<
edm::InputTag>(
"L1GtObjectMapsTag")),
41 verbose_(pset.getUntrackedParameter<
bool>(
"verbose",
false)) {}
61 if (pset ==
nullptr) {
63 ex <<
"Could not find L1 trigger names ParameterSet in the registry";
64 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
69 std::vector<int> algoBitNumbers1;
70 std::vector<L1GlobalTriggerObjectMap>
const &vectorInRecord =
72 algoBitNumbers1.reserve(vectorInRecord.size());
73 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator
74 i = vectorInRecord.begin(),
75 iEnd = vectorInRecord.end();
77 algoBitNumbers1.push_back(
i->algoBitNumber());
86 std::vector<int> algoBitNumbers2;
88 if (algoBitNumbers1 != algoBitNumbers2) {
90 ex <<
"Algorithm bit numbers do not match";
91 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
96 std::vector<std::string> algoNames2 =
97 pset->
getParameter<std::vector<std::string>>(
"@algorithmNames");
102 for (
int i = 0; i < static_cast<int>(algoNames2.size()); ++
i) {
103 if (!std::binary_search(algoBitNumbers1.begin(), algoBitNumbers1.end(),
107 ex <<
"Undefined algorithm should have empty name";
108 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
115 for (std::vector<int>::const_iterator iBit = algoBitNumbers1.begin(),
116 endBits = algoBitNumbers1.end();
117 iBit != endBits; ++iBit) {
123 if (algoName1 != algoNames2.at(*iBit)) {
125 ex <<
"Algorithm names do not match";
126 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
133 ex <<
"Algorithm results do not match";
134 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
138 std::vector<L1GtLogicParser::OperandToken>
const &operandTokens1 =
143 if (conditions2.
nConditions() != operandTokens1.size()) {
145 ex <<
"Number of conditions does not match";
146 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
150 std::vector<std::string> conditionNames2;
152 pset->
getParameter<std::vector<std::string>>(algoNames2.at(*iBit));
156 std::cout << *iBit <<
" " << algoNames2[*iBit] <<
" " 163 std::cout <<
" " << j <<
" " << conditionNames2[j] <<
" " 171 <<
static_cast<unsigned>(
180 unsigned iCondition = 0;
181 for (std::vector<L1GtLogicParser::OperandToken>::const_iterator
182 iToken1 = operandTokens1.begin(),
183 endTokens1 = operandTokens1.end();
184 iToken1 != endTokens1; ++iToken1, ++iCondition) {
187 if (iToken1->tokenNumber != static_cast<int>(iCondition)) {
189 ex <<
"Token numbers not sequential";
190 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
197 ex <<
"Condition results do not match";
198 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
203 if (iToken1->tokenName != conditionNames2.at(iCondition)) {
205 ex <<
"Condition names do not match";
206 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
216 if (combinations1->size() != combinations2.
nCombinations()) {
218 ex <<
"The number of combinations in a condition does not match";
219 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
223 for (CombinationsInCond::const_iterator iCombo = combinations1->begin(),
224 endCombos = combinations1->end();
225 iCombo != endCombos; ++iCombo) {
228 ex <<
"The number of indexes in a combination does not match";
229 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
233 for (std::vector<int>::const_iterator iIndex = iCombo->begin(),
234 endIndexes = iCombo->end();
235 iIndex != endIndexes; ++iIndex) {
239 iIndex - iCombo->begin())) {
241 ex <<
"Object index does not match";
242 ex.
addContext(
"Calling CompareToObjectMapRecord::analyze");
T getParameter(std::string const &) const
unsigned char getObjectIndex(unsigned combination, unsigned object) const
const std::vector< L1GtLogicParser::OperandToken > & operandTokenVector() const
unsigned short nObjectsPerCombination() const
edm::InputTag m_l1GtObjectMapTag
void getAlgorithmBitNumbers(std::vector< int > &algorithmBitNumbers) const
Fills the vector with all the algorithm bit numbers.
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
#define DEFINE_FWK_MODULE(type)
edm::ParameterSetID const & namesParameterSetID() const
const CombinationsInCond * getCombinationsInCond(const std::string &condNameVal) const
return all the combinations passing the requirements imposed in condition condNameVal ...
bool getMapped(key_type const &k, value_type &result) const
void analyze(edm::Event const &event, edm::EventSetup const &es) override
unsigned nConditions() const
~CompareToObjectMapRecord() override
CompareToObjectMapRecord(const edm::ParameterSet &pset)
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
unsigned nCombinations() const
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
unsigned getNumberOfConditions(int algorithmBitNumber) const
Number of conditions associated with an algorithm.
void addContext(std::string const &context)
edm::InputTag m_l1GtObjectMapsTag
bool getConditionResult(unsigned condition) const
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
const L1GlobalTriggerObjectMap * getObjectMap(const std::string &algoNameVal) const
return the object map for the algorithm algoNameVal
static Registry * instance()