CMS 3D CMS Logo

Public Member Functions

RCTObjectKeysOnlineProd Class Reference

Inheritance diagram for RCTObjectKeysOnlineProd:
L1ObjectKeysOnlineProdBase edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

virtual void fillObjectKeys (ReturnType pL1TriggerKey)
 RCTObjectKeysOnlineProd (const edm::ParameterSet &)
 ~RCTObjectKeysOnlineProd ()

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 32 of file RCTObjectKeysOnlineProd.cc.


Constructor & Destructor Documentation

RCTObjectKeysOnlineProd::RCTObjectKeysOnlineProd ( const edm::ParameterSet iConfig)

Definition at line 53 of file RCTObjectKeysOnlineProd.cc.

  : L1ObjectKeysOnlineProdBase( iConfig )
{}
RCTObjectKeysOnlineProd::~RCTObjectKeysOnlineProd ( )

Definition at line 58 of file RCTObjectKeysOnlineProd.cc.

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

}

Member Function Documentation

void RCTObjectKeysOnlineProd::fillObjectKeys ( ReturnType  pL1TriggerKey) [virtual]

Implements L1ObjectKeysOnlineProdBase.

Definition at line 73 of file RCTObjectKeysOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), gather_cfg::cout, l1t::OMDSReader::QueryResults::fillVariable(), L1TriggerKey::kRCT, L1ObjectKeysOnlineProdBase::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), and l1t::OMDSReader::singleAttribute().

{
  std::string rctKey = pL1TriggerKey->subsystemKey( L1TriggerKey::kRCT ) ;

  if( !rctKey.empty() )
    {
      std::string paremKey, scaleKey, ecalScaleKey , hcalScaleKey;
      // SELECT RCT_PARAMETER FROM RCT_CONF WHERE RCT_CONF.RCT_KEY = rctKey
      l1t::OMDSReader::QueryResults paremKeyResults =
        m_omdsReader.basicQuery( "RCT_PARAMETER",
                                 "CMS_RCT",
                                 "RCT_CONF",
                                 "RCT_CONF.RCT_KEY",
                                 m_omdsReader.singleAttribute( rctKey  ) );


      if( paremKeyResults.queryFailed() ||
          paremKeyResults.numberRows() != 1 ) // check query successful
        {
          edm::LogError( "L1-O2O" ) << "Problem with RCT Parameter key." ;
          return ;
        }


      l1t::OMDSReader::QueryResults scaleKeyResults =
        m_omdsReader.basicQuery( "L1T_SCALE_CALO_ET_THRESHOLD_ID",
                                 "CMS_RCT",
                                 "PAREM_CONF",
                                 "PAREM_CONF.PAREM_KEY",
                                 paremKeyResults );  // not null no need to check

      l1t::OMDSReader::QueryResults ecalKeyResults =
        m_omdsReader.basicQuery("ECAL_CONF",
                                "CMS_RCT",
                                "RCT_CONF",
                                "RCT_CONF.RCT_KEY",
                                m_omdsReader.singleAttribute(rctKey));

      if( ecalKeyResults.queryFailed() ||
          ecalKeyResults.numberRows() > 1 ) // check query successful)  
        {
          edm::LogError( "L1-O2O" ) << "Problem with rct_conf.ecal_conf." ;
          return ;
        }
      std::string ecalKey;
      if(!ecalKeyResults.fillVariable(ecalKey))
         ecalScaleKey = "NULL";
      else { // fill variable not null

        if( ecalKey == "NULL")
          ecalScaleKey = "NULL";
        else if(ecalKey == "IDENTITY")
          ecalScaleKey = "IDENTITY";
        else { // not identity or null
      

        l1t::OMDSReader::QueryResults ecalScaleKeyResults =
          m_omdsReader.basicQuery( "ECAL_LUT_CONFIG_ID",
                                     "CMS_RCT",
                                     "ECAL_SCALE_KEY",
                                   "ECAL_SCALE_KEY.ECAL_TAG",
                                     ecalKeyResults);
        
          if( ecalScaleKeyResults.queryFailed() ||
              ecalScaleKeyResults.numberRows() > 1 ) // check query successful)
            {
              std::cout << " nrows " << ecalScaleKeyResults.numberRows() <<std::endl;
              edm::LogError( "L1-O2O" ) << "bad results from lut_config_id." ;
              return ;
            }
          int ecalScaleTemp;
         
          ecalScaleKeyResults.fillVariable( ecalScaleTemp );

        


         std::stringstream ss;
         ss << ecalScaleTemp;
         ecalScaleKey = ss.str();
        }
      }    

      l1t::OMDSReader::QueryResults hcalKeyResults =
        m_omdsReader.basicQuery("HCAL_CONF",
                                "CMS_RCT",
                                "RCT_CONF",
                                "RCT_CONF.RCT_KEY",
                                m_omdsReader.singleAttribute(rctKey));

      if( hcalKeyResults.queryFailed() ||
          hcalKeyResults.numberRows() > 1 ) // check query successful)  
        {
          edm::LogError( "L1-O2O" ) << "Problem with rct_conf.hcal_conf." ;
          return ;
        }
      std::string hcalKey;
      if(!hcalKeyResults.fillVariable(hcalScaleKey))
        hcalScaleKey = "NULL";
  
    

      paremKeyResults.fillVariable( paremKey ) ;
      scaleKeyResults.fillVariable( scaleKey ) ;
  
      
      pL1TriggerKey->add( "L1RCTParametersRcd",
                          "L1RCTParameters",
                          paremKey ) ;
      pL1TriggerKey->add( "L1EmEtScaleRcd",
                          "L1CaloEtScale",
                          scaleKey ) ;
      pL1TriggerKey->add( "L1CaloEcalScaleRcd",
                          "L1CaloEcalScale",
                          ecalScaleKey ) ;
      pL1TriggerKey->add( "L1CaloHcalScaleRcd",
                          "L1CaloHcalScale",
                          hcalScaleKey ) ;
    }
}