CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1EmEtScaleOnlineProd.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1EmEtScaleOnlineProd
4 // Class: L1EmEtScaleOnlineProd
5 //
13 //
14 // Original Author: Werner Man-Li Sun
15 // Created: Tue Sep 16 22:43:22 CEST 2008
16 // $Id: L1EmEtScaleOnlineProd.cc,v 1.4 2012/11/19 15:56: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< L1EmEtScaleRcd, 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 L1EmEtScaleOnlineProd::newObject( const std::string& objectKey )
80 {
81  using namespace edm::es;
82 
83  // ~~~~~~~~~ Cut values ~~~~~~~~~
84 
85 
86  std::vector< std::string > queryStrings ;
87  queryStrings.push_back( "ET_GEV_BIN_LOW_0");
88  queryStrings.push_back( "ET_GEV_BIN_LOW_1");
89  queryStrings.push_back( "ET_GEV_BIN_LOW_2");
90  queryStrings.push_back( "ET_GEV_BIN_LOW_3");
91  queryStrings.push_back( "ET_GEV_BIN_LOW_4");
92  queryStrings.push_back( "ET_GEV_BIN_LOW_5");
93  queryStrings.push_back( "ET_GEV_BIN_LOW_6");
94  queryStrings.push_back( "ET_GEV_BIN_LOW_7");
95  queryStrings.push_back( "ET_GEV_BIN_LOW_8");
96  queryStrings.push_back( "ET_GEV_BIN_LOW_9");
97  queryStrings.push_back( "ET_GEV_BIN_LOW_10");
98  queryStrings.push_back( "ET_GEV_BIN_LOW_11");
99  queryStrings.push_back( "ET_GEV_BIN_LOW_12");
100  queryStrings.push_back( "ET_GEV_BIN_LOW_13");
101  queryStrings.push_back( "ET_GEV_BIN_LOW_14");
102  queryStrings.push_back( "ET_GEV_BIN_LOW_15");
103  queryStrings.push_back( "ET_GEV_BIN_LOW_16");
104  queryStrings.push_back( "ET_GEV_BIN_LOW_17");
105  queryStrings.push_back( "ET_GEV_BIN_LOW_18");
106  queryStrings.push_back( "ET_GEV_BIN_LOW_19");
107  queryStrings.push_back( "ET_GEV_BIN_LOW_20");
108  queryStrings.push_back( "ET_GEV_BIN_LOW_21");
109  queryStrings.push_back( "ET_GEV_BIN_LOW_22");
110  queryStrings.push_back( "ET_GEV_BIN_LOW_23");
111  queryStrings.push_back( "ET_GEV_BIN_LOW_24");
112  queryStrings.push_back( "ET_GEV_BIN_LOW_25");
113  queryStrings.push_back( "ET_GEV_BIN_LOW_26");
114  queryStrings.push_back( "ET_GEV_BIN_LOW_27");
115  queryStrings.push_back( "ET_GEV_BIN_LOW_28");
116  queryStrings.push_back( "ET_GEV_BIN_LOW_29");
117  queryStrings.push_back( "ET_GEV_BIN_LOW_30");
118  queryStrings.push_back( "ET_GEV_BIN_LOW_31");
119  queryStrings.push_back( "ET_GEV_BIN_LOW_32");
120  queryStrings.push_back( "ET_GEV_BIN_LOW_33");
121  queryStrings.push_back( "ET_GEV_BIN_LOW_34");
122  queryStrings.push_back( "ET_GEV_BIN_LOW_35");
123  queryStrings.push_back( "ET_GEV_BIN_LOW_36");
124  queryStrings.push_back( "ET_GEV_BIN_LOW_37");
125  queryStrings.push_back( "ET_GEV_BIN_LOW_38");
126  queryStrings.push_back( "ET_GEV_BIN_LOW_39");
127  queryStrings.push_back( "ET_GEV_BIN_LOW_40");
128  queryStrings.push_back( "ET_GEV_BIN_LOW_41");
129  queryStrings.push_back( "ET_GEV_BIN_LOW_42");
130  queryStrings.push_back( "ET_GEV_BIN_LOW_43");
131  queryStrings.push_back( "ET_GEV_BIN_LOW_44");
132  queryStrings.push_back( "ET_GEV_BIN_LOW_45");
133  queryStrings.push_back( "ET_GEV_BIN_LOW_46");
134  queryStrings.push_back( "ET_GEV_BIN_LOW_47");
135  queryStrings.push_back( "ET_GEV_BIN_LOW_48");
136  queryStrings.push_back( "ET_GEV_BIN_LOW_49");
137  queryStrings.push_back( "ET_GEV_BIN_LOW_50");
138  queryStrings.push_back( "ET_GEV_BIN_LOW_51");
139  queryStrings.push_back( "ET_GEV_BIN_LOW_52");
140  queryStrings.push_back( "ET_GEV_BIN_LOW_53");
141  queryStrings.push_back( "ET_GEV_BIN_LOW_54");
142  queryStrings.push_back( "ET_GEV_BIN_LOW_55");
143  queryStrings.push_back( "ET_GEV_BIN_LOW_56");
144  queryStrings.push_back( "ET_GEV_BIN_LOW_57");
145  queryStrings.push_back( "ET_GEV_BIN_LOW_58");
146  queryStrings.push_back( "ET_GEV_BIN_LOW_59");
147  queryStrings.push_back( "ET_GEV_BIN_LOW_60");
148  queryStrings.push_back( "ET_GEV_BIN_LOW_61");
149  queryStrings.push_back( "ET_GEV_BIN_LOW_62");
150  queryStrings.push_back( "ET_GEV_BIN_LOW_63");
151 
152  const l1t::OMDSReader::QueryResults scaleKeyResults =
153  m_omdsReader.singleAttribute( objectKey ) ;
154 
155 
156  l1t::OMDSReader::QueryResults scaleResults =
157  m_omdsReader.basicQuery( queryStrings,
158  "CMS_GT",
159  "L1T_SCALE_CALO_ET_THRESHOLD",
160  "L1T_SCALE_CALO_ET_THRESHOLD.ID",
161  m_omdsReader.basicQuery( "L1T_SCALE_CALO_ET_THRESHOLD_ID",
162  "CMS_RCT",
163  "L1CALOEMETTHRESH",
164  "L1CALOEMETTHRESH.NAME",
165  scaleKeyResults
166  ));
167 
168 
169 
170  if( scaleResults.queryFailed() ||
171  scaleResults.numberRows() != 1 ) // check query successful
172  {
173  edm::LogError( "L1-O2O" ) << "Problem with L1EmEtScale key." ;
174  return boost::shared_ptr< L1CaloEtScale >() ;
175  }
176  std::vector<double> m_thresholds;
177 
178  for( std::vector< std::string >::iterator thresh = queryStrings.begin();
179  thresh != queryStrings.end(); ++thresh) {
180  float tempScale = 0.0;
181  scaleResults.fillVariable(*thresh,tempScale);
182  m_thresholds.push_back(tempScale);
183  }
184 
185  l1t::OMDSReader::QueryResults lsbResults =
186  m_omdsReader.basicQuery("INPUTLSB",
187  "CMS_RCT",
188  "L1CALOEMETTHRESH",
189  "L1CALOEMETTHRESH.NAME",
190  scaleKeyResults
191  );
192  if( lsbResults.queryFailed() ||
193  lsbResults.numberRows() != 1 ) // check query successful
194  {
195  edm::LogError( "L1-O2O" ) << "Problem with L1EmEtScale key." ;
196  return boost::shared_ptr< L1CaloEtScale >() ;
197  }
198 
199  double m_lsb = 0.;
200  lsbResults.fillVariable(m_lsb);
201 
202  // std::cout << " input lsb " << m_lsb <<std::endl;
203 
204  //~~~~~~~~~ Instantiate new L1EmEtScale object. ~~~~~~~~~
205 
206  // Default objects for Lindsey
207 
208  return boost::shared_ptr< L1CaloEtScale >( new L1CaloEtScale( m_lsb,m_thresholds ) );
209 }
210 
211 
212 // ------------ method called to produce the data ------------
213 
214 
215 //define this as a plug-in
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
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)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:56
L1EmEtScaleOnlineProd(const edm::ParameterSet &)