ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfIO
src
TrigDBJobOptionsLoader.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
./TrigDBHelper.h
"
6
#include "
TrigConfIO/TrigDBJobOptionsLoader.h
"
7
8
TrigConf::TrigDBJobOptionsLoader::TrigDBJobOptionsLoader
(
const
std::string & connection) :
9
TrigDBLoader
(
"TrigDBJobOptionsLoader"
, connection)
10
{
11
{
// query for schema version 1
12
auto
& q =
m_queries
[1];
13
// tables
14
q.addToTableList (
"SUPER_MASTER_TABLE"
,
"SMT"
);
15
q.addToTableList (
"JO_MASTER_TABLE"
,
"JOMT"
);
16
// bind vars
17
q.extendBinding<
int
>(
"key"
);
18
// conditions
19
q.extendCondition(
"SMT.SMT_ID = :key"
);
20
q.extendCondition(
" AND SMT.SMT_JO_MASTER_TABLE_ID = JOMT.JO_ID"
);
21
// attributes
22
q.extendOutput<std::string>(
"SMT.SMT_NAME"
);
23
q.extendOutput<
int
> (
"SMT.SMT_JO_MASTER_TABLE_ID"
);
24
q.extendOutput<coral::Blob>(
"JOMT.JO_CONTENT"
);
25
// the field with the data
26
q.setDataName(
"JOMT.JO_CONTENT"
);
27
}
28
{
// query for schema version 2
29
auto
& q =
m_queries
[2];
30
// tables
31
q.addToTableList (
"SUPER_MASTER_TABLE"
,
"SMT"
);
32
q.addToTableList (
"HLT_JOBOPTIONS"
,
"HJO"
);
33
// bind vars
34
q.extendBinding<
int
>(
"key"
);
35
// conditions
36
q.extendCondition(
"SMT.SMT_ID = :key"
);
37
q.extendCondition(
"AND HJO.HJO_ID=SMT.SMT_HLT_JOBOPTIONS_ID"
);
38
// attributes
39
q.extendOutput<std::string>(
"SMT.SMT_NAME"
);
40
q.extendOutput<
int
> (
"SMT.SMT_HLT_JOBOPTIONS_ID"
);
41
q.extendOutput<coral::Blob>(
"HJO.HJO_DATA"
);
42
// the field with the data
43
q.setDataName(
"HJO.HJO_DATA"
);
44
}
45
}
46
47
// Destructor defined here because QueryDefinition is an incomplete type in the header
48
TrigConf::TrigDBJobOptionsLoader::~TrigDBJobOptionsLoader
() =
default
;
49
50
bool
51
TrigConf::TrigDBJobOptionsLoader::loadJobOptions
(
unsigned
int
smk,
52
boost::property_tree::ptree &
jobOptions
,
53
const
std::string & outFileName )
const
54
{
55
// load data into ptree
56
if
(
useCrest
()) {
57
loadFromCrest
(smk,
jobOptions
, outFileName,
"HLT job options"
,
"JO"
);
58
}
else
{
59
loadFromOracle
(smk,
jobOptions
, outFileName,
"HLT job options"
,
m_queries
);
60
}
61
return
true
;
62
}
63
64
bool
65
TrigConf::TrigDBJobOptionsLoader::loadJobOptions
(
unsigned
int
smk,
66
DataStructure
&
jobOptions
,
67
const
std::string & outFileName )
const
68
{
69
70
boost::property_tree::ptree ptJobOptions;
71
loadJobOptions
( smk, ptJobOptions, outFileName );
72
try
{
73
jobOptions
.setData(std::move(ptJobOptions));
74
}
75
catch
(std::exception & ex) {
76
jobOptions
.clear();
77
TRG_MSG_ERROR
(
"When reading HLT job options for SMK "
<< smk <<
" a parsing error occured ( "
<< ex.what() <<
" )"
);
78
throw
TrigConf::ParsingException
(
"TrigDBJobOptionsLoader: parsing error "
+ std::string(ex.what()));
79
}
80
return
true
;
81
}
82
TrigDBHelper.h
TrigDBJobOptionsLoader.h
Loader class for Trigger configuration from the Trigger DB.
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition
DataStructure.h:37
TrigConf::ParsingException
Definition
Trigger/TrigConfiguration/TrigConfIO/TrigConfIO/Exceptions.h:56
TrigConf::TrigDBJobOptionsLoader::TrigDBJobOptionsLoader
TrigDBJobOptionsLoader(const std::string &connection)
Constructor.
Definition
TrigDBJobOptionsLoader.cxx:8
TrigConf::TrigDBJobOptionsLoader::m_queries
std::map< size_t, QueryDefinition > m_queries
Definition
TrigDBJobOptionsLoader.h:60
TrigConf::TrigDBJobOptionsLoader::loadJobOptions
bool loadJobOptions(unsigned int smk, boost::property_tree::ptree &jobOptions, const std::string &outFileName="") const
Load job options from the Trigger DB into a ptree for a given SuperMasterKey (SMK).
Definition
TrigDBJobOptionsLoader.cxx:51
TrigConf::TrigDBJobOptionsLoader::~TrigDBJobOptionsLoader
virtual ~TrigDBJobOptionsLoader() override
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
TrigConf::TrigDBLoader::useCrest
bool useCrest() const
Definition
TrigDBLoader.h:74
TrigConf::TrigDBLoader::TrigDBLoader
TrigDBLoader(const std::string &loaderName, const std::string &connection)
Constructor.
Definition
TrigDBLoader.cxx:26
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::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
jobOptions
Definition
jobOptions.pA.py:1
Generated on
for ATLAS Offline Software by
1.17.0