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 
19 
20 
21 
22 namespace edmtest
23 {
25  {
26  public:
28  {
29  std::cout<<"RunInfoESAnalyzer"<<std::endl;
30  }
31  explicit RunInfoESAnalyzer(int i)
32  { std::cout<<"RunInfoESAnalyzer "<<i<<std::endl; }
33  virtual ~RunInfoESAnalyzer() {
34  std::cout<<"~RunInfoESAnalyzer "<<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  RunInfoESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){
45  std::cout<<"###RunInfoESAnalyzer::beginRun"<<std::endl;
46  edm::ESHandle<RunInfo> RunInfo_lumiarray;
47  std::cout<<"got eshandle"<<std::endl;
48  context.get<RunInfoRcd>().get(RunInfo_lumiarray);
49  std::cout<<"got data"<<std::endl;
50  }
51 
52  void
53  RunInfoESAnalyzer::beginJob(){
54  std::cout<<"###RunInfoESAnalyzer::beginJob"<<std::endl;
55 
56  }
57 
58  */
59  void
61  using namespace edm::eventsetup;
62  std::cout<<"###RunInfoESAnalyzer::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 \"RunInfoRcd"<<"\" does not exist "<<std::endl;
71  }
73  std::cout<<"got eshandle"<<std::endl;
74  context.get<RunInfoRcd>().get(sum);
75  std::cout<<"got context"<<std::endl;
76  const RunInfo* summary=sum.product();
77  std::cout<<"got RunInfo* "<< 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  */
88  }
90 }
91 
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
void printAllValues() const
Definition: RunInfo.cc:22
const T & get() const
Definition: EventSetup.h:55
heterocontainer::HCTypeTag TypeTag
edm::EventID id() const
Definition: EventBase.h:60
RunInfoESAnalyzer(edm::ParameterSet const &p)
T const * product() const
Definition: ESHandle.h:86