CMS 3D CMS Logo

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 std::shared_ptr< RunInfoReturnType
 
- 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
 

Public Member Functions

 L1RCTOmdsFedVectorProducer (const edm::ParameterSet &)
 
ReturnType produce (const RunInfoRcd &)
 
 ~L1RCTOmdsFedVectorProducer ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- 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)
 

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::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())
 
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 55 of file L1RCTOmdsFedVectorProducer.cc.

Member Typedef Documentation

Definition at line 60 of file L1RCTOmdsFedVectorProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 82 of file L1RCTOmdsFedVectorProducer.cc.

References edm::ESProducer::setWhatProduced().

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

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

Member Function Documentation

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

Definition at line 110 of file L1RCTOmdsFedVectorProducer.cc.

References authpath, connectionString, cond::persistency::Session::coralSession(), DEFINE_FWK_EVENTSETUP_MODULE, edm::eventsetup::EventSetupRecord::get(), RunInfo::m_run, edm::ESHandle< T >::product(), python.rootplot.root2matplotlib::replace(), convertSQLiteXML::runNumber, dataDML::schema, dataDML::session, cond::persistency::ConnectionPool::setAuthenticationPath(), cond::persistency::Transaction::start(), AlCaHLTBitMon_QueryRunRegistry::string, heppy_report::summary, tableToRead, cond::persistency::Session::transaction(), and heppy_batch::val.

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

Member Data Documentation

std::string L1RCTOmdsFedVectorProducer::authpath
private

Definition at line 66 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::connectionString
private

Definition at line 65 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::tableToRead
private

Definition at line 67 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().