File indexing completed on 2024-04-06 12:02:01
0001
0002
0003
0004
0005
0006
0007 #include <stdexcept>
0008 #include <string>
0009 #include <iostream>
0010 #include <fstream>
0011 #include <map>
0012 #include <vector>
0013 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/MakerMacros.h"
0016
0017 #include "FWCore/Framework/interface/EventSetup.h"
0018 #include "FWCore/Utilities/interface/ESGetToken.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022
0023 #include "CondFormats/CSCObjects/interface/CSCCrateMap.h"
0024 #include "CondFormats/DataRecord/interface/CSCCrateMapRcd.h"
0025 #include "CondFormats/CSCObjects/interface/CSCMapItem.h"
0026
0027 using namespace std;
0028 namespace edmtest {
0029 class CSCReadCrateMapValuesAnalyzer : public edm::global::EDAnalyzer<> {
0030 public:
0031 explicit CSCReadCrateMapValuesAnalyzer(edm::ParameterSet const& p) : token_{esConsumes()} {}
0032 ~CSCReadCrateMapValuesAnalyzer() override {}
0033 void analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& c) const override;
0034
0035 private:
0036 const edm::ESGetToken<CSCCrateMap, CSCCrateMapRcd> token_;
0037 };
0038
0039 void CSCReadCrateMapValuesAnalyzer::analyze(edm::StreamID,
0040 const edm::Event& e,
0041 const edm::EventSetup& context) const {
0042 using namespace edm::eventsetup;
0043
0044 edm::LogSystem log("CSCCrateMap");
0045
0046 log << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0047 log << " ---EVENT NUMBER " << e.id().event() << std::endl;
0048
0049 const CSCCrateMap* myCrateMap = &context.getData(token_);
0050
0051 std::map<int, CSCMapItem::MapItem>::const_iterator it;
0052
0053 int count = 0;
0054 for (it = myCrateMap->crate_map.begin(); it != myCrateMap->crate_map.end(); ++it) {
0055 count = count + 1;
0056 log << "Key: crate " << it->first << std::endl;
0057
0058 log << count << ") ";
0059 log << it->second.chamberLabel << " ";
0060 log << it->second.chamberId << " ";
0061 log << it->second.endcap << " ";
0062 log << it->second.station << " ";
0063 log << it->second.ring << " ";
0064 log << it->second.chamber << " ";
0065 log << it->second.cscIndex << " ";
0066 log << it->second.layerIndex << " ";
0067 log << it->second.stripIndex << " ";
0068 log << it->second.anodeIndex << " ";
0069 log << it->second.strips << " ";
0070 log << it->second.anodes << " ";
0071 log << it->second.crateLabel << " ";
0072 log << it->second.crateid << " ";
0073 log << it->second.sector << " ";
0074 log << it->second.trig_sector << " ";
0075 log << it->second.dmb << " ";
0076 log << it->second.cscid << " ";
0077 log << it->second.ddu << " ";
0078 log << it->second.ddu_input << " ";
0079 log << it->second.slink << " "
0080 << " ";
0081 log << it->second.fed_crate << " "
0082 << " ";
0083 log << it->second.ddu_slot << " "
0084 << " ";
0085 log << it->second.dcc_fifo << " "
0086 << " ";
0087 log << it->second.fiber_crate << " "
0088 << " ";
0089 log << it->second.fiber_pos << " "
0090 << " ";
0091 log << it->second.fiber_socket << " " << std::endl;
0092 }
0093 }
0094 DEFINE_FWK_MODULE(CSCReadCrateMapValuesAnalyzer);
0095 }