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