File indexing completed on 2024-04-06 12:22:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <memory>
0021
0022
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
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
0049 edm::ESGetToken<L1RPCHwConfig, L1RPCHwConfigRcd> getToken_;
0050 };
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 TestHWConfig::TestHWConfig(const edm::ParameterSet& iConfig)
0064 : getToken_(esConsumes())
0065
0066 {
0067
0068 }
0069
0070
0071
0072
0073
0074
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 }
0099
0100 }
0101
0102
0103
0104 std::cout << " Done " << hwConfig.size() << std::endl;
0105 }
0106
0107
0108 DEFINE_FWK_MODULE(TestHWConfig);