CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual unsigned long long retrieveData( unsigned int ) override;
25  virtual const std::string dataType() const override;
26  virtual const std::string sourceType() const override;
27  virtual ~CMSRunSummaryDummy2DB();
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  }
73  return "CMSRUNSUMMARY";
74  }
76  return "DUMMY";
77  }
79 }//ns lumi
82 #endif
virtual unsigned long long retrieveData(unsigned int) override
CMSRunSummaryDummy2DB(const std::string &dest)
tuple lumi
Definition: fjr2json.py:35
virtual const std::string sourceType() const override
std::string m_dest
Definition: DataPipe.h:27
void setAuthentication(const std::string &authPath)
Definition: DBConfig.cc:15
virtual const std::string dataType() const override
std::string m_authpath
Definition: DataPipe.h:29
tuple cout
Definition: gather_cfg.py:121
#define DEFINE_EDM_PLUGIN(factory, type, name)
tuple runnum
Definition: summaryLumi.py:210
static const std::string cmsrunsummaryTableName()
Definition: LumiNames.cc:2