CMS 3D CMS Logo

JetResolutionDBReader.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Author: Sébastien Brochet
4 //
5 
6 // system include files
7 #include <memory>
8 #include <iostream>
9 
10 // user include files
13 
19 
23 
24 //
25 // class declaration
26 //
27 
29  public:
31  ~JetResolutionDBReader() override;
32 
33 
34  private:
35  void beginJob() override ;
36  void analyze(const edm::Event&, const edm::EventSetup&) override;
37  void endJob() override ;
38 
41 
43  bool m_print;
44 };
45 
47  public:
49 
50 
51  private:
52  void analyze(const edm::Event&, const edm::EventSetup&) override;
53 
56 
58  bool m_print;
59 };
60 
61 
63 {
64  m_era = iConfig.getUntrackedParameter<std::string>("era");
65  m_label = iConfig.getUntrackedParameter<std::string>("label");
66  m_print = iConfig.getUntrackedParameter<bool>("dump", true);
67  m_save_file = iConfig.getUntrackedParameter<bool>("saveFile", false);
68 }
69 
70 
72 {
73 
74 }
75 
77 {
79  std::cout << "Inspecting JER payload for label: "<< m_label << std::endl;
80 
81  iSetup.get<JetResolutionRcd>().get(m_label, jerObjectHandle);
82 
83  if (m_print) {
84  jerObjectHandle->dump();
85  }
86 
87  if (m_save_file) {
88  std::string f = m_era + "_" + m_label + ".txt";
89  jerObjectHandle->saveToFile(f);
90  std::cout << "JER payload saved as " << f << std::endl;
91  }
92 }
93 
95 {
96 }
97 
99 {
100 }
101 
103 {
104  m_era = iConfig.getUntrackedParameter<std::string>("era");
105  m_label = iConfig.getUntrackedParameter<std::string>("label");
106  m_print = iConfig.getUntrackedParameter<bool>("dump", true);
107  m_save_file = iConfig.getUntrackedParameter<bool>("saveFile", false);
108 }
109 
111 {
113  std::cout << "Inspecting JER SF payload for label: "<< m_label << std::endl;
114 
115  iSetup.get<JetResolutionScaleFactorRcd>().get(m_label, jerObjectHandle);
116 
117  if (m_print) {
118  jerObjectHandle->dump();
119  }
120 
121  if (m_save_file) {
122  std::string f = m_era + "_" + m_label + ".txt";
123  jerObjectHandle->saveToFile(f);
124  std::cout << "JER SF payload saved as " << f << std::endl;
125  }
126 }
127 
128 //define this as a plug-in
T getUntrackedParameter(std::string const &, T const &) const
JetResolutionScaleFactorDBReader(const edm::ParameterSet &)
void saveToFile(const std::string &file) const
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
double f[11][100]
void analyze(const edm::Event &, const edm::EventSetup &) override
T get() const
Definition: EventSetup.h:71
JetResolutionDBReader(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override