CMS 3D CMS Logo

L1GtPsbSetupConfigOnlineProd.h
Go to the documentation of this file.
1 #ifndef L1GtConfigProducers_L1GtPsbSetupConfigOnlineProd_h
2 #define L1GtConfigProducers_L1GtPsbSetupConfigOnlineProd_h
3 
18 // system include files
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 // user include files
24 // base class
26 
31 
32 // forward declarations
33 
34 // class declaration
36  public L1ConfigOnlineProdBase<L1GtPsbSetupRcd, L1GtPsbSetup>
37 {
38 
39 public:
40 
43 
46 
48  std::unique_ptr<L1GtPsbSetup> newObject(const std::string& objectKey) override;
49 
50 private:
51 
54  static bool notPsbColumnName(const std::string& columnName);
55 
57  void addPsbFromDb(const std::string& psbKey, std::vector<L1GtPsbConfig>& psbSetup);
58 
60  void addDefaultPsb(const std::string& psbColumn, std::vector<L1GtPsbConfig>& psbSetup) const;
61 
63  bool checkOneLineResult(
64  const l1t::OMDSReader::QueryResults& result, const std::string& queryDescription) const;
65 
68  template<class T> void getRequiredValue(
69  const l1t::OMDSReader::QueryResults& result, const std::string& colName, T& value) const {
70  if (!result.fillVariable(colName, value)) {
71  throw cms::Exception("NullValue") << "Required field " << colName
72  << " is NULL in database!";
73  }
74  }
75 
78  std::vector<bool> extractBoolVector(
80  const std::string& suffix, unsigned nColumns) const;
81 
84  const std::string& prefix, unsigned number, const std::string& suffix) const;
85 
87  std::string numberedColumnName(const std::string& prefix, unsigned number) const;
88  unsigned numberFromString(const std::string& aString) const;
89 
90 };
91 
92 #endif
bool checkOneLineResult(const l1t::OMDSReader::QueryResults &result, const std::string &queryDescription) const
Ensures that result contains exactly one line, returning false otherwise.
static bool notPsbColumnName(const std::string &columnName)
std::string numberedColumnName(const std::string &prefix, unsigned number, const std::string &suffix) const
Concatenates prefix, number and suffix into a string.
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
void getRequiredValue(const l1t::OMDSReader::QueryResults &result, const std::string &colName, T &value) const
std::unique_ptr< L1GtPsbSetup > newObject(const std::string &objectKey) override
public methods
void addDefaultPsb(const std::string &psbColumn, std::vector< L1GtPsbConfig > &psbSetup) const
Creates a default valued PSB from an empty foreign key in the GT_SETUP table.
~L1GtPsbSetupConfigOnlineProd() override
destructor
Definition: query.py:1
Definition: value.py:1
std::vector< bool > extractBoolVector(const l1t::OMDSReader::QueryResults &query, const std::string &prefix, const std::string &suffix, unsigned nColumns) const
L1GtPsbSetupConfigOnlineProd(const edm::ParameterSet &)
constructor
void addPsbFromDb(const std::string &psbKey, std::vector< L1GtPsbConfig > &psbSetup)
Creates a new PSB object from a GT_PSB_SETUP entry and adds.
long double T
unsigned numberFromString(const std::string &aString) const