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 ADD_FIELD(helper, L1MuGMTParameters, VersionLUTs);
00087
00088 boost::shared_ptr<L1MuGMTParameters> ptrResult(new L1MuGMTParameters);
00089
00090 std::vector<std::string> resultColumns = helper.getColumnList();
00091 resultColumns.push_back("CMSSW_VERSION");
00092
00093 l1t::OMDSReader::QueryResults resultLines =
00094 m_omdsReader.basicQuery(
00095
00096 resultColumns,
00097
00098 "CMS_GMT",
00099
00100 "GMT_SOFTWARE_CONFIG",
00101
00102 "GMT_SOFTWARE_CONFIG.KEY",
00103
00104 m_omdsReader.singleAttribute(objectKey) );
00105
00106 if(resultLines.numberRows() == 1) {
00107 const AttributeList& resultRecord = resultLines.attributeLists().front();
00108 checkCMSSWVersion(resultRecord);
00109 helper.extractRecord(resultRecord, *ptrResult);
00110 return ptrResult;
00111 }
00112
00113 throw cond::Exception("Couldn't find GMT_SOFTWARE_CONFIG record for GMT key `" + objectKey + "'") ;
00114 }
00115
00116 void L1MuGMTParametersOnlineProducer::checkCMSSWVersion(const coral::AttributeList& configRecord)
00117 {
00118 const coral::Attribute& version = configRecord["CMSSW_VERSION"];
00119
00120
00121 if(version.isNull()) {
00122 edm::LogInfo("No CMSSW version set in database, accepting " PROJECT_VERSION);
00123 return;
00124 }
00125
00126
00127 const std::string& versionString = version.data<string>();
00128
00129
00130 if(versionString != PROJECT_VERSION) {
00131 std::string errMsg = "CMSSW version mismatch: Configuration requires " +
00132 versionString + ", but this is " PROJECT_VERSION "!";
00133
00134 if(ignoreVersionMismatch_) {
00135 edm::LogWarning(errMsg + " (will continue because ignoreVersionMismatch is set)");
00136 } else {
00137 throw cond::Exception(errMsg);
00138 }
00139 }
00140 }
00141
00142 L1MuGMTParametersOnlineProducer::L1MuGMTParametersOnlineProducer(const edm::ParameterSet& ps) :
00143 L1ConfigOnlineProdBase<L1MuGMTParametersRcd, L1MuGMTParameters>(ps)
00144 {
00145 ignoreVersionMismatch_ = ps.getParameter<bool>("ignoreVersionMismatch");
00146 }
00147
00148
00149 L1MuGMTParametersOnlineProducer::~L1MuGMTParametersOnlineProducer() {}
00150
00151 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTParametersOnlineProducer);