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 private:
34  void beginJob() override;
35  void analyze(const edm::Event&, const edm::EventSetup&) override;
36  void endJob() override;
37 
41 
43  bool m_print;
44 };
45 
47 public:
49 
50 private:
51  void analyze(const edm::Event&, const edm::EventSetup&) override;
52 
56 
58  bool m_print;
59 };
60 
62  m_era = iConfig.getUntrackedParameter<std::string>("era");
63  m_label = iConfig.getUntrackedParameter<std::string>("label");
65  m_print = iConfig.getUntrackedParameter<bool>("dump", true);
66  m_save_file = iConfig.getUntrackedParameter<bool>("saveFile", false);
67 }
68 
70 
72  std::cout << "Inspecting JER payload for label: " << m_label << std::endl;
73 
74  auto jerObjectHandle = iSetup.getTransientHandle(m_token);
75 
76  if (m_print) {
77  jerObjectHandle->dump();
78  }
79 
80  if (m_save_file) {
81  std::string f = m_era + "_" + m_label + ".txt";
82  jerObjectHandle->saveToFile(f);
83  std::cout << "JER payload saved as " << f << std::endl;
84  }
85 }
86 
88 
90 
92  m_era = iConfig.getUntrackedParameter<std::string>("era");
93  m_label = iConfig.getUntrackedParameter<std::string>("label");
95  m_print = iConfig.getUntrackedParameter<bool>("dump", true);
96  m_save_file = iConfig.getUntrackedParameter<bool>("saveFile", false);
97 }
98 
100  std::cout << "Inspecting JER SF payload for label: " << m_label << std::endl;
101 
102  auto jerObjectHandle = iSetup.getTransientHandle(m_token);
103 
104  if (m_print) {
105  jerObjectHandle->dump();
106  }
107 
108  if (m_save_file) {
109  std::string f = m_era + "_" + m_label + ".txt";
110  jerObjectHandle->saveToFile(f);
111  std::cout << "JER SF payload saved as " << f << std::endl;
112  }
113 }
114 
115 //define this as a plug-in
edm::ESGetToken< JME::JetResolutionObject, JetResolutionScaleFactorRcd > m_token
T getUntrackedParameter(std::string const &, T const &) const
JetResolutionScaleFactorDBReader(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
double f[11][100]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(const edm::Event &, const edm::EventSetup &) override
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:162
JetResolutionDBReader(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< JME::JetResolutionObject, JetResolutionRcd > m_token