CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected 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 boost::shared_ptr< TData > newObject (const std::string &objectKey, const TRcd &iRecord)=0
 
boost::shared_ptr< TData > produce (const TRcd &iRecord)
 
 ~L1ConfigOnlineProdBaseExt ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 

Protected Member Functions

bool getObjectKey (const TRcd &record, boost::shared_ptr< TData > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Protected Attributes

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

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

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

Definition at line 34 of file L1ConfigOnlineProdBaseExt.h.

Constructor & Destructor Documentation

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

Definition at line 66 of file L1ConfigOnlineProdBaseExt.h.

References cond::persistency::ConnectionPool::configure(), l1t::OMDSReader::connect(), cond::persistency::ConnectionPool::createSession(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), L1ConfigOnlineProdBaseExt< TRcd, TData >::m_copyFromCondDB, L1ConfigOnlineProdBaseExt< TRcd, TData >::m_dbSession, L1ConfigOnlineProdBaseExt< TRcd, TData >::m_omdsReader, cond::persistency::ConnectionPool::setAuthenticationPath(), edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

67  : m_omdsReader(),
68  m_forceGeneration( iConfig.getParameter< bool >( "forceGeneration" ) ),
69  m_dbSession(),
70  m_copyFromCondDB( false )
71 {
72  //the following line is needed to tell the framework what
73  // data is being produced
74  setWhatProduced(this);
75 
76  //now do what ever other initialization is needed
77 
78  if( iConfig.exists( "copyFromCondDB" ) )
79  {
80  m_copyFromCondDB = iConfig.getParameter< bool >( "copyFromCondDB" ) ;
81 
82  if( m_copyFromCondDB )
83  {
84  cond::persistency::ConnectionPool connectionPool;
85  // Connect DB Session
86  connectionPool.setAuthenticationPath(
87  iConfig.getParameter< std::string >( "onlineAuthentication" ) ) ;
88  connectionPool.configure() ;
89  m_dbSession = connectionPool.createSession( iConfig.getParameter< std::string >( "onlineDB" ) ) ;
90  }
91  }
92  else
93  {
95  iConfig.getParameter< std::string >( "onlineDB" ),
96  iConfig.getParameter< std::string >( "onlineAuthentication" ) ) ;
97  }
98 }
T getParameter(std::string const &) const
cond::persistency::Session m_dbSession
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
Session createSession(const std::string &connectionString, bool writeCapable=false)
void connect(const std::string &connectString, const std::string &authenticationPath)
Definition: OMDSReader.cc:49
void setAuthenticationPath(const std::string &p)
template<class TRcd , class TData >
L1ConfigOnlineProdBaseExt< TRcd, TData >::~L1ConfigOnlineProdBaseExt ( )

Definition at line 101 of file L1ConfigOnlineProdBaseExt.h.

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

Member Function Documentation

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

// Get L1TriggerKeyList L1TriggerKeyList keyList ;

l1t::DataWriter dataWriter ;

<< "Problem getting last L1TriggerKeyList" ;

Definition at line 184 of file L1ConfigOnlineProdBaseExt.h.

References dtTPAnalyzer_cfg::dataType, edm::false, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::eventsetup::EventSetupRecord::get(), relval_steps::key, align_cfg::recordName, AlCaHLTBitMon_QueryRunRegistry::string, and L1TriggerKeyListExt::token().

188 {
189  // Get L1TriggerKeyExt
190  const L1TriggerKeyExtRcd& keyRcd =
191  record.template getRecord< L1TriggerKeyExtRcd >() ;
192 
193  // Explanation of funny syntax: since record is dependent, we are not
194  // expecting getRecord to be a template so the compiler parses it
195  // as a non-template. http://gcc.gnu.org/ml/gcc-bugs/2005-11/msg03685.html
196 
197  // If L1TriggerKeyExt is invalid, then all configuration objects are
198  // already in ORCON.
200  try
201  {
202  keyRcd.get( key ) ;
203  }
205  {
206  objectKey = std::string() ;
207  return false ;
208  }
209 
210  // Get object key from L1TriggerKeyExt
211  std::string recordName = edm::typelookup::className<TRcd>();
212  std::string dataType = edm::typelookup::className<TData>();
213 
214  objectKey = key->get( recordName, dataType ) ;
215 
216 /* edm::LogVerbatim( "L1-O2O" ) */
217 /* << "L1ConfigOnlineProdBase record " << recordName */
218 /* << " type " << dataType << " obj key " << objectKey ; */
219 
220  // Get L1TriggerKeyListExt
221  L1TriggerKeyListExt keyList ;
224  l1t::DataWriterExt dataWriter ;
226  if( !dataWriter.fillLastTriggerKeyList( keyList ) )
227  {
228  edm::LogError( "L1-O2O" )
229  << "Problem getting last L1TriggerKeyListExt" ;
231  }
232 
233  // If L1TriggerKeyList does not contain object key, token is empty
234 
235  return
236  keyList.token( recordName, dataType, objectKey ) == std::string() ;
237 }
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
JetCorrectorParameters::Record record
Definition: classes.h:7
tuple recordName
Definition: align_cfg.py:66
void get(HolderT &iHolder) const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
volatile std::atomic< bool > shutdown_flag false
std::string token(const std::string &tscKey) const
template<class TRcd, class TData>
virtual boost::shared_ptr< TData > L1ConfigOnlineProdBaseExt< TRcd, TData >::newObject ( const std::string &  objectKey,
const TRcd &  iRecord 
)
pure virtual
template<class TRcd, class TData >
boost::shared_ptr< 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 111 of file L1ConfigOnlineProdBaseExt.h.

References dtTPAnalyzer_cfg::dataType, edm::eventsetup::EventSetupRecord::get(), relval_steps::key, align_cfg::recordName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

112 {
113  using namespace edm::es;
114  boost::shared_ptr< TData > pData ;
115 
116  // Get object key and check if already in ORCON
117  std::string key ;
118  if( getObjectKey( iRecord, pData, key ) || m_forceGeneration )
119  {
120  if( m_copyFromCondDB )
121  {
122  // Get L1TriggerKeyListExt from EventSetup
123  const L1TriggerKeyListExtRcd& keyListRcd =
126  iRecord.template getRecord< L1TriggerKeyListExtRcd >() ;
130 
131  keyListRcd.get( keyList ) ;
132 
133  // Find payload token
134  std::string recordName = edm::typelookup::className<TRcd>();
135  std::string dataType = edm::typelookup::className<TData>();
136  std::string payloadToken =
137  keyList->token( recordName, dataType, key ) ;
138 
139  edm::LogVerbatim( "L1-O2O" )
140  << "Copying payload for " << recordName
141  << "@" << dataType << " obj key " << key
142  << " from CondDB." ;
143  edm::LogVerbatim( "L1-O2O" )
144  << "TOKEN " << payloadToken ;
145 
146  // Get object from POOL
147  // Copied from l1t::DataWriter::readObject()
148  if( !payloadToken.empty() )
149  {
151  pData = m_dbSession.fetchPayload<TData>( payloadToken ) ;
153  }
154  }
155  else
156  {
157  pData = newObject( key, iRecord ) ;
158  }
159 
160  // if( pData.get() == 0 )
161  if( pData == boost::shared_ptr< TData >() )
162  {
163  std::string dataType = edm::typelookup::className<TData>();
164 
165  throw l1t::DataInvalidException( "Unable to generate " +
166  dataType + " for key " + key +
167  "." ) ;
168  }
169  }
170  else
171  {
172  std::string dataType = edm::typelookup::className<TData>();
173 
174  throw l1t::DataAlreadyPresentException( dataType +
175  " for key " + key + " already in CondDB." ) ;
176  }
177 
178  return pData ;
179 }
cond::persistency::Session m_dbSession
boost::shared_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:190
void start(bool readOnly=true)
Definition: Session.cc:22
tuple recordName
Definition: align_cfg.py:66
Transaction & transaction()
Definition: Session.cc:66
void get(HolderT &iHolder) const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
virtual boost::shared_ptr< TData > newObject(const std::string &objectKey, const TRcd &iRecord)=0
bool getObjectKey(const TRcd &record, boost::shared_ptr< TData > data, std::string &objectKey)

Member Data Documentation

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

Definition at line 49 of file L1ConfigOnlineProdBaseExt.h.

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