1 #ifndef RecoLuminosity_LumiProducer_HLTDummy2DB_h
2 #define RecoLuminosity_LumiProducer_HLTDummy2DB_h
3 #include "RelationalAccess/ConnectionService.h"
4 #include "RelationalAccess/ISessionProxy.h"
5 #include "RelationalAccess/ITransaction.h"
6 #include "RelationalAccess/ISchema.h"
7 #include "RelationalAccess/ITable.h"
8 #include "RelationalAccess/ITableDataEditor.h"
9 #include "RelationalAccess/IBulkOperation.h"
10 #include "CoralBase/AttributeList.h"
11 #include "CoralBase/AttributeSpecification.h"
12 #include "CoralBase/Attribute.h"
13 #include "CoralBase/Exception.h"
25 virtual unsigned long long retrieveData(
unsigned int )
override;
38 coral::ConnectionService*
svc=
new coral::ConnectionService;
43 coral::ISessionProxy*
session=svc->connect(
m_dest,coral::Update);
45 unsigned int totalcmsls=32;
46 session->transaction().start(
false);
47 coral::ISchema&
schema=session->nominalSchema();
50 coral::AttributeList hltData;
51 hltData.extend<
unsigned long long>(
"HLT_ID");
52 hltData.extend<
unsigned int>(
"RUNNUM");
53 hltData.extend<
unsigned int>(
"CMSLSNUM");
55 hltData.extend<
unsigned long long>(
"INPUTCOUNT");
56 hltData.extend<
unsigned long long>(
"ACCEPTCOUNT");
57 hltData.extend<
unsigned int>(
"PRESCALE");
58 coral::IBulkOperation* hltInserter=hlttable.dataEditor().bulkInsert(hltData,totalcmsls*260);
60 unsigned long long& hlt_id=hltData[
"HLT_ID"].data<
unsigned long long>();
61 unsigned int& hltrunnum=hltData[
"RUNNUM"].data<
unsigned int>();
62 unsigned int&
cmslsnum=hltData[
"CMSLSNUM"].data<
unsigned int>();
64 unsigned long long& inputcount=hltData[
"INPUTCOUNT"].data<
unsigned long long>();
65 unsigned long long& acceptcount=hltData[
"ACCEPTCOUNT"].data<
unsigned long long>();
66 unsigned int& prescale=hltData[
"PRESCALE"].data<
unsigned int>();
68 for(
unsigned int i=1;
i<=totalcmsls;++
i){
69 for(
unsigned int j=1;
j<165;++
j){
79 hltInserter->processNextIteration();
85 std::cout<<
"database problem "<<er.what()<<std::endl;
86 session->transaction().rollback();
92 session->transaction().commit();
HLTDummy2DB(const std::string &dest)
virtual unsigned long long retrieveData(unsigned int) override
void setAuthentication(const std::string &authPath)
virtual const std::string dataType() const override
static const std::string hltTableName()
virtual const std::string sourceType() const override
unsigned long long generateNextIDForTable(const std::string &tableName, unsigned int interval=1)
#define DEFINE_EDM_PLUGIN(factory, type, name)