CMS 3D CMS Logo

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 // system include files
20 
21 // user include files
23 
26 
27 //
28 // class declaration
29 //
30 
31 class L1JetEtScaleOnlineProd : public L1ConfigOnlineProdBase<L1JetEtScaleRcd, L1CaloEtScale> {
32 public:
34  ~L1JetEtScaleOnlineProd() override;
35 
36  std::unique_ptr<L1CaloEtScale> newObject(const std::string& objectKey) override;
37 
38 private:
39  // ----------member data ---------------------------
40 };
41 
42 //
43 // constants, enums and typedefs
44 //
45 
46 //
47 // static data member definitions
48 //
49 
50 //
51 // constructors and destructor
52 //
55  //the following line is needed to tell the framework what
56  // data is being produced
57 
58  //now do what ever other initialization is needed
59 }
60 
62  // do anything here that needs to be done at desctruction time
63  // (e.g. close files, deallocate resources etc.)
64 }
65 
66 std::unique_ptr<L1CaloEtScale> L1JetEtScaleOnlineProd::newObject(const std::string& objectKey) {
67  // get scales keys
68  l1t::OMDSReader::QueryResults scalesKeyResults = m_omdsReader.basicQuery("GCT_SCALES_KEY",
69  "CMS_GCT",
70  "GCT_PHYS_PARAMS",
71  "GCT_PHYS_PARAMS.CONFIG_KEY",
72  m_omdsReader.singleAttribute(objectKey));
73 
74  std::string scalesKey;
75 
76  if (scalesKeyResults.queryFailed()) {
77  edm::LogError("L1-O2O") << "Problem with key for L1JetEtScaleRcd : GCT scales key query failed ";
78  } else if (scalesKeyResults.numberRows() != 1) {
79  edm::LogError("L1-O2O") << "Problem with key for L1JetEtScaleRcd : " << (scalesKeyResults.numberRows())
80  << " rows were returned when getting GCT scales key";
81  } else {
82  scalesKeyResults.fillVariable(scalesKey);
83  }
84 
85  // get jet scale key
86  l1t::OMDSReader::QueryResults jetScaleKeyResults =
87  m_omdsReader.basicQuery("SC_CENJET_ET_THRESHOLD_FK", "CMS_GT", "L1T_SCALES", "L1T_SCALES.ID", scalesKeyResults);
88 
89  std::string jetScaleKey;
90 
91  if (jetScaleKeyResults.queryFailed()) {
92  edm::LogError("L1-O2O") << "Problem with key for L1GctJetEtScaleRcd : jet scale key query failed ";
93  } else if (jetScaleKeyResults.numberRows() != 1) {
94  edm::LogError("L1-O2O") << "Problem with key for L1GctJetEtScaleRcd : " << (jetScaleKeyResults.numberRows())
95  << " rows were returned when getting jet Et scale key";
96  } else {
97  jetScaleKeyResults.fillVariable(jetScaleKey);
98  }
99 
100  // get thresholds
101  std::vector<std::string> queryStrings;
102  queryStrings.push_back("ET_GEV_BIN_LOW_0");
103  queryStrings.push_back("ET_GEV_BIN_LOW_1");
104  queryStrings.push_back("ET_GEV_BIN_LOW_2");
105  queryStrings.push_back("ET_GEV_BIN_LOW_3");
106  queryStrings.push_back("ET_GEV_BIN_LOW_4");
107  queryStrings.push_back("ET_GEV_BIN_LOW_5");
108  queryStrings.push_back("ET_GEV_BIN_LOW_6");
109  queryStrings.push_back("ET_GEV_BIN_LOW_7");
110  queryStrings.push_back("ET_GEV_BIN_LOW_8");
111  queryStrings.push_back("ET_GEV_BIN_LOW_9");
112  queryStrings.push_back("ET_GEV_BIN_LOW_10");
113  queryStrings.push_back("ET_GEV_BIN_LOW_11");
114  queryStrings.push_back("ET_GEV_BIN_LOW_12");
115  queryStrings.push_back("ET_GEV_BIN_LOW_13");
116  queryStrings.push_back("ET_GEV_BIN_LOW_14");
117  queryStrings.push_back("ET_GEV_BIN_LOW_15");
118  queryStrings.push_back("ET_GEV_BIN_LOW_16");
119  queryStrings.push_back("ET_GEV_BIN_LOW_17");
120  queryStrings.push_back("ET_GEV_BIN_LOW_18");
121  queryStrings.push_back("ET_GEV_BIN_LOW_19");
122  queryStrings.push_back("ET_GEV_BIN_LOW_20");
123  queryStrings.push_back("ET_GEV_BIN_LOW_21");
124  queryStrings.push_back("ET_GEV_BIN_LOW_22");
125  queryStrings.push_back("ET_GEV_BIN_LOW_23");
126  queryStrings.push_back("ET_GEV_BIN_LOW_24");
127  queryStrings.push_back("ET_GEV_BIN_LOW_25");
128  queryStrings.push_back("ET_GEV_BIN_LOW_26");
129  queryStrings.push_back("ET_GEV_BIN_LOW_27");
130  queryStrings.push_back("ET_GEV_BIN_LOW_28");
131  queryStrings.push_back("ET_GEV_BIN_LOW_29");
132  queryStrings.push_back("ET_GEV_BIN_LOW_30");
133  queryStrings.push_back("ET_GEV_BIN_LOW_31");
134  queryStrings.push_back("ET_GEV_BIN_LOW_32");
135  queryStrings.push_back("ET_GEV_BIN_LOW_33");
136  queryStrings.push_back("ET_GEV_BIN_LOW_34");
137  queryStrings.push_back("ET_GEV_BIN_LOW_35");
138  queryStrings.push_back("ET_GEV_BIN_LOW_36");
139  queryStrings.push_back("ET_GEV_BIN_LOW_37");
140  queryStrings.push_back("ET_GEV_BIN_LOW_38");
141  queryStrings.push_back("ET_GEV_BIN_LOW_39");
142  queryStrings.push_back("ET_GEV_BIN_LOW_40");
143  queryStrings.push_back("ET_GEV_BIN_LOW_41");
144  queryStrings.push_back("ET_GEV_BIN_LOW_42");
145  queryStrings.push_back("ET_GEV_BIN_LOW_43");
146  queryStrings.push_back("ET_GEV_BIN_LOW_44");
147  queryStrings.push_back("ET_GEV_BIN_LOW_45");
148  queryStrings.push_back("ET_GEV_BIN_LOW_46");
149  queryStrings.push_back("ET_GEV_BIN_LOW_47");
150  queryStrings.push_back("ET_GEV_BIN_LOW_48");
151  queryStrings.push_back("ET_GEV_BIN_LOW_49");
152  queryStrings.push_back("ET_GEV_BIN_LOW_50");
153  queryStrings.push_back("ET_GEV_BIN_LOW_51");
154  queryStrings.push_back("ET_GEV_BIN_LOW_52");
155  queryStrings.push_back("ET_GEV_BIN_LOW_53");
156  queryStrings.push_back("ET_GEV_BIN_LOW_54");
157  queryStrings.push_back("ET_GEV_BIN_LOW_55");
158  queryStrings.push_back("ET_GEV_BIN_LOW_56");
159  queryStrings.push_back("ET_GEV_BIN_LOW_57");
160  queryStrings.push_back("ET_GEV_BIN_LOW_58");
161  queryStrings.push_back("ET_GEV_BIN_LOW_59");
162  queryStrings.push_back("ET_GEV_BIN_LOW_60");
163  queryStrings.push_back("ET_GEV_BIN_LOW_61");
164  queryStrings.push_back("ET_GEV_BIN_LOW_62");
165  queryStrings.push_back("ET_GEV_BIN_LOW_63");
166 
168  queryStrings, "CMS_GT", "L1T_SCALE_CALO_ET_THRESHOLD", "L1T_SCALE_CALO_ET_THRESHOLD.ID", jetScaleKeyResults);
169 
170  std::vector<double> thresholds;
171 
172  if (scaleResults.queryFailed() || scaleResults.numberRows() != 1) // check query successful
173  {
174  edm::LogError("L1-O2O") << "Problem with L1JetEtScale key : when reading scale.";
175  } else {
176  for (std::vector<std::string>::iterator thresh = queryStrings.begin(); thresh != queryStrings.end(); ++thresh) {
177  float tempScale = 0.0;
178  scaleResults.fillVariable(*thresh, tempScale);
179  thresholds.push_back(tempScale);
180  }
181  }
182 
183  // get region LSB
184  double rgnEtLsb = 0.;
185 
186  l1t::OMDSReader::QueryResults lsbResults = m_omdsReader.basicQuery("GCT_RGN_ET_LSB",
187  "CMS_GCT",
188  "GCT_PHYS_PARAMS",
189  "GCT_PHYS_PARAMS.CONFIG_KEY",
190  m_omdsReader.singleAttribute(objectKey));
191 
192  if (lsbResults.queryFailed()) {
193  edm::LogError("L1-O2O") << "Problem with L1JetEtScale key.";
194  } else {
195  lsbResults.fillVariable("GCT_RGN_ET_LSB", rgnEtLsb);
196  }
197 
198  // return object
199  return std::make_unique<L1CaloEtScale>(rgnEtLsb, thresholds);
200 }
201 
202 // ------------ method called to produce the data ------------
203 
204 //define this as a plug-in
l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
particleFlowZeroSuppressionECAL_cff.thresholds
thresholds
Definition: particleFlowZeroSuppressionECAL_cff.py:31
L1ConfigOnlineProdBase< L1JetEtScaleRcd, L1CaloEtScale >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBase.h:65
L1JetEtScaleOnlineProd
Definition: L1JetEtScaleOnlineProd.cc:31
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1ConfigOnlineProdBase
Definition: L1ConfigOnlineProdBase.h:52
l1t::OMDSReader::QueryResults::fillVariable
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
L1JetEtScaleRcd
Definition: L1JetEtScaleRcd.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
l1t::OMDSReader::QueryResults::numberRows
int numberRows() const
Definition: OMDSReader.h:60
L1CaloEtScale
Definition: L1CaloEtScale.h:29
l1t::OMDSReader::basicQuery
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:75
GOODCOLL_filter_cfg.thresh
thresh
Definition: GOODCOLL_filter_cfg.py:74
L1CaloEtScale.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
l1t::OMDSReader::QueryResults::queryFailed
bool queryFailed() const
Definition: OMDSReader.h:59
L1JetEtScaleOnlineProd::~L1JetEtScaleOnlineProd
~L1JetEtScaleOnlineProd() override
Definition: L1JetEtScaleOnlineProd.cc:61
L1JetEtScaleOnlineProd::newObject
std::unique_ptr< L1CaloEtScale > newObject(const std::string &objectKey) override
Definition: L1JetEtScaleOnlineProd.cc:66
L1JetEtScaleRcd.h
L1ConfigOnlineProdBase.h
L1JetEtScaleOnlineProd::L1JetEtScaleOnlineProd
L1JetEtScaleOnlineProd(const edm::ParameterSet &)
Definition: L1JetEtScaleOnlineProd.cc:53