CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTParametersOnlineProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // \class L1MuGMTParametersOnlineProducer
4 //
5 // Description: A class to produce the L1 GMT emulator Parameters record in the event setup
6 // by reading them from the online database.
7 //
8 // $Date: 2012/02/10 14:20:06 $
9 // $Revision: 1.3 $
10 //
11 // Author :
12 // Thomas Themel
13 //
14 //--------------------------------------------------
16 
19 
20 /* Define this to see debug output from the record parsing layer. */
21 //#define RECORDHELPER_DEBUG
22 
26 
27 using namespace std;
28 using coral::AttributeList;
29 
30 RH_ASSIGN_GROUP(L1MuGMTParameters, TGlobalTriggerGroup)
31 
32 
36 boost::shared_ptr<L1MuGMTParameters> L1MuGMTParametersOnlineProducer::newObject( const std::string& objectKey )
37 {
38  using namespace edm::es;
39 
41 
42  // Copy data members from L1MuGMTParameters,
43  // and M-x replace-regexp RET .*m_\([a-z:_]*\) RET ADD_FIELD(helper, L1MuGMTParameters, \1) RET
44 
45  ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_barrel);
46  ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_barrel);
47  ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_barrel);
48  ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_endcap);
49  ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_endcap);
50  ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_endcap);
51  ADD_FIELD(helper, L1MuGMTParameters, EtaWeight_COU);
52  ADD_FIELD(helper, L1MuGMTParameters, PhiWeight_COU);
53  ADD_FIELD(helper, L1MuGMTParameters, EtaPhiThreshold_COU);
54  ADD_FIELD(helper, L1MuGMTParameters, CaloTrigger);
55  ADD_FIELD(helper, L1MuGMTParameters, IsolationCellSizeEta);
56  ADD_FIELD(helper, L1MuGMTParameters, IsolationCellSizePhi);
57  ADD_FIELD(helper, L1MuGMTParameters, DoOvlRpcAnd);
58  ADD_FIELD(helper, L1MuGMTParameters, PropagatePhi);
59  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPhiBrl);
60  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPhiFwd);
61  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodEtaBrl);
62  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodEtaFwd);
63  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPtBrl);
64  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodPtFwd);
65  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodChargeBrl);
66  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodChargeFwd);
67  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPBrl);
68  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPFwd);
69  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPSpecialUseANDBrl);
70  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodMIPSpecialUseANDFwd);
71  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOBrl);
72  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOFwd);
73  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOSpecialUseANDBrl);
74  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodISOSpecialUseANDFwd);
75  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodSRKBrl);
76  ADD_FIELD(helper, L1MuGMTParameters, MergeMethodSRKFwd);
77  ADD_FIELD(helper, L1MuGMTParameters, HaloOverwritesMatchedBrl);
78  ADD_FIELD(helper, L1MuGMTParameters, HaloOverwritesMatchedFwd);
79  ADD_FIELD(helper, L1MuGMTParameters, SortRankOffsetBrl);
80  ADD_FIELD(helper, L1MuGMTParameters, SortRankOffsetFwd);
81  ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordDTCSC);
82  ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordCSCDT);
83  ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordbRPCCSC);
84  ADD_FIELD(helper, L1MuGMTParameters, CDLConfigWordfRPCDT);
85  ADD_FIELD(helper, L1MuGMTParameters, VersionSortRankEtaQLUT);
86  ADD_FIELD(helper, L1MuGMTParameters, VersionLUTs);
87 
88  boost::shared_ptr<L1MuGMTParameters> ptrResult(new L1MuGMTParameters);
89 
90  std::vector<std::string> resultColumns = helper.getColumnList();
91  resultColumns.push_back("CMSSW_VERSION");
92 
93  l1t::OMDSReader::QueryResults resultLines =
94  m_omdsReader.basicQuery(
95  // SELECTed columns
96  resultColumns,
97  // schema name
98  "CMS_GMT",
99  // table name
100  "GMT_SOFTWARE_CONFIG",
101  // WHERE lhs
102  "GMT_SOFTWARE_CONFIG.KEY",
103  // WHERE rhs
104  m_omdsReader.singleAttribute(objectKey) );
105 
106  if(resultLines.numberRows() == 1) {
107  const AttributeList& resultRecord = resultLines.attributeLists().front();
108  checkCMSSWVersion(resultRecord);
109  helper.extractRecord(resultRecord, *ptrResult);
110  return ptrResult;
111  }
112 
113  throw cond::Exception("Couldn't find GMT_SOFTWARE_CONFIG record for GMT key `" + objectKey + "'") ;
114 }
115 
116 void L1MuGMTParametersOnlineProducer::checkCMSSWVersion(const coral::AttributeList& configRecord)
117 {
118  const coral::Attribute& version = configRecord["CMSSW_VERSION"];
119 
120  /* If the DB field is unset, take any. */
121  if(version.isNull()) {
122  edm::LogInfo("No CMSSW version set in database, accepting " PROJECT_VERSION);
123  return;
124  }
125 
126  /* Else make sure we have the correct version. */
127  const std::string& versionString = version.data<string>();
128 
129  /* PROJECT_VERSION is passed as a -D #define from scramv1 (eg CMSSW_2_1_0) */
130  if(versionString != PROJECT_VERSION) {
131  std::string errMsg = "CMSSW version mismatch: Configuration requires " +
132  versionString + ", but this is " PROJECT_VERSION "!";
133 
134  if(ignoreVersionMismatch_) {
135  edm::LogWarning(errMsg + " (will continue because ignoreVersionMismatch is set)");
136  } else {
137  throw cond::Exception(errMsg);
138  }
139  }
140 }
141 
144 {
145  ignoreVersionMismatch_ = ps.getParameter<bool>("ignoreVersionMismatch");
146 }
147 
148 
150 
T getParameter(std::string const &) const
#define RH_ASSIGN_GROUP(TOutput, TGroup)
Definition: RecordHelper.h:129
const std::vector< coral::AttributeList > & attributeLists() const
Definition: OMDSReader.h:65
#define ADD_FIELD(HELPER, OUTPUT_NAME, FIELD_NAME)
Definition: RecordHelper.h:200
L1MuGMTParametersOnlineProducer(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:56
string const
Definition: compareJSON.py:14
void checkCMSSWVersion(const coral::AttributeList &configRecord)