test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
L1RCTOmdsFedVectorProducer Class Reference
Inheritance diagram for L1RCTOmdsFedVectorProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef boost::shared_ptr
< RunInfo
ReturnType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

 L1RCTOmdsFedVectorProducer (const edm::ParameterSet &)
 
ReturnType produce (const RunInfoRcd &)
 
 ~L1RCTOmdsFedVectorProducer ()
 
- 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

std::string authpath
 
std::string connectionString
 
std::string tableToRead
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- 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 &)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 56 of file L1RCTOmdsFedVectorProducer.cc.

Member Typedef Documentation

typedef boost::shared_ptr<RunInfo> L1RCTOmdsFedVectorProducer::ReturnType

Definition at line 61 of file L1RCTOmdsFedVectorProducer.cc.

Constructor & Destructor Documentation

L1RCTOmdsFedVectorProducer::L1RCTOmdsFedVectorProducer ( const edm::ParameterSet iConfig)

Definition at line 83 of file L1RCTOmdsFedVectorProducer.cc.

References edm::ESProducer::setWhatProduced().

83  :
84  connectionString(iConfig.getParameter<std::string>("connectionString")),
85  authpath(iConfig.getParameter<std::string>("authpath")),
86  tableToRead(iConfig.getParameter<std::string>("tableToRead"))
87 {
88  //the following line is needed to tell the framework what
89  // data is being produced
90  setWhatProduced(this,"OmdsFedVector");
91 
92  //now do what ever other initialization is needed
93 }
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
L1RCTOmdsFedVectorProducer::~L1RCTOmdsFedVectorProducer ( )

Definition at line 96 of file L1RCTOmdsFedVectorProducer.cc.

97 {
98 
99  // do anything here that needs to be done at desctruction time
100  // (e.g. close files, deallocate resources etc.)
101 
102 }

Member Function Documentation

L1RCTOmdsFedVectorProducer::ReturnType L1RCTOmdsFedVectorProducer::produce ( const RunInfoRcd iRecord)

Definition at line 111 of file L1RCTOmdsFedVectorProducer.cc.

References authpath, connectionString, edm::eventsetup::EventSetupRecord::get(), python.rootplot.root2matplotlib::replace(), convertSQLiteXML::runNumber, dataDML::schema, models::session, cond::persistency::ConnectionPool::setAuthenticationPath(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, edmLumisInFiles::summary, and tableToRead.

112 {
113  // std::cout << "ENTERING L1RCTOmdsFedVectorProducer::produce()" << std::endl;
114 
115  using namespace edm::es;
116  boost::shared_ptr<RunInfo> pRunInfo ;
117 
118  // std::cout << "GETTING FED VECTOR FROM OMDS" << std::endl;
119 
120  // GETTING ALREADY-EXISTING RUNINFO OUT OF ES TO FIND OUT RUN NUMBER
122  iRecord.get(sum);
123  const RunInfo* summary=sum.product();
124  int runNumber = summary->m_run;
125 
126  // CREATING NEW RUNINFO WHICH WILL GET NEW FED VECTOR AND BE RETURNED
127  pRunInfo = boost::shared_ptr<RunInfo>( new RunInfo() );
128 
129 
130  // DO THE DATABASE STUFF
131 
132  //make connection object
134 
135  //set in configuration object authentication path
136  connection.setAuthenticationPath(authpath);
137  connection.configure();
138 
139  //create session object from connection
140  cond::persistency::Session session = connection.createSession(connectionString,true );
141 
142  session.transaction().start(true); // (true=readOnly)
143 
144  coral::ISchema& schema = session.coralSession().schema("CMS_RUNINFO");
145 
146  //condition
147  coral::AttributeList conditionData;
148  conditionData.extend<int>( "n_run" );
149  conditionData[0].data<int>() = runNumber;
150 
151  std::string columnToRead_val = "VALUE";
152 
153  std::string tableToRead_fed = "RUNSESSION_STRING";
154  coral::IQuery* queryV = schema.newQuery();
155  queryV->addToTableList(tableToRead);
156  queryV->addToTableList(tableToRead_fed);
157  queryV->addToOutputList(tableToRead_fed + "." + columnToRead_val, columnToRead_val);
158  //queryV->addToOutputList(tableToRead + "." + columnToRead, columnToRead);
159  //condition
160  std::string condition = tableToRead + ".RUNNUMBER=:n_run AND " + tableToRead + ".NAME='CMS.LVL0:FED_ENABLE_MASK' AND RUNSESSION_PARAMETER.ID = RUNSESSION_STRING.RUNSESSION_PARAMETER_ID";
161  //std::string condition = tableToRead + ".runnumber=:n_run AND " + tableToRead + ".name='CMS.LVL0:FED_ENABLE_MASK'";
162  queryV->setCondition(condition, conditionData);
163  coral::ICursor& cursorV = queryV->execute();
164  std::string fed;
165  if ( cursorV.next() ) {
166  //cursorV.currentRow().toOutputStream(std::cout) << std::endl;
167  const coral::AttributeList& row = cursorV.currentRow();
168  fed = row[columnToRead_val].data<std::string>();
169  }
170  else {
171  fed="null";
172  }
173  //std::cout << "string fed emask == " << fed << std::endl;
174  delete queryV;
175 
176  std::replace(fed.begin(), fed.end(), '%', ' ');
177  std::stringstream stream(fed);
178  for(;;)
179  {
180  std::string word;
181  if ( !(stream >> word) ){break;}
182  std::replace(word.begin(), word.end(), '&', ' ');
183  std::stringstream ss(word);
184  int fedNumber;
185  int val;
186  ss >> fedNumber >> val;
187  //std::cout << "fed:: " << fed << "--> val:: " << val << std::endl;
188  //val bit 0 represents the status of the SLINK, but 5 and 7 means the SLINK/TTS is ON but NA or BROKEN (see mail of alex....)
189  if( (val & 0001) == 1 && (val != 5) && (val != 7) )
190  pRunInfo->m_fed_in.push_back(fedNumber);
191  }
192  // std::cout << "feds in run:--> ";
193  // std::copy(pRunInfo->m_fed_in.begin(), pRunInfo->m_fed_in.end(), std::ostream_iterator<int>(std::cout, ", "));
194  // std::cout << std::endl;
195  /*
196  for (size_t i =0; i<pRunInfo->m_fed_in.size() ; ++i)
197  {
198  std::cout << "fed in run:--> " << pRunInfo->m_fed_in[i] << std::endl;
199  }
200  */
201 
202  return pRunInfo ;
203 }
tuple schema
Definition: dataDML.py:2334
void get(HolderT &iHolder) const
session
Definition: models.py:201
void setAuthenticationPath(const std::string &p)

Member Data Documentation

std::string L1RCTOmdsFedVectorProducer::authpath
private

Definition at line 67 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::connectionString
private

Definition at line 66 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::tableToRead
private

Definition at line 68 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().