CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
L1ConfigOnlineProdBaseExt< TRcd, TData > Class Template Referenceabstract

#include <L1ConfigOnlineProdBaseExt.h>

Inheritance diagram for L1ConfigOnlineProdBaseExt< TRcd, TData >:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1ConfigOnlineProdBaseExt (const edm::ParameterSet &)
 
virtual std::unique_ptr< const TData > newObject (const std::string &objectKey, const TRcd &iRecord)=0
 
std::unique_ptr< const TData > produce (const TRcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Protected Member Functions

bool getObjectKey (const TRcd &record, std::string &objectKey)
 
edm::ESConsumesCollectorT< TRcd > wrappedSetWhatProduced (const edm::ParameterSet &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Protected Attributes

bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Private Attributes

edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcdkey_token
 
edm::ESGetToken< L1TriggerKeyListExt, L1TriggerKeyListExtRcdkeyList_token
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 

Detailed Description

template<class TRcd, class TData>
class L1ConfigOnlineProdBaseExt< TRcd, TData >

Definition at line 32 of file L1ConfigOnlineProdBaseExt.h.

Constructor & Destructor Documentation

◆ L1ConfigOnlineProdBaseExt()

template<class TRcd , class TData >
L1ConfigOnlineProdBaseExt< TRcd, TData >::L1ConfigOnlineProdBaseExt ( const edm::ParameterSet iConfig)

Definition at line 63 of file L1ConfigOnlineProdBaseExt.h.

64  : m_omdsReader(),
65  m_forceGeneration(iConfig.getParameter<bool>("forceGeneration")),
66  m_dbSession(),
67  m_copyFromCondDB(false) {
68  //the following line is needed to tell the framework what
69  // data is being produced
70  // setWhatProduced(this)
71  // .setConsumes(keyList_token)
72  // .setConsumes(key_token);
73 
74  //now do what ever other initialization is needed
75 
76  if (iConfig.exists("copyFromCondDB")) {
77  m_copyFromCondDB = iConfig.getParameter<bool>("copyFromCondDB");
78 
79  if (m_copyFromCondDB) {
80  cond::persistency::ConnectionPool connectionPool;
81  // Connect DB Session
82  connectionPool.setAuthenticationPath(iConfig.getParameter<std::string>("onlineAuthentication"));
83  connectionPool.configure();
84  m_dbSession = connectionPool.createSession(iConfig.getParameter<std::string>("onlineDB"));
85  }
86  } else {
87  m_omdsReader.connect(iConfig.getParameter<std::string>("onlineDB"),
88  iConfig.getParameter<std::string>("onlineAuthentication"));
89  }
90 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cond::persistency::Session m_dbSession
bool exists(std::string const &parameterName) const
checks if a parameter exists
Session createSession(const std::string &connectionString, bool writeCapable=false)
void connect(const std::string &connectString, const std::string &authenticationPath)
Definition: OMDSReader.cc:43
void setAuthenticationPath(const std::string &p)

◆ ~L1ConfigOnlineProdBaseExt()

template<class TRcd , class TData >
L1ConfigOnlineProdBaseExt< TRcd, TData >::~L1ConfigOnlineProdBaseExt ( )
override

Definition at line 102 of file L1ConfigOnlineProdBaseExt.h.

102  {
103  // do anything here that needs to be done at desctruction time
104  // (e.g. close files, deallocate resources etc.)
105 }

Member Function Documentation

◆ getObjectKey()

template<class TRcd, class TData >
bool L1ConfigOnlineProdBaseExt< TRcd, TData >::getObjectKey ( const TRcd &  record,
std::string &  objectKey 
)
protected

// Get L1TriggerKeyList L1TriggerKeyList keyList ;

l1t::DataWriter dataWriter ;

<< "Problem getting last L1TriggerKeyList" ;

Definition at line 161 of file L1ConfigOnlineProdBaseExt.h.

161  {
162  // Get L1TriggerKeyExt
163  const L1TriggerKeyExtRcd& keyRcd = record.template getRecord<L1TriggerKeyExtRcd>();
164 
165  // Explanation of funny syntax: since record is dependent, we are not
166  // expecting getRecord to be a template so the compiler parses it
167  // as a non-template. http://gcc.gnu.org/ml/gcc-bugs/2005-11/msg03685.html
168 
169  // If L1TriggerKeyExt is invalid, then all configuration objects are
170  // already in ORCON.
171  // edm::ESHandle<L1TriggerKeyExt> key_token;
172  try {
173  keyRcd.get(key_token);
174  } catch (l1t::DataAlreadyPresentException& ex) {
175  objectKey = std::string();
176  return false;
177  }
178 
179  // Get object key from L1TriggerKeyExt
180  std::string recordName = edm::typelookup::className<TRcd>();
181  std::string dataType = edm::typelookup::className<TData>();
182 
183  objectKey = keyRcd.get(key_token).get(recordName, dataType);
184 
185  /* edm::LogVerbatim( "L1-O2O" ) */
186  /* << "L1ConfigOnlineProdBase record " << recordName */
187  /* << " type " << dataType << " obj key " << objectKey ; */
188 
189  // Get L1TriggerKeyListExt
190  L1TriggerKeyListExt keyList;
193  l1t::DataWriterExt dataWriter;
195  if (!dataWriter.fillLastTriggerKeyList(keyList)) {
196  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
198  }
199 
200  // If L1TriggerKeyList does not contain object key, token is empty
201 
202  return keyList.token(recordName, dataType, objectKey).empty();
203 }
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > key_token
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
Log< level::Error, false > LogError
std::string token(const std::string &tscKey) const
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const

◆ newObject()

template<class TRcd, class TData>
virtual std::unique_ptr<const TData> L1ConfigOnlineProdBaseExt< TRcd, TData >::newObject ( const std::string &  objectKey,
const TRcd &  iRecord 
)
pure virtual

◆ produce()

template<class TRcd, class TData >
std::unique_ptr< const TData > L1ConfigOnlineProdBaseExt< TRcd, TData >::produce ( const TRcd &  iRecord)

// Get L1TriggerKeyList from EventSetup const L1TriggerKeyListRcd& keyListRcd =
iRecord.template getRecord< L1TriggerKeyListRcd >() ; edm::ESHandle< L1TriggerKeyList > keyList ;

Definition at line 108 of file L1ConfigOnlineProdBaseExt.h.

108  {
109  std::unique_ptr<const TData> pData;
110 
111  // Get object key and check if already in ORCON
113  if (getObjectKey(iRecord, key) || m_forceGeneration) {
114  if (m_copyFromCondDB) {
115  // Get L1TriggerKeyListExt from EventSetup
116  const L1TriggerKeyListExtRcd& keyListRcd =
119  iRecord.template getRecord<L1TriggerKeyListExtRcd>();
122 
123  auto const& keyList = keyListRcd.get(keyList_token);
124 
125  // Find payload token
126  std::string recordName = edm::typelookup::className<TRcd>();
127  std::string dataType = edm::typelookup::className<TData>();
128  std::string payloadToken = keyList.token(recordName, dataType, key);
129 
130  edm::LogVerbatim("L1-O2O") << "Copying payload for " << recordName << "@" << dataType << " obj key " << key
131  << " from CondDB.";
132  edm::LogVerbatim("L1-O2O") << "TOKEN " << payloadToken;
133 
134  // Get object from POOL
135  // Copied from l1t::DataWriter::readObject()
136  if (!payloadToken.empty()) {
138  pData = m_dbSession.fetchPayload<TData>(payloadToken);
140  }
141  } else {
142  pData = newObject(key, iRecord);
143  }
144 
145  // if( pData.get() == 0 )
146  if (pData == std::unique_ptr<const TData>()) {
147  std::string dataType = edm::typelookup::className<TData>();
148 
149  throw l1t::DataInvalidException("Unable to generate " + dataType + " for key " + key + ".");
150  }
151  } else {
152  std::string dataType = edm::typelookup::className<TData>();
153 
154  throw l1t::DataAlreadyPresentException(dataType + " for key " + key + " already in CondDB.");
155  }
156 
157  return pData;
158 }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< L1TriggerKeyListExt, L1TriggerKeyListExtRcd > keyList_token
cond::persistency::Session m_dbSession
void start(bool readOnly=true)
Definition: Session.cc:18
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
Transaction & transaction()
Definition: Session.cc:52
virtual std::unique_ptr< const TData > newObject(const std::string &objectKey, const TRcd &iRecord)=0
bool getObjectKey(const TRcd &record, std::string &objectKey)
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const

◆ wrappedSetWhatProduced()

template<class TRcd , class TData >
edm::ESConsumesCollectorT< TRcd > L1ConfigOnlineProdBaseExt< TRcd, TData >::wrappedSetWhatProduced ( const edm::ParameterSet iConfig)
protected

Definition at line 93 of file L1ConfigOnlineProdBaseExt.h.

94  {
95  auto collector = setWhatProduced(this);
96  keyList_token = collector.consumes();
97  key_token = collector.consumes();
98  return collector;
99 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > key_token
edm::ESGetToken< L1TriggerKeyListExt, L1TriggerKeyListExtRcd > keyList_token

Member Data Documentation

◆ key_token

template<class TRcd, class TData>
edm::ESGetToken<L1TriggerKeyExt, L1TriggerKeyExtRcd> L1ConfigOnlineProdBaseExt< TRcd, TData >::key_token
private

Definition at line 44 of file L1ConfigOnlineProdBaseExt.h.

◆ keyList_token

template<class TRcd, class TData>
edm::ESGetToken<L1TriggerKeyListExt, L1TriggerKeyListExtRcd> L1ConfigOnlineProdBaseExt< TRcd, TData >::keyList_token
private

Definition at line 43 of file L1ConfigOnlineProdBaseExt.h.

◆ m_copyFromCondDB

template<class TRcd, class TData>
bool L1ConfigOnlineProdBaseExt< TRcd, TData >::m_copyFromCondDB
protected

◆ m_dbSession

template<class TRcd, class TData>
cond::persistency::Session L1ConfigOnlineProdBaseExt< TRcd, TData >::m_dbSession
protected

◆ m_forceGeneration

template<class TRcd, class TData>
bool L1ConfigOnlineProdBaseExt< TRcd, TData >::m_forceGeneration
protected

Definition at line 48 of file L1ConfigOnlineProdBaseExt.h.

◆ m_omdsReader

template<class TRcd, class TData>
l1t::OMDSReader L1ConfigOnlineProdBaseExt< TRcd, TData >::m_omdsReader
protected