CMS 3D CMS Logo

RunSummaryESAnalyzer.cc
Go to the documentation of this file.
1 #include <stdexcept>
2 #include <string>
3 #include <iostream>
4 #include <map>
12 
13 using namespace std;
14 
15 namespace edmtest {
17  private:
19 
20  public:
21  explicit RunSummaryESAnalyzer(edm::ParameterSet const& p) : m_RunSummaryToken(esConsumes()) {
22  edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer" << std::endl;
23  }
24  explicit RunSummaryESAnalyzer(int i) {
25  edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer " << i << std::endl;
26  }
27  ~RunSummaryESAnalyzer() override { edm::LogPrint("RunSummaryESAnalyzer") << "~RunSummaryESAnalyzer " << std::endl; }
28  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
29 
30  private:
31  };
32 
34  using namespace edm::eventsetup;
35  edm::LogPrint("RunSummaryESAnalyzer") << "###RunSummaryESAnalyzer::analyze" << std::endl;
36 
37  // Context is not used.
38  edm::LogPrint("RunSummaryESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
39  edm::LogPrint("RunSummaryESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl;
43  //record not found
44  edm::LogPrint("RunSummaryESAnalyzer") << "Record \"RunSummaryRcd"
45  << "\" does not exist " << std::endl;
46  }
47  edm::LogPrint("RunSummaryESAnalyzer") << "got eshandle" << std::endl;
48  edm::ESHandle<RunSummary> sum = context.getHandle(m_RunSummaryToken);
49  edm::LogPrint("RunSummaryESAnalyzer") << "got context" << std::endl;
50  const RunSummary* summary = sum.product();
51  edm::LogPrint("RunSummaryESAnalyzer") << "got RunSummary* " << std::endl;
52 
53  edm::LogPrint("RunSummaryESAnalyzer") << "print result" << std::endl;
54  summary->printAllValues();
55  std::vector<std::string> subdet = summary->getSubdtIn();
56  edm::LogPrint("RunSummaryESAnalyzer") << "subdetector in the run " << std::endl;
57  for (size_t i = 0; i < subdet.size(); i++) {
58  edm::LogPrint("RunSummaryESAnalyzer") << "--> " << subdet[i] << std::endl;
59  }
60  }
62 } // namespace edmtest
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
T const * product() const
Definition: ESHandle.h:86
RunSummaryESAnalyzer(edm::ParameterSet const &p)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Warning, true > LogPrint
const edm::ESGetToken< RunSummary, RunSummaryRcd > m_RunSummaryToken
heterocontainer::HCTypeTag TypeTag
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121