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>
9 
11 
13 
15 
16 using namespace std;
17 
18 namespace edmtest {
20  public:
21  explicit RunInfoESAnalyzer(edm::ParameterSet const& p) { std::cout << "RunInfoESAnalyzer" << std::endl; }
22  explicit RunInfoESAnalyzer(int i) { std::cout << "RunInfoESAnalyzer " << i << std::endl; }
23  ~RunInfoESAnalyzer() override { std::cout << "~RunInfoESAnalyzer " << std::endl; }
24  // virtual void beginJob();
25  // virtual void beginRun(const edm::Run&, const edm::EventSetup& context);
26  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
27 
28  private:
29  };
30 
31  /* void
32  RunInfoESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){
33  std::cout<<"###RunInfoESAnalyzer::beginRun"<<std::endl;
34  edm::ESHandle<RunInfo> RunInfo_lumiarray;
35  std::cout<<"got eshandle"<<std::endl;
36  context.get<RunInfoRcd>().get(RunInfo_lumiarray);
37  std::cout<<"got data"<<std::endl;
38  }
39 
40  void
41  RunInfoESAnalyzer::beginJob(){
42  std::cout<<"###RunInfoESAnalyzer::beginJob"<<std::endl;
43 
44  }
45 
46  */
47  void RunInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
48  using namespace edm::eventsetup;
49  std::cout << "###RunInfoESAnalyzer::analyze" << std::endl;
50 
51  // Context is not used.
52  std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
53  std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
57  //record not found
58  std::cout << "Record \"RunInfoRcd"
59  << "\" does not exist " << std::endl;
60  }
62  std::cout << "got eshandle" << std::endl;
63  context.get<RunInfoRcd>().get(sum);
64  std::cout << "got context" << std::endl;
65  const RunInfo* summary = sum.product();
66  std::cout << "got RunInfo* " << std::endl;
67 
68  std::cout << "print result" << std::endl;
69  summary->printAllValues();
70  /* std::vector<std::string> subdet = summary->getSubdtIn();
71  std::cout<<"subdetector in the run "<< std::endl;
72  for (size_t i=0; i<subdet.size(); i++){
73  std::cout<<"--> " << subdet[i] << std::endl;
74  }
75  */
76  }
78 } // namespace edmtest
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void printAllValues() const
Definition: RunInfo.cc:20
heterocontainer::HCTypeTag TypeTag
edm::EventID id() const
Definition: EventBase.h:59
RunInfoESAnalyzer(edm::ParameterSet const &p)
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86