File indexing completed on 2024-04-06 12:02:31
0001 #include <iostream>
0002
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009
0010 #include "CondFormats/RPCObjects/interface/RPCReadOutMapping.h"
0011 #include "CondFormats/DataRecord/interface/RPCReadOutMappingRcd.h"
0012 #include "CondFormats/RPCObjects/interface/RPCEMap.h"
0013 #include "CondFormats/DataRecord/interface/RPCEMapRcd.h"
0014
0015 using namespace std;
0016 using namespace edm;
0017
0018
0019 class RPCReadOutMapAnalyzer : public edm::one::EDAnalyzer<> {
0020 public:
0021 explicit RPCReadOutMapAnalyzer(const edm::ParameterSet&);
0022 ~RPCReadOutMapAnalyzer() override = default;
0023 void analyze(const edm::Event&, const edm::EventSetup&) override;
0024
0025 private:
0026 bool m_flag;
0027 edm::ESGetToken<RPCEMap, RPCEMapRcd> readoutMappingToken_;
0028 edm::ESGetToken<RPCReadOutMapping, RPCReadOutMappingRcd> mapZeroToken_;
0029 };
0030
0031 RPCReadOutMapAnalyzer::RPCReadOutMapAnalyzer(const edm::ParameterSet& iConfig)
0032 : m_flag(iConfig.getUntrackedParameter<bool>("useNewEMap", false)),
0033 readoutMappingToken_(esConsumes()),
0034 mapZeroToken_(esConsumes()) {
0035 ::putenv(const_cast<char*>(std::string("CORAL_AUTH_USER konec").c_str()));
0036 ::putenv(const_cast<char*>(std::string("CORAL_AUTH_PASSWORD konecPass").c_str()));
0037 }
0038
0039 void RPCReadOutMapAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0040 std::cout << "====== RPCReadOutMapAnalyzer" << std::endl;
0041
0042 const RPCReadOutMapping* map;
0043 if (m_flag) {
0044 map = iSetup.getData(readoutMappingToken_).convert();
0045 } else {
0046 map = &iSetup.getData(mapZeroToken_);
0047 }
0048 cout << "version: " << map->version() << endl;
0049
0050 pair<int, int> dccRange = map->dccNumberRange();
0051 cout << " dcc range: " << dccRange.first << " to " << dccRange.second << endl;
0052 vector<const DccSpec*> dccs = map->dccList();
0053 typedef vector<const DccSpec*>::const_iterator IDCC;
0054 for (IDCC idcc = dccs.begin(); idcc != dccs.end(); idcc++)
0055 cout << (**idcc).print(4);
0056
0057 cout << "--- --- --- --- --- --- --- --- ---" << endl;
0058 cout << "--- --- --- --- --- --- --- --- ---" << endl;
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 }
0085
0086
0087 DEFINE_FWK_MODULE(RPCReadOutMapAnalyzer);