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, boost::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 58 of file L1RCTOmdsFedVectorProducer.cc.

Member Typedef Documentation

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

Definition at line 63 of file L1RCTOmdsFedVectorProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 85 of file L1RCTOmdsFedVectorProducer.cc.

References edm::ESProducer::setWhatProduced().

85  :
86  connectionString(iConfig.getParameter<std::string>("connectionString")),
87  authpath(iConfig.getParameter<std::string>("authpath")),
88  tableToRead(iConfig.getParameter<std::string>("tableToRead"))
89 {
90  //the following line is needed to tell the framework what
91  // data is being produced
92  setWhatProduced(this,"OmdsFedVector");
93 
94  //now do what ever other initialization is needed
95 }
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 98 of file L1RCTOmdsFedVectorProducer.cc.

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

Member Function Documentation

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

Definition at line 113 of file L1RCTOmdsFedVectorProducer.cc.

References authpath, cond::DbConnection::configuration(), connectionString, edm::eventsetup::EventSetupRecord::get(), python.rootplot.root2matplotlib::replace(), convertSQLiteXML::runNumber, python.IdGenerator::schema, python.CommonUtils::session, cond::DbConnectionConfiguration::setAuthenticationPath(), AlCaHLTBitMon_QueryRunRegistry::string, edmLumisInFiles::summary, and tableToRead.

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

Member Data Documentation

std::string L1RCTOmdsFedVectorProducer::authpath
private

Definition at line 69 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::connectionString
private

Definition at line 68 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::tableToRead
private

Definition at line 70 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().