CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DBReader.cc
Go to the documentation of this file.
1 // #include "CondFormats/PhysicsToolsObjects/interface/Histogram2D.h"
4 
5 #include "DBReader.h"
6 
7 #include <iostream>
8 #include <cstdio>
9 #include <sys/time.h>
10 #include <string>
11 
12 DBReader::DBReader(const edm::ParameterSet& iConfig) : type_(iConfig.getUntrackedParameter<std::string>("Type")) {}
13 
16  iSetup.get<MuScleFitDBobjectRcd>().get(dbObject);
17  edm::LogInfo("DBReader") << "[DBReader::analyze] End Reading MuScleFitDBobjectRcd" << std::endl;
18 
19  std::cout << "identifiers size from dbObject = " << dbObject->identifiers.size() << std::endl;
20  std::cout << "parameters size from dbObject = " << dbObject->parameters.size() << std::endl;
21  ;
22 
23  // This string is one of: scale, resolution, background.
24  // Create the corrector and set the parameters
25  if (type_ == "scale")
26  corrector_.reset(new MomentumScaleCorrector(dbObject.product()));
27  else if (type_ == "resolution")
28  resolution_.reset(new ResolutionFunction(dbObject.product()));
29  else if (type_ == "background")
30  background_.reset(new BackgroundFunction(dbObject.product()));
31  else {
32  std::cout << "Error: unrecognized type. Use one of those: 'scale', 'resolution', 'background'" << std::endl;
33  exit(1);
34  }
35 
36  // cout << "pointer = " << corrector_.get() << endl;
37 }
38 
39 //: printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",1)){}
40 
42 
43 void DBReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
44  initialize(iSetup);
45  if (type_ == "scale")
47  else if (type_ == "resolution")
49  else if (type_ == "background")
51 }
52 
55 
std::shared_ptr< MomentumScaleCorrector > corrector_
Definition: DBReader.h:58
std::shared_ptr< BackgroundFunction > background_
Definition: DBReader.h:60
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DBReader.cc:43
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void initialize(const edm::EventSetup &iSetup)
Definition: DBReader.cc:14
std::string type_
Definition: DBReader.h:56
DBReader(const edm::ParameterSet &)
Definition: DBReader.cc:12
void printParameters(const T &functionPtr)
Definition: DBReader.h:35
std::shared_ptr< ResolutionFunction > resolution_
Definition: DBReader.h:59
Log< level::Info, false > LogInfo
T const * product() const
Definition: ESHandle.h:86
T get() const
Definition: EventSetup.h:88
tuple cout
Definition: gather_cfg.py:144
~DBReader() override
Definition: DBReader.cc:41