ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoAlgorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCONFDATA_L1TOPOALGORITHM_H
6#define TRIGCONFDATA_L1TOPOALGORITHM_H
7
9#include <vector>
10#include <optional>
11
12namespace TrigConf {
13
20 class L1TopoAlgorithm final : public DataStructure {
21 public:
22
24
26 public:
27 VariableParameter(const std::string & name, int value, std::optional<unsigned int> selection = std::nullopt)
29 const std::string & name() const { return m_name; }
30 int value() const { return m_value; }
31 unsigned int selection() const { return m_selection.value_or(0); }
32 std::optional<unsigned int> selection_optional() const { return m_selection; }
33 private:
34 std::string m_name{""};
35 int m_value{0};
36 std::optional<unsigned int> m_selection{};
37 };
38
40 L1TopoAlgorithm() = default;
41
45
49 L1TopoAlgorithm(const std::string & algoName, AlgorithmType algoType, const std::string & algoCategory, const ptree & data);
50
52 virtual ~L1TopoAlgorithm() override = default;
53
54 virtual std::string className() const override;
55
56 AlgorithmType type() const;
57
58 const std::string & category() const;
59
61 const std::string & klass() const;
62
66 const std::vector<std::string> & inputs() const;
67
71 const std::vector<std::string> & outputs() const;
72 std::vector<std::string> fullOutputs() const;
73
75 DataStructure generics() const;
76
77 std::string genericParameter(const std::string & parName) const;
78
79 template<class T>
80 T genericParameter(const std::string & parName) const {
81 return getAttribute<T>("fixedParameters.generics." + parName + ".value");
82 }
83
85 const std::vector<VariableParameter> & parameters() const;
86
88 void print(std::ostream & os = std::cout) const override;
89
90 protected:
91
92 virtual void update() override { load(); }
93
94 private:
95
97 void load();
98
100
101 std::string m_category{};
102
103 std::vector<std::string> m_inputs{};
104 std::vector<std::string> m_outputs{};
105
106 std::vector<VariableParameter> m_parameters;
107
108 };
109
110 class XEFlavour {
111 public:
113 enum class FLAV {
114 jXE = 0,
115 jXEC = 1,
116 jTE = 2,
117 jTEC = 3,
118 jTEFWD = 4,
122 gXERHO = 8,
123 gXENC = 9,
124 gTE = 10,
125 gMHT = 11,
126 cXE = 12,
128 jXEPerf = 14, // Only for simulation studies!
129 };
130
131 static std::string flavourIntToStr(const unsigned int flavInt){
132 if(flavInt==int(FLAV::jXE)) return "jXE";
133 if(flavInt==int(FLAV::jXEC)) return "jXEC";
134 if(flavInt==int(FLAV::jTE)) return "jTE";
135 if(flavInt==int(FLAV::jTEC)) return "jTEC";
136 if(flavInt==int(FLAV::jTEFWD)) return "jTEFWD";
137 if(flavInt==int(FLAV::jTEFWDA)) return "jTEFWDA";
138 if(flavInt==int(FLAV::jTEFWDC)) return "jTEFWDC";
139 if(flavInt==int(FLAV::gXEJWOJ)) return "gXEJWOJ";
140 if(flavInt==int(FLAV::gXERHO)) return "gXERHO";
141 if(flavInt==int(FLAV::gXENC)) return "gXENC";
142 if(flavInt==int(FLAV::gTE)) return "gTE";
143 if(flavInt==int(FLAV::gMHT)) return "gMHT";
144 if(flavInt==int(FLAV::cXE)) return "cXE";
145 if(flavInt==int(FLAV::gESPRESSO)) return "gESPRESSO";
146 if(flavInt==int(FLAV::jXEPerf)) return "jXEPerf";
147 throw std::runtime_error("Flavour " + std::to_string(flavInt) + " for EnergyThreshold algorithm not recongnised!");
148 };
149 static unsigned int flavourStrToInt(const std::string & flavStr){
150 if(flavStr=="jXE") return int(FLAV::jXE);
151 if(flavStr=="jXEC") return int(FLAV::jXEC);
152 if(flavStr=="jTE") return int(FLAV::jTE);
153 if(flavStr=="jTEC") return int(FLAV::jTEC);
154 if(flavStr=="jTEFWD") return int(FLAV::jTEFWD);
155 if(flavStr=="jTEFWDA") return int(FLAV::jTEFWDA);
156 if(flavStr=="jTEFWDC") return int(FLAV::jTEFWDC);
157 if(flavStr=="gXE") return int(FLAV::gXEJWOJ); // for backward compatibility
158 if(flavStr=="gXEJWOJ") return int(FLAV::gXEJWOJ);
159 if(flavStr=="gXERHO") return int(FLAV::gXERHO);
160 if(flavStr=="gXEPUFIT") return int(FLAV::gXENC); // for backward compatibility
161 if(flavStr=="gXENC") return int(FLAV::gXENC);
162 if(flavStr=="gTE") return int(FLAV::gTE);
163 if(flavStr=="gMHT") return int(FLAV::gMHT);
164 if(flavStr=="cXE") return int(FLAV::cXE);
165 if(flavStr=="gESPRESSO") return int(FLAV::gESPRESSO);
166 if(flavStr=="jXEPerf") return int(FLAV::jXEPerf);
167 throw std::runtime_error("Flavour " + flavStr + " for EnergyThreshold algorithm not recongnised!");
168 };
169
170 };
171
172}
173
174#endif
const ptree & data() const
Access to the underlying data, if needed.
DataStructure()
Default constructor, leading to an uninitialized configuration object.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
boost::property_tree::ptree ptree
virtual std::string className() const override
A string that is the name of the class.
L1TopoAlgorithm()=default
Constructor.
DataStructure generics() const
Accessors to generic parameters.
std::vector< std::string > fullOutputs() const
void print(std::ostream &os=std::cout) const override
print main info
std::string genericParameter(const std::string &parName) const
const std::vector< std::string > & inputs() const
Accessor to input collections Sorting and Multiplicity algorithms have only one input.
L1TopoAlgorithm(L1TopoAlgorithm &&)=default
const std::vector< std::string > & outputs() const
Accessor to output collections Sorting and Multiplicity algorithms have only one output.
L1TopoAlgorithm & operator=(const L1TopoAlgorithm &)=delete
std::vector< VariableParameter > m_parameters
const std::vector< VariableParameter > & parameters() const
Accessor to register parameters which can change for each algorithm instance.
const std::string & category() const
virtual void update() override
Update the internal data after modification of the data object.
void load()
Update the internal data after modification of the data object.
AlgorithmType type() const
L1TopoAlgorithm(const L1TopoAlgorithm &)=delete
virtual ~L1TopoAlgorithm() override=default
Destructor.
std::vector< std::string > m_inputs
std::vector< std::string > m_outputs
T genericParameter(const std::string &parName) const
const std::string & klass() const
Accessor to algorithm class type.
static unsigned int flavourStrToInt(const std::string &flavStr)
static std::string flavourIntToStr(const unsigned int flavInt)
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22
VariableParameter(const std::string &name, int value, std::optional< unsigned int > selection=std::nullopt)
std::optional< unsigned int > selection_optional() const
std::optional< unsigned int > m_selection