File indexing completed on 2023-03-17 11:14:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTscObjectKeysOnlineProd.h"
0017
0018
0019
0020
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022
0023
0024 L1GtTscObjectKeysOnlineProd::L1GtTscObjectKeysOnlineProd(const edm::ParameterSet& parSet)
0025 : L1ObjectKeysOnlineProdBase(parSet),
0026 m_enableL1GtParameters(parSet.getParameter<bool>("EnableL1GtParameters")),
0027 m_enableL1GtTriggerMenu(parSet.getParameter<bool>("EnableL1GtTriggerMenu")),
0028 m_enableL1GtPsbSetup(parSet.getParameter<bool>("EnableL1GtPsbSetup")) {
0029
0030 }
0031
0032
0033 L1GtTscObjectKeysOnlineProd::~L1GtTscObjectKeysOnlineProd() {
0034
0035 }
0036
0037
0038
0039 std::string L1GtTscObjectKeysOnlineProd::keyL1GtParameters(const std::string& subsystemKey,
0040 const std::string& gtSchema) {
0041 std::string objectKey;
0042
0043 if (!subsystemKey.empty()) {
0044
0045
0046
0047 l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
0048 "GTFE_SETUP_FK", gtSchema, "GT_SETUP", "GT_SETUP.ID", m_omdsReader.singleAttribute(subsystemKey));
0049
0050
0051 if (objectKeyResults.queryFailed()) {
0052 edm::LogError("L1-O2O") << "Problem with key for record L1GtParametersRcd: query failed ";
0053 return objectKey;
0054 } else if ((objectKeyResults.numberRows() != 1)) {
0055 edm::LogError("L1-O2O") << "Problem with key for record L1GtParametersRcd: " << (objectKeyResults.numberRows())
0056 << " rows were returned";
0057 return objectKey;
0058 }
0059
0060 objectKeyResults.fillVariable(objectKey);
0061 }
0062
0063 return objectKey;
0064 }
0065
0066 std::string L1GtTscObjectKeysOnlineProd::keyL1GtTriggerMenu(const std::string& subsystemKey,
0067 const std::string& gtSchema) {
0068 std::string objectKey;
0069
0070 if (!subsystemKey.empty()) {
0071
0072
0073
0074 l1t::OMDSReader::QueryResults objectKeyResults = m_omdsReader.basicQuery(
0075 "L1T_MENU_FK", gtSchema, "GT_SETUP", "GT_SETUP.ID", m_omdsReader.singleAttribute(subsystemKey));
0076
0077
0078 if (objectKeyResults.queryFailed()) {
0079 edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMenuRcd: query failed ";
0080 return objectKey;
0081 } else if ((objectKeyResults.numberRows() != 1)) {
0082 edm::LogError("L1-O2O") << "Problem with key for record L1GtTriggerMenuRcd: " << (objectKeyResults.numberRows())
0083 << " rows were returned";
0084 return objectKey;
0085 }
0086
0087 objectKeyResults.fillVariable(objectKey);
0088 }
0089
0090 return objectKey;
0091 }
0092
0093 std::string L1GtTscObjectKeysOnlineProd::keyL1GtPsbSetup(const std::string& subsystemKey, const std::string& gtSchema) {
0094 std::string objectKey;
0095
0096 if (!subsystemKey.empty()) {
0097
0098
0099 objectKey = subsystemKey;
0100 }
0101
0102 return objectKey;
0103 }
0104
0105
0106 void L1GtTscObjectKeysOnlineProd::fillObjectKeys(FillType pL1TriggerKey) {
0107
0108
0109
0110 std::string subsystemKey = pL1TriggerKey->subsystemKey(L1TriggerKey::kGT);
0111 const std::string gtSchema = "CMS_GT";
0112
0113
0114 if (m_enableL1GtParameters) {
0115 const std::string& objectKey = keyL1GtParameters(subsystemKey, gtSchema);
0116 if (!objectKey.empty()) {
0117 pL1TriggerKey->add("L1GtParametersRcd", "L1GtParameters", objectKey);
0118 }
0119 }
0120
0121
0122 if (m_enableL1GtTriggerMenu) {
0123 const std::string& objectKey = keyL1GtTriggerMenu(subsystemKey, gtSchema);
0124 if (!objectKey.empty()) {
0125 pL1TriggerKey->add("L1GtTriggerMenuRcd", "L1GtTriggerMenu", objectKey);
0126 }
0127 }
0128
0129
0130 if (m_enableL1GtPsbSetup) {
0131 const std::string& objectKey = keyL1GtPsbSetup(subsystemKey, gtSchema);
0132 if (!objectKey.empty()) {
0133 pL1TriggerKey->add("L1GtPsbSetupRcd", "L1GtPsbSetup", objectKey);
0134 }
0135 }
0136 }
0137
0138 DEFINE_FWK_EVENTSETUP_MODULE(L1GtTscObjectKeysOnlineProd);