CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamReaderFromDB.cc

Go to the documentation of this file.
00001 // system include files
00002 #include <memory>
00003 
00004 // user include files
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012 
00013 using namespace std;
00014 
00015 class EcalTPGParamReaderFromDB : public edm::EDAnalyzer {
00016         public:
00017                 explicit EcalTPGParamReaderFromDB(const edm::ParameterSet&);
00018                 ~EcalTPGParamReaderFromDB();
00019 
00020         private:
00021                 virtual void beginJob() ;
00022                 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00023                 virtual void endJob() ;
00024 
00025                 std::string host;
00026                 std::string sid;
00027                 std::string user;
00028                 std::string pass;
00029                 int port;
00030                 int min_run;
00031                 int n_run;
00032 };
00033 
00034 
00035 #include "CalibCalorimetry/EcalTPGTools/plugins/EcalTPGDBApp.h"
00036 
00037 
00038 EcalTPGParamReaderFromDB::EcalTPGParamReaderFromDB(const edm::ParameterSet & ps)
00039 {
00040         host    = ps.getParameter<std::string>("host");
00041         sid     = ps.getParameter<std::string>("sid");
00042         user    = ps.getParameter<std::string>("user");
00043         pass    = ps.getParameter<std::string>("pass");
00044         port    = ps.getParameter<int>("port");
00045         min_run = ps.getParameter<int>("min_run");
00046         n_run   = ps.getParameter<int>("n_run");
00047 }
00048 
00049 
00050 
00051 EcalTPGParamReaderFromDB::~EcalTPGParamReaderFromDB()
00052 {
00053 }
00054 
00055 
00056 
00057 void EcalTPGParamReaderFromDB::analyze(const edm::Event& ev, const edm::EventSetup& es)
00058 {
00059         try {
00060                 EcalTPGDBApp app( sid, user, pass);
00061 
00062                 //int i ; 
00063                 //app.readTPGPedestals(i);
00064                 //app.writeTPGLUT();
00065                 //app.writeTPGWeights();
00066 
00067         } catch (exception &e) {
00068                 cout << "ERROR:  " << e.what() << endl;
00069         } catch (...) {
00070                 cout << "Unknown error caught" << endl;
00071         }
00072 
00073         cout << "All Done." << endl;
00074 }
00075 
00076 
00077 
00078 void EcalTPGParamReaderFromDB::beginJob()
00079 {
00080 }
00081 
00082 
00083 
00084 void EcalTPGParamReaderFromDB::endJob() {
00085 }
00086 
00087 //define this as a plug-in
00088 DEFINE_FWK_MODULE(EcalTPGParamReaderFromDB);