test
CMS 3D CMS Logo

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