CMS 3D CMS Logo

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