File indexing completed on 2024-04-06 12:22:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "L1TriggerConfig/L1ScalesProducers/interface/L1MuTriggerPtScaleOnlineProducer.h"
0013
0014
0015 #ifdef DEBUG_PT_SCALE
0016 #include <iostream>
0017 #endif
0018
0019 #include <sstream>
0020
0021 using namespace std;
0022
0023 L1MuTriggerPtScaleOnlineProducer::L1MuTriggerPtScaleOnlineProducer(const edm::ParameterSet& ps)
0024 : L1ConfigOnlineProdBase<L1MuTriggerPtScaleRcd, L1MuTriggerPtScale>(ps),
0025 m_signedPacking(ps.getParameter<bool>("signedPackingPt")),
0026 m_nbitsPacking(ps.getParameter<int>("nbitPackingPt")),
0027 m_nBins(ps.getParameter<int>("nbinsPt")) {}
0028
0029 L1MuTriggerPtScaleOnlineProducer::~L1MuTriggerPtScaleOnlineProducer() {}
0030
0031
0032
0033
0034
0035
0036 std::unique_ptr<L1MuTriggerPtScale> L1MuTriggerPtScaleOnlineProducer::newObject(const std::string& objectKey) {
0037
0038 l1t::OMDSReader::QueryResults keysRecord = m_omdsReader.basicQuery(
0039
0040 "SC_MUON_PT_FK",
0041
0042 "CMS_GT",
0043
0044 "L1T_SCALES",
0045
0046 "L1T_SCALES.ID",
0047
0048 m_omdsReader.singleAttribute(objectKey));
0049
0050 if (keysRecord.numberRows() != 1)
0051 {
0052 throw cond::Exception(
0053 "Problem finding L1MuTriggerScales associated "
0054 "with scales key " +
0055 objectKey);
0056 }
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 ScaleRecordHelper h("PT_GEV_BIN_LOW", m_nBins);
0069
0070 vector<string> columns;
0071 h.pushColumnNames(columns);
0072
0073 l1t::OMDSReader::QueryResults resultRecord = m_omdsReader.basicQuery(
0074
0075 columns,
0076
0077 "CMS_GT",
0078
0079 "L1T_SCALE_MUON_PT",
0080
0081 "L1T_SCALE_MUON_PT.ID",
0082
0083 keysRecord);
0084
0085 if (resultRecord.numberRows() != 1) {
0086 throw cond::Exception("Couldn't find Pt scale record for scales key `" + objectKey + "'");
0087 }
0088
0089 vector<double> scales;
0090 h.extractScales(resultRecord, scales);
0091
0092 auto result = std::make_unique<L1MuTriggerPtScale>(m_nbitsPacking, m_signedPacking, m_nBins, scales);
0093
0094 #ifdef DEBUG_PT_SCALE
0095 cout << "PT scale:" << endl << result->getPtScale()->print() << endl;
0096 #endif
0097
0098 return result;
0099 }