Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:47

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;               // map of processors to their roles
0019     std::map<std::string, std::string> procToSlot;               // map of processors to their slots in some crate
0020     std::map<std::string, bool> procEnabled;                     // processor is active/disabled (also including daqttc)
0021     std::map<std::string, std::string> daqttcToRole;             // map of DAQ/TTC boards to their roles
0022     std::map<std::string, std::string> daqttcToCrate;            // map of DAQ/TTC boards to the crates they sit in
0023     std::map<std::string, std::set<std::string> > roleForProcs;  // map of roles, each describing a set of processors
0024     std::map<std::string, std::set<std::string> > crateForProcs;  // map of crates, each containing a set of processors
0025     std::map<std::string, std::set<std::string> >
0026         roleForDaqttcs;  // map of roles, each describing a set of DAQ/TTC boards
0027 
0028     std::map<std::string, std::map<std::string, Parameter> >
0029         procParameters;  // setting objects found in the configuration for a given processor
0030     std::map<std::string, std::map<std::string, Mask> >
0031         procMasks;  // mask objects found in the configuration for a given processor
0032 
0033     bool isConfigured;           // lock allowing access to the system
0034     mutable std::ostream *logs;  // print processing logs unless is set to a null pointer
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);  // must have all parameters
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 }  // namespace l1t
0086 
0087 #endif