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 (Time_t target) const
 
Iterator find (const boost::posix_time::ptime &target) const
 
cond::RunInfo_t get (Time_t target) const
 
cond::RunInfo_t get (const boost::posix_time::ptime &target) const
 
void load (Time_t low, Time_t up)
 
void load (const boost::posix_time::ptime &low, const boost::posix_time::ptime &up)
 
RunInfoProxyoperator= (const RunInfoProxy &rhs)
 
void reset ()
 
 RunInfoProxy ()
 
 RunInfoProxy (const std::shared_ptr< SessionImpl > &session)
 
 RunInfoProxy (const RunInfoProxy &rhs)
 
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() {}
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ 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) {}
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ 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) {}
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

Member Function Documentation

◆ begin()

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

Definition at line 112 of file RunInfoProxy.cc.

References m_data.

112  {
113  if (m_data.get()) {
114  return Iterator(m_data->runList.begin());
115  }
116  return Iterator();
117  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ checkTransaction()

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

Definition at line 105 of file RunInfoProxy.cc.

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

Referenced by load().

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  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12

◆ end()

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

Definition at line 119 of file RunInfoProxy.cc.

References m_data.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and get().

119  {
120  if (m_data.get()) {
121  return Iterator(m_data->runList.end());
122  }
123  return Iterator();
124  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ find() [1/2]

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

Definition at line 142 of file RunInfoProxy.cc.

References pfDeepBoostedJetPreprocessParams_cfi::lower_bound, m_data, AlCaHLTBitMon_ParallelJobs::p, and filterCSVwithJSON::target.

Referenced by get().

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  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ find() [2/2]

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

Definition at line 150 of file RunInfoProxy.cc.

References pfDeepBoostedJetPreprocessParams_cfi::lower_bound, m_data, AlCaHLTBitMon_ParallelJobs::p, and filterCSVwithJSON::target.

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  }
TGeoIterator Iterator
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ get() [1/2]

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

Definition at line 159 of file RunInfoProxy.cc.

References end(), find(), filterCSVwithJSON::target, and cond::persistency::throwException().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), util.rrapi.RRApi::data(), rrapi.RRApi::data(), data_sources.json_list::first(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), data_sources.json_list::indices(), data_sources.json_list::last(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), util.rrapi.RRApi::reports(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

159  {
160  Iterator it = find(target);
161  if (it == Iterator())
162  throwException("No data has been found.", "RunInfoProxy::get(Time_t)");
163  if (it == end())
164  throwException("The target run has not been found in the selected run range.", "RunInfoProxy::get(Time_t)");
165  return *it;
166  }
TGeoIterator Iterator
Iterator find(Time_t target) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12

◆ get() [2/2]

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

Definition at line 169 of file RunInfoProxy.cc.

References end(), find(), filterCSVwithJSON::target, and cond::persistency::throwException().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), submitPVValidationJobs.BetterConfigParser::__updateDict(), data_sources.json_list::as_dicts(), data_sources.json_list::as_table(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), util.rrapi.RRApi::data(), rrapi.RRApi::data(), data_sources.json_list::first(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), submitPVValidationJobs.BetterConfigParser::getResultingSection(), data_sources.json_list::indices(), data_sources.json_list::last(), util.rrapi.RRApi::report(), rrapi.RRApi::report(), util.rrapi.RRApi::reports(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), util.rrapi.RRApi::tables(), util.rrapi.RRApi::tags(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

169  {
170  Iterator it = find(target);
171  if (it == Iterator())
172  throwException("No data has been found.", "RunInfoProxy::get(const boost::posix_time::ptime&)");
173  if (it == end())
174  throwException("The target time has not been found in the selected time range.",
175  "RunInfoProxy::get(const boost::posix_time::ptime&)");
176  return *it;
177  }
TGeoIterator Iterator
Iterator find(Time_t target) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12

◆ load() [1/2]

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

Definition at line 66 of file RunInfoProxy.cc.

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

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

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  }
Definition: BitonicSort.h:7
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
void checkTransaction(const std::string &ctx)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ load() [2/2]

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

Definition at line 82 of file RunInfoProxy.cc.

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().

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  }
Definition: BitonicSort.h:7
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
void checkTransaction(const std::string &ctx)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ operator=()

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

Definition at line 59 of file RunInfoProxy.cc.

References m_data, and m_session.

59  {
60  m_data = rhs.m_data;
61  m_session = rhs.m_session;
62  return *this;
63  }
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ reset()

void RunInfoProxy::reset ( void  )

Definition at line 99 of file RunInfoProxy.cc.

References m_data.

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

99  {
100  if (m_data.get()) {
101  m_data->runList.clear();
102  }
103  }
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

◆ size()

int RunInfoProxy::size ( void  ) const

Definition at line 179 of file RunInfoProxy.cc.

References m_data.

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

179 { return m_data.get() ? m_data->runList.size() : 0; }
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103

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=().