CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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

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
 

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 >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &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

Definition at line 58 of file L1RCTOmdsFedVectorProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 80 of file L1RCTOmdsFedVectorProducer.cc.

References edm::ESProducer::setWhatProduced().

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

Definition at line 91 of file L1RCTOmdsFedVectorProducer.cc.

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

Member Function Documentation

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

Definition at line 101 of file L1RCTOmdsFedVectorProducer.cc.

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

101  {
102  // std::cout << "ENTERING L1RCTOmdsFedVectorProducer::produce()" << std::endl;
103 
104  // std::cout << "GETTING FED VECTOR FROM OMDS" << std::endl;
105 
106  // GETTING ALREADY-EXISTING RUNINFO OUT OF ES TO FIND OUT RUN NUMBER
108  iRecord.get(sum);
109  const RunInfo* summary = sum.product();
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
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Transaction & transaction()
Definition: Session.cc:52
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
uint64_t word
T const * product() const
Definition: ESHandle.h:86
coral::ISessionProxy & coralSession()
Definition: Session.cc:218
int m_run
Definition: RunInfo.h:20
void setAuthenticationPath(const std::string &p)

Member Data Documentation

std::string L1RCTOmdsFedVectorProducer::authpath
private

Definition at line 65 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::connectionString
private

Definition at line 64 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().

std::string L1RCTOmdsFedVectorProducer::tableToRead
private

Definition at line 66 of file L1RCTOmdsFedVectorProducer.cc.

Referenced by produce().