File indexing completed on 2024-04-06 12:03:13
0001 #include "CondTools/L1Trigger/interface/DataManager.h"
0002 #include "CondCore/CondDB/interface/ConnectionPool.h"
0003
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005
0006 namespace l1t {
0007
0008 DataManager::DataManager() : session(nullptr) {}
0009
0010 DataManager::DataManager(const std::string& connectString, const std::string& authenticationPath, bool isOMDS) {
0011 connect(connectString, authenticationPath, isOMDS);
0012 }
0013
0014 void DataManager::connect(const std::string& connectString, const std::string& authenticationPath, bool isOMDS) {
0015 setDebug(false);
0016 cond::persistency::ConnectionPool connection;
0017 connection.setAuthenticationPath(authenticationPath);
0018 if (debugFlag)
0019 connection.setMessageVerbosity(coral::Debug);
0020 else
0021 connection.setMessageVerbosity(coral::Error);
0022 connection.configure();
0023
0024 session = connection.createSession(connectString, false);
0025 }
0026
0027 DataManager::~DataManager() {
0028
0029 session.close();
0030 }
0031
0032 edm::eventsetup::TypeTag DataManager::findType(const std::string& type) {
0033 static edm::eventsetup::TypeTag defaultType;
0034 edm::eventsetup::TypeTag typeTag = edm::eventsetup::TypeTag::findType(type);
0035
0036 if (typeTag == defaultType)
0037
0038 edm::LogError("L1TriggerDB") << "DataManager::findType() : " << type << " was not found";
0039
0040 return typeTag;
0041 }
0042
0043 void DataManager::setDebug(bool debug) { debugFlag = debug; }
0044 }