ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfData
src
HLTPrescalesSet.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigConfData/HLTPrescalesSet.h
"
6
7
TrigConf::HLTPrescalesSet::HLTPrescalesSet
()
8
{}
9
10
TrigConf::HLTPrescalesSet::HLTPrescalesSet
(
const
boost::property_tree::ptree &
data
)
11
:
DataStructure
(
data
)
12
{
13
load
();
14
}
15
16
void
17
TrigConf::HLTPrescalesSet::load
()
18
{
19
m_name
=
getAttribute
(
"name"
);
20
const
auto
& prescales =
data
().get_child(
"prescales"
);
21
for
(
auto
& p : prescales ) {
22
23
double
prescaleValue = p.second.get_child(
"prescale"
).get_value<
double
>();
24
HLTPrescale
ps;
25
ps.prescale = prescaleValue < 0 ? -prescaleValue : prescaleValue;
26
ps.enabled = (prescaleValue > 0);
27
boost::optional<bool> enabledField = p.second.get_optional<
bool
>(
"enabled"
);
28
if
( enabledField ) {
29
ps.enabled = *enabledField;
30
}
31
32
// store in map by name
33
m_prescales
[p.first] = ps;
34
35
// store in map by hash
36
uint32_t namehash = p.second.get_child(
"hash"
).get_value<uint32_t>();
37
m_prescalesByHash
[namehash] = ps;
38
39
// repeat for express stream prescale
40
HLTPrescale
ps_express;
41
// checks if contains express prescale in chain from prescale file/DB entry
42
// does not check against menu definition, check to be done when used elsewhere
43
if
(p.second.get_optional<
double
>(
"prescale_express"
)){
44
double
prescaleValue_express = p.second.get_child(
"prescale_express"
).get_value<
double
>();
45
ps_express.
prescale
= prescaleValue_express < 0 ? -prescaleValue_express : prescaleValue_express;
46
ps_express.
enabled
= (prescaleValue_express > 0);
47
boost::optional<bool> enabledField_express = p.second.get_optional<
bool
>(
"enabled_express"
);
48
if
( enabledField_express ) {
49
ps_express.
enabled
= *enabledField_express;
50
}
51
// store in map by name
52
m_prescales_express
[p.first] = ps_express;
53
54
// store in maps by hash
55
m_prescalesByHash_express
[namehash] = ps_express;
56
}
57
}
58
}
59
60
void
61
TrigConf::HLTPrescalesSet::clear
()
62
{
63
m_psk
= 0;
64
m_prescales
.clear();
65
m_prescalesByHash
.clear();
66
}
67
68
std::size_t
69
TrigConf::HLTPrescalesSet::size
()
const
70
{
71
return
m_prescales
.size();
72
}
73
74
unsigned
int
75
TrigConf::HLTPrescalesSet::psk
()
const
{
76
return
m_psk
;
77
}
78
79
void
80
TrigConf::HLTPrescalesSet::setPSK
(
unsigned
int
psk
) {
81
m_psk
=
psk
;
82
}
83
84
const
TrigConf::HLTPrescalesSet::HLTPrescale
&
85
TrigConf::HLTPrescalesSet::prescale
(
const
std::string & chainName)
const
{
86
return
m_prescales
.at(chainName);
87
}
88
89
const
TrigConf::HLTPrescalesSet::HLTPrescale
&
90
TrigConf::HLTPrescalesSet::prescale
(uint32_t chainHash)
const
{
91
return
m_prescalesByHash
.at(chainHash);
92
}
93
94
95
const
TrigConf::HLTPrescalesSet::HLTPrescale
&
96
TrigConf::HLTPrescalesSet::prescale_express
(
const
std::string & chainName)
const
{
97
auto
search
=
m_prescales_express
.find(chainName);
98
if
(
search
!=
m_prescales_express
.end()) {
99
return
search
->second;
100
}
else
{
101
return
m_notInExpress
;
102
}
103
}
104
105
const
TrigConf::HLTPrescalesSet::HLTPrescale
&
106
TrigConf::HLTPrescalesSet::prescale_express
(uint32_t chainHash)
const
{
107
auto
search
=
m_prescalesByHash_express
.find(chainHash);
108
if
(
search
!=
m_prescalesByHash_express
.end()) {
109
return
search
->second;
110
}
else
{
111
return
m_notInExpress
;
112
}
113
}
114
115
void
116
TrigConf::HLTPrescalesSet::printPrescaleSet
(
bool
full)
const
117
{
118
std::cout <<
"Name '"
<<
name
() <<
"'"
<< std::endl;
119
std::cout <<
"Prescales: "
<<
size
() << std::endl;
120
if
(full) {
121
int
c(0);
122
for
(
auto
& ps :
m_prescales
) {
123
std::cout <<
" "
<< c++ <<
": "
<< ps.first <<
" -> "
<< ps.second.prescale << (ps.second.enabled ?
""
:
" (disabled)"
) << std::endl;
124
}
125
}
126
}
127
HLTPrescalesSet.h
size
size_t size() const
Number of registered mappings.
TrigConf::DataStructure::name
virtual const std::string & name() const final
Definition
DataStructure.cxx:108
TrigConf::DataStructure::data
const ptree & data() const
Access to the underlying data, if needed.
Definition
DataStructure.h:83
TrigConf::DataStructure::DataStructure
DataStructure()
Default constructor, leading to an uninitialized configuration object.
Definition
DataStructure.cxx:11
TrigConf::DataStructure::m_name
std::string m_name
Definition
DataStructure.h:259
TrigConf::DataStructure::getAttribute
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
Definition
DataStructure.h:152
TrigConf::HLTPrescalesSet::size
std::size_t size() const
number of HLT prescales
Definition
HLTPrescalesSet.cxx:69
TrigConf::HLTPrescalesSet::prescale_express
const HLTPrescale & prescale_express(const std::string &chainName) const
HLT prescales by chain names.
Definition
HLTPrescalesSet.cxx:96
TrigConf::HLTPrescalesSet::prescale
const HLTPrescale & prescale(const std::string &chainName) const
HLT prescales by chain names.
Definition
HLTPrescalesSet.cxx:85
TrigConf::HLTPrescalesSet::m_prescales_express
std::unordered_map< std::string, HLTPrescale > m_prescales_express
Definition
HLTPrescalesSet.h:85
TrigConf::HLTPrescalesSet::m_notInExpress
HLTPrescale m_notInExpress
Definition
HLTPrescalesSet.h:91
TrigConf::HLTPrescalesSet::setPSK
void setPSK(unsigned int psk)
Definition
HLTPrescalesSet.cxx:80
TrigConf::HLTPrescalesSet::m_prescalesByHash
std::unordered_map< uint32_t, HLTPrescale > m_prescalesByHash
Definition
HLTPrescalesSet.h:82
TrigConf::HLTPrescalesSet::m_prescales
std::unordered_map< std::string, HLTPrescale > m_prescales
Definition
HLTPrescalesSet.h:79
TrigConf::HLTPrescalesSet::HLTPrescalesSet
HLTPrescalesSet()
Constructors.
Definition
HLTPrescalesSet.cxx:7
TrigConf::HLTPrescalesSet::m_psk
unsigned int m_psk
the prescale key
Definition
HLTPrescalesSet.h:76
TrigConf::HLTPrescalesSet::psk
unsigned int psk() const
setter and getter for the HLT prescale key
Definition
HLTPrescalesSet.cxx:75
TrigConf::HLTPrescalesSet::printPrescaleSet
void printPrescaleSet(bool full) const
Definition
HLTPrescalesSet.cxx:116
TrigConf::HLTPrescalesSet::clear
virtual void clear() override
Clearing the configuration data.
Definition
HLTPrescalesSet.cxx:61
TrigConf::HLTPrescalesSet::load
void load()
Definition
HLTPrescalesSet.cxx:17
TrigConf::HLTPrescalesSet::m_prescalesByHash_express
std::unordered_map< uint32_t, HLTPrescale > m_prescalesByHash_express
Definition
HLTPrescalesSet.h:88
search
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition
hcg.cxx:743
TrigConf::HLTPrescalesSet::HLTPrescale
Definition
HLTPrescalesSet.h:22
TrigConf::HLTPrescalesSet::HLTPrescale::prescale
double prescale
Definition
HLTPrescalesSet.h:24
TrigConf::HLTPrescalesSet::HLTPrescale::enabled
bool enabled
Definition
HLTPrescalesSet.h:23
Generated on
for ATLAS Offline Software by
1.17.0