File indexing completed on 2023-03-17 11:14:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
0023
0024 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
0025 #include "CondFormats/DataRecord/interface/L1HfRingEtScaleRcd.h"
0026
0027
0028
0029
0030
0031 class L1HfRingEtScaleOnlineProd : public L1ConfigOnlineProdBase<L1HfRingEtScaleRcd, L1CaloEtScale> {
0032 public:
0033 L1HfRingEtScaleOnlineProd(const edm::ParameterSet&);
0034 ~L1HfRingEtScaleOnlineProd() override;
0035
0036 std::unique_ptr<L1CaloEtScale> newObject(const std::string& objectKey) override;
0037
0038 private:
0039
0040 };
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 L1HfRingEtScaleOnlineProd::L1HfRingEtScaleOnlineProd(const edm::ParameterSet& iConfig)
0054 : L1ConfigOnlineProdBase<L1HfRingEtScaleRcd, L1CaloEtScale>(iConfig) {
0055
0056
0057
0058
0059 }
0060
0061 L1HfRingEtScaleOnlineProd::~L1HfRingEtScaleOnlineProd() {
0062
0063
0064 }
0065
0066 std::unique_ptr<L1CaloEtScale> L1HfRingEtScaleOnlineProd::newObject(const std::string& objectKey) {
0067
0068 l1t::OMDSReader::QueryResults scalesKeyResults = m_omdsReader.basicQuery("GCT_SCALES_KEY",
0069 "CMS_GCT",
0070 "GCT_PHYS_PARAMS",
0071 "GCT_PHYS_PARAMS.CONFIG_KEY",
0072 m_omdsReader.singleAttribute(objectKey));
0073
0074 std::string scalesKey;
0075
0076 if (scalesKeyResults.queryFailed()) {
0077 edm::LogError("L1-O2O") << "Problem with key for L1JetEtScaleRcd : GCT scales key query failed ";
0078 } else if (scalesKeyResults.numberRows() != 1) {
0079 edm::LogError("L1-O2O") << "Problem with key for L1JetEtScaleRcd : " << (scalesKeyResults.numberRows())
0080 << " rows were returned when getting GCT scales key";
0081 } else {
0082 scalesKeyResults.fillVariable(scalesKey);
0083 }
0084
0085
0086 l1t::OMDSReader::QueryResults hfRingScaleKeyResults =
0087 m_omdsReader.basicQuery("SC_HF_ET_SUM_FK", "CMS_GT", "L1T_SCALES", "L1T_SCALES.ID", scalesKeyResults);
0088
0089 std::string hfRingScaleKey;
0090
0091 if (hfRingScaleKeyResults.queryFailed()) {
0092 edm::LogError("L1-O2O") << "Problem with key for L1HfRingEtScaleRcd : HF ring Et scale key query failed ";
0093 } else if (hfRingScaleKeyResults.numberRows() != 1) {
0094 edm::LogError("L1-O2O") << "Problem with key for L1HfRingEtScaleRcd : " << (hfRingScaleKeyResults.numberRows())
0095 << " rows were returned when getting HF ring Et scale key";
0096 } else {
0097 hfRingScaleKeyResults.fillVariable(hfRingScaleKey);
0098 }
0099
0100
0101 std::vector<std::string> queryStrings;
0102 queryStrings.push_back("E_GEV_BIN_LOW_0");
0103 queryStrings.push_back("E_GEV_BIN_LOW_1");
0104 queryStrings.push_back("E_GEV_BIN_LOW_2");
0105 queryStrings.push_back("E_GEV_BIN_LOW_3");
0106 queryStrings.push_back("E_GEV_BIN_LOW_4");
0107 queryStrings.push_back("E_GEV_BIN_LOW_5");
0108 queryStrings.push_back("E_GEV_BIN_LOW_6");
0109 queryStrings.push_back("E_GEV_BIN_LOW_7");
0110
0111 l1t::OMDSReader::QueryResults scaleResults = m_omdsReader.basicQuery(
0112 queryStrings, "CMS_GT", "L1T_SCALE_HF_ET_SUM", "L1T_SCALE_HF_ET_SUM.ID", hfRingScaleKeyResults);
0113
0114 std::vector<double> thresholds;
0115
0116 if (scaleResults.queryFailed()) {
0117 edm::LogError("L1-O2O") << "Problem with L1HfRingEtScale key : scale query failed.";
0118 } else if (scaleResults.numberRows() != 1) {
0119 edm::LogError("L1-O2O") << "Problem with L1HfRingEtScale key : scale query failed.";
0120 } else {
0121 for (std::vector<std::string>::iterator thresh = queryStrings.begin(); thresh != queryStrings.end(); ++thresh) {
0122 float tempScale = 0.;
0123 scaleResults.fillVariable(*thresh, tempScale);
0124 thresholds.push_back(tempScale);
0125 }
0126 }
0127
0128
0129 double rgnEtLsb = 0.;
0130
0131 l1t::OMDSReader::QueryResults lsbResults = m_omdsReader.basicQuery("GCT_RGN_ET_LSB",
0132 "CMS_GCT",
0133 "GCT_PHYS_PARAMS",
0134 "GCT_PHYS_PARAMS.CONFIG_KEY",
0135 m_omdsReader.singleAttribute(objectKey));
0136
0137 if (lsbResults.queryFailed()) {
0138 edm::LogError("L1-O2O") << "Problem with L1JetEtScale key.";
0139 } else {
0140 lsbResults.fillVariable("GCT_RGN_ET_LSB", rgnEtLsb);
0141 }
0142
0143
0144 return std::make_unique<L1CaloEtScale>(0xff, 0x7, rgnEtLsb, thresholds);
0145 }
0146
0147
0148
0149
0150 DEFINE_FWK_EVENTSETUP_MODULE(L1HfRingEtScaleOnlineProd);