test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripPayloadMapTableCreator.cc
Go to the documentation of this file.
5 
6 #include <iostream>
7 
9 
10 #include "RelationalAccess/ITransaction.h"
11 #include "RelationalAccess/ISessionProxy.h"
12 #include "RelationalAccess/ISchema.h"
13 #include "RelationalAccess/ITable.h"
14 #include "RelationalAccess/TableDescription.h"
15 #include "CoralBase/Attribute.h"
16 #include "CoralBase/AttributeList.h"
17 #include "CoralBase/TimeStamp.h"
18 
19 
21 public:
22  explicit SiStripPayloadMapTableCreator(const edm::ParameterSet& iConfig );
24  virtual void analyze( const edm::Event& evt, const edm::EventSetup& evtSetup);
25  virtual void endJob();
26 
27 private:
30 };
31 
32 
34  m_connectionPool(),
35  m_configMapDb( iConfig.getParameter< std::string >("configMapDatabase") ){
38 }
39 
41 }
42 
44  boost::shared_ptr<coral::ISessionProxy> cmDbSession = m_connectionPool.createCoralSession( m_configMapDb, true );
45  coral::TableDescription mapTable;
46  mapTable.setName("STRIP_CONFIG_TO_PAYLOAD_MAP");
47  mapTable.insertColumn("CONFIG_HASH", coral::AttributeSpecification::typeNameForType<std::string>());
48  mapTable.insertColumn("PAYLOAD_HASH", coral::AttributeSpecification::typeNameForType<std::string>());
49  mapTable.insertColumn("PAYLOAD_TYPE", coral::AttributeSpecification::typeNameForType<std::string>());
50  mapTable.insertColumn("CONFIG_STRING", coral::AttributeSpecification::typeNameForType<std::string>());
51  mapTable.insertColumn("INSERTION_TIME", coral::AttributeSpecification::typeNameForType<coral::TimeStamp>());
52  mapTable.setPrimaryKey("CONFIG_HASH");
53  mapTable.setNotNullConstraint("CONFIG_HASH");
54  mapTable.setNotNullConstraint("PAYLOAD_HASH");
55  mapTable.setNotNullConstraint("PAYLOAD_TYPE");
56  mapTable.setNotNullConstraint("CONFIG_STRING");
57  mapTable.setNotNullConstraint("INSERTION_TIME");
58 
59  cmDbSession->transaction().start( false );
60  cmDbSession->nominalSchema().createTable(mapTable);
61  cmDbSession->transaction().commit();
62 }
63 
65 }
66 
67 // ------
T getParameter(std::string const &) const
cond::persistency::ConnectionPool m_connectionPool
boost::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup)
void setParameters(const edm::ParameterSet &connectionPset)
SiStripPayloadMapTableCreator(const edm::ParameterSet &iConfig)