CMS 3D CMS Logo

SiStripPayloadMapTableCreator.cc
Go to the documentation of this file.
6 
7 #include <iostream>
8 
10 
11 #include "RelationalAccess/ITransaction.h"
12 #include "RelationalAccess/ISessionProxy.h"
13 #include "RelationalAccess/ISchema.h"
14 #include "RelationalAccess/ITable.h"
15 #include "RelationalAccess/TableDescription.h"
16 #include "CoralBase/Attribute.h"
17 #include "CoralBase/AttributeList.h"
18 #include "CoralBase/TimeStamp.h"
19 
21 public:
22  explicit SiStripPayloadMapTableCreator(const edm::ParameterSet& iConfig);
24  void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
25  void endJob() override;
26 
27 private:
30 };
31 
33  : m_connectionPool(), m_configMapDb(iConfig.getParameter<std::string>("configMapDatabase")) {
36 }
37 
39 
41  std::shared_ptr<coral::ISessionProxy> cmDbSession = m_connectionPool.createCoralSession(m_configMapDb, true);
42  coral::TableDescription mapTable;
43  mapTable.setName("STRIP_CONFIG_TO_PAYLOAD_MAP");
44  mapTable.insertColumn("CONFIG_HASH", coral::AttributeSpecification::typeNameForType<std::string>());
45  mapTable.insertColumn("PAYLOAD_HASH", coral::AttributeSpecification::typeNameForType<std::string>());
46  mapTable.insertColumn("PAYLOAD_TYPE", coral::AttributeSpecification::typeNameForType<std::string>());
47  mapTable.insertColumn("CONFIG_STRING", coral::AttributeSpecification::typeNameForType<std::string>());
48  mapTable.insertColumn("INSERTION_TIME", coral::AttributeSpecification::typeNameForType<coral::TimeStamp>());
49  mapTable.setPrimaryKey("CONFIG_HASH");
50  mapTable.setNotNullConstraint("CONFIG_HASH");
51  mapTable.setNotNullConstraint("PAYLOAD_HASH");
52  mapTable.setNotNullConstraint("PAYLOAD_TYPE");
53  mapTable.setNotNullConstraint("CONFIG_STRING");
54  mapTable.setNotNullConstraint("INSERTION_TIME");
55 
56  cmDbSession->transaction().start(false);
57  cmDbSession->nominalSchema().createTable(mapTable);
58  cmDbSession->transaction().commit();
59 }
60 
62 
63 // ------
SiStripPayloadMapTableCreator::~SiStripPayloadMapTableCreator
~SiStripPayloadMapTableCreator() override
Definition: SiStripPayloadMapTableCreator.cc:38
SiStripPayloadMapTableCreator
Definition: SiStripPayloadMapTableCreator.cc:20
ConnectionPool.h
SiStripPayloadMapTableCreator::endJob
void endJob() override
Definition: SiStripPayloadMapTableCreator.cc:61
cond::persistency::ConnectionPool::createCoralSession
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:167
SiStripPayloadMapTableCreator::m_configMapDb
std::string m_configMapDb
Definition: SiStripPayloadMapTableCreator.cc:29
SiStripPayloadMapTableCreator::analyze
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
Definition: SiStripPayloadMapTableCreator.cc:40
EDAnalyzer.h
SiStripPayloadMapTableCreator::m_connectionPool
cond::persistency::ConnectionPool m_connectionPool
Definition: SiStripPayloadMapTableCreator.cc:28
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
cond::persistency::ConnectionPool
Definition: ConnectionPool.h:35
SiStripPayloadMapTableCreator::SiStripPayloadMapTableCreator
SiStripPayloadMapTableCreator(const edm::ParameterSet &iConfig)
Definition: SiStripPayloadMapTableCreator.cc:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
cond::persistency::ConnectionPool::setParameters
void setParameters(const edm::ParameterSet &connectionPset)
Definition: ConnectionPool.cc:41
edm::EventSetup
Definition: EventSetup.h:57
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:125
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet.h
edm::Event
Definition: Event.h:73