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 
20 
22 public:
23  explicit SiStripPayloadMapTableCreator(const edm::ParameterSet& iConfig );
25  void analyze( const edm::Event& evt, const edm::EventSetup& evtSetup) override;
26  void endJob() override;
27 
28 private:
31 };
32 
33 
36  m_configMapDb( iConfig.getParameter< std::string >("configMapDatabase") ){
39 }
40 
42 }
43 
45  std::shared_ptr<coral::ISessionProxy> cmDbSession = m_connectionPool.createCoralSession( m_configMapDb, true );
46  coral::TableDescription mapTable;
47  mapTable.setName("STRIP_CONFIG_TO_PAYLOAD_MAP");
48  mapTable.insertColumn("CONFIG_HASH", coral::AttributeSpecification::typeNameForType<std::string>());
49  mapTable.insertColumn("PAYLOAD_HASH", coral::AttributeSpecification::typeNameForType<std::string>());
50  mapTable.insertColumn("PAYLOAD_TYPE", coral::AttributeSpecification::typeNameForType<std::string>());
51  mapTable.insertColumn("CONFIG_STRING", coral::AttributeSpecification::typeNameForType<std::string>());
52  mapTable.insertColumn("INSERTION_TIME", coral::AttributeSpecification::typeNameForType<coral::TimeStamp>());
53  mapTable.setPrimaryKey("CONFIG_HASH");
54  mapTable.setNotNullConstraint("CONFIG_HASH");
55  mapTable.setNotNullConstraint("PAYLOAD_HASH");
56  mapTable.setNotNullConstraint("PAYLOAD_TYPE");
57  mapTable.setNotNullConstraint("CONFIG_STRING");
58  mapTable.setNotNullConstraint("INSERTION_TIME");
59 
60  cmDbSession->transaction().start( false );
61  cmDbSession->nominalSchema().createTable(mapTable);
62  cmDbSession->transaction().commit();
63 }
64 
66 }
67 
68 // ------
T getParameter(std::string const &) const
cond::persistency::ConnectionPool m_connectionPool
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
void setParameters(const edm::ParameterSet &connectionPset)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiStripPayloadMapTableCreator(const edm::ParameterSet &iConfig)
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)