CMS 3D CMS Logo

L1HtMissScaleOnlineProd.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1HtMissScaleOnlineProd
4 // Class: L1HtMissScaleOnlineProd
5 //
13 //
14 // Original Author: Werner Man-Li Sun
15 // Created: Tue Sep 16 22:43:22 CEST 2008
16 //
17 //
18 
19 // system include files
20 
21 // user include files
23 
26 
27 //
28 // class declaration
29 //
30 
31 class L1HtMissScaleOnlineProd : public L1ConfigOnlineProdBase<L1HtMissScaleRcd, L1CaloEtScale> {
32 public:
34  ~L1HtMissScaleOnlineProd() override;
35 
36  std::unique_ptr<L1CaloEtScale> newObject(const std::string& objectKey) override;
37 
38 private:
39  // ----------member data ---------------------------
40 };
41 
42 //
43 // constants, enums and typedefs
44 //
45 
46 //
47 // static data member definitions
48 //
49 
50 //
51 // constructors and destructor
52 //
55  //the following line is needed to tell the framework what
56  // data is being produced
57 
58  //now do what ever other initialization is needed
59 }
60 
62  // do anything here that needs to be done at desctruction time
63  // (e.g. close files, deallocate resources etc.)
64 }
65 
66 std::unique_ptr<L1CaloEtScale> L1HtMissScaleOnlineProd::newObject(const std::string& objectKey) {
67  // get scales keys
68  l1t::OMDSReader::QueryResults scalesKeyResults = m_omdsReader.basicQuery("GCT_SCALES_KEY",
69  "CMS_GCT",
70  "GCT_PHYS_PARAMS",
71  "GCT_PHYS_PARAMS.CONFIG_KEY",
72  m_omdsReader.singleAttribute(objectKey));
73 
74  std::string scalesKey;
75 
76  if (scalesKeyResults.queryFailed()) {
77  edm::LogError("L1-O2O") << "Problem with key for L1HtMissScaleRcd : GCT scales key query failed ";
78  } else if (scalesKeyResults.numberRows() != 1) {
79  edm::LogError("L1-O2O") << "Problem with key for L1HtMissScaleRcd : " << (scalesKeyResults.numberRows())
80  << " rows were returned when getting GCT scales key";
81  } else {
82  scalesKeyResults.fillVariable(scalesKey);
83  }
84 
85  edm::LogInfo("L1-O2O") << "L1 scales key : " << scalesKey << std::endl;
86 
87  // get jet scale key
88  l1t::OMDSReader::QueryResults htmScaleKeyResults =
89  m_omdsReader.basicQuery("SC_HTM_FK", "CMS_GT", "L1T_SCALES", "L1T_SCALES.ID", scalesKeyResults);
90 
91  std::string htmScaleKey;
92 
93  if (htmScaleKeyResults.queryFailed()) {
94  edm::LogError("L1-O2O") << "Problem with key for L1HtMissEtScaleRcd : HtMiss scale key query failed ";
95  } else if (htmScaleKeyResults.numberRows() != 1) {
96  edm::LogError("L1-O2O") << "Problem with key for L1HtMissScaleRcd : " << (htmScaleKeyResults.numberRows())
97  << " rows were returned when getting HtMiss scale key";
98  } else {
99  htmScaleKeyResults.fillVariable(htmScaleKey);
100  }
101 
102  edm::LogInfo("L1-O2O") << "L1HtMiss scale key : " << htmScaleKey << std::endl;
103 
104  // get thresholds
105  std::vector<std::string> queryStrings;
106  queryStrings.push_back("E_GEV_BIN_LOW_0");
107  queryStrings.push_back("E_GEV_BIN_LOW_1");
108  queryStrings.push_back("E_GEV_BIN_LOW_2");
109  queryStrings.push_back("E_GEV_BIN_LOW_3");
110  queryStrings.push_back("E_GEV_BIN_LOW_4");
111  queryStrings.push_back("E_GEV_BIN_LOW_5");
112  queryStrings.push_back("E_GEV_BIN_LOW_6");
113  queryStrings.push_back("E_GEV_BIN_LOW_7");
114  queryStrings.push_back("E_GEV_BIN_LOW_8");
115  queryStrings.push_back("E_GEV_BIN_LOW_9");
116  queryStrings.push_back("E_GEV_BIN_LOW_10");
117  queryStrings.push_back("E_GEV_BIN_LOW_11");
118  queryStrings.push_back("E_GEV_BIN_LOW_12");
119  queryStrings.push_back("E_GEV_BIN_LOW_13");
120  queryStrings.push_back("E_GEV_BIN_LOW_14");
121  queryStrings.push_back("E_GEV_BIN_LOW_15");
122  queryStrings.push_back("E_GEV_BIN_LOW_16");
123  queryStrings.push_back("E_GEV_BIN_LOW_17");
124  queryStrings.push_back("E_GEV_BIN_LOW_18");
125  queryStrings.push_back("E_GEV_BIN_LOW_19");
126  queryStrings.push_back("E_GEV_BIN_LOW_20");
127  queryStrings.push_back("E_GEV_BIN_LOW_21");
128  queryStrings.push_back("E_GEV_BIN_LOW_22");
129  queryStrings.push_back("E_GEV_BIN_LOW_23");
130  queryStrings.push_back("E_GEV_BIN_LOW_24");
131  queryStrings.push_back("E_GEV_BIN_LOW_25");
132  queryStrings.push_back("E_GEV_BIN_LOW_26");
133  queryStrings.push_back("E_GEV_BIN_LOW_27");
134  queryStrings.push_back("E_GEV_BIN_LOW_28");
135  queryStrings.push_back("E_GEV_BIN_LOW_29");
136  queryStrings.push_back("E_GEV_BIN_LOW_30");
137  queryStrings.push_back("E_GEV_BIN_LOW_31");
138  queryStrings.push_back("E_GEV_BIN_LOW_32");
139  queryStrings.push_back("E_GEV_BIN_LOW_33");
140  queryStrings.push_back("E_GEV_BIN_LOW_34");
141  queryStrings.push_back("E_GEV_BIN_LOW_35");
142  queryStrings.push_back("E_GEV_BIN_LOW_36");
143  queryStrings.push_back("E_GEV_BIN_LOW_37");
144  queryStrings.push_back("E_GEV_BIN_LOW_38");
145  queryStrings.push_back("E_GEV_BIN_LOW_39");
146  queryStrings.push_back("E_GEV_BIN_LOW_40");
147  queryStrings.push_back("E_GEV_BIN_LOW_41");
148  queryStrings.push_back("E_GEV_BIN_LOW_42");
149  queryStrings.push_back("E_GEV_BIN_LOW_43");
150  queryStrings.push_back("E_GEV_BIN_LOW_44");
151  queryStrings.push_back("E_GEV_BIN_LOW_45");
152  queryStrings.push_back("E_GEV_BIN_LOW_46");
153  queryStrings.push_back("E_GEV_BIN_LOW_47");
154  queryStrings.push_back("E_GEV_BIN_LOW_48");
155  queryStrings.push_back("E_GEV_BIN_LOW_49");
156  queryStrings.push_back("E_GEV_BIN_LOW_50");
157  queryStrings.push_back("E_GEV_BIN_LOW_51");
158  queryStrings.push_back("E_GEV_BIN_LOW_52");
159  queryStrings.push_back("E_GEV_BIN_LOW_53");
160  queryStrings.push_back("E_GEV_BIN_LOW_54");
161  queryStrings.push_back("E_GEV_BIN_LOW_55");
162  queryStrings.push_back("E_GEV_BIN_LOW_56");
163  queryStrings.push_back("E_GEV_BIN_LOW_57");
164  queryStrings.push_back("E_GEV_BIN_LOW_58");
165  queryStrings.push_back("E_GEV_BIN_LOW_59");
166  queryStrings.push_back("E_GEV_BIN_LOW_60");
167  queryStrings.push_back("E_GEV_BIN_LOW_61");
168  queryStrings.push_back("E_GEV_BIN_LOW_62");
169  queryStrings.push_back("E_GEV_BIN_LOW_63");
170  queryStrings.push_back("E_GEV_BIN_LOW_64");
171  queryStrings.push_back("E_GEV_BIN_LOW_65");
172  queryStrings.push_back("E_GEV_BIN_LOW_66");
173  queryStrings.push_back("E_GEV_BIN_LOW_67");
174  queryStrings.push_back("E_GEV_BIN_LOW_68");
175  queryStrings.push_back("E_GEV_BIN_LOW_69");
176  queryStrings.push_back("E_GEV_BIN_LOW_70");
177  queryStrings.push_back("E_GEV_BIN_LOW_71");
178  queryStrings.push_back("E_GEV_BIN_LOW_72");
179  queryStrings.push_back("E_GEV_BIN_LOW_73");
180  queryStrings.push_back("E_GEV_BIN_LOW_74");
181  queryStrings.push_back("E_GEV_BIN_LOW_75");
182  queryStrings.push_back("E_GEV_BIN_LOW_76");
183  queryStrings.push_back("E_GEV_BIN_LOW_77");
184  queryStrings.push_back("E_GEV_BIN_LOW_78");
185  queryStrings.push_back("E_GEV_BIN_LOW_79");
186  queryStrings.push_back("E_GEV_BIN_LOW_80");
187  queryStrings.push_back("E_GEV_BIN_LOW_81");
188  queryStrings.push_back("E_GEV_BIN_LOW_82");
189  queryStrings.push_back("E_GEV_BIN_LOW_83");
190  queryStrings.push_back("E_GEV_BIN_LOW_84");
191  queryStrings.push_back("E_GEV_BIN_LOW_85");
192  queryStrings.push_back("E_GEV_BIN_LOW_86");
193  queryStrings.push_back("E_GEV_BIN_LOW_87");
194  queryStrings.push_back("E_GEV_BIN_LOW_88");
195  queryStrings.push_back("E_GEV_BIN_LOW_89");
196  queryStrings.push_back("E_GEV_BIN_LOW_90");
197  queryStrings.push_back("E_GEV_BIN_LOW_91");
198  queryStrings.push_back("E_GEV_BIN_LOW_92");
199  queryStrings.push_back("E_GEV_BIN_LOW_93");
200  queryStrings.push_back("E_GEV_BIN_LOW_94");
201  queryStrings.push_back("E_GEV_BIN_LOW_95");
202  queryStrings.push_back("E_GEV_BIN_LOW_96");
203  queryStrings.push_back("E_GEV_BIN_LOW_97");
204  queryStrings.push_back("E_GEV_BIN_LOW_98");
205  queryStrings.push_back("E_GEV_BIN_LOW_99");
206  queryStrings.push_back("E_GEV_BIN_LOW_100");
207  queryStrings.push_back("E_GEV_BIN_LOW_101");
208  queryStrings.push_back("E_GEV_BIN_LOW_102");
209  queryStrings.push_back("E_GEV_BIN_LOW_103");
210  queryStrings.push_back("E_GEV_BIN_LOW_104");
211  queryStrings.push_back("E_GEV_BIN_LOW_105");
212  queryStrings.push_back("E_GEV_BIN_LOW_106");
213  queryStrings.push_back("E_GEV_BIN_LOW_107");
214  queryStrings.push_back("E_GEV_BIN_LOW_108");
215  queryStrings.push_back("E_GEV_BIN_LOW_109");
216  queryStrings.push_back("E_GEV_BIN_LOW_110");
217  queryStrings.push_back("E_GEV_BIN_LOW_111");
218  queryStrings.push_back("E_GEV_BIN_LOW_112");
219  queryStrings.push_back("E_GEV_BIN_LOW_113");
220  queryStrings.push_back("E_GEV_BIN_LOW_114");
221  queryStrings.push_back("E_GEV_BIN_LOW_115");
222  queryStrings.push_back("E_GEV_BIN_LOW_116");
223  queryStrings.push_back("E_GEV_BIN_LOW_117");
224  queryStrings.push_back("E_GEV_BIN_LOW_118");
225  queryStrings.push_back("E_GEV_BIN_LOW_119");
226  queryStrings.push_back("E_GEV_BIN_LOW_120");
227  queryStrings.push_back("E_GEV_BIN_LOW_121");
228  queryStrings.push_back("E_GEV_BIN_LOW_122");
229  queryStrings.push_back("E_GEV_BIN_LOW_123");
230  queryStrings.push_back("E_GEV_BIN_LOW_124");
231  queryStrings.push_back("E_GEV_BIN_LOW_125");
232  queryStrings.push_back("E_GEV_BIN_LOW_126");
233  queryStrings.push_back("E_GEV_BIN_LOW_127");
234 
236  queryStrings, "CMS_GT", "L1T_SCALE_HTM_ENERGY", "L1T_SCALE_HTM_ENERGY.ID", htmScaleKeyResults);
237 
238  // L1T_SCALE_HTM_ENERGY
239 
240  std::vector<double> thresholds;
241 
242  if (scaleResults.queryFailed() || scaleResults.numberRows() != 1) // check query successful
243  {
244  edm::LogError("L1-O2O") << "Problem with L1HtMissScale key : when reading scale.";
245  } else {
246  for (std::vector<std::string>::iterator thresh = queryStrings.begin(); thresh != queryStrings.end(); ++thresh) {
247  float tempScale = 0.;
248  scaleResults.fillVariable(*thresh, tempScale);
249  thresholds.push_back(tempScale);
250  }
251  }
252 
253  // get region LSB
254  double rgnEtLsb = 0.;
255 
256  l1t::OMDSReader::QueryResults lsbResults = m_omdsReader.basicQuery("GCT_RGN_ET_LSB",
257  "CMS_GCT",
258  "GCT_PHYS_PARAMS",
259  "GCT_PHYS_PARAMS.CONFIG_KEY",
260  m_omdsReader.singleAttribute(objectKey));
261 
262  if (lsbResults.queryFailed()) {
263  edm::LogError("L1-O2O") << "Problem with L1HtMissScale key.";
264  } else {
265  lsbResults.fillVariable("GCT_RGN_ET_LSB", rgnEtLsb);
266  }
267 
268  // return object
269  return std::make_unique<L1CaloEtScale>(0, 0x7f, rgnEtLsb, thresholds);
270 }
271 
272 // ------------ method called to produce the data ------------
273 
274 //define this as a plug-in
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1HtMissScaleOnlineProd(const edm::ParameterSet &)
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
std::unique_ptr< L1CaloEtScale > newObject(const std::string &objectKey) override
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60