1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
/**
* \class L1GlobalTriggerObjectMap
*
*
* Description: see header file.
*
* Implementation:
* <TODO: enter implementation details>
*
* \author: Vasile Mihai Ghete - HEPHY Vienna
*
*
*/
// this class header
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
// system include files
#include <iostream>
#include <iomanip>
#include <iterator>
#include <algorithm>
// user include files
#include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
// forward declarations
// methods
// return all the combinations passing the requirements imposed in condition condNameVal
const CombinationsInCond* L1GlobalTriggerObjectMap::getCombinationsInCond(const std::string& condNameVal) const {
for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
if ((m_operandTokenVector[i]).tokenName == condNameVal) {
return &(m_combinationVector.at((m_operandTokenVector[i]).tokenNumber));
}
}
// return a null address - should not arrive here
edm::LogError("L1GlobalTriggerObjectMap") << "\n\n ERROR: The requested condition with tokenName = " << condNameVal
<< "\n does not exists in the operand token vector."
<< "\n Returning zero pointer for getCombinationsInCond\n\n"
<< std::endl;
return nullptr;
}
/// return all the combinations passing the requirements imposed in condition condNumberVal
const CombinationsInCond* L1GlobalTriggerObjectMap::getCombinationsInCond(const int condNumberVal) const {
for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
if ((m_operandTokenVector[i]).tokenNumber == condNumberVal) {
return &(m_combinationVector.at((m_operandTokenVector[i]).tokenNumber));
}
}
// return a null address - should not arrive here
edm::LogError("L1GlobalTriggerObjectMap")
<< "\n\n ERROR: The requested condition with tokenNumber = " << condNumberVal
<< "\n does not exists in the operand token vector."
<< "\n Returning zero pointer for getCombinationsInCond\n\n"
<< std::endl;
return nullptr;
}
// return the result for the condition condNameVal
const bool L1GlobalTriggerObjectMap::getConditionResult(const std::string& condNameVal) const {
for (size_t i = 0; i < m_operandTokenVector.size(); ++i) {
if ((m_operandTokenVector[i]).tokenName == condNameVal) {
return (m_operandTokenVector[i]).tokenResult;
}
}
// return false - should not arrive here
edm::LogError("L1GlobalTriggerObjectMap") << "\n\n ERROR: The requested condition with name = " << condNameVal
<< "\n does not exists in the operand token vector."
<< "\n Returning false for getConditionResult\n\n"
<< std::endl;
return false;
}
void L1GlobalTriggerObjectMap::reset() {
// name of the algorithm
m_algoName.clear();
// bit number for algorithm
m_algoBitNumber = -1;
// GTL result of the algorithm
m_algoGtlResult = false;
// vector of operand tokens for an algorithm
m_operandTokenVector.clear();
// vector of combinations for all conditions in an algorithm
m_combinationVector.clear();
}
void L1GlobalTriggerObjectMap::print(std::ostream& myCout) const {
myCout << "L1GlobalTriggerObjectMap: print " << std::endl;
myCout << " Algorithm name: " << m_algoName << std::endl;
myCout << " Bit number: " << m_algoBitNumber << std::endl;
myCout << " GTL result: " << m_algoGtlResult << std::endl;
int operandTokenVectorSize = m_operandTokenVector.size();
myCout << " Operand token vector size: " << operandTokenVectorSize;
if (operandTokenVectorSize == 0) {
myCout << " - not properly initialized! " << std::endl;
} else {
myCout << std::endl;
for (int i = 0; i < operandTokenVectorSize; ++i) {
myCout << " " << std::setw(5) << (m_operandTokenVector[i]).tokenNumber << "\t" << std::setw(25)
<< (m_operandTokenVector[i]).tokenName << "\t" << (m_operandTokenVector[i]).tokenResult << std::endl;
}
}
myCout << " CombinationVector size: " << m_combinationVector.size() << std::endl;
myCout << " conditions: " << std::endl;
std::vector<CombinationsInCond>::const_iterator itVVV;
int iCond = 0;
for (itVVV = m_combinationVector.begin(); itVVV != m_combinationVector.end(); itVVV++) {
std::string condName = (m_operandTokenVector[iCond]).tokenName;
bool condResult = (m_operandTokenVector[iCond]).tokenResult;
myCout << " Condition " << condName << " evaluated to " << condResult << std::endl;
myCout << " List of combinations passing all requirements for this condition:" << std::endl;
myCout << " ";
if ((*itVVV).empty()) {
myCout << "(none)";
} else {
CombinationsInCond::const_iterator itVV;
for (itVV = (*itVVV).begin(); itVV != (*itVVV).end(); itVV++) {
myCout << "( ";
std::copy((*itVV).begin(), (*itVV).end(), std::ostream_iterator<int>(myCout, " "));
myCout << "); ";
}
}
iCond++;
myCout << "\n\n";
}
}
|