Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:45:56

0001 #include "FWCore/PluginManager/interface/PluginManager.h"
0002 #include "FWCore/PluginManager/interface/standard.h"
0003 #include "FWCore/PluginManager/interface/SharedLibrary.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0006 //
0007 #include "CondCore/CondDB/interface/CondDB.h"
0008 //
0009 #include <fstream>
0010 #include <iomanip>
0011 #include <cstdlib>
0012 #include <iostream>
0013 
0014 using namespace cond::db;
0015 
0016 int main(int argc, char** argv) {
0017   edmplugin::PluginManager::Config config;
0018   edmplugin::PluginManager::configure(edmplugin::standard::config());
0019 
0020   std::string connectionString0("oracle://cms_orcon_adg/CMS_COND_31X_RUN_INFO");
0021   std::string connectionString1("oracle://cms_orcoff_prep/CMS_CONDITIONS");
0022   std::string gtConnectionStr("oracle://cms_orcon_adg/CMS_COND_31X_GLOBALTAG");
0023   try {
0024     Session session;
0025     //session.configuration().setMessageVerbosity( coral::Debug );
0026     size_t i = 0;
0027     IOVProxy reader;
0028     std::cout << "# Connecting with db in " << connectionString0 << std::endl;
0029     session.open(connectionString0, true);
0030     session.transaction().start(true);
0031     std::string tag0("runinfo_31X_hlt");
0032     reader = session.readIov(tag0, true);
0033     std::cout << "Tag " << reader.tag() << " timeType:" << cond::time::timeTypeName(reader.timeType())
0034               << " size:" << reader.size() << " type:" << reader.payloadObjectType()
0035               << " endOfValidity:" << reader.endOfValidity() << " lastValidatedTime:" << reader.lastValidatedTime()
0036               << std::endl;
0037 
0038     for (auto iov : reader) {
0039       i++;
0040       std::cout << "#Since " << iov.since << " Till " << iov.till << " PID " << iov.payloadId << std::endl;
0041       if (i == 20)
0042         break;
0043     }
0044     session.transaction().commit();
0045     session.close();
0046 
0047     std::cout << "# Connecting with db in " << connectionString1 << std::endl;
0048     session.open(connectionString1, true);
0049     session.transaction().start(true);
0050     reader = session.readIov(tag0, true);
0051     i = 0;
0052     std::cout << "Tag " << reader.tag() << " timeType:" << cond::time::timeTypeName(reader.timeType())
0053               << " size:" << reader.size() << " type:" << reader.payloadObjectType()
0054               << " endOfValidity:" << reader.endOfValidity() << " lastValidatedTime:" << reader.lastValidatedTime()
0055               << std::endl;
0056 
0057     for (auto iov : reader) {
0058       i++;
0059       std::cout << "#Since " << iov.since << " Till " << iov.till << " PID " << iov.payloadId << std::endl;
0060       if (i == 20)
0061         break;
0062     }
0063     session.transaction().commit();
0064     session.close();
0065 
0066     std::cout << "# Connecting with db in " << gtConnectionStr << std::endl;
0067     session.open(gtConnectionStr, true);
0068     session.transaction().start(true);
0069     GTProxy gtReader = session.readGlobalTag("FT_R_53_V6");
0070     i = 0;
0071     for (auto t : gtReader) {
0072       i++;
0073       std::cout << "#Tag " << t.tagName() << " Record " << t.recordName() << " Label " << t.recordLabel() << std::endl;
0074       if (i == 20)
0075         break;
0076     }
0077     session.transaction().commit();
0078     session.close();
0079 
0080     std::cout << "# Connecting with db in " << connectionString1 << std::endl;
0081     session.open(connectionString1, true);
0082     session.transaction().start(true);
0083     gtReader = session.readGlobalTag("FT_R_53_V6");
0084     i = 0;
0085     for (auto t : gtReader) {
0086       i++;
0087       std::cout << "#Tag " << t.tagName() << " Record " << t.recordName() << " Label " << t.recordLabel() << std::endl;
0088       if (i == 20)
0089         break;
0090     }
0091     session.transaction().commit();
0092     session.close();
0093 
0094   } catch (const std::exception& e) {
0095     std::cout << "ERROR: " << e.what() << std::endl;
0096     return -1;
0097   } catch (...) {
0098     std::cout << "UNEXPECTED FAILURE." << std::endl;
0099     return -1;
0100   }
0101 }