00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "L1TriggerConfig/GMTConfigProducers/interface/L1MuGMTParametersOnlineProducer.h"
00016
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 #include "FWCore/Framework/interface/EventSetup.h"
00019
00020
00021
00022
00023 #include "L1TriggerConfig/GMTConfigProducers/interface/RecordHelper.h"
00024 #include "L1TriggerConfig/GMTConfigProducers/interface/GTRecordGroup.h"
00025 #include "CondTools/L1Trigger/interface/Exception.h"
00026
00027 using namespace std;
00028 using coral::AttributeList;
00029
00030 RH_ASSIGN_GROUP(L1MuGMTParameters, TGlobalTriggerGroup)
00031
00032
00036 boost::shared_ptr<L1MuGMTParameters> L1MuGMTParametersOnlineProducer::newObject( const std::string& objectKey )
00037 {
00038 using namespace edm::es;
00039
00040 RecordHelper<L1MuGMTParameters> helper;
00041
00042
00043
00044
00045 ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_barrel);
00046 ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_barrel);
00047 ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_barrel);
00048 ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_endcap);
00049 ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_endcap);
00050 ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_endcap);
00051 ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_COU);
00052 ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_COU);
00053 ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_COU);
00054 ADD_FIELD(helper, L1MuGMTParameters, CaloTrigger);
00055 ADD_FIELD(helper, L1MuGMTParameters, IsolationCellSizeEta);
00056 ADD_FIELD(helper, L1MuGMTParameters, IsolationCellSizePhi);
00057 ADD_FIELD(helper, L1MuGMTParameters, DoOvlRpcAnd);
00058 ADD_FIELD(helper, L1MuGMTParameters, PropagatePhi);
00059 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPhiBrl);
00060 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPhiFwd);
00061 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodEtaBrl);
00062 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodEtaFwd);
00063 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPtBrl);
00064 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPtFwd);
00065 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodChargeBrl);
00066 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodChargeFwd);
00067 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPBrl);
00068 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPFwd);
00069 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPSpecialUseANDBrl);
00070 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPSpecialUseANDFwd);
00071 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOBrl);
00072 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOFwd);
00073 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOSpecialUseANDBrl);
00074 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOSpecialUseANDFwd);
00075 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodSRKBrl);
00076 ADD_FIELD(helper, L1MuGMTParameters, MergeMethodSRKFwd);
00077 ADD_FIELD(helper, L1MuGMTParameters, HaloOverwritesMatchedBrl);
00078 ADD_FIELD(helper, L1MuGMTParameters, HaloOverwritesMatchedFwd);
00079 ADD_FIELD(helper, L1MuGMTParameters, SortRankOffsetBrl);
00080 ADD_FIELD(helper, L1MuGMTParameters, SortRankOffsetFwd);
00081 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordDTCSC);
00082 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordCSCDT);
00083 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordbRPCCSC);
00084 ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordfRPCDT);
00085 ADD_FIELD(helper, L1MuGMTParameters, VersionSortRankEtaQLUT);
00086
00087 boost::shared_ptr<L1MuGMTParameters> ptrResult(new L1MuGMTParameters);
00088
00089 std::vector<std::string> resultColumns = helper.getColumnList();
00090 resultColumns.push_back("CMSSW_VERSION");
00091
00092 l1t::OMDSReader::QueryResults resultLines =
00093 m_omdsReader.basicQuery(
00094
00095 resultColumns,
00096
00097 "CMS_GMT",
00098
00099 "GMT_SOFTWARE_CONFIG",
00100
00101 "GMT_SOFTWARE_CONFIG.KEY",
00102
00103 m_omdsReader.singleAttribute(objectKey) );
00104
00105 if(resultLines.numberRows() == 1) {
00106 const AttributeList& resultRecord = resultLines.attributeLists().front();
00107 checkCMSSWVersion(resultRecord);
00108 helper.extractRecord(resultRecord, *ptrResult);
00109 return ptrResult;
00110 }
00111
00112 throw cond::Exception("Couldn't find GMT_SOFTWARE_CONFIG record for GMT key `" + objectKey + "'") ;
00113 }
00114
00115 void L1MuGMTParametersOnlineProducer::checkCMSSWVersion(const coral::AttributeList& configRecord)
00116 {
00117 const coral::Attribute& version = configRecord["CMSSW_VERSION"];
00118
00119
00120 if(version.isNull()) {
00121 edm::LogInfo("No CMSSW version set in database, accepting " PROJECT_VERSION);
00122 return;
00123 }
00124
00125
00126 const std::string& versionString = version.data<string>();
00127
00128
00129 if(versionString != PROJECT_VERSION) {
00130 std::string errMsg = "CMSSW version mismatch: Configuration requires " +
00131 versionString + ", but this is " PROJECT_VERSION "!";
00132
00133 if(ignoreVersionMismatch_) {
00134 edm::LogWarning(errMsg + " (will continue because ignoreVersionMismatch is set)");
00135 } else {
00136 throw cond::Exception(errMsg);
00137 }
00138 }
00139 }
00140
00141 L1MuGMTParametersOnlineProducer::L1MuGMTParametersOnlineProducer(const edm::ParameterSet& ps) :
00142 L1ConfigOnlineProdBase<L1MuGMTParametersRcd, L1MuGMTParameters>(ps)
00143 {
00144 ignoreVersionMismatch_ = ps.getParameter<bool>("ignoreVersionMismatch");
00145 }
00146
00147
00148 L1MuGMTParametersOnlineProducer::~L1MuGMTParametersOnlineProducer() {}
00149
00150 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTParametersOnlineProducer);