CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1MuTriggerScalesOnlineProducer Class Reference

#include <L1MuTriggerScalesOnlineProducer.h>

Inheritance diagram for L1MuTriggerScalesOnlineProducer:
L1ConfigOnlineProdBase< L1MuTriggerScalesRcd, L1MuTriggerScales > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 L1MuTriggerScalesOnlineProducer (const edm::ParameterSet &)
virtual boost::shared_ptr
< L1MuTriggerScales
newObject (const std::string &objectKey)
 ~L1MuTriggerScalesOnlineProducer ()

Private Attributes

unsigned int m_nbinsEta
unsigned int m_nbitPackingEta
unsigned int m_nbitPackingPhi
L1MuTriggerScales m_scales
bool m_signedPackingPhi

Detailed Description

Definition at line 37 of file L1MuTriggerScalesOnlineProducer.h.


Constructor & Destructor Documentation

L1MuTriggerScalesOnlineProducer::L1MuTriggerScalesOnlineProducer ( const edm::ParameterSet ps)

Definition at line 21 of file L1MuTriggerScalesOnlineProducer.cc.

  : L1ConfigOnlineProdBase<L1MuTriggerScalesRcd, L1MuTriggerScales>(ps),
    m_scales( 
              ps.getParameter<int>("nbitPackingDTEta"),
              ps.getParameter<bool>("signedPackingDTEta"),
              ps.getParameter<int>("nbinsDTEta"),
              ps.getParameter<double>("minDTEta"),
              ps.getParameter<double>("maxDTEta"),
              ps.getParameter<int>("offsetDTEta"),

              ps.getParameter<int>("nbitPackingCSCEta"),
              ps.getParameter<int>("nbinsCSCEta"),
              ps.getParameter<double>("minCSCEta"),
              ps.getParameter<double>("maxCSCEta"),

              ps.getParameter<std::vector<double> >("scaleRPCEta"),
              ps.getParameter<int>("nbitPackingBrlRPCEta"),
              ps.getParameter<bool>("signedPackingBrlRPCEta"),
              ps.getParameter<int>("nbinsBrlRPCEta"),
              ps.getParameter<int>("offsetBrlRPCEta"),
              ps.getParameter<int>("nbitPackingFwdRPCEta"),
              ps.getParameter<bool>("signedPackingFwdRPCEta"),
              ps.getParameter<int>("nbinsFwdRPCEta"),
              ps.getParameter<int>("offsetFwdRPCEta"),
              // Fields that should now be generated from OMDS:
              // TODO: Adjust m_scales's definition to be a bit
              //       more accessible for the partial initialization.
              //ps.getParameter<int>("nbitPackingGMTEta"),
              0,
              //ps.getParameter<int>("nbinsGMTEta"),
              0,
              //ps.getParameter<std::vector<double> >("scaleGMTEta"),
              std::vector<double>(1),
              //ps.getParameter<int>("nbitPackingPhi"),
              0,
              //ps.getParameter<bool>("signedPackingPhi"),
              false,
              //ps.getParameter<int>("nbinsPhi"),
              0,
              //ps.getParameter<double>("minPhi"),
              0,
              //ps.getParameter<double>("maxPhi") 
              0       
              ),
    /* Metadata that's not yet in the database. */
    m_nbitPackingPhi(ps.getParameter<int>("nbitPackingPhi")),
    m_nbitPackingEta(ps.getParameter<int>("nbitPackingGMTEta")),
    m_nbinsEta(ps.getParameter<int>("nbinsGMTEta")),
    m_signedPackingPhi(ps.getParameter<bool>("signedPackingPhi"))
{
}
L1MuTriggerScalesOnlineProducer::~L1MuTriggerScalesOnlineProducer ( )

Definition at line 73 of file L1MuTriggerScalesOnlineProducer.cc.

{}

Member Function Documentation

boost::shared_ptr< L1MuTriggerScales > L1MuTriggerScalesOnlineProducer::newObject ( const std::string &  objectKey) [virtual]

Implements L1ConfigOnlineProdBase< L1MuTriggerScalesRcd, L1MuTriggerScales >.

Definition at line 116 of file L1MuTriggerScalesOnlineProducer.cc.

References l1t::OMDSReader::basicQuery(), Exception, ScaleRecordHelper::extractScales(), L1MuTriggerScales_cfi::L1MuTriggerScales, m_nbinsEta, m_nbitPackingEta, m_nbitPackingPhi, L1ConfigOnlineProdBase< L1MuTriggerScalesRcd, L1MuTriggerScales >::m_omdsReader, m_scales, m_signedPackingPhi, ScaleRecordHelper::pushColumnNames(), L1MuTriggerScales::setGMTEtaScale(), L1MuTriggerScales::setPhiScale(), and l1t::OMDSReader::singleAttribute().

{
   using namespace edm::es;   

   // The key we get from the O2O subsystem is the CMS_GMT.L1T_SCALES key,
   // but the eta/phi scales have their own subtables, so let's find 
   // out.
   vector<string> foreignKeys;

   const std::string etaKeyColumn("SC_MUON_ETA_FK");
   const std::string phiKeyColumn("SC_MUON_PHI_FK");

   foreignKeys.push_back(etaKeyColumn);
   foreignKeys.push_back(phiKeyColumn);

   l1t::OMDSReader::QueryResults keysRecord = 
         m_omdsReader.basicQuery(
          // SELECTed columns
          foreignKeys,
          // schema name
          "CMS_GT",
          // table name
          "L1T_SCALES",
          // WHERE lhs
          "L1T_SCALES.ID",
          // WHERE rhs
          m_omdsReader.singleAttribute( objectKey  ) );

   if( keysRecord.numberRows() != 1 ) // check if query was successful
   {
       throw cond::Exception("Problem finding L1MuTriggerScales associated "
                             "with scales key `" + objectKey + "'");
   }


   std::string etaKeyValue;
   std::string phiKeyValue;
   keysRecord.fillVariable(etaKeyColumn, etaKeyValue);
   keysRecord.fillVariable(phiKeyColumn, phiKeyValue);

   vector<string> columns;

   // get the eta scales from the database
   ScaleRecordHelper etaHelper("ETA_BIN_LOW", m_nbinsEta);
   etaHelper.pushColumnNames(columns);

   l1t::OMDSReader::QueryResults etaRecord = 
         m_omdsReader.basicQuery(
          // SELECTed columns
          columns,
          // schema name
          "CMS_GT",
          // table name
          "L1T_SCALE_MUON_ETA",
          // WHERE lhs
          "L1T_SCALE_MUON_ETA.ID",
          // WHERE rhs
          m_omdsReader.singleAttribute( etaKeyValue  ) );

   vector<double> etaScales;
   etaHelper.extractScales(etaRecord, etaScales);
   
   auto_ptr<L1MuSymmetricBinnedScale> ptrEtaScale(new L1MuSymmetricBinnedScale(m_nbitPackingEta, m_nbinsEta, etaScales));
   m_scales.setGMTEtaScale(*ptrEtaScale);

   columns.clear();   

   // get the phi scales from the database
   PhiScaleHelper phiHelper;

   l1t::OMDSReader::QueryResults phiRecord = 
         m_omdsReader.basicQuery(
          // SELECTed columns
          columns,
          // schema name
          "CMS_GT",
          // table name
          "L1T_SCALE_MUON_PHI",
          // WHERE lhs
          "L1T_SCALE_MUON_PHI.ID",
          // WHERE rhs
          m_omdsReader.singleAttribute( phiKeyValue  ) );

   auto_ptr<L1MuBinnedScale> ptrPhiScale(phiHelper.makeBinnedScale(phiRecord, m_nbitPackingPhi, m_signedPackingPhi));

   m_scales.setPhiScale(*ptrPhiScale);

   boost::shared_ptr<L1MuTriggerScales> l1muscale =
     boost::shared_ptr<L1MuTriggerScales>( new L1MuTriggerScales( m_scales ) );

   return l1muscale ;
}

Member Data Documentation

Definition at line 50 of file L1MuTriggerScalesOnlineProducer.h.

Referenced by newObject().

Definition at line 49 of file L1MuTriggerScalesOnlineProducer.h.

Referenced by newObject().

Definition at line 48 of file L1MuTriggerScalesOnlineProducer.h.

Referenced by newObject().

Definition at line 47 of file L1MuTriggerScalesOnlineProducer.h.

Referenced by newObject().

Definition at line 51 of file L1MuTriggerScalesOnlineProducer.h.

Referenced by newObject().