Instructions for writing a subclass of L1ObjectKeysOnlineProdBase for Run Settings objects

For TSC objects, see SWGuideL1ObjectKeysOnlineProdBaseTSC instead.

For Run Settings (RS) objects, the object key is read from a designated table in OMDS, e.g. MYSUBSYSTEM_RUN_SETTINGS_KEY_CURRENT, that contains a single row with the object keys for the next run. There is no need to determine the TSC key or the top-level subsystem keys, so the three-step workflow used for TSC key objects is unnecessary.

This base class, L1ObjectKeysOnlineProdBase, contains a protected data member m_omdsReader of type OMDSReader. Individual subsystems implement a concrete subclass, in which the fillObjectKeys(...) function uses m_omdsReader to determine the object keys by reading them directly from MYSUBSYSTEM_RUN_SETTINGS_KEY_CURRENT. These object keys are then stored in the L1TriggerKey object given as an argument to fillObjectKeys(...).

Skeleton for subclasses of L1ObjectKeysOnlineProdBase for RS objects

The skeleton below shows example code for a single object key. However, all the object keys for a given subsystem should be handled by a single producer, so the code below should be replicated for each object key. The skeleton also shows how to enable/disable O2O for each object through run-time parameters (read in through the ParameterSet); this functionality is optional.

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

This key is also used by the ESProducers that read the configuration data from OMDS (subclasses of L1ConfigOnlineProdBase). So, the choice of object key must be coordinated between the two ESProducers.

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

#include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

class MYSUBSYSTEM_RSKeysOnlineProd : public L1ObjectKeysOnlineProdBase {
   public:
      MYSUBSYSTEM_RSKeysOnlineProd(const edm::ParameterSet& iConfig) ;
      ~MYSUBSYSTEM_RSKeysOnlineProd() {}

      virtual void fillObjectKeys( ReturnType pL1TriggerKey ) ;
   private:
      bool m_enableMYOBJECT ;
};

MYSUBSYSTEM_RSKeysOnlineProd::MYSUBSYSTEM_RSKeysOnlineProd(const edm::ParameterSet& iConfig)
   : L1ObjectKeysOnlineProdBase( iConfig ),
     m_enableMYOBJECT( iConfig.getParameter< bool >( "enableMYOBJECT" ) )
{
}

void
MYSUBSYSTEM_RSKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey )
{
   if( m_enableMYOBJECT )
   {
      // Execute SQL queries to get data from OMDS (using key) and make C++ object.
      // Example: SELECT A_KEY FROM CMS_XXX.XXX_RUN_SETTINGS_KEYS_CURRENT
      l1t::OMDSReader::QueryResults objectKeyResults =
         m_omdsReader.basicQuery(
            "A_KEY",
            "CMS_XXX",
            "XXX_RUN_SETTINGS_KEYS_CURRENT" );

      std::string objectKey ;

      // check if query was successful
      if( objectKeyResults.queryFailed() )
      {
          edm::LogError("L1-O2O")
                  << "Problem with key for record MYOBJECTRcd: query failed ";
      }
      else if( objectKeyResults.numberRows() != 1 )
      {
          edm::LogError("L1-O2O")
                  << "Problem with key for record MYOBJECTRcd: "
                  << (objectKeyResults.numberRows()) << " rows were returned";
      }
      else
      {
         objectKeyResults.fillVariable( objectKey ) ;
      }

      pL1TriggerKey->add( "MYOBJECTRcd", "MYOBJECT", objectKey ) ;
   }
}

DEFINE_FWK_EVENTSETUP_MODULE(MYSUBSYSTEM_RSKeysOnlineProd);

Skeletons for python configuration files for RS object keys

MYSUBSYSTEM_RSKeysOnline_cfi.py

import FWCore.ParameterSet.Config as cms
MYSUBSYSTEM_RSKeysOnline = cms.ESProducer("MYSUBSYSTEM_RSKeysOnlineProd",
    onlineAuthentication = cms.string('.'),
    subsystemLabel = cms.string('MYSUBSYSTEM_'),
    onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'),
    enableMYOBJECT = cms.bool( True )
)

MYSUBSYSTEM_RSKeysOnline_cff.py

import FWCore.ParameterSet.Config as cms
from CondTools.L1Trigger.L1TriggerKeyDummy_cff import *
L1TriggerKeyDummy.objectKeys = cms.VPSet()
L1TriggerKeyDummy.label = cms.string('SubsystemKeysOnly')
from L1TriggerConfig.MYSUBSYSTEM_ConfigProducers.MYSUBSYSTEM_RSKeysOnline_cfi import *
MYSUBSYSTEM_RSKeysOnline.subsystemLabel = ''

-- WernerSun - 27 Feb 2009

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2009-03-28 - 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