CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/L1TriggerConfig/L1GtConfigProducers/src/L1GtParametersTrivialProducer.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtParametersTrivialProducer.h"
00019 
00020 // system include files
00021 #include <memory>
00022 
00023 #include "boost/shared_ptr.hpp"
00024 #include <boost/cstdint.hpp>
00025 
00026 
00027 // user include files
00028 //   base class
00029 #include "FWCore/Framework/interface/ESProducer.h"
00030 
00031 #include "FWCore/Framework/interface/ModuleFactory.h"
00032 
00033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00034 #include "FWCore/MessageLogger/interface/MessageDrop.h"
00035 
00036 #include "CondFormats/DataRecord/interface/L1GtParametersRcd.h"
00037 
00038 // forward declarations
00039 
00040 // constructor(s)
00041 L1GtParametersTrivialProducer::L1GtParametersTrivialProducer(const edm::ParameterSet& parSet)
00042 {
00043     // tell the framework what data is being produced
00044     setWhatProduced(this, &L1GtParametersTrivialProducer::produceGtParameters);
00045 
00046     // now do what ever other initialization is needed
00047 
00048     // total Bx's in the event
00049 
00050     m_totalBxInEvent = parSet.getParameter<int>("TotalBxInEvent");
00051 
00052     if (m_totalBxInEvent > 0) {
00053         if ( (m_totalBxInEvent%2) == 0 ) {
00054             m_totalBxInEvent = m_totalBxInEvent - 1;
00055 
00056             edm::LogInfo("L1GtParametersTrivialProducer")
00057             << "\nWARNING: Number of bunch crossing in event rounded to: "
00058             << m_totalBxInEvent << "\n         The number must be an odd number!\n"
00059             << std::endl;
00060         }
00061     } else {
00062 
00063         edm::LogInfo("L1GtParametersTrivialProducer")
00064         << "\nWARNING: Number of bunch crossing in event must be a positive number!"
00065         << "\n  Requested value was: " << m_totalBxInEvent
00066         << "\n  Reset to 1 (L1Accept bunch only).\n"
00067         << std::endl;
00068 
00069         m_totalBxInEvent = 1;
00070 
00071     }
00072 
00073     m_daqActiveBoards = static_cast<boost::uint16_t> (parSet.getParameter<unsigned int> (
00074             "DaqActiveBoards"));
00075 
00076     m_evmActiveBoards = static_cast<boost::uint16_t> (parSet.getParameter<unsigned int> (
00077             "EvmActiveBoards"));
00078 
00079     m_daqNrBxBoard = parSet.getParameter<std::vector<int> > ("DaqNrBxBoard");
00080 
00081     m_evmNrBxBoard = parSet.getParameter<std::vector<int> > ("EvmNrBxBoard");
00082 
00083     m_bstLengthBytes = parSet.getParameter<unsigned int> ("BstLengthBytes");
00084 
00085 }
00086 
00087 // destructor
00088 L1GtParametersTrivialProducer::~L1GtParametersTrivialProducer()
00089 {
00090 
00091     // empty
00092 
00093 }
00094 
00095 
00096 // member functions
00097 
00098 // method called to produce the data
00099 boost::shared_ptr<L1GtParameters> L1GtParametersTrivialProducer::produceGtParameters(
00100     const L1GtParametersRcd& iRecord)
00101 {
00102 
00103     using namespace edm::es;
00104 
00105 
00106     boost::shared_ptr<L1GtParameters> pL1GtParameters =
00107         boost::shared_ptr<L1GtParameters>( new L1GtParameters() );
00108 
00109 
00110     // set total Bx's in the event
00111     pL1GtParameters->setGtTotalBxInEvent(m_totalBxInEvent);
00112 
00113     // set the active boards for L1 GT DAQ record
00114     pL1GtParameters->setGtDaqActiveBoards(m_daqActiveBoards);
00115 
00116     // set the active boards for L1 GT EVM record
00117     pL1GtParameters->setGtEvmActiveBoards(m_evmActiveBoards);
00118 
00119     // set the number of Bx per board for L1 GT DAQ record
00120     pL1GtParameters->setGtDaqNrBxBoard(m_daqNrBxBoard);
00121 
00122     // set the number of Bx per board for L1 GT EVM record
00123     pL1GtParameters->setGtEvmNrBxBoard(m_evmNrBxBoard);
00124 
00125     // set length of BST record (in bytes) for L1 GT EVM record
00126     pL1GtParameters->setGtBstLengthBytes(m_bstLengthBytes);
00127 
00128     return pL1GtParameters ;
00129 }
00130