CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunSummaryESAnalyzer.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 
19 
20 
21 
22 namespace edmtest
23 {
25  {
26  public:
28  {
29  std::cout<<"RunSummaryESAnalyzer"<<std::endl;
30  }
31  explicit RunSummaryESAnalyzer(int i)
32  { std::cout<<"RunSummaryESAnalyzer "<<i<<std::endl; }
33  virtual ~RunSummaryESAnalyzer() {
34  std::cout<<"~RunSummaryESAnalyzer "<<std::endl;
35  }
36  // virtual void beginJob();
37  // virtual void beginRun(const edm::Run&, const edm::EventSetup& context);
38  virtual void analyze(const edm::Event& e, const edm::EventSetup& c) override;
39  private:
40  };
41 
42 
43  /* void
44  RunSummaryESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){
45  std::cout<<"###RunSummaryESAnalyzer::beginRun"<<std::endl;
46  edm::ESHandle<RunSummary> RunSummary_lumiarray;
47  std::cout<<"got eshandle"<<std::endl;
48  context.get<RunSummaryRcd>().get(RunSummary_lumiarray);
49  std::cout<<"got data"<<std::endl;
50  }
51 
52  void
53  RunSummaryESAnalyzer::beginJob(){
54  std::cout<<"###RunSummaryESAnalyzer::beginJob"<<std::endl;
55 
56  }
57 
58  */
59  void
61  using namespace edm::eventsetup;
62  std::cout<<"###RunSummaryESAnalyzer::analyze"<<std::endl;
63 
64  // Context is not used.
65  std::cout <<" I AM IN RUN NUMBER "<<e.id().run() <<std::endl;
66  std::cout <<" ---EVENT NUMBER "<<e.id().event() <<std::endl;
69  //record not found
70  std::cout <<"Record \"RunSummaryRcd"<<"\" does not exist "<<std::endl;
71  }
73  std::cout<<"got eshandle"<<std::endl;
74  context.get<RunSummaryRcd>().get(sum);
75  std::cout<<"got context"<<std::endl;
76  const RunSummary* summary=sum.product();
77  std::cout<<"got RunSummary* "<< std::endl;
78 
79 
80  std::cout<< "print result" << std::endl;
81  summary->printAllValues();
82  std::vector<std::string> subdet = summary->getSubdtIn();
83  std::cout<<"subdetector in the run "<< std::endl;
84  for (size_t i=0; i<subdet.size(); i++){
85  std::cout<<"--> " << subdet[i] << std::endl;
86  }
87  }
89 }
90 
91 
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
RunSummaryESAnalyzer(edm::ParameterSet const &p)
const T & get() const
Definition: EventSetup.h:55
heterocontainer::HCTypeTag TypeTag
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:125