CMS 3D CMS Logo

CMSRunSummaryDummy2DB.cc
Go to the documentation of this file.
1 #ifndef RecoLuminosity_LumiProducer_CMSRunSummaryDummy2DB_H
2 #define RecoLuminosity_LumiProducer_CMSRunSummaryDummy2DB_H
3 #include "RelationalAccess/ConnectionService.h"
4 #include "RelationalAccess/ISessionProxy.h"
5 #include "RelationalAccess/ITransaction.h"
6 #include "RelationalAccess/ITypeConverter.h"
7 #include "RelationalAccess/ISchema.h"
8 #include "RelationalAccess/ITable.h"
9 #include "RelationalAccess/ITableDataEditor.h"
10 #include "CoralBase/TimeStamp.h"
11 #include "CoralBase/AttributeList.h"
12 #include "CoralBase/AttributeSpecification.h"
13 #include "CoralBase/Attribute.h"
14 #include "CoralBase/Exception.h"
19 #include <iostream>
20 namespace lumi {
22  public:
24  unsigned long long retrieveData(unsigned int) override;
25  const std::string dataType() const override;
26  const std::string sourceType() const override;
27  ~CMSRunSummaryDummy2DB() override;
28  }; //cl CMSRunSummaryDummy2DB
29  //
30  //implementation
31  //
33  unsigned long long CMSRunSummaryDummy2DB::retrieveData(unsigned int runnum) {
34  //
35  //generate dummy data of run summary for the given run and write data to LumiDB
36  //
37  std::string fakehltkey("/cdaq/Cosmic/V12");
38  coral::ConnectionService* svc = new coral::ConnectionService;
39  lumi::DBConfig dbconf(*svc);
40  if (!m_authpath.empty()) {
42  }
43  coral::ISessionProxy* session = svc->connect(m_dest, coral::Update);
44  coral::ITypeConverter& tpc = session->typeConverter();
45  tpc.setCppTypeForSqlType("unsigned int", "NUMBER(10)");
46  try {
47  session->transaction().start(false);
48  coral::ISchema& schema = session->nominalSchema();
49  coral::ITable& runtable = schema.tableHandle(LumiNames::cmsrunsummaryTableName());
50  coral::AttributeList runData;
51  runtable.dataEditor().rowBuffer(runData);
52  runData["RUNNUM"].data<unsigned int>() = runnum;
53  runData["FILLNUM"].data<unsigned int>() = 8973344;
54  runData["SEQUENCE"].data<std::string>() = "run sequence key";
55  runData["HLTKEY"].data<std::string>() = fakehltkey;
56  runData["STARTTIME"].data<coral::TimeStamp>() = coral::TimeStamp::now();
57  runData["STOPTIME"].data<coral::TimeStamp>() = coral::TimeStamp::now();
58 
59  runtable.dataEditor().insertRow(runData);
60  } catch (const coral::Exception& er) {
61  std::cout << "database problem " << er.what() << std::endl;
62  session->transaction().rollback();
63  delete session;
64  delete svc;
65  throw er;
66  }
67  session->transaction().commit();
68  delete session;
69  delete svc;
70  return 0;
71  }
72  const std::string CMSRunSummaryDummy2DB::dataType() const { return "CMSRUNSUMMARY"; }
73  const std::string CMSRunSummaryDummy2DB::sourceType() const { return "DUMMY"; }
75 } // namespace lumi
78 #endif
DataPipe.h
lumi::DataPipe::m_dest
std::string m_dest
Definition: DataPipe.h:29
submitPVValidationJobs.now
now
Definition: submitPVValidationJobs.py:639
gather_cfg.cout
cout
Definition: gather_cfg.py:144
lumi::DataPipe
Definition: DataPipe.h:8
lumi::DBConfig::setAuthentication
void setAuthentication(const std::string &authPath)
Definition: DBConfig.cc:15
LumiNames.h
lumi::LumiNames::cmsrunsummaryTableName
static const std::string cmsrunsummaryTableName()
Definition: LumiNames.cc:2
DataPipeFactory.h
lumi::CMSRunSummaryDummy2DB::dataType
const std::string dataType() const override
Definition: CMSRunSummaryDummy2DB.cc:72
lumi::CMSRunSummaryDummy2DB::sourceType
const std::string sourceType() const override
Definition: CMSRunSummaryDummy2DB.cc:73
lumi::CMSRunSummaryDummy2DB
Definition: CMSRunSummaryDummy2DB.cc:21
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
lumi::DataPipe::m_authpath
std::string m_authpath
Definition: DataPipe.h:31
edmplugin::PluginFactory
Definition: PluginFactory.h:34
lumi::DBConfig
Definition: DBConfig.h:8
lumi::CMSRunSummaryDummy2DB::~CMSRunSummaryDummy2DB
~CMSRunSummaryDummy2DB() override
Definition: CMSRunSummaryDummy2DB.cc:74
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
lumi::CMSRunSummaryDummy2DB::CMSRunSummaryDummy2DB
CMSRunSummaryDummy2DB(const std::string &dest)
Definition: CMSRunSummaryDummy2DB.cc:32
Exception
Definition: hltDiff.cc:245
Exception.h
DBConfig.h
lumi::CMSRunSummaryDummy2DB::retrieveData
unsigned long long retrieveData(unsigned int) override
Definition: CMSRunSummaryDummy2DB.cc:33
lumi
Definition: LumiSectionData.h:20
mps_fire.dest
dest
Definition: mps_fire.py:179