Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:25

0001 // -*- C++ -*-
0002 //
0003 // Package:    TestHWConfig
0004 // Class:      TestHWConfig
0005 //
0006 /**\class TestHWConfig TestHWConfig.cc L1TriggerConfig/TestHWConfig/src/TestHWConfig.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Tomasz Maciej Frueboes
0015 //         Created:  Wed Apr  9 14:03:40 CEST 2008
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 
0031 #include "FWCore/Framework/interface/EventSetup.h"
0032 #include "FWCore/Framework/interface/ESHandle.h"
0033 
0034 #include "CondFormats/DataRecord/interface/L1RPCHwConfigRcd.h"
0035 #include "CondFormats/RPCObjects/interface/L1RPCHwConfig.h"
0036 
0037 //
0038 // class decleration
0039 //
0040 
0041 class TestHWConfig : public edm::global::EDAnalyzer<> {
0042 public:
0043   explicit TestHWConfig(const edm::ParameterSet&);
0044 
0045 private:
0046   void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override;
0047 
0048   // ----------member data ---------------------------
0049   edm::ESGetToken<L1RPCHwConfig, L1RPCHwConfigRcd> getToken_;
0050 };
0051 
0052 //
0053 // constants, enums and typedefs
0054 //
0055 
0056 //
0057 // static data member definitions
0058 //
0059 
0060 //
0061 // constructors and destructor
0062 //
0063 TestHWConfig::TestHWConfig(const edm::ParameterSet& iConfig)
0064     : getToken_(esConsumes())
0065 
0066 {
0067   //now do what ever initialization is needed
0068 }
0069 
0070 //
0071 // member functions
0072 //
0073 
0074 // ------------ method called to for each event  ------------
0075 void TestHWConfig::analyze(edm::StreamID, const edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0076   using namespace edm;
0077   L1RPCHwConfig const& hwConfig = iSetup.getData(getToken_);
0078 
0079   std::cout << "Checking crates " << std::endl;
0080 
0081   for (int crate = 0; crate < 12; ++crate) {
0082     std::set<int> enabledTowers;
0083 
0084     for (int tw = -16; tw < 17; ++tw) {
0085       if (hwConfig.isActive(tw, crate, 0))
0086         enabledTowers.insert(tw);
0087     }
0088 
0089     if (!enabledTowers.empty()) {
0090       std::cout << "Crate " << crate << ", active towers:";
0091 
0092       std::set<int>::iterator it;
0093       for (it = enabledTowers.begin(); it != enabledTowers.end(); ++it) {
0094         std::cout << " " << *it;
0095       }
0096       std::cout << std::endl;
0097 
0098     }  // printout
0099 
0100   }  // crate iteration ends
0101 
0102   //std::cout << "First BX: "<<hwConfig->getFirstBX()<<", last BX: "<<hwConfig->getLastBX()<<std::endl;
0103 
0104   std::cout << " Done " << hwConfig.size() << std::endl;
0105 }
0106 
0107 //define this as a plug-in
0108 DEFINE_FWK_MODULE(TestHWConfig);