CMS 3D CMS Logo

L1GctJetFinderParamsOnlineProd.cc
Go to the documentation of this file.
4 
5 class L1GctJetFinderParamsOnlineProd : public L1ConfigOnlineProdBase<L1GctJetFinderParamsRcd, L1GctJetFinderParams> {
6 public:
10 
11  std::unique_ptr<L1GctJetFinderParams> newObject(const std::string& objectKey) override;
12 
13 private:
14 };
15 
16 std::unique_ptr<L1GctJetFinderParams> L1GctJetFinderParamsOnlineProd::newObject(const std::string& objectKey) {
17  // Execute SQL queries to get data from OMDS (using key) and make C++ object
18  // Example: SELECT A_PARAMETER FROM CMS_XXX.XXX_CONF WHERE XXX_CONF.XXX_KEY = objectKey
19 
20  // get parameters
21  std::vector<std::string> columns;
22  columns.push_back("GCT_RGN_ET_LSB");
23  columns.push_back("GCT_HT_LSB");
24  columns.push_back("GCT_CJET_SEED_ET_THRESHOLD");
25  columns.push_back("GCT_TJET_SEED_ET_THRESHOLD");
26  columns.push_back("GCT_FJET_SEED_ET_THRESHOLD");
27  columns.push_back("GCT_HT_JET_ET_THRESHOLD");
28  columns.push_back("GCT_MHT_JET_ET_THRESHOLD");
29  columns.push_back("GCT_TAU_ISO_ET_THRESHOLD");
30  columns.push_back("GCT_CEN_JET_ETA_MAX");
31  columns.push_back("GCT_JET_CORR_KEY");
32 
34  columns, "CMS_GCT", "GCT_PHYS_PARAMS", "GCT_PHYS_PARAMS.CONFIG_KEY", m_omdsReader.singleAttribute(objectKey));
35 
36  if (results.queryFailed()) // check if query was successful
37  {
38  edm::LogError("L1-O2O") << "Problem with L1GctJetFinderParams key.";
39  return std::unique_ptr<L1GctJetFinderParams>();
40  }
41 
42  // fill values
43  double rgnEtLsb = 0.;
44  double htLsb = 0.;
45  double cJetSeed = 0.;
46  double tJetSeed = 0.;
47  double fJetSeed = 0.;
48  double tauIsoEtThresh = 0.;
49  double htJetEtThresh = 0.;
50  double mhtJetEtThresh = 0.;
51  short int etaBoundary = 7;
52  int corrType = 0;
53  std::vector<std::vector<double> > jetCorrCoeffs;
54  std::vector<std::vector<double> > tauCorrCoeffs;
55  bool convertToEnergy = false; // Not in OMDS
56  std::vector<double> energyConvCoeffs(11); // Not in OMDS
57  std::string jetCorrKey;
58 
59  results.fillVariable("GCT_RGN_ET_LSB", rgnEtLsb);
60  results.fillVariable("GCT_HT_LSB", htLsb);
61  results.fillVariable("GCT_CJET_SEED_ET_THRESHOLD", cJetSeed);
62  results.fillVariable("GCT_TJET_SEED_ET_THRESHOLD", tJetSeed);
63  results.fillVariable("GCT_FJET_SEED_ET_THRESHOLD", fJetSeed);
64  results.fillVariable("GCT_TAU_ISO_ET_THRESHOLD", tauIsoEtThresh);
65  results.fillVariable("GCT_HT_JET_ET_THRESHOLD", htJetEtThresh);
66  results.fillVariable("GCT_MHT_JET_ET_THRESHOLD", mhtJetEtThresh);
67  results.fillVariable("GCT_CEN_JET_ETA_MAX", etaBoundary);
68  results.fillVariable("GCT_JET_CORR_KEY", jetCorrKey);
69 
70  edm::LogInfo("L1-O2O") << "L1 jet corrections key : " << jetCorrKey << std::endl;
71 
72  // get jet corr coefficients
73  std::vector<std::string> jetCorrColumns;
74  jetCorrColumns.push_back("GCT_JETCORR_TYPE");
75  jetCorrColumns.push_back("GCT_JETCORR_NETA_10");
76  jetCorrColumns.push_back("GCT_JETCORR_NETA_9");
77  jetCorrColumns.push_back("GCT_JETCORR_NETA_8");
78  jetCorrColumns.push_back("GCT_JETCORR_NETA_7");
79  jetCorrColumns.push_back("GCT_JETCORR_NETA_6");
80  jetCorrColumns.push_back("GCT_JETCORR_NETA_5");
81  jetCorrColumns.push_back("GCT_JETCORR_NETA_4");
82  jetCorrColumns.push_back("GCT_JETCORR_NETA_3");
83  jetCorrColumns.push_back("GCT_JETCORR_NETA_2");
84  jetCorrColumns.push_back("GCT_JETCORR_NETA_1");
85  jetCorrColumns.push_back("GCT_JETCORR_NETA_0");
86  jetCorrColumns.push_back("GCT_JETCORR_PETA_0");
87  jetCorrColumns.push_back("GCT_JETCORR_PETA_1");
88  jetCorrColumns.push_back("GCT_JETCORR_PETA_2");
89  jetCorrColumns.push_back("GCT_JETCORR_PETA_3");
90  jetCorrColumns.push_back("GCT_JETCORR_PETA_4");
91  jetCorrColumns.push_back("GCT_JETCORR_PETA_5");
92  jetCorrColumns.push_back("GCT_JETCORR_PETA_6");
93  jetCorrColumns.push_back("GCT_JETCORR_PETA_7");
94  jetCorrColumns.push_back("GCT_JETCORR_PETA_8");
95  jetCorrColumns.push_back("GCT_JETCORR_PETA_9");
96  jetCorrColumns.push_back("GCT_JETCORR_PETA_10");
97 
98  l1t::OMDSReader::QueryResults jetCorrResults = m_omdsReader.basicQuery(jetCorrColumns,
99  "CMS_GCT",
100  "GCT_JET_CORRECTIONS",
101  "GCT_JET_CORRECTIONS.CONFIG_KEY",
102  m_omdsReader.singleAttribute(jetCorrKey));
103 
104  if (jetCorrResults.queryFailed()) // check if query was successful
105  {
106  edm::LogError("L1-O2O") << "Problem getting L1 jet corrections";
107  return std::unique_ptr<L1GctJetFinderParams>();
108  }
109 
110  // fill jet corr type
111  jetCorrResults.fillVariable("GCT_JETCORR_TYPE", corrType);
112 
113  edm::LogInfo("L1-O2O") << "L1 jet corrections type : " << corrType << std::endl;
114 
115  // get coefficients
116  for (unsigned i = 0; i < L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
117  // get corr key for eta value
118  std::stringstream etaCol;
119  etaCol << "GCT_JETCORR_NETA_" << std::dec << i;
120  std::string etaKey;
121  jetCorrResults.fillVariable(etaCol.str(), etaKey);
122 
123  std::vector<std::string> coeffColumns;
124  coeffColumns.push_back("GCT_JETCORR_C0");
125  coeffColumns.push_back("GCT_JETCORR_C1");
126  coeffColumns.push_back("GCT_JETCORR_C2");
127  coeffColumns.push_back("GCT_JETCORR_C3");
128  coeffColumns.push_back("GCT_JETCORR_C4");
129  coeffColumns.push_back("GCT_JETCORR_C5");
130  coeffColumns.push_back("GCT_JETCORR_C6");
131  coeffColumns.push_back("GCT_JETCORR_C7");
132  coeffColumns.push_back("GCT_JETCORR_C8");
133  coeffColumns.push_back("GCT_JETCORR_C9");
134  coeffColumns.push_back("GCT_JETCORR_C10");
135  coeffColumns.push_back("GCT_JETCORR_C11");
136  coeffColumns.push_back("GCT_JETCORR_C12");
137  coeffColumns.push_back("GCT_JETCORR_C13");
138  coeffColumns.push_back("GCT_JETCORR_C14");
139  coeffColumns.push_back("GCT_JETCORR_C15");
140  coeffColumns.push_back("GCT_JETCORR_C16");
141  coeffColumns.push_back("GCT_JETCORR_C17");
142  coeffColumns.push_back("GCT_JETCORR_C18");
143  coeffColumns.push_back("GCT_JETCORR_C19");
144 
146  coeffColumns, "CMS_GCT", "GCT_JET_COEFFS", "GCT_JET_COEFFS.CONFIG_KEY", m_omdsReader.singleAttribute(etaKey));
147 
148  if (results.queryFailed()) // check if query was successful
149  {
150  edm::LogError("L1-O2O") << "Problem getting L1 jet correction coefficients";
151  return std::unique_ptr<L1GctJetFinderParams>();
152  }
153 
154  // fill coeffs - TODO
155  std::vector<double> coeffs;
156 
157  unsigned nCoeffs = 0;
158  if (corrType == 0)
159  nCoeffs = 0;
160  else if (corrType == 2)
161  nCoeffs = 8; // ORCA style
162  else if (corrType == 3)
163  nCoeffs = 4; // Simple
164  else if (corrType == 4)
165  nCoeffs = 15; // piecewise-cubic
166  else if (corrType == 5)
167  nCoeffs = 6; // PF
168  else {
169  edm::LogError("L1-O2O") << "Unsupported jet correction type : " << corrType;
170  return std::unique_ptr<L1GctJetFinderParams>();
171  }
172 
173  for (unsigned j = 0; j < nCoeffs; ++j) {
174  std::stringstream coeffCol;
175  coeffCol << "GCT_JETCORR_C" << std::dec << j;
176  // int coeff;
177  double coeff;
178  jetCorrResults.fillVariable(coeffCol.str(), coeff);
179 
180  coeffs.push_back(coeff);
181  }
182 
183  jetCorrCoeffs.push_back(coeffs);
184 
185  // copy to tau coeffs
187  tauCorrCoeffs.push_back(coeffs);
188  }
189 
190  return std::make_unique<L1GctJetFinderParams>(rgnEtLsb,
191  htLsb,
192  cJetSeed,
193  fJetSeed,
194  tJetSeed,
195  tauIsoEtThresh,
196  htJetEtThresh,
197  mhtJetEtThresh,
198  etaBoundary,
199  corrType,
200  jetCorrCoeffs,
201  tauCorrCoeffs,
202  convertToEnergy,
203  energyConvCoeffs
204 
205  );
206 }
207 
l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
mps_fire.i
i
Definition: mps_fire.py:355
L1GctJetFinderParamsRcd.h
L1ConfigOnlineProdBase< L1GctJetFinderParamsRcd, L1GctJetFinderParams >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBase.h:65
edm::LogInfo
Definition: MessageLogger.h:254
bookConverter.results
results
Definition: bookConverter.py:144
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1ConfigOnlineProdBase
Definition: L1ConfigOnlineProdBase.h:52
L1GctJetFinderParams.h
l1t::OMDSReader::QueryResults::fillVariable
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
L1GctJetFinderParamsRcd
Definition: L1GctJetFinderParamsRcd.h:31
L1GctJetFinderParamsOnlineProd::newObject
std::unique_ptr< L1GctJetFinderParams > newObject(const std::string &objectKey) override
Definition: L1GctJetFinderParamsOnlineProd.cc:16
L1GctJetFinderParams
Definition: L1GctJetFinderParams.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
L1GctJetFinderParamsOnlineProd::L1GctJetFinderParamsOnlineProd
L1GctJetFinderParamsOnlineProd(const edm::ParameterSet &iConfig)
Definition: L1GctJetFinderParamsOnlineProd.cc:7
l1t::OMDSReader::basicQuery
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75
L1GctJetFinderParams::N_CENTRAL_ETA_VALUES
static const unsigned N_CENTRAL_ETA_VALUES
Number of eta bins used in correction.
Definition: L1GctJetFinderParams.h:13
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
mps_check.columns
columns
Definition: mps_check.py:244
L1GctJetFinderParamsOnlineProd::~L1GctJetFinderParamsOnlineProd
~L1GctJetFinderParamsOnlineProd() override
Definition: L1GctJetFinderParamsOnlineProd.cc:9
L1GctJetFinderParamsOnlineProd
Definition: L1GctJetFinderParamsOnlineProd.cc:5
l1t::OMDSReader::QueryResults::queryFailed
bool queryFailed() const
Definition: OMDSReader.h:59
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
L1ConfigOnlineProdBase.h
L1GctJetFinderParams::NUMBER_ETA_VALUES
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
Definition: L1GctJetFinderParams.h:12