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

using ReturnType = std::unique_ptr< RunInfo >
 

Public Member Functions

 L1RCTOmdsFedVectorProducer (const edm::ParameterSet &)
 
ReturnType produce (const RunInfoRcd &)
 
 ~L1RCTOmdsFedVectorProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
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
 
edm::ESGetToken< RunInfo, RunInfoRcdtoken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 53 of file L1RCTOmdsFedVectorProducer.cc.

Member Typedef Documentation

◆ ReturnType

Definition at line 58 of file L1RCTOmdsFedVectorProducer.cc.

Constructor & Destructor Documentation

◆ L1RCTOmdsFedVectorProducer()

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

Definition at line 82 of file L1RCTOmdsFedVectorProducer.cc.

References edm::ESProducer::setWhatProduced(), and token_.

83  : connectionString(iConfig.getParameter<std::string>("connectionString")),
84  authpath(iConfig.getParameter<std::string>("authpath")),
85  tableToRead(iConfig.getParameter<std::string>("tableToRead")) {
86  //the following line is needed to tell the framework what
87  // data is being produced
88  token_ = setWhatProduced(this, "OmdsFedVector").consumes();
89 
90  //now do what ever other initialization is needed
91 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< RunInfo, RunInfoRcd > token_

◆ ~L1RCTOmdsFedVectorProducer()

L1RCTOmdsFedVectorProducer::~L1RCTOmdsFedVectorProducer ( )
override

Definition at line 93 of file L1RCTOmdsFedVectorProducer.cc.

93  {
94  // do anything here that needs to be done at desctruction time
95  // (e.g. close files, deallocate resources etc.)
96 }

Member Function Documentation

◆ produce()

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

Definition at line 103 of file L1RCTOmdsFedVectorProducer.cc.

References authpath, connectionString, cond::persistency::Session::coralSession(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), python.rootplot.root2matplotlib::replace(), convertSQLiteXML::runNumber, cond::persistency::ConnectionPool::setAuthenticationPath(), contentValuesCheck::ss, cond::persistency::Transaction::start(), cms::cuda::stream, AlCaHLTBitMon_QueryRunRegistry::string, edmLumisInFiles::summary, tableToRead, token_, cond::persistency::Session::transaction(), and heppy_batch::val.

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

Member Data Documentation

◆ authpath

std::string L1RCTOmdsFedVectorProducer::authpath
private

Definition at line 65 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

◆ connectionString

std::string L1RCTOmdsFedVectorProducer::connectionString
private

Definition at line 64 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

◆ tableToRead

std::string L1RCTOmdsFedVectorProducer::tableToRead
private

Definition at line 66 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

◆ token_

edm::ESGetToken<RunInfo, RunInfoRcd> L1RCTOmdsFedVectorProducer::token_
private

Definition at line 68 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by L1RCTOmdsFedVectorProducer(), and produce().