CMS 3D CMS Logo

List of all members | Public Member Functions
CSCTFConfigOnlineProd Class Reference

#include <CSCTFConfigOnlineProd.h>

Inheritance diagram for CSCTFConfigOnlineProd:
L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 CSCTFConfigOnlineProd (const edm::ParameterSet &iConfig)
 
std::unique_ptr< L1MuCSCTFConfigurationnewObject (const std::string &objectKey) override
 
 ~CSCTFConfigOnlineProd () override
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::unique_ptr< L1MuCSCTFConfigurationproduce (const L1MuCSCTFConfigurationRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
bool getObjectKey (const L1MuCSCTFConfigurationRcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Attributes inherited from L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Definition at line 5 of file CSCTFConfigOnlineProd.h.

Constructor & Destructor Documentation

◆ CSCTFConfigOnlineProd()

CSCTFConfigOnlineProd::CSCTFConfigOnlineProd ( const edm::ParameterSet iConfig)
inline

◆ ~CSCTFConfigOnlineProd()

CSCTFConfigOnlineProd::~CSCTFConfigOnlineProd ( )
inlineoverride

Definition at line 9 of file CSCTFConfigOnlineProd.h.

9 {}

Member Function Documentation

◆ newObject()

std::unique_ptr< L1MuCSCTFConfiguration > CSCTFConfigOnlineProd::newObject ( const std::string &  objectKey)
overridevirtual

Implements L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >.

Definition at line 5 of file CSCTFConfigOnlineProd.cc.

5  {
6  edm::LogInfo("L1-O2O: CSCTFConfigOnlineProd") << "Producing "
7  << "L1MuCSCTFConfiguration "
8  << "with key CSCTF_KEY=" << objectKey;
9 
10  std::string csctfreg[12];
11 
12  // loop over the 12 SPs forming the CSCTF crate
13  for (int iSP = 1; iSP < 13; iSP++) {
14  std::string spkey = objectKey + "00";
15  if (iSP < 10)
16  spkey += "0";
17  spkey += std::to_string(iSP);
18 
19  // SELECT Multiple columns FROM TABLE with correct key:
20  std::vector<std::string> columns;
21  columns.push_back("STATIC_CONFIG");
22  columns.push_back("ETA_CONFIG");
23  columns.push_back("FIRMWARE");
24 
25  //SELECT * FROM CMS_CSC_TF.CSCTF_SP_CONF WHERE CSCTF_SP_CONF.SP_KEY = spkey
27  columns, "CMS_CSC_TF", "CSCTF_SP_CONF", "CSCTF_SP_CONF.SP_KEY", m_omdsReader.singleAttribute(spkey));
28 
29  if (results.queryFailed()) // check if query was successful
30  {
31  edm::LogError("L1-O2O") << "Problem with L1CSCTFParameters key.";
32  // return empty configuration
33  return std::make_unique<L1MuCSCTFConfiguration>();
34  }
35 
36  std::string conf_stat, conf_eta, conf_firmware;
37  results.fillVariable("STATIC_CONFIG", conf_stat);
38  results.fillVariable("ETA_CONFIG", conf_eta);
39  results.fillVariable("FIRMWARE", conf_firmware);
40 
41  LogDebug("L1-O2O: CSCTFConfigOnlineProd:") << "conf_stat queried: " << conf_stat << "conf_eta queried:" << conf_eta
42  << "conf_firmware queried:" << conf_firmware;
43 
44  for (size_t pos = conf_stat.find("\\n"); pos != std::string::npos; pos = conf_stat.find("\\n", pos)) {
45  conf_stat[pos] = ' ';
46  conf_stat[pos + 1] = '\n';
47  }
48 
49  for (size_t pos = conf_eta.find("\\n"); pos != std::string::npos; pos = conf_eta.find("\\n", pos)) {
50  conf_eta[pos] = ' ';
51  conf_eta[pos + 1] = '\n';
52  }
53 
54  for (size_t pos = conf_firmware.find("\\n"); pos != std::string::npos; pos = conf_firmware.find("\\n", pos)) {
55  conf_firmware[pos] = ' ';
56  conf_firmware[pos + 1] = '\n';
57  }
58 
59  LogDebug("L1-O2O: CSCTFConfigOnlineProd") << "\nSP KEY: " << spkey << "\n\nSTATIC CONFIGURATION:\n"
60  << conf_stat << "\nDAT_ETA CONFIGURATION:\n"
61  << conf_eta << "\nFIRMWARE VERSIONS:\n"
62  << conf_firmware;
63 
64  // The CSCTF firmware needs a bit more manipulation
65  // The firmware is written in the DBS as SP SP day/month/year, where the real year is 2000+year
66  // For easy handling when retrieving the configuration I prefer to write is as
67  // FIRMWARE SP SP yearmonthday
68  // e.g. SP SP 26/06/09 -> FIRMWARE SP SP 20090626
69 
70  std::string conf_firmware_sp;
71 
72  std::stringstream conf(conf_firmware);
73  while (!conf.eof()) {
74  char buff[1024];
75  conf.getline(buff, 1024);
76  std::stringstream line(buff);
77 
78  std::string register_ = "FIRMWARE";
79  std::string chip_;
80  line >> chip_;
81  std::string muon_;
82  line >> muon_;
83  std::string writeValue_;
84  line >> writeValue_;
85 
86  size_t pos;
87  pos = writeValue_.find('/');
88 
90  day.push_back(writeValue_[pos - 2]);
91  day.push_back(writeValue_[pos - 1]);
92 
93  std::string month;
94  month.push_back(writeValue_[pos + 1]);
95  month.push_back(writeValue_[pos + 2]);
96 
97  std::string year("20");
98  year.push_back(writeValue_[pos + 4]);
99  year.push_back(writeValue_[pos + 5]);
100 
101  //std::cout << "day " << day <<std::endl;
102  //std::cout << "month " << month <<std::endl;
103  //std::cout << "year " << year <<std::endl;
104 
105  std::string date = year + month + day;
106  // std::cout << register_ << " -- "
107  // << chip_ << " -- "
108  // << muon_ << " -- "
109  // << date << " -- "
110  // << std::endl;
111 
112  // for the CSCTF emulator there is no need of the other firmware (CCB and MS)
113  if (chip_ == "SP")
114  conf_firmware_sp += register_ + " " + chip_ + " " + muon_ + " " + date + "\n";
115  }
116 
117  edm::LogInfo("L1-O2O: CSCTFConfigOnlineProd") << "\nSP KEY: " << spkey << "\n\nSTATIC CONFIGURATION:\n"
118  << conf_stat << "\nDAT_ETA CONFIGURATION:\n"
119  << conf_eta << "\nFIRMWARE VERSIONS:\n"
120  << conf_firmware_sp;
121 
122  std::string conf_read = conf_eta + conf_stat + conf_firmware_sp;
123  // write all registers for a given SP
124  csctfreg[iSP - 1] = conf_read;
125  }
126 
127  // return the final object with the configuration for all CSCTF
128  return std::make_unique<L1MuCSCTFConfiguration>(csctfreg);
129 }

References l1t::OMDSReader::basicQuery(), mps_check::columns, indexGen::date, util.getRunInfo::day(), mps_splice::line, LogDebug, L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >::m_omdsReader, bookConverter::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBase.h:65
pos
Definition: PixelAliasList.h:18
edm::LogInfo
Definition: MessageLogger.h:254
bookConverter.results
results
Definition: bookConverter.py:144
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
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
util.getRunInfo.day
def day(string)
Definition: getRunInfo.py:11
indexGen.date
date
Definition: indexGen.py:99
mps_check.columns
columns
Definition: mps_check.py:244
mps_splice.line
line
Definition: mps_splice.py:76