CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1t::WriterProxyT< Record, Type > Class Template Reference

#include <WriterProxy.h>

Inheritance diagram for l1t::WriterProxyT< Record, Type >:
l1t::WriterProxy

Public Member Functions

std::string save (const edm::EventSetup &setup) const override
 
void setToken (edm::ConsumesCollector cc) override
 
 ~WriterProxyT () override
 
- Public Member Functions inherited from l1t::WriterProxy
virtual ~WriterProxy ()
 

Private Attributes

edm::ESGetToken< Type, RecordrcdToken
 

Detailed Description

template<class Record, class Type>
class l1t::WriterProxyT< Record, Type >

Definition at line 47 of file WriterProxy.h.

Constructor & Destructor Documentation

◆ ~WriterProxyT()

template<class Record , class Type >
l1t::WriterProxyT< Record, Type >::~WriterProxyT ( )
inlineoverride

Definition at line 52 of file WriterProxy.h.

52 {}

Member Function Documentation

◆ save()

template<class Record , class Type >
std::string l1t::WriterProxyT< Record, Type >::save ( const edm::EventSetup setup) const
inlineoverridevirtual

Implements l1t::WriterProxy.

Definition at line 57 of file WriterProxy.h.

References cond::persistency::Transaction::commit(), cond::service::PoolDBOutputService::forceInit(), patZpeak::handle, cond::persistency::Transaction::isActive(), edm::Service< T >::isAvailable(), l1t::WriterProxyT< Record, Type >::rcdToken, cond::service::PoolDBOutputService::session(), singleTopDQM_cfi::setup, cond::persistency::Transaction::start(), cond::persistency::Session::storePayload(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::persistency::Session::transaction().

Referenced by SpecificationBuilder_cfi.Specification::saveAll().

57  {
58  // load record and type from EventSetup and save them in db
60 
61  try {
62  handle = setup.getHandle(rcdToken);
63  } catch (l1t::DataAlreadyPresentException& ex) {
64  return std::string();
65  }
66  // If handle is invalid, then data is already in DB
67 
69  if (!poolDb.isAvailable()) {
70  throw cond::Exception("DataWriter: PoolDBOutputService not available.");
71  }
72  poolDb->forceInit();
73  cond::persistency::Session session = poolDb->session();
74  if (not session.transaction().isActive())
75  session.transaction().start(false); // true: read only, false: read-write
76 
77  std::shared_ptr<Type> pointer = std::make_shared<Type>(*(handle.product()));
78  std::string payloadToken = session.storePayload(*pointer);
79 
80  session.transaction().commit();
81  return payloadToken;
82  }
persistency::Exception Exception
Definition: Exception.h:25
void start(bool readOnly=true)
Definition: Session.cc:18
Transaction & transaction()
Definition: Session.cc:52
cond::Hash storePayload(const T &payload, const boost::posix_time::ptime &creationTime=boost::posix_time::microsec_clock::universal_time())
Definition: Session.h:186
bool isAvailable() const
Definition: Service.h:40
edm::ESGetToken< Type, Record > rcdToken
Definition: WriterProxy.h:49
cond::persistency::Session session() const

◆ setToken()

template<class Record , class Type >
void l1t::WriterProxyT< Record, Type >::setToken ( edm::ConsumesCollector  cc)
inlineoverridevirtual

Implements l1t::WriterProxy.

Definition at line 54 of file WriterProxy.h.

References gpuPixelDoublets::cc, and l1t::WriterProxyT< Record, Type >::rcdToken.

54 { rcdToken = cc.esConsumes(); }
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< Type, Record > rcdToken
Definition: WriterProxy.h:49

Member Data Documentation

◆ rcdToken

template<class Record , class Type >
edm::ESGetToken<Type, Record> l1t::WriterProxyT< Record, Type >::rcdToken
private