CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1MuTriggerPtScaleOnlineProducer Class Reference

#include <L1MuTriggerPtScaleOnlineProducer.h>

Inheritance diagram for L1MuTriggerPtScaleOnlineProducer:
L1ConfigOnlineProdBase< L1MuTriggerPtScaleRcd, L1MuTriggerPtScale > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Member Functions

 L1MuTriggerPtScaleOnlineProducer (const edm::ParameterSet &)
boost::shared_ptr
< L1MuTriggerPtScale
newObject (const std::string &objectKey)
 ~L1MuTriggerPtScaleOnlineProducer ()

Private Attributes

unsigned int m_nBins
unsigned int m_nbitsPacking
bool m_signedPacking

Detailed Description

Definition at line 35 of file L1MuTriggerPtScaleOnlineProducer.h.


Constructor & Destructor Documentation

L1MuTriggerPtScaleOnlineProducer::L1MuTriggerPtScaleOnlineProducer ( const edm::ParameterSet ps)

Definition at line 25 of file L1MuTriggerPtScaleOnlineProducer.cc.

  : L1ConfigOnlineProdBase<L1MuTriggerPtScaleRcd, L1MuTriggerPtScale>(ps),
    m_signedPacking(ps.getParameter<bool>("signedPackingPt")),
    m_nbitsPacking(ps.getParameter<int>("nbitPackingPt")),
    m_nBins(ps.getParameter<int>("nbinsPt"))
{
}
L1MuTriggerPtScaleOnlineProducer::~L1MuTriggerPtScaleOnlineProducer ( )

Definition at line 33 of file L1MuTriggerPtScaleOnlineProducer.cc.

{}

Member Function Documentation

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

Implements L1ConfigOnlineProdBase< L1MuTriggerPtScaleRcd, L1MuTriggerPtScale >.

Definition at line 42 of file L1MuTriggerPtScaleOnlineProducer.cc.

References l1t::OMDSReader::basicQuery(), gather_cfg::cout, Exception, ScaleRecordHelper::extractScales(), h, L1MuTriggerPtScale_cfi::L1MuTriggerPtScale, m_nBins, m_nbitsPacking, L1ConfigOnlineProdBase< L1MuTriggerPtScaleRcd, L1MuTriggerPtScale >::m_omdsReader, m_signedPacking, ScaleRecordHelper::pushColumnNames(), query::result, and l1t::OMDSReader::singleAttribute().

{
   using namespace edm::es;

   // find Pt key from main scales key
   l1t::OMDSReader::QueryResults keysRecord = 
         m_omdsReader.basicQuery(
          // SELECTed columns
          "SC_MUON_PT_FK",
          // 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);
   }


   /*
SQL> describe cms_gt.l1t_scale_muon_pt;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                        NOT NULL VARCHAR2(300)
 PT_GEV_BIN_LOW_0                                   NUMBER
 [...]
 PT_GEV_BIN_LOW_32                                  NUMBER
   */

   ScaleRecordHelper h("PT_GEV_BIN_LOW", m_nBins );

   vector<string> columns;
   h.pushColumnNames(columns);

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

   if(resultRecord.numberRows() != 1) { 
       throw cond::Exception("Couldn't find Pt scale record for scales key `" 
                             + objectKey + "'") ;
   }

   vector<double> scales;
   h.extractScales(resultRecord, scales);
   
   boost::shared_ptr<L1MuTriggerPtScale> result( new L1MuTriggerPtScale(m_nbitsPacking, m_signedPacking, m_nBins, scales) );
   
#ifdef DEBUG_PT_SCALE
   cout << "PT scale:" << endl << result->getPtScale()->print() << endl;
#endif


   return result ;
}

Member Data Documentation

Definition at line 47 of file L1MuTriggerPtScaleOnlineProducer.h.

Referenced by newObject().

Definition at line 46 of file L1MuTriggerPtScaleOnlineProducer.h.

Referenced by newObject().

Definition at line 45 of file L1MuTriggerPtScaleOnlineProducer.h.

Referenced by newObject().