CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/L1TriggerConfig/GMTConfigProducers/src/L1MuGMTParametersOnlineProducer.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   \class L1MuGMTParametersOnlineProducer
00004 //
00005 //   Description:  A class to produce the L1 GMT emulator Parameters record in the event setup
00006 //                 by reading them from the online database.
00007 //
00008 //   $Date: 2012/02/10 14:20:06 $
00009 //   $Revision: 1.3 $
00010 //
00011 //   Author :
00012 //   Thomas Themel
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 /* Define this to see debug output from the record parsing layer. */
00021 //#define RECORDHELPER_DEBUG
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   // Copy data members from L1MuGMTParameters,
00043   // and  M-x replace-regexp RET .*m_\([a-z:_]*\) RET ADD_FIELD(helper, L1MuGMTParameters, \1) RET
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           // SELECTed columns
00096           resultColumns,
00097           // schema name
00098           "CMS_GMT",
00099           // table name
00100           "GMT_SOFTWARE_CONFIG",
00101           // WHERE lhs
00102           "GMT_SOFTWARE_CONFIG.KEY",
00103           // WHERE rhs
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   /* If the DB field is unset, take any. */
00121   if(version.isNull()) {
00122     edm::LogInfo("No CMSSW version set in database, accepting " PROJECT_VERSION);
00123     return;
00124   }
00125 
00126   /* Else make sure we have the correct  version. */
00127   const std::string& versionString = version.data<string>();
00128 
00129   /* PROJECT_VERSION is passed as a -D #define from scramv1 (eg CMSSW_2_1_0) */
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);