CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1GtPrescaleFactorsTechTrigConfigOnlineProd Class Reference

#include <L1GtPrescaleFactorsTechTrigConfigOnlineProd.h>

Inheritance diagram for L1GtPrescaleFactorsTechTrigConfigOnlineProd:
L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1GtPrescaleFactorsTechTrigConfigOnlineProd (const edm::ParameterSet &)
 constructor More...
 
virtual boost::shared_ptr
< L1GtPrescaleFactors
newObject (const std::string &objectKey)
 public methods More...
 
 ~L1GtPrescaleFactorsTechTrigConfigOnlineProd ()
 destructor More...
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
boost::shared_ptr
< L1GtPrescaleFactors
produce (const L1GtPrescaleFactorsTechTrigRcd &iRecord)
 
 ~L1ConfigOnlineProdBase ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 

Private Attributes

bool m_isDebugEnabled
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >
bool getObjectKey (const L1GtPrescaleFactorsTechTrigRcd &record, boost::shared_ptr< L1GtPrescaleFactors > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Attributes inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Description: online producer for L1GtPrescaleFactorsTechTrigRcd.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 32 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.

Constructor & Destructor Documentation

L1GtPrescaleFactorsTechTrigConfigOnlineProd::L1GtPrescaleFactorsTechTrigConfigOnlineProd ( const edm::ParameterSet parSet)
L1GtPrescaleFactorsTechTrigConfigOnlineProd::~L1GtPrescaleFactorsTechTrigConfigOnlineProd ( )

destructor

Definition at line 37 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.

37  {
38 
39  // empty
40 
41 }

Member Function Documentation

boost::shared_ptr< L1GtPrescaleFactors > L1GtPrescaleFactorsTechTrigConfigOnlineProd::newObject ( const std::string &  objectKey)
virtual

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >.

Definition at line 45 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), l1t::OMDSReader::basicQueryView(), l1t::OMDSReader::columnNames(), l1t::OMDSReader::QueryResults::fillVariable(), l1t::OMDSReader::QueryResults::fillVariableFromRow(), i, edm::isDebugEnabled(), getDQMSummary::iter, LogTrace, m_isDebugEnabled, L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), python.entryComment::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

46  {
47 
48  // FIXME seems to not work anymore in constructor...
50 
51  // shared pointer for L1GtPrescaleFactors
52  boost::shared_ptr<L1GtPrescaleFactors> pL1GtPrescaleFactors =
53  boost::shared_ptr<L1GtPrescaleFactors>(new L1GtPrescaleFactors());
54 
55  // Procedure:
56  // objectKey received as input is GT_RUN_SETTINGS_FK
57  //
58  // get from GT_RUN_SETTINGS_PRESC_VIEW the PRESCALE_FACTORS_TT_FK and the index PRESCALE_INDEX
59  // for the GT_RUN_SETTINGS_FK
60  //
61  // get the prescale factors for key PRESCALE_FACTORS_TT_FK
62  // from GT_FDL_PRESCALE_FACTORS_TT table
63 
64  const std::string gtSchema = "CMS_GT";
65 
66  // select * from CMS_GT.GT_RUN_SETTINGS_PRESC_VIEW
67  // where GT_RUN_SETTINGS_PRESC_VIEW.ID = objectKey
68 
69  std::vector<std::string> columnsView;
70  columnsView.push_back("PRESCALE_INDEX");
71  columnsView.push_back("PRESCALE_FACTORS_TT_FK");
72 
74  columnsView, gtSchema, "GT_RUN_SETTINGS_PRESC_VIEW",
75  "GT_RUN_SETTINGS_PRESC_VIEW.ID", m_omdsReader.singleAttribute(
76  objectKey));
77 
78  // check if query was successful
79  if (resultsView.queryFailed()) {
80  edm::LogError("L1-O2O")
81  << "Problem to get content of GT_RUN_SETTINGS_PRESC_VIEW "
82  << "for GT_RUN_SETTINGS_PRESC_VIEW.ID: " << objectKey;
83  return pL1GtPrescaleFactors;
84  }
85 
86  // retrieve PRESCALE_INDEX and PRESCALE_FACTORS_TT_FK for GT_RUN_SETTINGS_FK
87 
88  std::string objectKeyPrescaleFactorsSet = "WRONG_KEY_INITIAL";
89  short prescaleFactorsSetIndex = 9999;
90 
91  int resultsViewRows = resultsView.numberRows();
92  if (m_isDebugEnabled) {
93  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << "\nFound "
94  << resultsViewRows << " prescale factors sets for \n "
95  << "GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey << "\n"
96  << std::endl;
97  }
98 
99  // vector to be filled (resultsViewRows prescale factors sets)
100  std::vector<std::vector<int> > pFactors;
101  pFactors.reserve(resultsViewRows);
102 
103  int countSet = -1;
104 
105  for (int iRow = 0; iRow < resultsViewRows; ++iRow) {
106 
107  for (std::vector<std::string>::const_iterator constIt =
108  columnsView.begin(); constIt != columnsView.end(); ++constIt) {
109 
110  if ((*constIt) == "PRESCALE_INDEX") {
111  resultsView.fillVariableFromRow(*constIt, iRow,
112  prescaleFactorsSetIndex);
113  } else if ((*constIt) == "PRESCALE_FACTORS_TT_FK") {
114  resultsView.fillVariableFromRow(*constIt, iRow,
115  objectKeyPrescaleFactorsSet);
116  } else {
117 
118  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
119  << "\nUnknown field " << (*constIt)
120  << " requested for columns in GT_RUN_SETTINGS_PRESC_VIEW"
121  << std::endl;
122 
123  }
124  }
125 
126  if (m_isDebugEnabled) {
127  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
128  << "\nFound prescale factors set: \n index = "
129  << prescaleFactorsSetIndex
130  << "\n PRESCALE_FACTORS_TT_FK = "
131  << objectKeyPrescaleFactorsSet << "\n" << std::endl;
132  }
133 
134  // retrive now the prescale factors for PRESCALE_FACTORS_TT_FK
135 
136 
137  // SQL query:
138  //
139  // select * from CMS_GT.GT_FDL_PRESCALE_FACTORS_TT
140  // WHERE GT_FDL_PRESCALE_FACTORS_TT.ID = objectKeyPrescaleFactorsSet
141  const std::vector<std::string>& columns = m_omdsReader.columnNames(
142  gtSchema, "GT_FDL_PRESCALE_FACTORS_TT");
143 
144  if (m_isDebugEnabled) {
145  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
146  << "\nColumn names for GT_FDL_PRESCALE_FACTORS_TT"
147  << std::endl;
148 
149  for (std::vector<std::string>::const_iterator iter =
150  columns.begin(); iter != columns.end(); iter++) {
151  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
152  << (*iter) << std::endl;
153 
154  }
155  }
156 
158  columns, gtSchema, "GT_FDL_PRESCALE_FACTORS_TT",
159  "GT_FDL_PRESCALE_FACTORS_TT.ID",
160  m_omdsReader.singleAttribute(objectKeyPrescaleFactorsSet));
161 
162  // check if query was successful
163  if (results.queryFailed()) {
164  edm::LogError("L1-O2O")
165  << "Problem with L1GtPrescaleFactorsTechTrigRcd key:"
166  << objectKeyPrescaleFactorsSet;
167  return pL1GtPrescaleFactors;
168  }
169 
170 
171 
172 
173  // check if set indices are ordered, starting from 0 (initial value for countSet is -1)
174  countSet++;
175  if (prescaleFactorsSetIndex != countSet) {
176  edm::LogError("L1-O2O")
177  << "L1GtPrescaleFactorsTechTrig has unordered sets PRESCALE_INDEX in DB for\n"
178  << " GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey << "\n"
179  << std::endl;
180  return pL1GtPrescaleFactors;
181 
182  }
183 
184 
185  // fill one set of prescale factors
186  int pfSetSize = columns.size() - 1; // table ID is also in columns
187  std::vector<int> pfSet(pfSetSize, 0);
188 
189  for (int i = 0; i < pfSetSize; i++) {
190  results.fillVariable(columns[i + 1], pfSet[i]);
191  }
192 
193  pFactors.push_back(pfSet);
194 
195  }
196 
197  // fill the record
198 
199  pL1GtPrescaleFactors->setGtPrescaleFactors(pFactors);
200 
201  if (m_isDebugEnabled) {
202  std::ostringstream myCoutStream;
203  pL1GtPrescaleFactors->print(myCoutStream);
204  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
205  << "\nThe following L1GtPrescaleFactorsTechTrigRcd record was read from OMDS: \n"
206  << myCoutStream.str() << "\n" << std::endl;
207  }
208 
209  return pL1GtPrescaleFactors;
210 }
bool isDebugEnabled()
int i
Definition: DBlmapReader.cc:9
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:319
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 LogTrace(id)
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName) const
Definition: OMDSReader.cc:165
const QueryResults basicQueryView(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &viewName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
Definition: OMDSReader.cc:191

Member Data Documentation

bool L1GtPrescaleFactorsTechTrigConfigOnlineProd::m_isDebugEnabled
private

Definition at line 49 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.

Referenced by newObject().