CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
lumi::CMSRunSummaryDummy2DB Class Reference
Inheritance diagram for lumi::CMSRunSummaryDummy2DB:
lumi::DataPipe

Public Member Functions

 CMSRunSummaryDummy2DB (const std::string &dest)
 
virtual const std::string dataType () const override
 
virtual unsigned long long retrieveData (unsigned int) override
 
virtual const std::string sourceType () const override
 
virtual ~CMSRunSummaryDummy2DB ()
 
- Public Member Functions inherited from lumi::DataPipe
 DataPipe (const std::string &)
 
std::string getAuthPath () const
 
std::string getMode () const
 
float getNorm () const
 
std::string getSource () const
 
void setAuthPath (const std::string &authpath)
 
void setMode (const std::string &mode)
 
void setNoCheckingStableBeam ()
 
void setNorm (float norm)
 
void setNoValidate ()
 
void setSource (const std::string &source)
 
virtual ~DataPipe ()
 

Additional Inherited Members

- Protected Attributes inherited from lumi::DataPipe
std::string m_authpath
 
std::string m_dest
 
std::string m_mode
 
bool m_nocheckingstablebeam
 
float m_norm
 
bool m_novalidate
 
std::string m_source
 

Detailed Description

Definition at line 21 of file CMSRunSummaryDummy2DB.cc.

Constructor & Destructor Documentation

lumi::CMSRunSummaryDummy2DB::CMSRunSummaryDummy2DB ( const std::string &  dest)

Definition at line 32 of file CMSRunSummaryDummy2DB.cc.

32 :DataPipe(dest){}
DataPipe(const std::string &)
Definition: DataPipe.cc:2
lumi::CMSRunSummaryDummy2DB::~CMSRunSummaryDummy2DB ( )
virtual

Definition at line 78 of file CMSRunSummaryDummy2DB.cc.

78 {}

Member Function Documentation

const std::string lumi::CMSRunSummaryDummy2DB::dataType ( ) const
overridevirtual

Implements lumi::DataPipe.

Definition at line 72 of file CMSRunSummaryDummy2DB.cc.

72  {
73  return "CMSRUNSUMMARY";
74  }
unsigned long long lumi::CMSRunSummaryDummy2DB::retrieveData ( unsigned int  runnum)
overridevirtual

Implements lumi::DataPipe.

Definition at line 33 of file CMSRunSummaryDummy2DB.cc.

References lumi::LumiNames::cmsrunsummaryTableName(), gather_cfg::cout, Exception, lumi::DataPipe::m_authpath, lumi::DataPipe::m_dest, fileCollector::now, dataDML::schema, models::session, lumi::DBConfig::setAuthentication(), AlCaHLTBitMon_QueryRunRegistry::string, and dataDML::svc.

33  {
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()){
41  dbconf.setAuthentication(m_authpath);
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  }
tuple schema
Definition: dataDML.py:2334
tuple svc
Definition: dataDML.py:2332
std::string m_dest
Definition: DataPipe.h:27
std::string m_authpath
Definition: DataPipe.h:29
tuple cout
Definition: gather_cfg.py:145
tuple runnum
Definition: summaryLumi.py:210
static const std::string cmsrunsummaryTableName()
Definition: LumiNames.cc:2
session
Definition: models.py:201
const std::string lumi::CMSRunSummaryDummy2DB::sourceType ( ) const
overridevirtual

Implements lumi::DataPipe.

Definition at line 75 of file CMSRunSummaryDummy2DB.cc.

75  {
76  return "DUMMY";
77  }