CMS 3D CMS Logo

L1MuTriggerPtScaleOnlineProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // \class L1MuTriggerPtScaleOnlineProducer
4 //
5 // Description: A class to produce the L1 mu emulator scales record in the event setup
6 //
7 //
8 // Author :
9 // W. Sun (copied from L1MuTriggerScalesProducer)
10 //
11 //--------------------------------------------------
13 
14 // #define DEBUG_PT_SCALE
15 #ifdef DEBUG_PT_SCALE
16 #include <iostream>
17 #endif
18 
19 #include <sstream>
20 
21 using namespace std;
22 
25  m_signedPacking(ps.getParameter<bool>("signedPackingPt")),
26  m_nbitsPacking(ps.getParameter<int>("nbitPackingPt")),
27  m_nBins(ps.getParameter<int>("nbinsPt")) {}
28 
30 
31 //
32 // member functions
33 //
34 
35 // ------------ method called to produce the data ------------
36 std::unique_ptr<L1MuTriggerPtScale> L1MuTriggerPtScaleOnlineProducer::newObject(const std::string& objectKey) {
37  // find Pt key from main scales key
39  // SELECTed columns
40  "SC_MUON_PT_FK",
41  // schema name
42  "CMS_GT",
43  // table name
44  "L1T_SCALES",
45  // WHERE lhs
46  "L1T_SCALES.ID",
47  // WHERE rhs
48  m_omdsReader.singleAttribute(objectKey));
49 
50  if (keysRecord.numberRows() != 1) // check if query was successful
51  {
52  throw cond::Exception(
53  "Problem finding L1MuTriggerScales associated "
54  "with scales key " +
55  objectKey);
56  }
57 
58  /*
59 SQL> describe cms_gt.l1t_scale_muon_pt;
60  Name Null? Type
61  ----------------------------------------- -------- ----------------------------
62  ID NOT NULL VARCHAR2(300)
63  PT_GEV_BIN_LOW_0 NUMBER
64  [...]
65  PT_GEV_BIN_LOW_32 NUMBER
66  */
67 
68  ScaleRecordHelper h("PT_GEV_BIN_LOW", m_nBins);
69 
70  vector<string> columns;
71  h.pushColumnNames(columns);
72 
74  // SELECTed columns
75  columns,
76  // schema name
77  "CMS_GT",
78  // table name
79  "L1T_SCALE_MUON_PT",
80  // WHERE lhs
81  "L1T_SCALE_MUON_PT.ID",
82  // WHERE rhs
83  keysRecord);
84 
85  if (resultRecord.numberRows() != 1) {
86  throw cond::Exception("Couldn't find Pt scale record for scales key `" + objectKey + "'");
87  }
88 
89  vector<double> scales;
90  h.extractScales(resultRecord, scales);
91 
92  auto result = std::make_unique<L1MuTriggerPtScale>(m_nbitsPacking, m_signedPacking, m_nBins, scales);
93 
94 #ifdef DEBUG_PT_SCALE
95  cout << "PT scale:" << endl << result->getPtScale()->print() << endl;
96 #endif
97 
98  return result;
99 }
l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
electrons_cff.bool
bool
Definition: electrons_cff.py:393
L1MuTriggerPtScaleOnlineProducer::L1MuTriggerPtScaleOnlineProducer
L1MuTriggerPtScaleOnlineProducer(const edm::ParameterSet &)
Definition: L1MuTriggerPtScaleOnlineProducer.cc:23
L1MuTriggerPtScaleOnlineProducer.h
L1ConfigOnlineProdBase< L1MuTriggerPtScaleRcd, L1MuTriggerPtScale >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBase.h:65
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1ConfigOnlineProdBase
Definition: L1ConfigOnlineProdBase.h:52
L1MuTriggerPtScaleOnlineProducer::m_nBins
unsigned int m_nBins
Definition: L1MuTriggerPtScaleOnlineProducer.h:44
L1MuTriggerPtScaleOnlineProducer::~L1MuTriggerPtScaleOnlineProducer
~L1MuTriggerPtScaleOnlineProducer() override
Definition: L1MuTriggerPtScaleOnlineProducer.cc:29
L1MuTriggerPtScale
Definition: L1MuTriggerPtScale.h:33
h
ScaleRecordHelper
Definition: ScaleRecordHelper.h:21
L1MuTriggerPtScaleOnlineProducer::m_signedPacking
bool m_signedPacking
Definition: L1MuTriggerPtScaleOnlineProducer.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
createfilelist.int
int
Definition: createfilelist.py:10
l1t::OMDSReader::QueryResults::numberRows
int numberRows() const
Definition: OMDSReader.h:60
cond::Exception
persistency::Exception Exception
Definition: Exception.h:25
L1MuTriggerPtScaleOnlineProducer::m_nbitsPacking
unsigned int m_nbitsPacking
Definition: L1MuTriggerPtScaleOnlineProducer.h:43
L1MuTriggerPtScaleRcd
Definition: L1MuTriggerPtScaleRcd.h:12
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
std
Definition: JetResolutionObject.h:76
mps_check.columns
columns
Definition: mps_check.py:244
mps_fire.result
result
Definition: mps_fire.py:311
L1MuTriggerPtScaleOnlineProducer::newObject
std::unique_ptr< L1MuTriggerPtScale > newObject(const std::string &objectKey) override
Definition: L1MuTriggerPtScaleOnlineProducer.cc:36