CMS 3D CMS Logo

Public Member Functions

lumi::CMSRunSummaryDummy2DB Class Reference

Inheritance diagram for lumi::CMSRunSummaryDummy2DB:
lumi::DataPipe

List of all members.

Public Member Functions

 CMSRunSummaryDummy2DB (const std::string &dest)
virtual const std::string dataType () const
virtual void retrieveData (unsigned int)
virtual const std::string sourceType () const
virtual ~CMSRunSummaryDummy2DB ()

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.

lumi::CMSRunSummaryDummy2DB::~CMSRunSummaryDummy2DB ( ) [virtual]

Definition at line 77 of file CMSRunSummaryDummy2DB.cc.

{}

Member Function Documentation

const std::string lumi::CMSRunSummaryDummy2DB::dataType ( ) const [virtual]

Implements lumi::DataPipe.

Definition at line 71 of file CMSRunSummaryDummy2DB.cc.

                                                       {
    return "CMSRUNSUMMARY";
  }
void lumi::CMSRunSummaryDummy2DB::retrieveData ( unsigned int  runnum) [virtual]

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, cmsPerfSuiteHarvest::now, runTheMatrix::runData(), python::IdGenerator::schema, python::CommonUtils::session, lumi::DBConfig::setAuthentication(), and python::CommonUtils::svc.

                                                              {
    //
    //generate dummy data of run summary for the given run and write data to LumiDB
    //
    std::string fakehltkey("/cdaq/Cosmic/V12");
    coral::ConnectionService* svc=new coral::ConnectionService;
    lumi::DBConfig dbconf(*svc);
    if(!m_authpath.empty()){
      dbconf.setAuthentication(m_authpath);
    }
    coral::ISessionProxy* session=svc->connect(m_dest,coral::Update);
    coral::ITypeConverter& tpc=session->typeConverter();
    tpc.setCppTypeForSqlType("unsigned int","NUMBER(10)");
    try{
      session->transaction().start(false);
      coral::ISchema& schema=session->nominalSchema();
      coral::ITable& runtable=schema.tableHandle(LumiNames::cmsrunsummaryTableName());
      coral::AttributeList runData;
      runtable.dataEditor().rowBuffer(runData);
      runData["RUNNUM"].data<unsigned int>()=runnum;
      runData["FILLNUM"].data<unsigned int>()=8973344;
      runData["SEQUENCE"].data<std::string>()="run sequence key";
      runData["HLTKEY"].data<std::string>()=fakehltkey;
      runData["STARTTIME"].data<coral::TimeStamp>()=coral::TimeStamp::now();
      runData["STOPTIME"].data<coral::TimeStamp>()=coral::TimeStamp::now();
      
      runtable.dataEditor().insertRow(runData);
    }catch( const coral::Exception& er){
      std::cout<<"database problem "<<er.what()<<std::endl;
      session->transaction().rollback();
      delete session;
      delete svc;
      throw er;
    }
    session->transaction().commit();
    delete session;
    delete svc;
  }
const std::string lumi::CMSRunSummaryDummy2DB::sourceType ( ) const [virtual]

Implements lumi::DataPipe.

Definition at line 74 of file CMSRunSummaryDummy2DB.cc.

                                                         {
    return "DUMMY";
  }