CMS 3D CMS Logo

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
DBReader::background_
std::shared_ptr< BackgroundFunction > background_
Definition: DBReader.h:60
MessageLogger.h
DBReader::~DBReader
~DBReader() override
Definition: DBReader.cc:41
ESHandle.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DBReader::resolution_
std::shared_ptr< ResolutionFunction > resolution_
Definition: DBReader.h:59
EDAnalyzer.h
DBReader::printParameters
void printParameters(const T &functionPtr)
Definition: DBReader.h:35
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
DBReader::type_
std::string type_
Definition: DBReader.h:56
Service.h
ResolutionFunction.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
DBReader::initialize
void initialize(const edm::EventSetup &iSetup)
Definition: DBReader.cc:14
DBReader
Definition: DBReader.h:24
edm::EventSetup
Definition: EventSetup.h:58
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
T
long double T
Definition: Basic3DVectorLD.h:48
DBReader::DBReader
DBReader(const edm::ParameterSet &)
Definition: DBReader.cc:12
EventSetup.h
DBReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DBReader.cc:43
ParameterSet.h
edm::Event
Definition: Event.h:73
MomentumScaleCorrector.h
BackgroundFunction.h
DBReader::corrector_
std::shared_ptr< MomentumScaleCorrector > corrector_
Definition: DBReader.h:58