CMS 3D CMS Logo

RunInfoESAnalyzer.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 RunInfoESAnalyzer(edm::ParameterSet const& p) : m_RunInfoToken(esConsumes()) {
22  edm::LogPrint("RunInfoESAnalyzer") << "RunInfoESAnalyzer" << std::endl;
23  }
24  explicit RunInfoESAnalyzer(int i) { edm::LogPrint("RunInfoESAnalyzer") << "RunInfoESAnalyzer " << i << std::endl; }
25  ~RunInfoESAnalyzer() override { edm::LogPrint("RunInfoESAnalyzer") << "~RunInfoESAnalyzer " << std::endl; }
26  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
27  };
29  using namespace edm::eventsetup;
30  edm::LogPrint("RunInfoESAnalyzer") << "###RunInfoESAnalyzer::analyze" << std::endl;
31 
32  // Context is not used.
33  edm::LogPrint("RunInfoESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
34  edm::LogPrint("RunInfoESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl;
38  //record not found
39  edm::LogPrint("RunInfoESAnalyzer") << "Record \"RunInfoRcd"
40  << "\" does not exist " << std::endl;
41  }
42  edm::LogPrint("RunInfoESAnalyzer") << "got eshandle" << std::endl;
43  edm::ESHandle<RunInfo> sum = context.getHandle(m_RunInfoToken);
44  edm::LogPrint("RunInfoESAnalyzer") << "got context" << std::endl;
45  const RunInfo* summary = sum.product();
46  edm::LogPrint("RunInfoESAnalyzer") << "got RunInfo* " << std::endl;
47  edm::LogPrint("RunInfoESAnalyzer") << "print result" << std::endl;
48  summary->printAllValues();
49  /*
50  std::vector<std::string> subdet = summary->getSubdtIn();
51  edm::LogPrint("RunInfoESAnalyzer")<<"subdetector in the run "<< std::endl;
52  for (size_t i=0; i<subdet.size(); i++){
53  edm::LogPrint("RunInfoESAnalyzer")<<"--> " << subdet[i] << std::endl;
54  }
55  */
56  }
58 } // 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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Warning, true > LogPrint
heterocontainer::HCTypeTag TypeTag
RunInfoESAnalyzer(edm::ParameterSet const &p)
const edm::ESGetToken< RunInfo, RunInfoRcd > m_RunInfoToken
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