File indexing completed on 2024-04-06 12:20:26
0001 #ifndef L1Trigger_L1TCommon_l1t_TriggerSystem_h
0002 #define L1Trigger_L1TCommon_l1t_TriggerSystem_h
0003
0004 #include <vector>
0005 #include <string>
0006 #include <map>
0007 #include <set>
0008
0009 #include "Parameter.h"
0010 #include "L1Trigger/L1TCommon/interface/Mask.h"
0011
0012 namespace l1t {
0013
0014 class TriggerSystem {
0015 private:
0016 std::string sysId;
0017
0018 std::map<std::string, std::string> procToRole;
0019 std::map<std::string, std::string> procToSlot;
0020 std::map<std::string, bool> procEnabled;
0021 std::map<std::string, std::string> daqttcToRole;
0022 std::map<std::string, std::string> daqttcToCrate;
0023 std::map<std::string, std::set<std::string> > roleForProcs;
0024 std::map<std::string, std::set<std::string> > crateForProcs;
0025 std::map<std::string, std::set<std::string> >
0026 roleForDaqttcs;
0027
0028 std::map<std::string, std::map<std::string, Parameter> >
0029 procParameters;
0030 std::map<std::string, std::map<std::string, Mask> >
0031 procMasks;
0032
0033 bool isConfigured;
0034 mutable std::ostream *logs;
0035
0036 public:
0037 void configureSystemFromFiles(const char *hwCfgFile, const char *topCfgFile, const char *key);
0038
0039 void addProcessor(const char *processor,
0040 const char *role,
0041 const char *crate,
0042 const char *slot);
0043
0044 void addDaq(const char *daq, const char *role, const char *crate);
0045
0046 void addParameter(
0047 const char *id, const char *procOrRole, const char *type, const char *value, const char *delim = ",");
0048
0049 void addTable(const char *id,
0050 const char *procOrRole,
0051 const char *columns,
0052 const char *types,
0053 const std::vector<std::string> &rows,
0054 const char *delim);
0055
0056 void addMask(const char *id, const char *procOrRoleOrDaq);
0057
0058 void disableProcOrRoleOrDaq(const char *procOrRoleOrDaq);
0059
0060 const std::map<std::string, std::string> &getProcToRoleAssignment(void) const noexcept { return procToRole; }
0061 const std::map<std::string, std::set<std::string> > &getRoleToProcsAssignment(void) const noexcept {
0062 return roleForProcs;
0063 }
0064
0065 const std::map<std::string, Parameter> &getParameters(const char *processor) const;
0066 const std::map<std::string, Mask> &getMasks(const char *processor) const;
0067
0068 bool isMasked(const char *proccessor, const char *id) const;
0069 bool isProcEnabled(const char *proccessor) const;
0070
0071 std::string systemId(void) const noexcept { return sysId; }
0072 void setSystemId(const char *id) noexcept { sysId = id; }
0073
0074 void setConfigured(bool state = true) noexcept { isConfigured = state; }
0075 void setLogStream(std::ostream *s) const noexcept { logs = s; }
0076
0077 TriggerSystem(void) {
0078 isConfigured = false;
0079 logs = nullptr;
0080 }
0081
0082 ~TriggerSystem(void) {}
0083 };
0084
0085 }
0086
0087 #endif