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