ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoAlgorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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#include <stdexcept>
12#include <string>
13
14namespace TrigConf {
15
22 class L1TopoAlgorithm final : public DataStructure {
23 public:
24
26
28 public:
29 VariableParameter(const std::string & name, int value, std::optional<unsigned int> selection = std::nullopt)
31 const std::string & name() const { return m_name; }
32 int value() const { return m_value; }
33 unsigned int selection() const { return m_selection.value_or(0); }
34 std::optional<unsigned int> selection_optional() const { return m_selection; }
35 private:
36 std::string m_name{""};
37 int m_value{0};
38 std::optional<unsigned int> m_selection{};
39 };
40
42 L1TopoAlgorithm() = default;
43
47
51 L1TopoAlgorithm(const std::string & algoName, AlgorithmType algoType, const std::string & algoCategory, const ptree & data);
52
54 virtual ~L1TopoAlgorithm() override = default;
55
56 virtual std::string className() const override;
57
58 AlgorithmType type() const;
59
60 const std::string & category() const;
61
63 const std::string & klass() const;
64
68 const std::vector<std::string> & inputs() const;
69
73 const std::vector<std::string> & outputs() const;
74 std::vector<std::string> fullOutputs() const;
75
77 DataStructure generics() const;
78
79 std::string genericParameter(const std::string & parName) const;
80
81 template<class T>
82 T genericParameter(const std::string & parName) const {
83 return getAttribute<T>("fixedParameters.generics." + parName + ".value");
84 }
85
87 const std::vector<VariableParameter> & parameters() const;
88
90 void print(std::ostream & os = std::cout) const override;
91
92 protected:
93
94 virtual void update() override { load(); }
95
96 private:
97
99 void load();
100
102
103 std::string m_category{};
104
105 std::vector<std::string> m_inputs{};
106 std::vector<std::string> m_outputs{};
107
108 std::vector<VariableParameter> m_parameters;
109
110 };
111
112 class XEFlavour {
113 public:
115 enum class FLAV {
116 jXE = 0,
117 jXEC = 1,
118 jTE = 2,
119 jTEC = 3,
120 jTEFWD = 4,
124 gXERHO = 8,
125 gXENC = 9,
126 gTE = 10,
127 gMHT = 11,
128 cXE = 12,
130 jXEPerf = 14, // Only for simulation studies!
131 };
132
133 static std::string flavourIntToStr(const unsigned int flavInt){
134 if(flavInt==int(FLAV::jXE)) return "jXE";
135 if(flavInt==int(FLAV::jXEC)) return "jXEC";
136 if(flavInt==int(FLAV::jTE)) return "jTE";
137 if(flavInt==int(FLAV::jTEC)) return "jTEC";
138 if(flavInt==int(FLAV::jTEFWD)) return "jTEFWD";
139 if(flavInt==int(FLAV::jTEFWDA)) return "jTEFWDA";
140 if(flavInt==int(FLAV::jTEFWDC)) return "jTEFWDC";
141 if(flavInt==int(FLAV::gXEJWOJ)) return "gXEJWOJ";
142 if(flavInt==int(FLAV::gXERHO)) return "gXERHO";
143 if(flavInt==int(FLAV::gXENC)) return "gXENC";
144 if(flavInt==int(FLAV::gTE)) return "gTE";
145 if(flavInt==int(FLAV::gMHT)) return "gMHT";
146 if(flavInt==int(FLAV::cXE)) return "cXE";
147 if(flavInt==int(FLAV::gESPRESSO)) return "gESPRESSO";
148 if(flavInt==int(FLAV::jXEPerf)) return "jXEPerf";
149 throw std::runtime_error("Flavour " + std::to_string(flavInt) + " for EnergyThreshold algorithm not recongnised!");
150 };
151 static unsigned int flavourStrToInt(const std::string & flavStr){
152 if(flavStr=="jXE") return int(FLAV::jXE);
153 if(flavStr=="jXEC") return int(FLAV::jXEC);
154 if(flavStr=="jTE") return int(FLAV::jTE);
155 if(flavStr=="jTEC") return int(FLAV::jTEC);
156 if(flavStr=="jTEFWD") return int(FLAV::jTEFWD);
157 if(flavStr=="jTEFWDA") return int(FLAV::jTEFWDA);
158 if(flavStr=="jTEFWDC") return int(FLAV::jTEFWDC);
159 if(flavStr=="gXE") return int(FLAV::gXEJWOJ); // for backward compatibility
160 if(flavStr=="gXEJWOJ") return int(FLAV::gXEJWOJ);
161 if(flavStr=="gXERHO") return int(FLAV::gXERHO);
162 if(flavStr=="gXEPUFIT") return int(FLAV::gXENC); // for backward compatibility
163 if(flavStr=="gXENC") return int(FLAV::gXENC);
164 if(flavStr=="gTE") return int(FLAV::gTE);
165 if(flavStr=="gMHT") return int(FLAV::gMHT);
166 if(flavStr=="cXE") return int(FLAV::cXE);
167 if(flavStr=="gESPRESSO") return int(FLAV::gESPRESSO);
168 if(flavStr=="jXEPerf") return int(FLAV::jXEPerf);
169 throw std::runtime_error("Flavour " + flavStr + " for EnergyThreshold algorithm not recongnised!");
170 };
171
172 };
173
174}
175
176#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