ATLAS Offline Software
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 
12 namespace 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 
42  L1TopoAlgorithm(const L1TopoAlgorithm &) = delete;
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,
119  jTEFWDA = 5,
120  jTEFWDC = 6,
121  gXEJWOJ = 7,
122  gXERHO = 8,
123  gXENC = 9,
124  gTE = 10,
125  gMHT = 11,
126  jXEPerf = 12, // Only for simulation studies!
127  };
128 
129  static std::string flavourIntToStr(const unsigned int flavInt){
130  if(flavInt==int(FLAV::jXE)) return "jXE";
131  if(flavInt==int(FLAV::jXEC)) return "jXEC";
132  if(flavInt==int(FLAV::jTE)) return "jTE";
133  if(flavInt==int(FLAV::jTEC)) return "jTEC";
134  if(flavInt==int(FLAV::jTEFWD)) return "jTEFWD";
135  if(flavInt==int(FLAV::jTEFWDA)) return "jTEFWDA";
136  if(flavInt==int(FLAV::jTEFWDC)) return "jTEFWDC";
137  if(flavInt==int(FLAV::gXEJWOJ)) return "gXEJWOJ";
138  if(flavInt==int(FLAV::gXERHO)) return "gXERHO";
139  if(flavInt==int(FLAV::gXENC)) return "gXENC";
140  if(flavInt==int(FLAV::gTE)) return "gTE";
141  if(flavInt==int(FLAV::gMHT)) return "gMHT";
142  if(flavInt==int(FLAV::jXEPerf)) return "jXEPerf";
143  throw std::runtime_error("Flavour " + std::to_string(flavInt) + " for EnergyThreshold algorithm not recongnised!");
144  };
145  static unsigned int flavourStrToInt(const std::string & flavStr){
146  if(flavStr=="jXE") return int(FLAV::jXE);
147  if(flavStr=="jXEC") return int(FLAV::jXEC);
148  if(flavStr=="jTE") return int(FLAV::jTE);
149  if(flavStr=="jTEC") return int(FLAV::jTEC);
150  if(flavStr=="jTEFWD") return int(FLAV::jTEFWD);
151  if(flavStr=="jTEFWDA") return int(FLAV::jTEFWDA);
152  if(flavStr=="jTEFWDC") return int(FLAV::jTEFWDC);
153  if(flavStr=="gXE") return int(FLAV::gXEJWOJ); // for backward compatibility
154  if(flavStr=="gXEJWOJ") return int(FLAV::gXEJWOJ);
155  if(flavStr=="gXERHO") return int(FLAV::gXERHO);
156  if(flavStr=="gXEPUFIT") return int(FLAV::gXENC); // for backward compatibility
157  if(flavStr=="gXENC") return int(FLAV::gXENC);
158  if(flavStr=="gTE") return int(FLAV::gTE);
159  if(flavStr=="gMHT") return int(FLAV::gMHT);
160  if(flavStr=="jXEPerf") return int(FLAV::jXEPerf);
161  throw std::runtime_error("Flavour " + flavStr + " for EnergyThreshold algorithm not recongnised!");
162  };
163 
164  };
165 
166 }
167 
168 #endif
TrigConf::DataStructure::data
const ptree & data() const
Access to the underlying data, if needed.
Definition: DataStructure.h:83
TrigConf::L1TopoAlgorithm::fullOutputs
std::vector< std::string > fullOutputs() const
Definition: L1TopoAlgorithm.cxx:119
TrigConf::L1TopoAlgorithm::L1TopoAlgorithm
L1TopoAlgorithm(L1TopoAlgorithm &&)=default
TrigConf::L1TopoAlgorithm
L1Topo algorithm configuration.
Definition: L1TopoAlgorithm.h:20
TrigConf::L1TopoAlgorithm::m_type
AlgorithmType m_type
Definition: L1TopoAlgorithm.h:99
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigConf::XEFlavour::FLAV::jXEPerf
@ jXEPerf
TrigConf::L1TopoAlgorithm::VariableParameter::selection_optional
std::optional< unsigned int > selection_optional() const
Definition: L1TopoAlgorithm.h:32
TrigConf::XEFlavour::FLAV::jTEFWD
@ jTEFWD
TrigConf::L1TopoAlgorithm::genericParameter
T genericParameter(const std::string &parName) const
Definition: L1TopoAlgorithm.h:80
TrigConf::L1TopoAlgorithm::VariableParameter::value
int value() const
Definition: L1TopoAlgorithm.h:30
TrigConf::L1TopoAlgorithm::AlgorithmType::UNKNOWN
@ UNKNOWN
TrigConf::L1TopoAlgorithm::m_parameters
std::vector< VariableParameter > m_parameters
Definition: L1TopoAlgorithm.h:106
TrigConf::L1TopoAlgorithm::generics
DataStructure generics() const
Accessors to generic parameters.
Definition: L1TopoAlgorithm.cxx:135
TrigConf::L1TopoAlgorithm::klass
const std::string & klass() const
Accessor to algorithm class type.
Definition: L1TopoAlgorithm.cxx:98
TrigConf::L1TopoAlgorithm::L1TopoAlgorithm
L1TopoAlgorithm()=default
Constructor.
TrigConf::L1TopoAlgorithm::AlgorithmType::SORTING
@ SORTING
TrigConf::L1TopoAlgorithm::L1TopoAlgorithm
L1TopoAlgorithm(const L1TopoAlgorithm &)=delete
TrigConf::XEFlavour::FLAV::jTEFWDA
@ jTEFWDA
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::XEFlavour::FLAV
FLAV
DO NOT CHANGE! Need to match with firmware values.
Definition: L1TopoAlgorithm.h:113
TrigConf::XEFlavour::FLAV::jTEFWDC
@ jTEFWDC
TrigConf::L1TopoAlgorithm::VariableParameter::VariableParameter
VariableParameter(const std::string &name, int value, std::optional< unsigned int > selection=std::nullopt)
Definition: L1TopoAlgorithm.h:27
TrigConf::L1TopoAlgorithm::print
void print(std::ostream &os=std::cout) const override
print main info
Definition: L1TopoAlgorithm.cxx:148
TrigConf::L1TopoAlgorithm::genericParameter
std::string genericParameter(const std::string &parName) const
Definition: L1TopoAlgorithm.cxx:129
TrigConf::L1TopoAlgorithm::type
AlgorithmType type() const
Definition: L1TopoAlgorithm.cxx:86
TrigConf::L1TopoAlgorithm::VariableParameter::m_selection
std::optional< unsigned int > m_selection
Definition: L1TopoAlgorithm.h:36
TrigConf::L1TopoAlgorithm::VariableParameter::m_value
int m_value
Definition: L1TopoAlgorithm.h:35
TrigConf::L1TopoAlgorithm::VariableParameter::name
const std::string & name() const
Definition: L1TopoAlgorithm.h:29
TrigConf::XEFlavour::FLAV::gXERHO
@ gXERHO
TrigConf::L1TopoAlgorithm::parameters
const std::vector< VariableParameter > & parameters() const
Accessor to register parameters which can change for each algorithm instance.
Definition: L1TopoAlgorithm.cxx:141
TrigConf::L1TopoAlgorithm::outputs
const std::vector< std::string > & outputs() const
Accessor to output collections Sorting and Multiplicity algorithms have only one output.
Definition: L1TopoAlgorithm.cxx:113
TrigConf::XEFlavour::FLAV::gMHT
@ gMHT
TrigConf::L1TopoAlgorithm::m_inputs
std::vector< std::string > m_inputs
Definition: L1TopoAlgorithm.h:103
TrigConf::L1TopoAlgorithm::category
const std::string & category() const
Definition: L1TopoAlgorithm.cxx:92
beamspotnt.parName
list parName
Definition: bin/beamspotnt.py:1287
TrigConf::L1TopoAlgorithm::VariableParameter::selection
unsigned int selection() const
Definition: L1TopoAlgorithm.h:31
TrigConf::L1TopoAlgorithm::AlgorithmType::MULTIPLICITY
@ MULTIPLICITY
TrigConf::XEFlavour::FLAV::jXEC
@ jXEC
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigConf::XEFlavour::flavourIntToStr
static std::string flavourIntToStr(const unsigned int flavInt)
Definition: L1TopoAlgorithm.h:129
TrigConf::name
Definition: HLTChainList.h:35
TrigConf::L1TopoAlgorithm::m_category
std::string m_category
Definition: L1TopoAlgorithm.h:101
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TrigConf::L1TopoAlgorithm::load
void load()
Update the internal data after modification of the data object.
Definition: L1TopoAlgorithm.cxx:26
TrigConf::XEFlavour
Definition: L1TopoAlgorithm.h:110
TrigConf::L1TopoAlgorithm::className
virtual std::string className() const override
A string that is the name of the class.
Definition: L1TopoAlgorithm.cxx:21
TrigConf::L1TopoAlgorithm::update
virtual void update() override
Update the internal data after modification of the data object.
Definition: L1TopoAlgorithm.h:92
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition: DataStructure.h:37
TrigConf::XEFlavour::flavourStrToInt
static unsigned int flavourStrToInt(const std::string &flavStr)
Definition: L1TopoAlgorithm.h:145
TrigConf::XEFlavour::FLAV::jTEC
@ jTEC
TrigConf::XEFlavour::FLAV::gXENC
@ gXENC
TrigConf::L1TopoAlgorithm::AlgorithmType::DECISION
@ DECISION
TrigConf::L1TopoAlgorithm::AlgorithmType
AlgorithmType
Definition: L1TopoAlgorithm.h:23
TrigConf::L1TopoAlgorithm::~L1TopoAlgorithm
virtual ~L1TopoAlgorithm() override=default
Destructor.
TrigConf::XEFlavour::FLAV::jTE
@ jTE
TrigConf::L1TopoAlgorithm::VariableParameter
Definition: L1TopoAlgorithm.h:25
TrigConf::XEFlavour::FLAV::gXEJWOJ
@ gXEJWOJ
DataStructure.h
TrigConf::DataStructure::ptree
boost::property_tree::ptree ptree
Definition: DataStructure.h:40
TrigConf::L1TopoAlgorithm::m_outputs
std::vector< std::string > m_outputs
Definition: L1TopoAlgorithm.h:104
TrigConf::XEFlavour::FLAV::jXE
@ jXE
TrigConf::L1TopoAlgorithm::inputs
const std::vector< std::string > & inputs() const
Accessor to input collections Sorting and Multiplicity algorithms have only one input.
Definition: L1TopoAlgorithm.cxx:107
TrigConf::XEFlavour::FLAV::gTE
@ gTE
TrigConf::L1TopoAlgorithm::operator=
L1TopoAlgorithm & operator=(const L1TopoAlgorithm &)=delete
TrigConf::L1TopoAlgorithm::VariableParameter::m_name
std::string m_name
Definition: L1TopoAlgorithm.h:34