CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RunSummaryESAnalyzer.cc
Go to the documentation of this file.
1 #include <stdexcept>
2 #include <string>
3 #include <iostream>
4 #include <map>
11 
12 using namespace std;
13 
14 namespace edmtest {
16  private:
18 
19  public:
20  explicit RunSummaryESAnalyzer(edm::ParameterSet const& p) : m_RunSummaryToken(esConsumes()) {
21  edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer" << std::endl;
22  }
23  explicit RunSummaryESAnalyzer(int i) {
24  edm::LogPrint("RunSummaryESAnalyzer") << "RunSummaryESAnalyzer " << i << std::endl;
25  }
26  ~RunSummaryESAnalyzer() override { edm::LogPrint("RunSummaryESAnalyzer") << "~RunSummaryESAnalyzer " << std::endl; }
27  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
28 
29  private:
30  };
31 
33  using namespace edm::eventsetup;
34  edm::LogPrint("RunSummaryESAnalyzer") << "###RunSummaryESAnalyzer::analyze" << std::endl;
35 
36  // Context is not used.
37  edm::LogPrint("RunSummaryESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
38  edm::LogPrint("RunSummaryESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl;
42  //record not found
43  edm::LogPrint("RunSummaryESAnalyzer") << "Record \"RunSummaryRcd"
44  << "\" does not exist " << std::endl;
45  }
46  edm::LogPrint("RunSummaryESAnalyzer") << "got eshandle" << std::endl;
47  edm::ESHandle<RunSummary> sum = context.getHandle(m_RunSummaryToken);
48  edm::LogPrint("RunSummaryESAnalyzer") << "got context" << std::endl;
49  const RunSummary* summary = sum.product();
50  edm::LogPrint("RunSummaryESAnalyzer") << "got RunSummary* " << std::endl;
51 
52  edm::LogPrint("RunSummaryESAnalyzer") << "print result" << std::endl;
53  summary->printAllValues();
54  std::vector<std::string> subdet = summary->getSubdtIn();
55  edm::LogPrint("RunSummaryESAnalyzer") << "subdetector in the run " << std::endl;
56  for (size_t i = 0; i < subdet.size(); i++) {
57  edm::LogPrint("RunSummaryESAnalyzer") << "--> " << subdet[i] << std::endl;
58  }
59  }
61 } // namespace edmtest
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
const edm::EventSetup & c
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
RunSummaryESAnalyzer(edm::ParameterSet const &p)
Log< level::Warning, true > LogPrint
const edm::ESGetToken< RunSummary, RunSummaryRcd > m_RunSummaryToken
heterocontainer::HCTypeTag TypeTag
edm::EventID id() const
Definition: EventBase.h:59
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
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