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 // $Id: L1HfRingEtScaleOnlineProd.cc,v 1.5 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< L1HfRingEtScaleRcd, 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 L1HfRingEtScaleOnlineProd::newObject( const std::string& objectKey )
80 {
81  using namespace edm::es;
82 
83  // get scales keys
84  l1t::OMDSReader::QueryResults scalesKeyResults =
86  "GCT_SCALES_KEY",
87  "CMS_GCT",
88  "GCT_PHYS_PARAMS",
89  "GCT_PHYS_PARAMS.CONFIG_KEY",
90  m_omdsReader.singleAttribute( objectKey ) );
91 
92  std::string scalesKey ;
93 
94  if( scalesKeyResults.queryFailed() ) {
95  edm::LogError("L1-O2O")
96  << "Problem with key for L1JetEtScaleRcd : GCT scales key query failed ";
97  }
98  else if( scalesKeyResults.numberRows() != 1 ) {
99  edm::LogError("L1-O2O")
100  << "Problem with key for L1JetEtScaleRcd : "
101  << (scalesKeyResults.numberRows()) << " rows were returned when getting GCT scales key";
102  }
103  else {
104  scalesKeyResults.fillVariable( scalesKey );
105  }
106 
107 
108  // get ring scale key
109  l1t::OMDSReader::QueryResults hfRingScaleKeyResults =
111  "SC_HF_ET_SUM_FK",
112  "CMS_GT",
113  "L1T_SCALES",
114  "L1T_SCALES.ID",
115  scalesKeyResults );
116 
117  std::string hfRingScaleKey ;
118 
119  if( hfRingScaleKeyResults.queryFailed() ) {
120  edm::LogError("L1-O2O")
121  << "Problem with key for L1HfRingEtScaleRcd : HF ring Et scale key query failed ";
122  }
123  else if( hfRingScaleKeyResults.numberRows() != 1 ) {
124  edm::LogError("L1-O2O")
125  << "Problem with key for L1HfRingEtScaleRcd : "
126  << (hfRingScaleKeyResults.numberRows()) << " rows were returned when getting HF ring Et scale key";
127  }
128  else {
129  hfRingScaleKeyResults.fillVariable( hfRingScaleKey ) ;
130  }
131 
132  // get thresholds
133  std::vector< std::string > queryStrings ;
134  queryStrings.push_back( "E_GEV_BIN_LOW_0");
135  queryStrings.push_back( "E_GEV_BIN_LOW_1");
136  queryStrings.push_back( "E_GEV_BIN_LOW_2");
137  queryStrings.push_back( "E_GEV_BIN_LOW_3");
138  queryStrings.push_back( "E_GEV_BIN_LOW_4");
139  queryStrings.push_back( "E_GEV_BIN_LOW_5");
140  queryStrings.push_back( "E_GEV_BIN_LOW_6");
141  queryStrings.push_back( "E_GEV_BIN_LOW_7");
142 
143  l1t::OMDSReader::QueryResults scaleResults =
144  m_omdsReader.basicQuery( queryStrings,
145  "CMS_GT",
146  "L1T_SCALE_HF_ET_SUM",
147  "L1T_SCALE_HF_ET_SUM.ID",
148  hfRingScaleKeyResults
149  );
150 
151  std::vector<double> thresholds;
152 
153  if( scaleResults.queryFailed() ) {
154  edm::LogError( "L1-O2O" ) << "Problem with L1HfRingEtScale key : scale query failed." ;
155  }
156  else if ( scaleResults.numberRows() != 1 ) {
157  edm::LogError( "L1-O2O" ) << "Problem with L1HfRingEtScale key : scale query failed." ;
158  }
159  else {
160  for( std::vector< std::string >::iterator thresh = queryStrings.begin();
161  thresh != queryStrings.end(); ++thresh) {
162  float tempScale = 0.;
163  scaleResults.fillVariable(*thresh,tempScale);
164  thresholds.push_back(tempScale);
165  }
166  }
167 
168  // get region LSB
169  double rgnEtLsb=0.;
170 
171  l1t::OMDSReader::QueryResults lsbResults =
172  m_omdsReader.basicQuery( "GCT_RGN_ET_LSB",
173  "CMS_GCT",
174  "GCT_PHYS_PARAMS",
175  "GCT_PHYS_PARAMS.CONFIG_KEY",
176  m_omdsReader.singleAttribute( objectKey ) ) ;
177 
178  if( lsbResults.queryFailed() ) {
179  edm::LogError( "L1-O2O" ) << "Problem with L1JetEtScale key." ;
180  }
181  else {
182  lsbResults.fillVariable( "GCT_RGN_ET_LSB", rgnEtLsb );
183  }
184 
185  //~~~~~~~~~ Instantiate new L1HfRingEtScale object. ~~~~~~~~~
186  return boost::shared_ptr< L1CaloEtScale >( new L1CaloEtScale(0xff, 0x7, rgnEtLsb, thresholds ) );
187 }
188 
189 
190 // ------------ method called to produce the data ------------
191 
192 
193 //define this as a plug-in
L1HfRingEtScaleOnlineProd(const edm::ParameterSet &)
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
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:56
virtual boost::shared_ptr< L1CaloEtScale > newObject(const std::string &objectKey)