CMS 3D CMS Logo

List of all members | Public Member Functions
lumi::HLTDummy2DB Class Reference
Inheritance diagram for lumi::HLTDummy2DB:
lumi::DataPipe

Public Member Functions

const std::string dataType () const override
 
 HLTDummy2DB (const std::string &dest)
 
unsigned long long retrieveData (unsigned int) override
 
const std::string sourceType () const override
 
 ~HLTDummy2DB () override
 
- Public Member Functions inherited from lumi::DataPipe
 DataPipe (const std::string &)
 
 DataPipe (const DataPipe &)=delete
 
std::string getAuthPath () const
 
std::string getMode () const
 
float getNorm () const
 
std::string getSource () const
 
const DataPipeoperator= (const DataPipe &)=delete
 
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 22 of file HLTDummy2DB.cc.

Constructor & Destructor Documentation

◆ HLTDummy2DB()

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

Definition at line 33 of file HLTDummy2DB.cc.

33 : DataPipe(dest) {}
DataPipe(const std::string &)
Definition: DataPipe.cc:2

◆ ~HLTDummy2DB()

lumi::HLTDummy2DB::~HLTDummy2DB ( )
override

Definition at line 99 of file HLTDummy2DB.cc.

99 {}

Member Function Documentation

◆ dataType()

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

Implements lumi::DataPipe.

Definition at line 97 of file HLTDummy2DB.cc.

97 { return "HLT"; }

◆ retrieveData()

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

Implements lumi::DataPipe.

Definition at line 34 of file HLTDummy2DB.cc.

References c, gather_cfg::cout, Exception, lumi::idDealer::generateNextIDForTable(), lumi::LumiNames::hltTableName(), mps_fire::i, dqmiolumiharvest::j, lumi::DataPipe::m_authpath, lumi::DataPipe::m_dest, BTVHLTOfflineSource_cfi::pathname, runnum, lumi::DBConfig::setAuthentication(), and AlCaHLTBitMon_QueryRunRegistry::string.

34  {
35  //
36  //generate dummy data of hlt for the given run and write data to LumiDB
37  //
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  try {
45  unsigned int totalcmsls = 32;
46  session->transaction().start(false);
47  coral::ISchema& schema = session->nominalSchema();
48  lumi::idDealer idg(schema);
49  coral::ITable& hlttable = schema.tableHandle(LumiNames::hltTableName());
50  coral::AttributeList hltData;
51  hltData.extend<unsigned long long>("HLT_ID");
52  hltData.extend<unsigned int>("RUNNUM");
53  hltData.extend<unsigned int>("CMSLSNUM");
54  hltData.extend<std::string>("PATHNAME");
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);
59  //loop over lumi LS
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>();
63  std::string& pathname = hltData["PATHNAME"].data<std::string>();
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>();
67 
68  for (unsigned int i = 1; i <= totalcmsls; ++i) {
69  for (unsigned int j = 1; j < 165; ++j) {
70  hlt_id = idg.generateNextIDForTable(LumiNames::hltTableName());
71  hltrunnum = runnum;
72  cmslsnum = i;
73  char c[10];
74  ::sprintf(c, "%d", j);
75  pathname = std::string("FakeHLTPath_") + std::string(c);
76  inputcount = 12345;
77  acceptcount = 10;
78  prescale = 1;
79  hltInserter->processNextIteration();
80  }
81  }
82  hltInserter->flush();
83  delete hltInserter;
84  } catch (const coral::Exception& er) {
85  std::cout << "database problem " << er.what() << std::endl;
86  session->transaction().rollback();
87  delete session;
88  delete svc;
89  throw er;
90  }
91  //delete detailInserter;
92  session->transaction().commit();
93  delete session;
94  delete svc;
95  return 0;
96  }
int runnum
std::string m_dest
Definition: DataPipe.h:29
static const std::string hltTableName()
Definition: LumiNames.cc:14
std::string m_authpath
Definition: DataPipe.h:31

◆ sourceType()

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

Implements lumi::DataPipe.

Definition at line 98 of file HLTDummy2DB.cc.

98 { return "DUMMY"; }