ATLAS Offline Software
TrigDBLoader.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 #ifndef TRIGCONFIO_TRIGDBLOADER_H
13 #define TRIGCONFIO_TRIGDBLOADER_H
14 
16 #include "TrigConfIO/Exceptions.h"
17 
18 #include <memory>
19 #include <map>
20 
21 #include "boost/property_tree/ptree_fwd.hpp"
22 
23 
24 // namespace boost { namespace property_tree {
25 // class ptree;
26 // }}
27 namespace coral {
28  class ISessionProxy;
29  class Blob;
30 }
31 
32 namespace TrigConf {
33 
34  class QueryDefinition;
35 
40  public:
41 
43  TrigDBLoader(const std::string & loaderName, const std::string & connection);
44 
46  virtual ~TrigDBLoader();
47 
53  void setCrestConnection(const std::string & server, const std::string & version = "");
54 
61  void setCrestTrigDB(const std::string & crestTrigDB);
62 
66  size_t schemaVersion(coral::ISessionProxy* session) const;
67 
68  void setLevel(MSGTC::Level lvl) { msg().setLevel(lvl); }
69 
70  MSGTC::Level outputLevel() const { return msg().level(); }
71 
72  protected:
73 
74  bool useCrest() const {
75  return m_useCrest;
76  }
77 
89  std::string getTrigDataCrest(const std::string & type, int key) const;
90 
92  std::unique_ptr<coral::ISessionProxy> createDBSession() const;
93 
96  const std::map<size_t, QueryDefinition> & queries) const;
97 
98  void loadFromCrest(unsigned int key, boost::property_tree::ptree & pt,
99  const std::string & outFileName, const std::string & description,
100  const std::string & query_type) const;
101 
102  void loadFromOracle(unsigned int key, boost::property_tree::ptree & pt,
103  const std::string & outFileName, const std::string & description,
104  const std::map<size_t, QueryDefinition> & queries) const;
105 
106  private:
107 
108  // private variables
109  bool m_useCrest {false};
110  std::string m_connection {""};
111  std::string m_crestServer {""};
112  std::string m_crestVersion {""};
113  std::string m_crestTrigDb {""};
117  };
118 
119 }
120 
121 #endif
122 
Exceptions.h
TrigConf::TrigDBLoader::schemaVersion
size_t schemaVersion(coral::ISessionProxy *session) const
access to TriggerDB schema version
Definition: TrigDBLoader.cxx:38
TrigConf::TrigDBLoader::m_connection
std::string m_connection
Definition: TrigDBLoader.h:110
TrigConf::TrigDBLoader
Loader of trigger configurations from the Trigger database.
Definition: TrigDBLoader.h:39
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
TrigConf::TrigDBLoader::loadFromCrest
void loadFromCrest(unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::string &query_type) const
Definition: TrigDBLoader.cxx:194
TrigConf::TrigDBLoader::useCrest
bool useCrest() const
Definition: TrigDBLoader.h:74
TrigConf::TrigDBLoader::setCrestConnection
void setCrestConnection(const std::string &server, const std::string &version="")
declare CREST as the source of the configuration An empty crest server makes it use Oracle
Definition: TrigDBLoader.cxx:80
TrigConf::QueryDefinition
Definition: TrigDBHelper.h:30
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
coral
Definition: ISecondaryEventSelector.h:19
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
TrigConf::TrigDBLoader::m_crestTrigDb
std::string m_crestTrigDb
Definition: TrigDBLoader.h:113
TrigConf::TrigDBLoader::loadFromOracle
void loadFromOracle(unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::map< size_t, QueryDefinition > &queries) const
Definition: TrigDBLoader.cxx:220
TrigConf::TrigDBLoader::outputLevel
MSGTC::Level outputLevel() const
Definition: TrigDBLoader.h:70
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:86
TrigConf::TrigDBLoader::setCrestTrigDB
void setCrestTrigDB(const std::string &crestTrigDB)
set trigger db for the crest connection
Definition: TrigDBLoader.cxx:102
TrigConf::MsgStreamTC::level
MSGTC::Level level()
Return message level of stream.
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:53
TrigConf::TrigDBLoader::m_useCrest
bool m_useCrest
Definition: TrigDBLoader.h:109
TrigConf::TrigDBLoader::m_retrialTimeout
int m_retrialTimeout
Definition: TrigDBLoader.h:115
TrigConf::TrigDBLoader::m_connectionTimeout
int m_connectionTimeout
Definition: TrigDBLoader.h:116
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
dumpNswErrorDb.outFileName
string outFileName
Definition: dumpNswErrorDb.py:131
TrigConf::TrigDBLoader::m_retrialPeriod
int m_retrialPeriod
Definition: TrigDBLoader.h:114
TrigConf::TrigConfMessaging
Class to provide easy access to TrigConf::MsgStream for TrigConf classes.
Definition: TrigConfMessaging.h:28
TrigConf::TrigDBLoader::m_crestVersion
std::string m_crestVersion
Definition: TrigDBLoader.h:112
get_generator_info.version
version
Definition: get_generator_info.py:33
TrigConf::TrigDBLoader::getTrigDataCrest
std::string getTrigDataCrest(const std::string &type, int key) const
Get trigger configuration from the TriggerDB through Crest.
Definition: TrigDBLoader.cxx:134
TrigConf::TrigDBLoader::~TrigDBLoader
virtual ~TrigDBLoader()
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
TrigConf::TrigDBLoader::setLevel
void setLevel(MSGTC::Level lvl)
Definition: TrigDBLoader.h:68
TrigConf::TrigDBLoader::m_crestServer
std::string m_crestServer
Definition: TrigDBLoader.h:111
TrigConfMessaging.h
Messaging base class for TrigConf code shared with Lvl1 ( AthMessaging)
TrigConf::MsgStreamTC::setLevel
void setLevel(MSGTC::Level lvl)
Set message level of stream.
Definition: Trigger/TrigConfiguration/TrigConfBase/Root/MsgStream.cxx:52
python.html.AtlRunQueryDQSummary.server
server
Definition: AtlRunQueryDQSummary.py:21
TrigConf::TrigDBLoader::createDBSession
std::unique_ptr< coral::ISessionProxy > createDBSession() const
create (if needed) DB session and return the session proxy
Definition: TrigDBLoader.cxx:107
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
TrigConf::TrigDBLoader::getQueryDefinition
QueryDefinition getQueryDefinition(size_t schemaVersion, const std::map< size_t, QueryDefinition > &queries) const
return query for given schemaVersion from possible queries
Definition: TrigDBLoader.cxx:174
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TrigConf::TrigDBLoader::TrigDBLoader
TrigDBLoader(const std::string &loaderName, const std::string &connection)
Constructor.
Definition: TrigDBLoader.cxx:26