File indexing completed on 2024-04-06 12:22:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "L1TriggerConfig/GMTConfigProducers/interface/L1MuGMTParametersOnlineProducer.h"
0014
0015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017
0018
0019
0020
0021 #include "L1TriggerConfig/GMTConfigProducers/interface/RecordHelper.h"
0022 #include "L1TriggerConfig/GMTConfigProducers/interface/GTRecordGroup.h"
0023 #include "CondTools/L1Trigger/interface/Exception.h"
0024
0025 using namespace std;
0026 using coral::AttributeList;
0027
0028 RH_ASSIGN_GROUP(L1MuGMTParameters, TGlobalTriggerGroup)
0029
0030
0031
0032
0033
0034 std::unique_ptr<L1MuGMTParameters> L1MuGMTParametersOnlineProducer::newObject(const std::string& objectKey) {
0035 RecordHelper<L1MuGMTParameters> helper;
0036
0037
0038
0039
0040 ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_barrel);
0041 ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_barrel);
0042 ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_barrel);
0043 ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_endcap);
0044 ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_endcap);
0045 ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_endcap);
0046 ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_COU);
0047 ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_COU);
0048 ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_COU);
0049 ADD_FIELD(helper, L1MuGMTParameters, CaloTrigger);
0050 ADD_FIELD(helper, L1MuGMTParameters, IsolationCellSizeEta);
0051 ADD_FIELD(helper, L1MuGMTParameters, IsolationCellSizePhi);
0052 ADD_FIELD(helper, L1MuGMTParameters, DoOvlRpcAnd);
0053 ADD_FIELD(helper, L1MuGMTParameters, PropagatePhi);
0054 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPhiBrl);
0055 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPhiFwd);
0056 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodEtaBrl);
0057 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodEtaFwd);
0058 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPtBrl);
0059 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPtFwd);
0060 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodChargeBrl);
0061 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodChargeFwd);
0062 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPBrl);
0063 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPFwd);
0064 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPSpecialUseANDBrl);
0065 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPSpecialUseANDFwd);
0066 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOBrl);
0067 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOFwd);
0068 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOSpecialUseANDBrl);
0069 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOSpecialUseANDFwd);
0070 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodSRKBrl);
0071 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodSRKFwd);
0072 ADD_FIELD(helper, L1MuGMTParameters, HaloOverwritesMatchedBrl);
0073 ADD_FIELD(helper, L1MuGMTParameters, HaloOverwritesMatchedFwd);
0074 ADD_FIELD(helper, L1MuGMTParameters, SortRankOffsetBrl);
0075 ADD_FIELD(helper, L1MuGMTParameters, SortRankOffsetFwd);
0076 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordDTCSC);
0077 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordCSCDT);
0078 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordbRPCCSC);
0079 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordfRPCDT);
0080 ADD_FIELD(helper, L1MuGMTParameters, VersionSortRankEtaQLUT);
0081 ADD_FIELD(helper, L1MuGMTParameters, VersionLUTs);
0082
0083 auto ptrResult = std::make_unique<L1MuGMTParameters>();
0084
0085 std::vector<std::string> resultColumns = helper.getColumnList();
0086 resultColumns.push_back("CMSSW_VERSION");
0087
0088 l1t::OMDSReader::QueryResults resultLines = m_omdsReader.basicQuery(
0089
0090 resultColumns,
0091
0092 "CMS_GMT",
0093
0094 "GMT_SOFTWARE_CONFIG",
0095
0096 "GMT_SOFTWARE_CONFIG.KEY",
0097
0098 m_omdsReader.singleAttribute(objectKey));
0099
0100 if (resultLines.numberRows() == 1) {
0101 const AttributeList& resultRecord = resultLines.attributeLists().front();
0102 checkCMSSWVersion(resultRecord);
0103 helper.extractRecord(resultRecord, *ptrResult);
0104 return ptrResult;
0105 }
0106
0107 throw cond::Exception("Couldn't find GMT_SOFTWARE_CONFIG record for GMT key `" + objectKey + "'");
0108 }
0109
0110 void L1MuGMTParametersOnlineProducer::checkCMSSWVersion(const coral::AttributeList& configRecord) {
0111 const coral::Attribute& version = configRecord["CMSSW_VERSION"];
0112
0113
0114 if (version.isNull()) {
0115 edm::LogInfo("No CMSSW version set in database, accepting " PROJECT_VERSION);
0116 return;
0117 }
0118
0119
0120 const std::string& versionString = version.data<string>();
0121
0122
0123 if (versionString != PROJECT_VERSION) {
0124 std::string errMsg =
0125 "CMSSW version mismatch: Configuration requires " + versionString + ", but this is " + PROJECT_VERSION + "!";
0126
0127 if (ignoreVersionMismatch_) {
0128 edm::LogWarning(errMsg + " (will continue because ignoreVersionMismatch is set)");
0129 } else {
0130 throw cond::Exception(errMsg);
0131 }
0132 }
0133 }
0134
0135 L1MuGMTParametersOnlineProducer::L1MuGMTParametersOnlineProducer(const edm::ParameterSet& ps)
0136 : L1ConfigOnlineProdBase<L1MuGMTParametersRcd, L1MuGMTParameters>(ps) {
0137 ignoreVersionMismatch_ = ps.getParameter<bool>("ignoreVersionMismatch");
0138 }
0139
0140 L1MuGMTParametersOnlineProducer::~L1MuGMTParametersOnlineProducer() {}
0141
0142 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTParametersOnlineProducer);