CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
cond::persistency::RunInfoProxy Class Reference

#include <RunInfoProxy.h>

Classes

class  Iterator
 

Public Types

typedef std::vector< std::tuple< Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > RunInfoData
 

Public Member Functions

Iterator begin () const
 
Iterator end () const
 
Iterator find (const boost::posix_time::ptime &target) const
 
Iterator find (Time_t target) const
 
cond::RunInfo_t get (const boost::posix_time::ptime &target) const
 
cond::RunInfo_t get (Time_t target) const
 
void load (const boost::posix_time::ptime &low, const boost::posix_time::ptime &up)
 
void load (Time_t low, Time_t up)
 
RunInfoProxyoperator= (const RunInfoProxy &rhs)
 
void reset ()
 
 RunInfoProxy ()
 
 RunInfoProxy (const RunInfoProxy &rhs)
 
 RunInfoProxy (const std::shared_ptr< SessionImpl > &session)
 
int size () const
 

Private Member Functions

void checkTransaction (const std::string &ctx)
 

Private Attributes

std::shared_ptr< RunInfoProxyDatam_data
 
std::shared_ptr< SessionImplm_session
 

Detailed Description

Definition at line 26 of file RunInfoProxy.h.

Member Typedef Documentation

◆ RunInfoData

typedef std::vector<std::tuple<Time_t, boost::posix_time::ptime, boost::posix_time::ptime> > cond::persistency::RunInfoProxy::RunInfoData

Definition at line 28 of file RunInfoProxy.h.

Constructor & Destructor Documentation

◆ RunInfoProxy() [1/3]

RunInfoProxy::RunInfoProxy ( )

Definition at line 52 of file RunInfoProxy.cc.

52 : m_data(), m_session() {}

◆ RunInfoProxy() [2/3]

RunInfoProxy::RunInfoProxy ( const std::shared_ptr< SessionImpl > &  session)
explicit

Definition at line 54 of file RunInfoProxy.cc.

55  : m_data(new RunInfoProxyData), m_session(session) {}

◆ RunInfoProxy() [3/3]

RunInfoProxy::RunInfoProxy ( const RunInfoProxy rhs)

Definition at line 57 of file RunInfoProxy.cc.

57 : m_data(rhs.m_data), m_session(rhs.m_session) {}

Member Function Documentation

◆ begin()

RunInfoProxy::Iterator RunInfoProxy::begin ( void  ) const

Definition at line 112 of file RunInfoProxy.cc.

112  {
113  if (m_data.get()) {
114  return Iterator(m_data->runList.begin());
115  }
116  return Iterator();
117  }

References m_data.

◆ checkTransaction()

void RunInfoProxy::checkTransaction ( const std::string &  ctx)
private

Definition at line 105 of file RunInfoProxy.cc.

105  {
106  if (!m_session.get())
107  throwException("The session is not active.", ctx);
108  if (!m_session->isTransactionActive(false))
109  throwException("The transaction is not active.", ctx);
110  }

References m_session, and cond::persistency::throwException().

Referenced by load().

◆ end()

RunInfoProxy::Iterator RunInfoProxy::end ( void  ) const

Definition at line 119 of file RunInfoProxy.cc.

119  {
120  if (m_data.get()) {
121  return Iterator(m_data->runList.end());
122  }
123  return Iterator();
124  }

References m_data.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::fill(), and get().

◆ find() [1/2]

RunInfoProxy::Iterator RunInfoProxy::find ( const boost::posix_time::ptime &  target) const

Definition at line 150 of file RunInfoProxy.cc.

150  {
151  if (m_data.get()) {
152  auto p = std::lower_bound(m_data->runList.begin(), m_data->runList.end(), target, IOVTimeComp());
153  return Iterator(p);
154  }
155  return Iterator();
156  }

References cuda_std::lower_bound(), m_data, AlCaHLTBitMon_ParallelJobs::p, and filterCSVwithJSON::target.

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

◆ find() [2/2]

RunInfoProxy::Iterator RunInfoProxy::find ( Time_t  target) const

Definition at line 142 of file RunInfoProxy.cc.

142  {
143  if (m_data.get()) {
144  auto p = std::lower_bound(m_data->runList.begin(), m_data->runList.end(), target, IOVRunComp());
145  return Iterator(p);
146  }
147  return Iterator();
148  }

References cuda_std::lower_bound(), m_data, AlCaHLTBitMon_ParallelJobs::p, and filterCSVwithJSON::target.

Referenced by BeautifulSoup.Tag::__getattr__(), cond::payloadInspector::TimeHistoryPlot< PayloadType, Y >::fill(), BeautifulSoup.Tag::firstText(), and get().

◆ get() [1/2]

cond::RunInfo_t RunInfoProxy::get ( const boost::posix_time::ptime &  target) const

◆ get() [2/2]

cond::RunInfo_t RunInfoProxy::get ( Time_t  target) const

◆ load() [1/2]

void RunInfoProxy::load ( const boost::posix_time::ptime &  low,
const boost::posix_time::ptime &  up 
)

Definition at line 82 of file RunInfoProxy.cc.

82  {
83  if (!m_data.get())
84  return;
85 
86  // clear
87  reset();
88 
89  checkTransaction("RunInfoProxy::load(const boost::posix_time::ptime&,const boost::posix_time::ptime&)");
90 
92  if (!m_session->runInfoSchema().runInfoTable().getInclusiveTimeRange(low, up, m_data->runList)) {
93  throwException("No runs have been found in the interval (" + boost::posix_time::to_simple_string(low) + "," +
94  boost::posix_time::to_simple_string(up) + ")",
95  "RunInfoProxy::load(boost::posix_time::ptime&,const boost::posix_time::ptime&)");
96  }
97  }

References checkTransaction(), LaserClient_cfi::low, m_data, m_session, reset(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), and up.

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), MatrixToProcess.MatrixToProcess::listAll(), and ConfigBuilder.ConfigBuilder::prepare_FILTER().

◆ load() [2/2]

void RunInfoProxy::load ( Time_t  low,
Time_t  up 
)

Definition at line 66 of file RunInfoProxy.cc.

66  {
67  if (!m_data.get())
68  return;
69 
70  // clear
71  reset();
72 
73  checkTransaction("RunInfoProxy::load(Time_t,Time_t)");
74 
76  if (!m_session->runInfoSchema().runInfoTable().getInclusiveRunRange(low, up, m_data->runList)) {
77  throwException("No runs have been found in the range (" + std::to_string(low) + "," + std::to_string(up) + ")",
78  "RunInfoProxy::load(Time_t,Time_t)");
79  }
80  }

References checkTransaction(), LaserClient_cfi::low, m_data, m_session, reset(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), and up.

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), cond::persistency::Session::getRunInfo(), MatrixToProcess.MatrixToProcess::listAll(), and ConfigBuilder.ConfigBuilder::prepare_FILTER().

◆ operator=()

RunInfoProxy & RunInfoProxy::operator= ( const RunInfoProxy rhs)

Definition at line 59 of file RunInfoProxy.cc.

59  {
60  m_data = rhs.m_data;
61  m_session = rhs.m_session;
62  return *this;
63  }

References m_data, and m_session.

◆ reset()

void RunInfoProxy::reset ( void  )

Definition at line 99 of file RunInfoProxy.cc.

99  {
100  if (m_data.get()) {
101  m_data->runList.clear();
102  }
103  }

References m_data.

Referenced by MatrixReader.MatrixReader::__init__(), load(), data_sources.json_list::next(), and MatrixReader.MatrixReader::showRaw().

◆ size()

int RunInfoProxy::size ( void  ) const

Definition at line 179 of file RunInfoProxy.cc.

179 { return m_data.get() ? m_data->runList.size() : 0; }

References m_data.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

Member Data Documentation

◆ m_data

std::shared_ptr<RunInfoProxyData> cond::persistency::RunInfoProxy::m_data
private

Definition at line 103 of file RunInfoProxy.h.

Referenced by begin(), end(), find(), load(), operator=(), reset(), and size().

◆ m_session

std::shared_ptr<SessionImpl> cond::persistency::RunInfoProxy::m_session
private

Definition at line 104 of file RunInfoProxy.h.

Referenced by checkTransaction(), load(), and operator=().

cond::persistency::RunInfoProxy::find
Iterator find(Time_t target) const
Definition: RunInfoProxy.cc:142
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cond::persistency::RunInfoProxy::m_session
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
cond::persistency::RunInfoProxy::end
Iterator end() const
Definition: RunInfoProxy.cc:119
Iterator
Definition: DQMStoreStats.h:94
cond::persistency::RunInfoProxy::reset
void reset()
Definition: RunInfoProxy.cc:99
cms::Iterator
TGeoIterator Iterator
Definition: DDFilteredView.h:49
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
cond::persistency::RunInfoProxy::m_data
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
dummy
Definition: DummySelector.h:38
cond::persistency::RunInfoProxy::checkTransaction
void checkTransaction(const std::string &ctx)
Definition: RunInfoProxy.cc:105
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
up
Definition: BitonicSort.h:7