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