ATLAS Offline Software
L1TopoConfigAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef L1TOPOCONFIG_L1TOPOCONFIGALG_H
6 #define L1TOPOCONFIG_L1TOPOCONFIGALG_H
7 
8 #include <iostream>
9 #include <vector>
10 #include <string>
11 
12 namespace TXC {
13  class L1TopoConfigAlg;
14 }
15 
16 namespace TXC {
17 
18 std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &);
19 
20  struct InputElement {
21  InputElement(const std::string & name, const std::string & value, unsigned int position) :
23  std::string name {""};
24  std::string value {""};
25  unsigned int position {0};
26  };
27 
28  struct OutputElement {
29  OutputElement(const std::string & name, const std::string & value, unsigned int bits, const std::string & outname, unsigned int position) :
31  std::string name {""};
32  std::string value {""};
33  unsigned int nbits {0};
34  std::string outname {""};
35  unsigned int position {0};
36  };
37 
38  struct FixedParameter {
39  FixedParameter(const std::string & name, const std::string & value) :
40  name(name), value(value) {}
41  std::string name {""};
42  std::string value {""};
43  };
44 
46  RegisterParameter(const std::string & name, const std::string & value, unsigned int position, unsigned int selection) :
48  std::string name {""};
49  std::string value {""};
50  unsigned int position {0};
51  unsigned int selection {0};
52  };
53 
54 
55 
57  public:
58 
59  enum AlgKind { NONE = 0, SORT = 1, DECISION = 2 };
60 
61  // default constructor
62  L1TopoConfigAlg(const std::string & name, const std::string & type);
63 
64  // move constructor
66  L1TopoConfigAlg& operator=(L1TopoConfigAlg&&) noexcept = default;
67 
68  // destructor
69  virtual ~L1TopoConfigAlg();
70 
71  // accessors for algo
72  const std::string & name() const { return m_name; }
73  unsigned int algoID() const { return m_algoID; }
74  std::string fullname() const;
75 
76  const std::string & type() const { return m_type; }
77  const std::string & output() const { return m_output; }
78  bool isSortAlg() const { return m_kind == SORT; }
79  bool isDecAlg() const { return m_kind == DECISION; }
80 
81  // accessors for algo inputs
82  const std::vector<InputElement> & getInputs() const { return m_inputElements; }
83  std::vector<std::string> getInputNames() const;
84 
85  // accessors for algo outputs
86  const std::vector<OutputElement> & getOutputs() const { return m_outputElements; }
87  std::vector<std::string> getOutputNames() const;
88 
89  // accessors for fixed paramters (those which can not be changed through registers)
90  const std::vector<FixedParameter> & getFixedParameters() const { return m_fixedParameters; }
91 
92  // accessors for algo parameters
93  const std::vector<RegisterParameter> & getParameters() const { return m_variableParameters; }
94 
95 
96  // algorithm setters
97  void setAlgName(const std::string & name) { m_name = name; }
98  void setAlgType(const std::string & type) { m_type = type; }
99  void setAlgOutput(const std::string & output) { m_output = output; }
100  void setAlgoID( unsigned int algoID) { m_algoID = algoID; }
101  void setAlgKind(AlgKind kind) { m_kind = kind; }
102 
103  // algorithm parameter setters
104  void addInput(const std::string & name, const std::string &value, unsigned int position);
105  void addOutput(const std::string &name, const std::string &value, unsigned int bits, const std::string & outname, unsigned int position);
106  void addFixedParameter(const std::string &name, const std::string &value);
107  void addParameter(const std::string &name, const std::string &value, unsigned int position, unsigned int selection);
108 
109  private:
110 
112 
113  friend std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &);
114 
115  // algorithm attributes
116  std::string m_name {""};
117  std::string m_type {""};
118  std::string m_output {""};
119  unsigned int m_algoID {0};
121 
122  // parameter attributes
123  std::vector<TXC::InputElement> m_inputElements;
124  std::vector<TXC::OutputElement> m_outputElements;
125  std::vector<TXC::FixedParameter> m_fixedParameters;
126  std::vector<TXC::RegisterParameter> m_variableParameters;
127 
128  };
129 
130 std::ostream & operator<<(std::ostream &, const InputElement&);
131 std::ostream & operator<<(std::ostream &, const OutputElement&);
132 std::ostream & operator<<(std::ostream &, const FixedParameter&);
133 std::ostream & operator<<(std::ostream &, const RegisterParameter&);
134 
135 }
136 
137 
138 #endif /* defined(L1TOPOCONFIG_L1TOPOCONFIGALG_H) */
NONE
@ NONE
Definition: sTGCenumeration.h:13
TXC::operator<<
std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &)
Definition: L1TopoConfigAlg.cxx:104
TXC::L1TopoConfigAlg::setAlgoID
void setAlgoID(unsigned int algoID)
Definition: L1TopoConfigAlg.h:100
TXC::L1TopoConfigAlg::isDecAlg
bool isDecAlg() const
Definition: L1TopoConfigAlg.h:79
TXC::L1TopoConfigAlg::m_outputElements
std::vector< TXC::OutputElement > m_outputElements
Definition: L1TopoConfigAlg.h:124
TXC::RegisterParameter::selection
unsigned int selection
Definition: L1TopoConfigAlg.h:51
TXC::L1TopoConfigAlg::getOutputNames
std::vector< std::string > getOutputNames() const
Definition: L1TopoConfigAlg.cxx:71
TXC::FixedParameter::name
std::string name
Definition: L1TopoConfigAlg.h:41
TXC::L1TopoConfigAlg::m_type
std::string m_type
Definition: L1TopoConfigAlg.h:117
TXC::L1TopoConfigAlg::AlgKind
AlgKind
Definition: L1TopoConfigAlg.h:59
TXC::L1TopoConfigAlg::m_fixedParameters
std::vector< TXC::FixedParameter > m_fixedParameters
Definition: L1TopoConfigAlg.h:125
TXC::L1TopoConfigAlg::operator<<
friend std::ostream & operator<<(std::ostream &, const TXC::L1TopoConfigAlg &)
Definition: L1TopoConfigAlg.cxx:104
TXC::OutputElement::value
std::string value
Definition: L1TopoConfigAlg.h:32
TXC::L1TopoConfigAlg::setAlgKind
void setAlgKind(AlgKind kind)
Definition: L1TopoConfigAlg.h:101
athena.value
value
Definition: athena.py:122
TXC::L1TopoConfigAlg::setAlgOutput
void setAlgOutput(const std::string &output)
Definition: L1TopoConfigAlg.h:99
TXC::L1TopoConfigAlg::NONE
@ NONE
Definition: L1TopoConfigAlg.h:59
TXC::L1TopoConfigAlg::m_output
std::string m_output
Definition: L1TopoConfigAlg.h:118
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
TXC::L1TopoConfigAlg::L1TopoConfigAlg
L1TopoConfigAlg(L1TopoConfigAlg &&) noexcept=default
TXC::RegisterParameter::RegisterParameter
RegisterParameter(const std::string &name, const std::string &value, unsigned int position, unsigned int selection)
Definition: L1TopoConfigAlg.h:46
TXC::L1TopoConfigAlg::algoID
unsigned int algoID() const
Definition: L1TopoConfigAlg.h:73
TXC::L1TopoConfigAlg::addParameter
void addParameter(const std::string &name, const std::string &value, unsigned int position, unsigned int selection)
Definition: L1TopoConfigAlg.cxx:96
TXC::L1TopoConfigAlg::getInputNames
std::vector< std::string > getInputNames() const
Definition: L1TopoConfigAlg.cxx:63
TXC::L1TopoConfigAlg::isSortAlg
bool isSortAlg() const
Definition: L1TopoConfigAlg.h:78
TXC::L1TopoConfigAlg::m_variableParameters
std::vector< TXC::RegisterParameter > m_variableParameters
Definition: L1TopoConfigAlg.h:126
TXC::L1TopoConfigAlg::getOutputs
const std::vector< OutputElement > & getOutputs() const
Definition: L1TopoConfigAlg.h:86
TXC::OutputElement::outname
std::string outname
Definition: L1TopoConfigAlg.h:34
TXC::L1TopoConfigAlg::type
const std::string & type() const
Definition: L1TopoConfigAlg.h:76
TXC::InputElement::position
unsigned int position
Definition: L1TopoConfigAlg.h:25
TXC::L1TopoConfigAlg::addOutput
void addOutput(const std::string &name, const std::string &value, unsigned int bits, const std::string &outname, unsigned int position)
Definition: L1TopoConfigAlg.cxx:87
TXC::L1TopoConfigAlg::getInputs
const std::vector< InputElement > & getInputs() const
Definition: L1TopoConfigAlg.h:82
TXC::OutputElement::name
std::string name
Definition: L1TopoConfigAlg.h:31
TXC::OutputElement::OutputElement
OutputElement(const std::string &name, const std::string &value, unsigned int bits, const std::string &outname, unsigned int position)
Definition: L1TopoConfigAlg.h:29
TXC::L1TopoConfigAlg::name
const std::string & name() const
Definition: L1TopoConfigAlg.h:72
TXC::OutputElement::nbits
unsigned int nbits
Definition: L1TopoConfigAlg.h:33
TXC::L1TopoConfigAlg::DECISION
@ DECISION
Definition: L1TopoConfigAlg.h:59
TXC::L1TopoConfigAlg::m_kind
AlgKind m_kind
Definition: L1TopoConfigAlg.h:120
TXC::RegisterParameter::value
std::string value
Definition: L1TopoConfigAlg.h:49
selection
std::string selection
Definition: fbtTestBasics.cxx:73
TXC::L1TopoConfigAlg::L1TopoConfigAlg
L1TopoConfigAlg()
Definition: L1TopoConfigAlg.h:111
TXC::L1TopoConfigAlg::m_algoID
unsigned int m_algoID
Definition: L1TopoConfigAlg.h:119
TXC::L1TopoConfigAlg::output
const std::string & output() const
Definition: L1TopoConfigAlg.h:77
TXC
Definition: IL1TopoMenuLoader.h:10
beamspotman.outname
outname
Definition: beamspotman.py:414
TXC::L1TopoConfigAlg::addInput
void addInput(const std::string &name, const std::string &value, unsigned int position)
Definition: L1TopoConfigAlg.cxx:81
TXC::InputElement
Definition: L1TopoConfigAlg.h:20
TXC::L1TopoConfigAlg::setAlgName
void setAlgName(const std::string &name)
Definition: L1TopoConfigAlg.h:97
TXC::RegisterParameter
Definition: L1TopoConfigAlg.h:45
TXC::RegisterParameter::position
unsigned int position
Definition: L1TopoConfigAlg.h:50
TXC::InputElement::name
std::string name
Definition: L1TopoConfigAlg.h:23
TXC::L1TopoConfigAlg
Definition: L1TopoConfigAlg.h:56
TXC::InputElement::value
std::string value
Definition: L1TopoConfigAlg.h:24
TXC::OutputElement::position
unsigned int position
Definition: L1TopoConfigAlg.h:35
TXC::RegisterParameter::name
std::string name
Definition: L1TopoConfigAlg.h:48
TXC::FixedParameter::FixedParameter
FixedParameter(const std::string &name, const std::string &value)
Definition: L1TopoConfigAlg.h:39
TXC::L1TopoConfigAlg::setAlgType
void setAlgType(const std::string &type)
Definition: L1TopoConfigAlg.h:98
TXC::L1TopoConfigAlg::fullname
std::string fullname() const
Definition: L1TopoConfigAlg.cxx:57
TXC::FixedParameter
Definition: L1TopoConfigAlg.h:38
TXC::L1TopoConfigAlg::addFixedParameter
void addFixedParameter(const std::string &name, const std::string &value)
Definition: L1TopoConfigAlg.cxx:92
TXC::L1TopoConfigAlg::SORT
@ SORT
Definition: L1TopoConfigAlg.h:59
TXC::InputElement::InputElement
InputElement(const std::string &name, const std::string &value, unsigned int position)
Definition: L1TopoConfigAlg.h:21
TXC::L1TopoConfigAlg::getFixedParameters
const std::vector< FixedParameter > & getFixedParameters() const
Definition: L1TopoConfigAlg.h:90
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
TXC::FixedParameter::value
std::string value
Definition: L1TopoConfigAlg.h:42
TXC::L1TopoConfigAlg::m_inputElements
std::vector< TXC::InputElement > m_inputElements
Definition: L1TopoConfigAlg.h:123
TXC::L1TopoConfigAlg::m_name
std::string m_name
Definition: L1TopoConfigAlg.h:116
TXC::L1TopoConfigAlg::getParameters
const std::vector< RegisterParameter > & getParameters() const
Definition: L1TopoConfigAlg.h:93
TXC::OutputElement
Definition: L1TopoConfigAlg.h:28