CMS 3D CMS Logo

Public Member Functions

lumi::HLTDummy2DB Class Reference

Inheritance diagram for lumi::HLTDummy2DB:
lumi::DataPipe

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 22 of file HLTDummy2DB.cc.


Constructor & Destructor Documentation

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

Definition at line 33 of file HLTDummy2DB.cc.

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

Definition at line 102 of file HLTDummy2DB.cc.

{}

Member Function Documentation

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

Implements lumi::DataPipe.

Definition at line 96 of file HLTDummy2DB.cc.

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

Implements lumi::DataPipe.

Definition at line 34 of file HLTDummy2DB.cc.

References trackerHits::c, estimatePileup2::cmslsnum, gather_cfg::cout, Exception, lumi::idDealer::generateNextIDForTable(), lumi::LumiNames::hltTableName(), i, j, lumi::DataPipe::m_authpath, lumi::DataPipe::m_dest, timingPdfMaker::pathname, summaryLumi::runnum, python::IdGenerator::schema, python::CommonUtils::session, lumi::DBConfig::setAuthentication(), and python::CommonUtils::svc.

                                                    {
    //
    //generate dummy data of hlt for the given run and write data to LumiDB
    //
    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);
    try{
      unsigned int totalcmsls=32;
      session->transaction().start(false);
      coral::ISchema& schema=session->nominalSchema();
      lumi::idDealer idg(schema);
      coral::ITable& hlttable=schema.tableHandle(LumiNames::hltTableName());
      coral::AttributeList hltData;
      hltData.extend<unsigned long long>("HLT_ID");
      hltData.extend<unsigned int>("RUNNUM");
      hltData.extend<unsigned int>("CMSLSNUM");
      hltData.extend<std::string>("PATHNAME");
      hltData.extend<unsigned long long>("INPUTCOUNT");
      hltData.extend<unsigned long long>("ACCEPTCOUNT");
      hltData.extend<unsigned int>("PRESCALE");
      coral::IBulkOperation* hltInserter=hlttable.dataEditor().bulkInsert(hltData,totalcmsls*260);
      //loop over lumi LS
      unsigned long long& hlt_id=hltData["HLT_ID"].data<unsigned long long>();
      unsigned int& hltrunnum=hltData["RUNNUM"].data<unsigned int>();
      unsigned int& cmslsnum=hltData["CMSLSNUM"].data<unsigned int>();
      std::string& pathname=hltData["PATHNAME"].data<std::string>();
      unsigned long long& inputcount=hltData["INPUTCOUNT"].data<unsigned long long>();
      unsigned long long& acceptcount=hltData["ACCEPTCOUNT"].data<unsigned long long>();
      unsigned int& prescale=hltData["PRESCALE"].data<unsigned int>();
      
      for(unsigned int i=1;i<=totalcmsls;++i){
        for(unsigned int j=1;j<165;++j){
          hlt_id = idg.generateNextIDForTable(LumiNames::hltTableName());
          hltrunnum = runnum;
          cmslsnum = i;
          char c[10];
          ::sprintf(c,"%d",j);
          pathname=std::string("FakeHLTPath_")+std::string(c);
          inputcount=12345;
          acceptcount=10;
          prescale=1;
          hltInserter->processNextIteration();
        }
      }
      hltInserter->flush();
      delete hltInserter;
    }catch( const coral::Exception& er){
      std::cout<<"database problem "<<er.what()<<std::endl;
      session->transaction().rollback();
      delete session;
      delete svc;
      throw er;
    }
    //delete detailInserter;
    session->transaction().commit();
    delete session;
    delete svc;
  }
const std::string lumi::HLTDummy2DB::sourceType ( ) const [virtual]

Implements lumi::DataPipe.

Definition at line 99 of file HLTDummy2DB.cc.

                                               {
    return "DUMMY";
  }