11 m_category(algoCategory)
14 throw std::runtime_error(
"Algorithm category must be TOPO, R2TOPO, MUTOPO or MULTTOPO, but is '" + algoCategory +
"'");
22 return "L1TopoAlgorithm";
28 if(! isInitialized() ||
empty() ) {
31 if(
m_type == AlgorithmType::DECISION ) {
32 if( hasChild(
"input") ) {
33 for(
auto & inp : getList(
"input")) {
34 m_inputs.push_back(inp.getValue());
36 }
else if( hasChild(
"fixedParameters.inputs") ) {
37 for(
auto & inp : getList(
"fixedParameters.inputs")) {
38 m_inputs.push_back(inp[
"value"]);
41 for(
auto & o : getList(
"output")) {
42 m_outputs.push_back(o.getValue());
44 }
else if(
m_type == AlgorithmType::MULTIPLICITY ) {
46 if(
auto &
input = getAttribute(
"input");
input!=
"null") {
47 m_inputs.push_back(
input);
49 if(hasAttribute(
"flavour")){
52 m_outputs.push_back(getAttribute(
"output"));
54 if( hasAttribute(
"input") ) {
55 m_inputs.push_back( getAttribute(
"input") );
56 }
else if( hasChild(
"fixedParameters.input") ) {
57 auto inp = getObject(
"fixedParameters.input");
58 for(
auto &
k : inp.getKeys() ) {
59 m_inputs.push_back(inp[
k]);
63 m_outputs.push_back(getAttribute(
"output"));
66 if(
m_type == AlgorithmType::DECISION ||
m_type == AlgorithmType::SORTING ) {
67 for(
auto &
p : getList(
"variableParameters") ) {
68 if (
p[
"name"] ==
"MaxMSqr") {
69 unsigned int val =
p.getAttribute<
unsigned int>(
"value");
73 val = 1024*1024*10*10*10;
75 m_parameters.emplace_back(
p[
"name"],
val,
p.getAttribute_optional<
unsigned int>(
"selection"));
78 m_parameters.emplace_back(
p[
"name"],
p.getAttribute<
int>(
"value"),
p.getAttribute_optional<
unsigned int>(
"selection"));
100 if(hasAttribute(
"klass")) {
101 return getAttribute(
"klass");
103 return getAttribute(
"type");
106 const std::vector<std::string> &
112 const std::vector<std::string> &
118 std::vector<std::string>
121 std::vector<std::string>
out;
122 for(
auto &
s : m_outputs ) {
123 out.push_back(m_category +
"_" +
s);
131 return operator[](
"fixedParameters.generics." +
parName +
".value");
137 return getObject(
"fixedParameters.generics");
140 const std::vector<TrigConf::L1TopoAlgorithm::VariableParameter> &
150 os <<
"Algorithm " <<
name() <<
" (class " <<
klass() <<
", category " << m_category <<
")" << std::endl;
151 os <<
" input:" << std::endl;
153 os <<
" " <<
input << std::endl;
155 os <<
" output:" << std::endl;
159 os <<
" full output:" << std::endl;
160 for(
auto &
output : fullOutputs() ) {
163 if(
type() == AlgorithmType::MULTIPLICITY) {
164 os <<
" threshold definition: " << getAttribute(
"threshold") << std::endl;
165 os <<
" number of output bits: " << getAttribute<unsigned int>(
"nbits") << std::endl;
167 os <<
" generic parameters:" << std::endl;
168 auto genPars = generics();
169 for(
auto &
k : genPars.getKeys() ) {
170 os <<
" " <<
k <<
" ==> " << genericParameter(
k) << std::endl;
172 os <<
" parameters:" << std::endl;
175 for(
auto &
p :
pars ) {
176 os <<
" " <<
idx++ <<
" " <<
p.name() <<
"[" <<
p.selection() <<
"] ==> " <<
p.value() << std::endl;