Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:13

0001 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
0002 #include "OnlineDB/EcalCondDB/interface/all_lmf_types.h"
0003 #include <climits>
0004 #include <cstdlib>
0005 #include <ctime>
0006 #include <iomanip>
0007 #include <iostream>
0008 #include <string>
0009 #include <vector>
0010 
0011 using namespace std;
0012 
0013 class CondDBApp {
0014 public:
0015   /**
0016    *   App constructor; Makes the database connection
0017    */
0018   CondDBApp(string sid, string user, string pass, run_t r) {
0019     try {
0020       cout << "Making connection..." << flush;
0021       econn = new EcalCondDBInterface(sid, user, pass);
0022       run = r;
0023       cout << "Done." << endl;
0024     } catch (runtime_error& e) {
0025       cerr << e.what() << endl;
0026       exit(-1);
0027     }
0028   }
0029 
0030   /**
0031    *  App destructor;  Cleans up database connection
0032    */
0033   ~CondDBApp() { delete econn; }
0034 
0035   void doRun() {
0036     bool b = true;
0037     LMFPnPrimDat(econn, "ORANGE", "LED", b);
0038   }
0039 
0040 private:
0041   CondDBApp() = delete;  // hidden default constructor
0042   EcalCondDBInterface* econn;
0043   run_t run;
0044 };
0045 
0046 int main(int argc, char* argv[]) {
0047   string sid;
0048   string user;
0049   string pass;
0050 
0051   if (argc != 5) {
0052     cout << "Usage:" << endl;
0053     cout << "  " << argv[0] << " <SID> <user> <pass> <run>" << endl;
0054     exit(-1);
0055   }
0056 
0057   sid = argv[1];
0058   user = argv[2];
0059   pass = argv[3];
0060   int run = atoi(argv[4]);
0061 
0062   try {
0063     CondDBApp app(sid, user, pass, run);
0064     app.doRun();
0065   } catch (exception& e) {
0066     cout << "ERROR:  " << e.what() << endl;
0067   } catch (...) {
0068     cout << "Unknown error caught" << endl;
0069   }
0070 
0071   cout << "All Done." << endl;
0072 
0073   return 0;
0074 }