ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConfJobOptionsSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TrigConfigSvc_JobOptionsSvc
6#define TrigConfigSvc_JobOptionsSvc
7
8#include <string>
9#include <vector>
10
11#include "Gaudi/Interfaces/IOptionsSvc.h"
12#include "GaudiKernel/ServiceHandle.h"
13
16
17namespace TrigConf {
18
33 class JobOptionsSvc : public extends<AthService, TrigConf::IJobOptionsSvc, Gaudi::Interfaces::IOptionsSvc> {
34 using AthService::getProperties;
35
36 public:
37 JobOptionsSvc(const std::string& name, ISvcLocator* pSvcLocator);
38
39 virtual StatusCode initialize() override;
40 virtual StatusCode start() override;
41
44 virtual void set( const std::string& key, const std::string& value ) override
45 {
46 return m_optsvc->set(key,value);
47 }
48
49 virtual std::string get( const std::string& key, const std::string& default_ = {} ) const override
50 {
51 return m_optsvc->get(key,default_);
52 }
53
54 virtual std::string pop( const std::string& key, const std::string& default_ = {} ) override
55 {
56 return m_optsvc->pop(key,default_);
57 }
58
59 virtual bool has( const std::string& key ) const override
60 {
61 return m_optsvc->has(key);
62 }
63
64 virtual bool isSet( const std::string& key ) const override
65 {
66 return m_optsvc->isSet(key);
67 }
68
69 virtual std::vector<std::tuple<std::string, std::string>> items() const override
70 {
71 return m_optsvc->items();
72 }
73
74 virtual void bind( const std::string& prefix, Gaudi::Details::PropertyBase* property ) override
75 {
76 return m_optsvc->bind(prefix,property);
77 }
78
79 using OnlyDefaults = Gaudi::Interfaces::IOptionsSvc::OnlyDefaults;
80 virtual void broadcast( const std::regex& filter, const std::string& value,
81 OnlyDefaults defaults = OnlyDefaults{true} ) override
82 {
83 return m_optsvc->broadcast(filter, value, defaults);
84 }
85
86 virtual StatusCode readOptions(std::string_view, std::string_view) override
87 {
88 throw std::runtime_error("TrigConf::JobOptionsSvc::readOptions() is not supported");
89 }
90
91
94 virtual const std::string& server() const override { return m_server; }
95 virtual int superMasterKey() const override { return m_smk; }
96 virtual int l1PrescaleKey() const override { return m_l1psk; }
97 virtual int hltPrescaleKey() const override { return m_hltpsk; }
99
100 private:
101 StatusCode dumpOptions(const std::string& file);
102 StatusCode readOptionsJson(const std::string& file);
103 StatusCode readOptionsDB(const std::string& db_server, int smk);
104 void parseDBString(const std::string& s);
105
106 int m_smk{-1};
107 int m_l1psk{-1};
108 int m_hltpsk{-1};
109 std::string m_server;
110
111 // Same properties as in Gaudi's JobOptionsSvc
112 Gaudi::Property<std::string> m_sourceType{this, "TYPE", "NONE", "Configuration type (NONE, FILE, DB)"};
113 Gaudi::Property<std::string> m_sourcePath{this, "PATH", {}, "Path for NONE/FILE, connection string for DB"};
114 Gaudi::Property<std::string> m_searchPath{this, "SEARCHPATH", {}, "NOT SUPPORTED"};
115 Gaudi::Property<std::string> m_dump{this, "DUMPFILE", {}, "Dump job properties into JSON file"};
116
119 };
120
121} // namespace TrigConf
122
123#endif
virtual void broadcast(const std::regex &filter, const std::string &value, OnlyDefaults defaults=OnlyDefaults{true}) override
StatusCode readOptionsJson(const std::string &file)
virtual void set(const std::string &key, const std::string &value) override
virtual bool isSet(const std::string &key) const override
StatusCode dumpOptions(const std::string &file)
This is mainly for debugging purposes and to compare the JobOptions as seen by the JobOptionSvc to th...
Gaudi::Property< std::string > m_searchPath
StatusCode readOptionsDB(const std::string &db_server, int smk)
int m_hltpsk
HLT prescale key.
JobOptionsSvc(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Interfaces::IOptionsSvc::OnlyDefaults OnlyDefaults
Gaudi::Property< std::string > m_sourcePath
virtual bool has(const std::string &key) const override
void parseDBString(const std::string &s)
Parse DB connection string and fill private members.
std::string m_server
DB connection alias.
virtual StatusCode start() override
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_dump
virtual int l1PrescaleKey() const override
Return L1PSK (-1 if not set)
virtual int superMasterKey() const override
Return SMK (-1 if not set)
virtual void bind(const std::string &prefix, Gaudi::Details::PropertyBase *property) override
virtual std::string get(const std::string &key, const std::string &default_={}) const override
virtual int hltPrescaleKey() const override
Return HLTPSK (-1 if not set)
Gaudi::Property< std::string > m_sourceType
virtual StatusCode readOptions(std::string_view, std::string_view) override
virtual std::vector< std::tuple< std::string, std::string > > items() const override
ServiceHandle< Gaudi::Interfaces::IOptionsSvc > m_optsvc
handle to the "real" IOptionsSvc
virtual std::string pop(const std::string &key, const std::string &default_={}) override
virtual const std::string & server() const override
DB connection alias.
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22
TFile * file