CMS 3D CMS Logo

HLTConfDummy2DB.cc
Go to the documentation of this file.
1 #ifndef RecoLuminosity_LumiProducer_HLTConfDummy2DB_h
2 #define RecoLuminosity_LumiProducer_HLTConfDummy2DB_h
3 #include "RelationalAccess/ConnectionService.h"
4 #include "RelationalAccess/ISessionProxy.h"
5 #include "RelationalAccess/ITransaction.h"
6 #include "RelationalAccess/ISchema.h"
7 #include "RelationalAccess/IQuery.h"
8 #include "RelationalAccess/ICursor.h"
9 #include "RelationalAccess/ITable.h"
10 #include "RelationalAccess/ITableDataEditor.h"
11 #include "RelationalAccess/IBulkOperation.h"
12 #include "CoralBase/AttributeList.h"
13 #include "CoralBase/AttributeSpecification.h"
14 #include "CoralBase/Attribute.h"
15 #include "CoralBase/Exception.h"
20 #include <iostream>
21 #include <cstdio>
22 
23 namespace lumi {
24  class HLTConfDummy2DB : public DataPipe {
25  public:
26  explicit HLTConfDummy2DB(const std::string& dest);
27  unsigned long long retrieveData(unsigned int runnumber) override;
28  const std::string dataType() const override;
29  const std::string sourceType() const override;
30  ~HLTConfDummy2DB() override;
31  }; //cl HLTConfDummy2DB
32  //
33  //implementation
34  //
36  unsigned long long HLTConfDummy2DB::retrieveData(unsigned int runnumber) {
37  //
38  //generate dummy configuration data for the given hltconfid and write data to LumiDB
39  //
40  //std::cout<<"retrieving data for run "<<runnumber<<std::endl;
41  std::string fakehltkey("/cdaq/Cosmic/V12");
42  coral::ConnectionService* svc = new coral::ConnectionService;
43  lumi::DBConfig dbconf(*svc);
44  if (!m_authpath.empty()) {
46  }
47  coral::ISessionProxy* session = svc->connect(m_dest, coral::Update);
48  try {
49  unsigned int totalhltpath = 126;
50  session->transaction().start(false);
51  coral::ISchema& schema = session->nominalSchema();
52  coral::ITable& hltconftable = schema.tableHandle(LumiNames::trghltMapTableName());
53  coral::AttributeList hltconfData;
54  hltconfData.extend<std::string>("HLTKEY");
55  hltconfData.extend<std::string>("HLTPATHNAME");
56  hltconfData.extend<std::string>("L1SEED");
57  coral::IBulkOperation* hltconfInserter = hltconftable.dataEditor().bulkInsert(hltconfData, 200);
58  //
59  //loop over hltpaths
60  //
61  hltconfData["HLTKEY"].data<std::string>() = fakehltkey;
62  std::string& hltpathname = hltconfData["HLTPATHNAME"].data<std::string>();
63  std::string& l1seed = hltconfData["L1SEED"].data<std::string>();
64  for (unsigned int i = 1; i <= totalhltpath; ++i) {
65  char c[10];
66  ::sprintf(c, "-%d", i);
67  hltpathname = std::string("FakeHLTPATH_") + std::string(c);
68  l1seed = std::string("FakeL1SeedExpression_") + std::string(c);
69  hltconfInserter->processNextIteration();
70  }
71  hltconfInserter->flush();
72  delete hltconfInserter;
73  session->transaction().commit();
74  } catch (const coral::Exception& er) {
75  std::cout << "database problem " << er.what() << std::endl;
76  session->transaction().rollback();
77  delete session;
78  delete svc;
79  throw er;
80  }
81  delete session;
82  delete svc;
83  return 0;
84  }
85  const std::string HLTConfDummy2DB::dataType() const { return "HLTCONF"; }
86  const std::string HLTConfDummy2DB::sourceType() const { return "DUMMY"; }
88 } // namespace lumi
91 #endif
mps_fire.i
i
Definition: mps_fire.py:428
DataPipe.h
lumi::DataPipe::m_dest
std::string m_dest
Definition: DataPipe.h:27
lumi::HLTConfDummy2DB::dataType
const std::string dataType() const override
Definition: HLTConfDummy2DB.cc:85
gather_cfg.cout
cout
Definition: gather_cfg.py:144
lumi::DataPipe
Definition: DataPipe.h:8
lumi::DBConfig::setAuthentication
void setAuthentication(const std::string &authPath)
Definition: DBConfig.cc:15
LumiNames.h
DataPipeFactory.h
lumi::HLTConfDummy2DB::retrieveData
unsigned long long retrieveData(unsigned int runnumber) override
Definition: HLTConfDummy2DB.cc:36
lumi::HLTConfDummy2DB::HLTConfDummy2DB
HLTConfDummy2DB(const std::string &dest)
Definition: HLTConfDummy2DB.cc:35
triggerObjects_cff.l1seed
l1seed
Definition: triggerObjects_cff.py:33
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
lumi::LumiNames::trghltMapTableName
static const std::string trghltMapTableName()
Definition: LumiNames.cc:19
lumi::HLTConfDummy2DB::~HLTConfDummy2DB
~HLTConfDummy2DB() override
Definition: HLTConfDummy2DB.cc:87
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
lumi::DataPipe::m_authpath
std::string m_authpath
Definition: DataPipe.h:29
edmplugin::PluginFactory
Definition: PluginFactory.h:34
cond::runnumber
Definition: Time.h:19
lumi::DBConfig
Definition: DBConfig.h:8
lumi::HLTConfDummy2DB
Definition: HLTConfDummy2DB.cc:24
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
lumi::HLTConfDummy2DB::sourceType
const std::string sourceType() const override
Definition: HLTConfDummy2DB.cc:86
Exception
Definition: hltDiff.cc:246
Exception.h
DBConfig.h
lumi
Definition: LumiSectionData.h:20
mps_fire.dest
dest
Definition: mps_fire.py:179