test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual boost::shared_ptr
< L1MuCSCTFConfiguration
newObject (const std::string &objectKey)
 
 ~CSCTFConfigOnlineProd ()
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual boost::shared_ptr
< L1MuCSCTFConfiguration
produce (const L1MuCSCTFConfigurationRcd &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 ()
 

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< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >
bool getObjectKey (const L1MuCSCTFConfigurationRcd &record, boost::shared_ptr< L1MuCSCTFConfiguration > 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< 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 ( )
inline

Definition at line 9 of file CSCTFConfigOnlineProd.h.

9 {}

Member Function Documentation

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

Implements L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >.

Definition at line 6 of file CSCTFConfigOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), dbtoconf::conf, cond::rpcobgas::day, l1t::OMDSReader::QueryResults::fillVariable(), geometryCSVtoXML::line, LogDebug, L1ConfigOnlineProdBase< L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration >::m_omdsReader, l1t::OMDSReader::QueryResults::queryFailed(), python.entryComment::results, l1t::OMDSReader::singleAttribute(), AlCaHLTBitMon_QueryRunRegistry::string, and create_public_lumi_plots::year.

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