File indexing completed on 2024-04-06 12:02:45
0001 #include "CondCore/PopCon/interface/PopConAnalyzer.h"
0002 #include "CondTools/DT/interface/DTUserKeyedConfigHandler.h"
0003 #include "FWCore/Framework/interface/ESHandle.h"
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 #include "CondCore/CondDB/interface/KeyList.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "CondFormats/DTObjects/interface/DTKeyedConfig.h"
0008 #include "CondFormats/DataRecord/interface/DTKeyedConfigListRcd.h"
0009 #include <memory>
0010
0011
0012 class DTUserKeyedConfigPopConAnalyzer : public popcon::PopConAnalyzer<DTUserKeyedConfigHandler> {
0013 public:
0014 DTUserKeyedConfigPopConAnalyzer(const edm::ParameterSet& pset)
0015 : popcon::PopConAnalyzer<DTUserKeyedConfigHandler>(pset), perskeylistToken_(esConsumes()) {}
0016 ~DTUserKeyedConfigPopConAnalyzer() override {}
0017 void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override {
0018 edm::LogInfo("DTUserKeyedConfigPopConAnalyzer") << "got eSdata" << std::endl;
0019 cond::persistency::KeyList const& kl = iSetup.getData(perskeylistToken_);
0020 for (size_t i = 0; i < kl.size(); i++) {
0021 std::shared_ptr<DTKeyedConfig> kentry = kl.getUsingIndex<DTKeyedConfig>(i);
0022 if (kentry.get())
0023 edm::LogInfo("DTUserKeyedConfigPopConAnalyzer") << kentry->getId() << std::endl;
0024 }
0025 source().setList(&kl);
0026 }
0027
0028 private:
0029 edm::ESGetToken<cond::persistency::KeyList, DTKeyedConfigListRcd> perskeylistToken_;
0030 };
0031
0032 DEFINE_FWK_MODULE(DTUserKeyedConfigPopConAnalyzer);