test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1HfRingEtScaleOnlineProd.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1HfRingEtScaleOnlineProd
4 // Class: L1HfRingEtScaleOnlineProd
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< L1HfRingEtScaleRcd, 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 ring scale key
108  l1t::OMDSReader::QueryResults hfRingScaleKeyResults =
110  "SC_HF_ET_SUM_FK",
111  "CMS_GT",
112  "L1T_SCALES",
113  "L1T_SCALES.ID",
114  scalesKeyResults );
115 
116  std::string hfRingScaleKey ;
117 
118  if( hfRingScaleKeyResults.queryFailed() ) {
119  edm::LogError("L1-O2O")
120  << "Problem with key for L1HfRingEtScaleRcd : HF ring Et scale key query failed ";
121  }
122  else if( hfRingScaleKeyResults.numberRows() != 1 ) {
123  edm::LogError("L1-O2O")
124  << "Problem with key for L1HfRingEtScaleRcd : "
125  << (hfRingScaleKeyResults.numberRows()) << " rows were returned when getting HF ring Et scale key";
126  }
127  else {
128  hfRingScaleKeyResults.fillVariable( hfRingScaleKey ) ;
129  }
130 
131  // get thresholds
132  std::vector< std::string > queryStrings ;
133  queryStrings.push_back( "E_GEV_BIN_LOW_0");
134  queryStrings.push_back( "E_GEV_BIN_LOW_1");
135  queryStrings.push_back( "E_GEV_BIN_LOW_2");
136  queryStrings.push_back( "E_GEV_BIN_LOW_3");
137  queryStrings.push_back( "E_GEV_BIN_LOW_4");
138  queryStrings.push_back( "E_GEV_BIN_LOW_5");
139  queryStrings.push_back( "E_GEV_BIN_LOW_6");
140  queryStrings.push_back( "E_GEV_BIN_LOW_7");
141 
142  l1t::OMDSReader::QueryResults scaleResults =
143  m_omdsReader.basicQuery( queryStrings,
144  "CMS_GT",
145  "L1T_SCALE_HF_ET_SUM",
146  "L1T_SCALE_HF_ET_SUM.ID",
147  hfRingScaleKeyResults
148  );
149 
150  std::vector<double> thresholds;
151 
152  if( scaleResults.queryFailed() ) {
153  edm::LogError( "L1-O2O" ) << "Problem with L1HfRingEtScale key : scale query failed." ;
154  }
155  else if ( scaleResults.numberRows() != 1 ) {
156  edm::LogError( "L1-O2O" ) << "Problem with L1HfRingEtScale key : scale query failed." ;
157  }
158  else {
159  for( std::vector< std::string >::iterator thresh = queryStrings.begin();
160  thresh != queryStrings.end(); ++thresh) {
161  float tempScale = 0.;
162  scaleResults.fillVariable(*thresh,tempScale);
163  thresholds.push_back(tempScale);
164  }
165  }
166 
167  // get region LSB
168  double rgnEtLsb=0.;
169 
170  l1t::OMDSReader::QueryResults lsbResults =
171  m_omdsReader.basicQuery( "GCT_RGN_ET_LSB",
172  "CMS_GCT",
173  "GCT_PHYS_PARAMS",
174  "GCT_PHYS_PARAMS.CONFIG_KEY",
175  m_omdsReader.singleAttribute( objectKey ) ) ;
176 
177  if( lsbResults.queryFailed() ) {
178  edm::LogError( "L1-O2O" ) << "Problem with L1JetEtScale key." ;
179  }
180  else {
181  lsbResults.fillVariable( "GCT_RGN_ET_LSB", rgnEtLsb );
182  }
183 
184  //~~~~~~~~~ Instantiate new L1HfRingEtScale object. ~~~~~~~~~
185  return boost::shared_ptr< L1CaloEtScale >( new L1CaloEtScale(0xff, 0x7, rgnEtLsb, thresholds ) );
186 }
187 
188 
189 // ------------ method called to produce the data ------------
190 
191 
192 //define this as a plug-in
L1HfRingEtScaleOnlineProd(const edm::ParameterSet &)
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
dictionary thresholds
Definition: fff_deleter.py:273
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