CMS 3D CMS Logo

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