1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#include "FWCore/PluginManager/interface/PluginManager.h"
#include "FWCore/PluginManager/interface/standard.h"
#include "FWCore/PluginManager/interface/SharedLibrary.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
//
#include "CondCore/CondDB/interface/CondDB.h"
//
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <iostream>
using namespace cond::db;
int main(int argc, char** argv) {
edmplugin::PluginManager::Config config;
edmplugin::PluginManager::configure(edmplugin::standard::config());
std::string connectionString0("oracle://cms_orcon_adg/CMS_COND_31X_RUN_INFO");
std::string connectionString1("oracle://cms_orcoff_prep/CMS_CONDITIONS");
std::string gtConnectionStr("oracle://cms_orcon_adg/CMS_COND_31X_GLOBALTAG");
try {
Session session;
//session.configuration().setMessageVerbosity( coral::Debug );
size_t i = 0;
IOVProxy reader;
std::cout << "# Connecting with db in " << connectionString0 << std::endl;
session.open(connectionString0, true);
session.transaction().start(true);
std::string tag0("runinfo_31X_hlt");
reader = session.readIov(tag0, true);
std::cout << "Tag " << reader.tag() << " timeType:" << cond::time::timeTypeName(reader.timeType())
<< " size:" << reader.size() << " type:" << reader.payloadObjectType()
<< " endOfValidity:" << reader.endOfValidity() << " lastValidatedTime:" << reader.lastValidatedTime()
<< std::endl;
for (auto iov : reader) {
i++;
std::cout << "#Since " << iov.since << " Till " << iov.till << " PID " << iov.payloadId << std::endl;
if (i == 20)
break;
}
session.transaction().commit();
session.close();
std::cout << "# Connecting with db in " << connectionString1 << std::endl;
session.open(connectionString1, true);
session.transaction().start(true);
reader = session.readIov(tag0, true);
i = 0;
std::cout << "Tag " << reader.tag() << " timeType:" << cond::time::timeTypeName(reader.timeType())
<< " size:" << reader.size() << " type:" << reader.payloadObjectType()
<< " endOfValidity:" << reader.endOfValidity() << " lastValidatedTime:" << reader.lastValidatedTime()
<< std::endl;
for (auto iov : reader) {
i++;
std::cout << "#Since " << iov.since << " Till " << iov.till << " PID " << iov.payloadId << std::endl;
if (i == 20)
break;
}
session.transaction().commit();
session.close();
std::cout << "# Connecting with db in " << gtConnectionStr << std::endl;
session.open(gtConnectionStr, true);
session.transaction().start(true);
GTProxy gtReader = session.readGlobalTag("FT_R_53_V6");
i = 0;
for (auto t : gtReader) {
i++;
std::cout << "#Tag " << t.tagName() << " Record " << t.recordName() << " Label " << t.recordLabel() << std::endl;
if (i == 20)
break;
}
session.transaction().commit();
session.close();
std::cout << "# Connecting with db in " << connectionString1 << std::endl;
session.open(connectionString1, true);
session.transaction().start(true);
gtReader = session.readGlobalTag("FT_R_53_V6");
i = 0;
for (auto t : gtReader) {
i++;
std::cout << "#Tag " << t.tagName() << " Record " << t.recordName() << " Label " << t.recordLabel() << std::endl;
if (i == 20)
break;
}
session.transaction().commit();
session.close();
} catch (const std::exception& e) {
std::cout << "ERROR: " << e.what() << std::endl;
return -1;
} catch (...) {
std::cout << "UNEXPECTED FAILURE." << std::endl;
return -1;
}
}
|