Instructions for writing a subclass of L1ConfigOnlineProdBase

This base class is templated on the type of object to be produced and its EventSetup record. Thus, individual subsystems implement one concrete subclass for each object to be constructed. The base class contains a protected data member m_omdsReader of type OMDSReader. In the subclasses, the newObject(...) function uses m_omdsReader and the input object key to read the necessary data from OMDS and construct the corresponding C++ object.

Skeleton for subclasses of L1ConfigOnlineProdBase

Unlike the object key producer above, each EventSetup record should have a corresponding producer based on the skeleton code below.

In the skeleton, replace MYSUBSYSTEM with your subsystem name and MYOBJECT with your configuration object name. Also, < use name=CondTools/L1Trigger > should be added to the CMS.BuildFile.

Instructions for translating SQL queries into C++ can be found at SWGuideOMDSReaderSQLQueries.

#include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
#include "CondFormats/L1TObjects/interface/MYOBJECT.h"
#include "CondFormats/DataRecord/interface/MYOBJECTRcd.h"

class MYOBJECTConfigOnlineProd : public L1ConfigOnlineProdBase< MYOBJECTRcd, MYOBJECT > {
   public:
      MYOBJECTConfigOnlineProd(const edm::ParameterSet& iConfig)
         : L1ConfigOnlineProdBase< MYOBJECTRcd, MYOBJECT >( iConfig ) {}
      ~MYOBJECTConfigOnlineProd() {}

      virtual boost::shared_ptr< MYOBJECT > newObject( const std::string& objectKey ) ;
   private:
};

boost::shared_ptr< MYOBJECT >
MYOBJECTConfigOnlineProd::newObject( const std::string& objectKey )
{
   // Execute SQL queries to get data from OMDS (using key) and make C++ object
   // Example: SELECT A_PARAMETER FROM CMS_XXX.XXX_CONF WHERE XXX_CONF.XXX_KEY = objectKey
   l1t::OMDSReader::QueryResults results =
       m_omdsReader.basicQuery(
         "A_DATUM",
         "CMS_XXX",
         "XXX_CONF",
         "XXX_CONF.XXX_KEY",
         m_omdsReader.singleAttribute( objectKey ) ) ;

   if( results.queryFailed() ) // check if query was successful
   {
      edm::LogError( "L1-O2O" ) << "Problem with L1RCTParameters key." ;
      return boost::shared_ptr< MYOBJECT >() ;
   }

   double datum ;
   results.fillVariable( datum ) ;

   return boost::shared_ptr< MYOBJECT >( new MYOBJECT( datum ) ) ;
}

DEFINE_FWK_EVENTSETUP_MODULE(MYOBJECTConfigOnlineProd);

Skeleton for MYOBJECTConfigOnline_cfi.py

import FWCore.ParameterSet.Config as cms
MYOBJECTConfigOnline = cms.ESProducer("MYOBJECTConfigOnlineProd",
    onlineAuthentication = cms.string('.'),
    forceGeneration = cms.bool(False),
    onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R')
)

-- WernerSun - 26 Feb 2009

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2009-02-27 - WernerSun
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback