File indexing completed on 2024-04-06 12:23:15
0001 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
0002 #include "OnlineDB/EcalCondDB/interface/LMFDefFabric.h"
0003 #include "OnlineDB/EcalCondDB/interface/LMFLaserPulseDat.h"
0004 #include "OnlineDB/EcalCondDB/interface/LMFPnPrimDat.h"
0005 #include "OnlineDB/EcalCondDB/interface/all_lmf_types.h"
0006 #include <climits>
0007 #include <cstdlib>
0008 #include <ctime>
0009 #include <iomanip>
0010 #include <iostream>
0011 #include <string>
0012 #include <vector>
0013
0014 using namespace std;
0015
0016 class CondDBApp {
0017 public:
0018
0019
0020
0021 CondDBApp(string sid, string user, string pass, run_t r) {
0022 try {
0023 cout << "Making connection..." << flush;
0024 econn = new EcalCondDBInterface(sid, user, pass);
0025 run = r;
0026 cout << "Done." << endl;
0027 } catch (runtime_error& e) {
0028 cerr << e.what() << endl;
0029 exit(-1);
0030 }
0031 }
0032
0033
0034
0035
0036 ~CondDBApp() { delete econn; }
0037
0038 void doRead() {
0039 std::string location = "P5_Co";
0040 RunIOV runiov = econn->fetchRunIOV(location, run);
0041 cout << "Attaching data to Run " << runiov.getRunNumber() << endl;
0042
0043 LMFSeqDat seq(econn);
0044 seq.setRunIOV(runiov).setSequenceNumber(1);
0045
0046 seq.fetchID();
0047
0048 LMFRunIOV lmfruniov(econn);
0049 int type = 1;
0050 int color = 1;
0051 for (int lmr = 1; lmr < 93; lmr++) {
0052 bool res = econn->fetchLMFRunIOV(seq, lmfruniov, lmr, type, color);
0053 std::cout << "LMR: " << lmr << " - " << res << std::endl;
0054 if ((lmr == 1) || (lmr == 92)) {
0055 lmfruniov.dump();
0056 }
0057 }
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088 }
0089
0090 private:
0091 CondDBApp() = delete;
0092 EcalCondDBInterface* econn;
0093 run_t run;
0094 };
0095
0096 int main(int argc, char* argv[]) {
0097 string sid;
0098 string user;
0099 string pass;
0100
0101 if (argc != 5) {
0102 cout << "Usage:" << endl;
0103 cout << " " << argv[0] << " <SID> <user> <pass> <run>" << endl;
0104 exit(-1);
0105 }
0106
0107 sid = argv[1];
0108 user = argv[2];
0109 pass = argv[3];
0110 int run = atoi(argv[4]);
0111
0112 try {
0113 CondDBApp app(sid, user, pass, run);
0114 app.doRead();
0115 } catch (exception& e) {
0116 cout << "ERROR: " << e.what() << endl;
0117 } catch (...) {
0118 cout << "Unknown error caught" << endl;
0119 }
0120
0121 cout << "All Done." << endl;
0122
0123 return 0;
0124 }