#include <WriterProxy.h>
Public Member Functions | |
virtual std::string | save (const edm::EventSetup &setup) const |
virtual | ~WriterProxyT () |
Definition at line 48 of file WriterProxy.h.
virtual l1t::WriterProxyT< Record, Type >::~WriterProxyT | ( | ) | [inline, virtual] |
Definition at line 51 of file WriterProxy.h.
{}
virtual std::string l1t::WriterProxyT< Record, Type >::save | ( | const edm::EventSetup & | setup | ) | const [inline, virtual] |
Implements l1t::WriterProxy.
Definition at line 54 of file WriterProxy.h.
References cond::classNameForTypeId(), cond::DbScopedTransaction::commit(), Exception, edm::EventSetup::get(), patZpeak::handle, edm::Service< T >::isAvailable(), edm::ESHandle< T >::product(), python::CommonUtils::session, cond::DbScopedTransaction::start(), and cond::DbSession::storeObject().
{ // load record and type from EventSetup and save them in db edm::ESHandle<Type> handle; try { setup.get<Record> ().get (handle); } catch( l1t::DataAlreadyPresentException& ex ) { return std::string() ; } // If handle is invalid, then data is already in DB edm::Service<cond::service::PoolDBOutputService> poolDb; if (!poolDb.isAvailable()) { throw cond::Exception( "DataWriter: PoolDBOutputService not available." ) ; } cond::DbSession session = poolDb->session(); cond::DbScopedTransaction tr(session); // if throw transaction will unroll tr.start(false); boost::shared_ptr<Type> pointer(new Type (*(handle.product ()))); std::string payloadToken = session.storeObject( pointer.get(), cond::classNameForTypeId(typeid(Type)) ); tr.commit(); return payloadToken ; }