CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1JetEtScaleOnlineProd.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1JetEtScaleOnlineProd
4 // Class: L1JetEtScaleOnlineProd
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< L1JetEtScaleRcd, 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 
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 L1JetEtScaleRcd : GCT scales key query failed ";
96  }
97  else if( scalesKeyResults.numberRows() != 1 ) {
98  edm::LogError("L1-O2O")
99  << "Problem with key for L1JetEtScaleRcd : "
100  << (scalesKeyResults.numberRows()) << " rows were returned when getting GCT scales key";
101  }
102  else {
103  scalesKeyResults.fillVariable( scalesKey );
104  }
105 
106 
107  // get jet scale key
108  l1t::OMDSReader::QueryResults jetScaleKeyResults =
110  "SC_CENJET_ET_THRESHOLD_FK",
111  "CMS_GT",
112  "L1T_SCALES",
113  "L1T_SCALES.ID",
114  scalesKeyResults );
115 
116  std::string jetScaleKey ;
117 
118  if( jetScaleKeyResults.queryFailed() ) {
119  edm::LogError("L1-O2O")
120  << "Problem with key for L1GctJetEtScaleRcd : jet scale key query failed ";
121  }
122  else if( jetScaleKeyResults.numberRows() != 1 ) {
123  edm::LogError("L1-O2O")
124  << "Problem with key for L1GctJetEtScaleRcd : "
125  << (jetScaleKeyResults.numberRows()) << " rows were returned when getting jet Et scale key";
126  }
127  else {
128  jetScaleKeyResults.fillVariable( jetScaleKey ) ;
129  }
130 
131  // get thresholds
132  std::vector< std::string > queryStrings ;
133  queryStrings.push_back( "ET_GEV_BIN_LOW_0");
134  queryStrings.push_back( "ET_GEV_BIN_LOW_1");
135  queryStrings.push_back( "ET_GEV_BIN_LOW_2");
136  queryStrings.push_back( "ET_GEV_BIN_LOW_3");
137  queryStrings.push_back( "ET_GEV_BIN_LOW_4");
138  queryStrings.push_back( "ET_GEV_BIN_LOW_5");
139  queryStrings.push_back( "ET_GEV_BIN_LOW_6");
140  queryStrings.push_back( "ET_GEV_BIN_LOW_7");
141  queryStrings.push_back( "ET_GEV_BIN_LOW_8");
142  queryStrings.push_back( "ET_GEV_BIN_LOW_9");
143  queryStrings.push_back( "ET_GEV_BIN_LOW_10");
144  queryStrings.push_back( "ET_GEV_BIN_LOW_11");
145  queryStrings.push_back( "ET_GEV_BIN_LOW_12");
146  queryStrings.push_back( "ET_GEV_BIN_LOW_13");
147  queryStrings.push_back( "ET_GEV_BIN_LOW_14");
148  queryStrings.push_back( "ET_GEV_BIN_LOW_15");
149  queryStrings.push_back( "ET_GEV_BIN_LOW_16");
150  queryStrings.push_back( "ET_GEV_BIN_LOW_17");
151  queryStrings.push_back( "ET_GEV_BIN_LOW_18");
152  queryStrings.push_back( "ET_GEV_BIN_LOW_19");
153  queryStrings.push_back( "ET_GEV_BIN_LOW_20");
154  queryStrings.push_back( "ET_GEV_BIN_LOW_21");
155  queryStrings.push_back( "ET_GEV_BIN_LOW_22");
156  queryStrings.push_back( "ET_GEV_BIN_LOW_23");
157  queryStrings.push_back( "ET_GEV_BIN_LOW_24");
158  queryStrings.push_back( "ET_GEV_BIN_LOW_25");
159  queryStrings.push_back( "ET_GEV_BIN_LOW_26");
160  queryStrings.push_back( "ET_GEV_BIN_LOW_27");
161  queryStrings.push_back( "ET_GEV_BIN_LOW_28");
162  queryStrings.push_back( "ET_GEV_BIN_LOW_29");
163  queryStrings.push_back( "ET_GEV_BIN_LOW_30");
164  queryStrings.push_back( "ET_GEV_BIN_LOW_31");
165  queryStrings.push_back( "ET_GEV_BIN_LOW_32");
166  queryStrings.push_back( "ET_GEV_BIN_LOW_33");
167  queryStrings.push_back( "ET_GEV_BIN_LOW_34");
168  queryStrings.push_back( "ET_GEV_BIN_LOW_35");
169  queryStrings.push_back( "ET_GEV_BIN_LOW_36");
170  queryStrings.push_back( "ET_GEV_BIN_LOW_37");
171  queryStrings.push_back( "ET_GEV_BIN_LOW_38");
172  queryStrings.push_back( "ET_GEV_BIN_LOW_39");
173  queryStrings.push_back( "ET_GEV_BIN_LOW_40");
174  queryStrings.push_back( "ET_GEV_BIN_LOW_41");
175  queryStrings.push_back( "ET_GEV_BIN_LOW_42");
176  queryStrings.push_back( "ET_GEV_BIN_LOW_43");
177  queryStrings.push_back( "ET_GEV_BIN_LOW_44");
178  queryStrings.push_back( "ET_GEV_BIN_LOW_45");
179  queryStrings.push_back( "ET_GEV_BIN_LOW_46");
180  queryStrings.push_back( "ET_GEV_BIN_LOW_47");
181  queryStrings.push_back( "ET_GEV_BIN_LOW_48");
182  queryStrings.push_back( "ET_GEV_BIN_LOW_49");
183  queryStrings.push_back( "ET_GEV_BIN_LOW_50");
184  queryStrings.push_back( "ET_GEV_BIN_LOW_51");
185  queryStrings.push_back( "ET_GEV_BIN_LOW_52");
186  queryStrings.push_back( "ET_GEV_BIN_LOW_53");
187  queryStrings.push_back( "ET_GEV_BIN_LOW_54");
188  queryStrings.push_back( "ET_GEV_BIN_LOW_55");
189  queryStrings.push_back( "ET_GEV_BIN_LOW_56");
190  queryStrings.push_back( "ET_GEV_BIN_LOW_57");
191  queryStrings.push_back( "ET_GEV_BIN_LOW_58");
192  queryStrings.push_back( "ET_GEV_BIN_LOW_59");
193  queryStrings.push_back( "ET_GEV_BIN_LOW_60");
194  queryStrings.push_back( "ET_GEV_BIN_LOW_61");
195  queryStrings.push_back( "ET_GEV_BIN_LOW_62");
196  queryStrings.push_back( "ET_GEV_BIN_LOW_63");
197 
198  l1t::OMDSReader::QueryResults scaleResults =
199  m_omdsReader.basicQuery( queryStrings,
200  "CMS_GT",
201  "L1T_SCALE_CALO_ET_THRESHOLD",
202  "L1T_SCALE_CALO_ET_THRESHOLD.ID",
203  jetScaleKeyResults
204  );
205 
206  std::vector<double> thresholds;
207 
208  if( scaleResults.queryFailed() ||
209  scaleResults.numberRows() != 1 ) // check query successful
210  {
211  edm::LogError( "L1-O2O" ) << "Problem with L1JetEtScale key : when reading scale." ;
212  }
213  else {
214  for( std::vector< std::string >::iterator thresh = queryStrings.begin();
215  thresh != queryStrings.end(); ++thresh) {
216  float tempScale = 0.0;
217  scaleResults.fillVariable(*thresh,tempScale);
218  thresholds.push_back(tempScale);
219  }
220  }
221 
222  // get region LSB
223  double rgnEtLsb=0.;
224 
225  l1t::OMDSReader::QueryResults lsbResults =
226  m_omdsReader.basicQuery( "GCT_RGN_ET_LSB",
227  "CMS_GCT",
228  "GCT_PHYS_PARAMS",
229  "GCT_PHYS_PARAMS.CONFIG_KEY",
230  m_omdsReader.singleAttribute( objectKey ) ) ;
231 
232  if( lsbResults.queryFailed() ) {
233  edm::LogError( "L1-O2O" ) << "Problem with L1JetEtScale key." ;
234  }
235  else {
236  lsbResults.fillVariable( "GCT_RGN_ET_LSB", rgnEtLsb );
237  }
238 
239  // return object
240  return boost::shared_ptr< L1CaloEtScale >( new L1CaloEtScale( rgnEtLsb, thresholds ) );
241 }
242 
243 
244 // ------------ method called to produce the data ------------
245 
246 
247 //define this as a plug-in
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
L1JetEtScaleOnlineProd(const edm::ParameterSet &)
virtual boost::shared_ptr< L1CaloEtScale > newObject(const std::string &objectKey) override
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:86
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60