CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/L1TriggerConfig/L1GtConfigProducers/src/L1GtPsbSetupTrivialProducer.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtPsbSetupTrivialProducer.h"
00019 
00020 // system include files
00021 #include <memory>
00022 #include "boost/shared_ptr.hpp"
00023 
00024 #include <vector>
00025 
00026 // user include files
00027 #include "FWCore/Utilities/interface/EDMException.h"
00028 
00029 #include "FWCore/Framework/interface/ModuleFactory.h"
00030 #include "FWCore/Framework/interface/ESHandle.h"
00031 
00032 #include "CondFormats/DataRecord/interface/L1GtPsbSetupRcd.h"
00033 
00034 // forward declarations
00035 
00036 //
00037 
00038 
00039 // constructor(s)
00040 L1GtPsbSetupTrivialProducer::L1GtPsbSetupTrivialProducer(
00041         const edm::ParameterSet& parSet)
00042 {
00043     // tell the framework what data is being produced
00044     setWhatProduced(this, &L1GtPsbSetupTrivialProducer::producePsbSetup);
00045 
00046     // now do what ever other initialization is needed
00047 
00048     // detailed input configuration for PSB
00049     std::vector<edm::ParameterSet> psbSetup = parSet.getParameter<std::vector<
00050             edm::ParameterSet> > ("PsbSetup");
00051 
00052     // reserve space for L1 GT boards
00053     m_gtPsbSetup.reserve(psbSetup.size());
00054 
00055     std::vector<unsigned int> enableRecLvdsInt;
00056     enableRecLvdsInt.reserve(L1GtPsbConfig::PsbNumberLvdsGroups);
00057     std::vector<bool> enableRecLvds;
00058     enableRecLvds.reserve(L1GtPsbConfig::PsbNumberLvdsGroups);
00059 
00060     std::vector<unsigned int> enableRecSerLinkInt;
00061     enableRecSerLinkInt.reserve(L1GtPsbConfig::PsbSerLinkNumberChannels);
00062     std::vector<bool> enableRecSerLink;
00063     enableRecSerLink.reserve(L1GtPsbConfig::PsbSerLinkNumberChannels);
00064 
00065     for (std::vector<edm::ParameterSet>::const_iterator itPSet =
00066             psbSetup.begin(); itPSet != psbSetup.end(); ++itPSet) {
00067 
00068         //
00069         L1GtPsbConfig psbConfig(itPSet->getParameter<int> ("Slot"));
00070 
00071         psbConfig.setGtPsbCh0SendLvds(
00072                 itPSet->getParameter<bool> ("Ch0SendLvds"));
00073         psbConfig.setGtPsbCh1SendLvds(
00074                 itPSet->getParameter<bool> ("Ch1SendLvds"));
00075 
00076         enableRecLvdsInt = itPSet->getParameter<std::vector<unsigned int> > (
00077                 "EnableRecLvds");
00078 
00079         for (std::vector<unsigned int>::const_iterator cIt =
00080                 enableRecLvdsInt.begin(); cIt != enableRecLvdsInt.end(); ++cIt) {
00081             bool val = *cIt;
00082             enableRecLvds.push_back(val);
00083         }
00084 
00085         psbConfig.setGtPsbEnableRecLvds(enableRecLvds);
00086         enableRecLvds.clear();
00087 
00088         enableRecSerLinkInt
00089                 = itPSet->getParameter<std::vector<unsigned int> > (
00090                         "EnableRecSerLink");
00091 
00092         for (std::vector<unsigned int>::const_iterator cIt =
00093                 enableRecSerLinkInt.begin(); cIt != enableRecSerLinkInt.end(); ++cIt) {
00094             bool val = *cIt;
00095             enableRecSerLink.push_back(val);
00096         }
00097 
00098         psbConfig.setGtPsbEnableRecSerLink(enableRecSerLink);
00099         enableRecSerLink.clear();
00100 
00101         // push the board in the vector
00102         m_gtPsbSetup.push_back(psbConfig);
00103 
00104     }
00105 
00106 }
00107 
00108 // destructor
00109 L1GtPsbSetupTrivialProducer::~L1GtPsbSetupTrivialProducer()
00110 {
00111 
00112     // empty
00113 
00114 }
00115 
00116 // member functions
00117 
00118 // method called to produce the data
00119 boost::shared_ptr<L1GtPsbSetup> L1GtPsbSetupTrivialProducer::producePsbSetup(
00120         const L1GtPsbSetupRcd& iRecord)
00121 {
00122 
00123     using namespace edm::es;
00124 
00125     boost::shared_ptr<L1GtPsbSetup> pL1GtPsbSetup = boost::shared_ptr<
00126             L1GtPsbSetup>(new L1GtPsbSetup());
00127 
00128     pL1GtPsbSetup->setGtPsbSetup(m_gtPsbSetup);
00129 
00130     return pL1GtPsbSetup;
00131 }
00132