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::shared_ptr< L1MuCSCTFConfigurationnewObject (const std::string &objectKey) override
 
 ~CSCTFConfigOnlineProd () override
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::shared_ptr< L1MuCSCTFConfigurationproduce (const L1MuCSCTFConfigurationRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- 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 () noexcept(false)
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
bool getObjectKey (const L1MuCSCTFConfigurationRcd &record, std::shared_ptr< L1MuCSCTFConfiguration > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 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< 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 ( const edm::ParameterSet iConfig)
inline
CSCTFConfigOnlineProd::~CSCTFConfigOnlineProd ( )
inlineoverride

Definition at line 9 of file CSCTFConfigOnlineProd.h.

References newObject(), and AlCaHLTBitMon_QueryRunRegistry::string.

9 {}

Member Function Documentation

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

Implements L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >.

Definition at line 6 of file CSCTFConfigOnlineProd.cc.

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

Referenced by ~CSCTFConfigOnlineProd().

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