CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::persistency::RUN_INFO::Table Class Reference

#include <RunInfoSchema.h>

Inheritance diagram for cond::persistency::RUN_INFO::Table:
cond::persistency::IRunInfoTable

Public Member Functions

void create () override
 
bool exists () override
 
bool getInclusiveRunRange (cond::Time_t lower, cond::Time_t upper, std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > &runData) override
 
bool getInclusiveTimeRange (const boost::posix_time::ptime &lower, const boost::posix_time::ptime &upper, std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > &runData) override
 
cond::Time_t getLastInserted () override
 
void insert (const std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > &runs) override
 
void insertOne (cond::Time_t runNumber, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end) override
 
bool select (cond::Time_t runNumber, boost::posix_time::ptime &start, boost::posix_time::ptime &end) override
 
 Table (coral::ISchema &schema)
 
void updateEnd (cond::Time_t runNumber, const boost::posix_time::ptime &end) override
 
 ~Table () override
 
- Public Member Functions inherited from cond::persistency::IRunInfoTable
virtual ~IRunInfoTable ()
 

Private Attributes

coral::ISchema & m_schema
 

Detailed Description

Definition at line 46 of file RunInfoSchema.h.

Constructor & Destructor Documentation

Table::Table ( coral::ISchema &  schema)
explicit

Definition at line 10 of file RunInfoSchema.cc.

References m_schema, and cond::persistency::RUN_INFO::tname.

10  :
11  m_schema( schema ){
12  }
cond::persistency::RUN_INFO::Table::~Table ( )
inlineoverride

Member Function Documentation

void Table::create ( )
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 18 of file RunInfoSchema.cc.

References exists(), cond::persistency::TableDescription< Types >::get(), m_schema, cond::persistency::TableDescription< Types >::setPrimaryKey(), cond::persistency::throwException(), and cond::persistency::RUN_INFO::tname.

Referenced by cond::persistency::RunInfoSchema::create(), and o2olib.O2OTool::execute().

18  {
19  if( exists() ){
20  throwException( "RUN_INFO table already exists in this schema.",
21  "RUN_INFO::Table::create");
22  }
23  TableDescription< RUN_NUMBER, START_TIME, END_TIME > descr( tname );
24  descr.setPrimaryKey<RUN_NUMBER>();
25  createTable( m_schema, descr.get() );
26  }
static char const * tname
Definition: RunInfoSchema.h:13
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
bool cond::persistency::RUN_INFO::Table::exists ( )
overridevirtual
bool Table::getInclusiveRunRange ( cond::Time_t  lower,
cond::Time_t  upper,
std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > &  runData 
)
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 54 of file RunInfoSchema.cc.

References cond::persistency::Query< Types >::addCondition(), m_schema, q1, alignCSCRings::r, and pileupCalc::upper.

55  {
56  // first find the lowest existing run >= upper
57  Query< MIN_RUN_NUMBER > q0(m_schema);
58  q0.addCondition< RUN_NUMBER >( upper,">=" );
59  for( auto r: q0 ) upper = std::get<0>(r);
60  // then find the inclusive range
61  Query< RUN_NUMBER, START_TIME, END_TIME > q1(m_schema);
62  q1.addCondition< RUN_NUMBER >( lower, ">=").addCondition< RUN_NUMBER >( upper, "<=");
63  size_t prevSize = runData.size();
64  for( auto r: q1 ){
65  runData.push_back( r );
66  }
67  return runData.size()>prevSize;
68  }
double q1[4]
Definition: TauolaWrapper.h:87
bool Table::getInclusiveTimeRange ( const boost::posix_time::ptime &  lower,
const boost::posix_time::ptime &  upper,
std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > &  runData 
)
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 70 of file RunInfoSchema.cc.

References cond::persistency::Query< Types >::addCondition(), m_schema, q1, alignCSCRings::r, up, and pileupCalc::upper.

71  {
72  boost::posix_time::ptime up = upper;
73  // first find the lowest existing run >= upper
74  Query< MIN_START_TIME > q0(m_schema);
75  q0.addCondition< START_TIME >( upper,">=" );
76  for( auto r: q0 ) up = std::get<0>(r);
77  // then find the inclusive range
78  Query< RUN_NUMBER, START_TIME, END_TIME> q1(m_schema);
79  q1.addCondition< END_TIME >( lower, ">=").addCondition< START_TIME >( up, "<=");
80  size_t prevSize = runData.size();
81  for( auto r: q1 ){
82  runData.push_back( r );
83  }
84  return runData.size()>prevSize;
85  }
Definition: BitonicSort.h:8
double q1[4]
Definition: TauolaWrapper.h:87
cond::Time_t Table::getLastInserted ( )
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 39 of file RunInfoSchema.cc.

References MillePedeFileConverter_cfg::e, m_schema, cond::time::MIN_VAL(), alignCSCRings::r, writedatasetfile::run, and AlCaHLTBitMon_QueryRunRegistry::string.

39  {
41  Query< MAX_RUN_NUMBER > q0(m_schema);
42  try{
43  for( auto r: q0 ) {
44  run = std::get<0>(r);
45  }
46  // cope with mis-beahviour in the sqlite plugin: no result for MAX() returns NULL
47  } catch ( const coral::AttributeException& e ){
48  std::string message(e.what());
49  if( message.find( "Attempt to access data of NULL attribute" ) != 0 ) throw;
50  }
51  return run;
52  }
const Time_t MIN_VAL(0)
unsigned long long Time_t
Definition: Time.h:16
void Table::insert ( const std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > &  runs)
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 92 of file RunInfoSchema.cc.

References cond::persistency::BulkInserter< Types >::flush(), cond::persistency::BulkInserter< Types >::insert(), m_schema, writedatasetfile::run, writedatasetfile::runs, and cond::persistency::RUN_INFO::tname.

Referenced by BeautifulSoup.PageElement::append().

92  {
93  BulkInserter< RUN_NUMBER, START_TIME, END_TIME > inserter( m_schema, tname );
94  for( auto run : runs ) inserter.insert( run );
95  inserter.flush();
96  }
static char const * tname
Definition: RunInfoSchema.h:13
void Table::insertOne ( cond::Time_t  runNumber,
const boost::posix_time::ptime &  start,
const boost::posix_time::ptime &  end 
)
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 87 of file RunInfoSchema.cc.

References cond::persistency::RowBuffer< Columns >::get(), m_schema, and cond::persistency::RUN_INFO::tname.

87  {
88  RowBuffer< RUN_NUMBER, START_TIME, END_TIME > dataToInsert( std::tie(runNumber, start, end ) );
89  insertInTable( m_schema, tname, dataToInsert.get() );
90  }
Definition: start.py:1
static char const * tname
Definition: RunInfoSchema.h:13
#define end
Definition: vmac.h:39
bool Table::select ( cond::Time_t  runNumber,
boost::posix_time::ptime &  start,
boost::posix_time::ptime &  end 
)
overridevirtual
void Table::updateEnd ( cond::Time_t  runNumber,
const boost::posix_time::ptime &  end 
)
overridevirtual

Implements cond::persistency::IRunInfoTable.

Definition at line 98 of file RunInfoSchema.cc.

References cond::persistency::UpdateBuffer::addWhereCondition(), edmScanValgrind::buffer, m_schema, convertSQLiteXML::runNumber, cond::persistency::UpdateBuffer::setColumnData(), and cond::persistency::RUN_INFO::tname.

98  {
99  UpdateBuffer buffer;
100  buffer.setColumnData< END_TIME >( std::tie( end ) );
101  buffer.addWhereCondition<RUN_NUMBER>( runNumber );
102  updateTable( m_schema, tname, buffer );
103  }
static char const * tname
Definition: RunInfoSchema.h:13
#define end
Definition: vmac.h:39

Member Data Documentation

coral::ISchema& cond::persistency::RUN_INFO::Table::m_schema
private