CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DBReader.h
Go to the documentation of this file.
1 #ifndef DBReader_H
2 #define DBReader_H
3 
4 // system include files
5 //#include <memory>
6 
7 #include <iostream>
8 #include <vector>
9 
10 // user include files
19 
23 
24 class DBReader : public edm::EDAnalyzer {
25 public:
26  explicit DBReader(const edm::ParameterSet&);
27  ~DBReader() override;
28 
29  void initialize(const edm::EventSetup& iSetup);
30 
31  void analyze(const edm::Event&, const edm::EventSetup&) override;
32 
33 private:
34  template <typename T>
35  void printParameters(const T& functionPtr) {
36  // Looping directly on it does not work, because it is returned by value
37  // and the iterator gets invalidated on the next line. Save it to a temporary object
38  // and iterate on it.
39  std::vector<double> parVecVec(functionPtr->parameters());
40  std::vector<double>::const_iterator parVec = parVecVec.begin();
41  std::vector<int> functionId(functionPtr->identifiers());
42  std::vector<int>::const_iterator id = functionId.begin();
43  std::cout << "total number of parameters read from database = parVecVec.size() = " << parVecVec.size() << std::endl;
44  int iFunc = 0;
45  for (; id != functionId.end(); ++id, ++iFunc) {
46  int parNum = functionPtr->function(iFunc)->parNum();
47  std::cout << "For function id = " << *id << ", with " << parNum << " parameters: " << std::endl;
48  for (int par = 0; par < parNum; ++par) {
49  std::cout << "par[" << par << "] = " << *parVec << std::endl;
50  ++parVec;
51  }
52  }
53  }
54 
55  // uint32_t printdebug_;
57  //std::unique_ptr<BaseFunction> corrector_;
58  std::shared_ptr<MomentumScaleCorrector> corrector_;
59  std::shared_ptr<ResolutionFunction> resolution_;
60  std::shared_ptr<BackgroundFunction> background_;
61 };
62 #endif
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
uint16_t *__restrict__ id
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
tuple cout
Definition: gather_cfg.py:144
long double T
~DBReader() override
Definition: DBReader.cc:41