CMS 3D CMS Logo

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)
 
const std::string dataType () const override
 
unsigned long long retrieveData (unsigned int) override
 
const std::string sourceType () const override
 
 ~CMSRunSummaryDummy2DB () override
 
- 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

◆ CMSRunSummaryDummy2DB()

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

Definition at line 32 of file CMSRunSummaryDummy2DB.cc.

32 : DataPipe(dest) {}

◆ ~CMSRunSummaryDummy2DB()

lumi::CMSRunSummaryDummy2DB::~CMSRunSummaryDummy2DB ( )
override

Definition at line 74 of file CMSRunSummaryDummy2DB.cc.

74 {}

Member Function Documentation

◆ dataType()

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

Implements lumi::DataPipe.

Definition at line 72 of file CMSRunSummaryDummy2DB.cc.

72 { return "CMSRUNSUMMARY"; }

◆ retrieveData()

unsigned long long lumi::CMSRunSummaryDummy2DB::retrieveData ( unsigned int  runnum)
overridevirtual

Implements lumi::DataPipe.

Definition at line 33 of file CMSRunSummaryDummy2DB.cc.

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  }

References lumi::LumiNames::cmsrunsummaryTableName(), gather_cfg::cout, Exception, lumi::DataPipe::m_authpath, lumi::DataPipe::m_dest, submitPVValidationJobs::now, lumi::DBConfig::setAuthentication(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ sourceType()

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

Implements lumi::DataPipe.

Definition at line 73 of file CMSRunSummaryDummy2DB.cc.

73 { return "DUMMY"; }
lumi::DataPipe::m_dest
std::string m_dest
Definition: DataPipe.h:27
submitPVValidationJobs.now
now
Definition: submitPVValidationJobs.py:639
gather_cfg.cout
cout
Definition: gather_cfg.py:144
lumi::LumiNames::cmsrunsummaryTableName
static const std::string cmsrunsummaryTableName()
Definition: LumiNames.cc:2
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
lumi::DataPipe::m_authpath
std::string m_authpath
Definition: DataPipe.h:29
lumi::DBConfig
Definition: DBConfig.h:8
lumi::DataPipe::DataPipe
DataPipe(const std::string &)
Definition: DataPipe.cc:2
Exception
Definition: hltDiff.cc:245
mps_fire.dest
dest
Definition: mps_fire.py:179