ATLAS Offline Software
Loading...
Searching...
No Matches
HLTMonitoring.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <iomanip>
8
9using TV = boost::property_tree::ptree::value_type; // tree-value type
10using namespace std;
11
14
15TrigConf::HLTMonitoring::HLTMonitoring(const boost::property_tree::ptree & data)
17{
18 load();
19}
20
21void
23{
24 if(! isInitialized() || empty() ) {
25 return;
26 }
27 m_name = getAttribute("name");
28
29 // signatures
30 try {
31 for( const auto & [monGroupName, monGroup] : data().get_child( "signatures" ) ) {
32 std::map<std::string, std::vector<std::string>> monGroupChainMap;
33 for(const auto & [chainName, targetList] : monGroup) {
34 std::vector<std::string> monTarget{};
35 for(const auto & x: targetList) {
36 monTarget.push_back(x.second.get_value<std::string>());
37 m_targets.insert(monTarget.back());
38 }
39 monGroupChainMap.emplace( chainName, monTarget);
40 }
41 m_signatures.emplace( monGroupName, monGroupChainMap);
42 }
43 }
44 catch(std::exception & ex) {
45 std::cerr << "ERROR: problem when building the HLT monitoring. " << ex.what() << std::endl;
46 throw;
47 }
48}
49
50const std::set<std::string> &
54
55const std::map<std::string, std::map<std::string, std::vector<std::string>>> &
59
60std::vector<std::string>
62 std::vector<std::string> keys;
63 keys.reserve(m_signatures.size());
64 for(const auto& [key, value] : m_signatures) {
65 keys.push_back(key);
66 }
67 return keys;
68}
69
70std::vector<std::string>
71TrigConf::HLTMonitoring::chainsBySignatureAndTarget(const std::string & signature, const std::string & target) const {
72 std::vector<std::string> chains{};
73 for(const auto & [chain, targets] : m_signatures.at(signature)) {
74 if(find(begin(targets), end(targets), target) != end(targets)) {
75 chains.push_back(chain);
76 }
77 }
78 return chains;
79}
80
81std::size_t
83 return data().get_child("signatures").size();
84}
85
86void
88{
89 m_smk = 0;
90 m_name = "";
91}
92
93unsigned int
95 return m_smk;
96}
97
98void
100 m_smk = smk;
101}
102
103void
105 cout << "HLT monitoring '" << name() << "'" << endl;
106 cout << "Signatures: " << size() << endl;
107 cout << "Targets: " << targets().size() << endl;
108 if(full) {
109 cout << "Signatures: ";
110 bool first(true);
111 size_t sigNameWidth(0);
112 for( auto & sigName : signatureNames() ) {
113 if(first) {
114 first = false;
115 } else {
116 cout << ", ";
117 }
118 cout << sigName;
119 sigNameWidth = max(sigNameWidth,sigName.size());
120 }
121 cout << endl << "Targets: ";
122 first = true;
123 std::vector<size_t> tnwidth{};
124 for( auto & target : targets() ) {
125 if(first) {
126 first = false;
127 } else {
128 cout << ", ";
129 }
130 cout << target;
131 tnwidth.push_back(target.size());
132 }
133 cout << endl;
134
135 cout << "Count of monitored chains by target:" << endl;
136 first = true;
137 for( auto & target : targets() ) {
138 if(first) {
139 first = false;
140 cout << setw(sigNameWidth+2) << "";
141 } else {
142 cout << ", ";
143 }
144 cout << target;
145 }
146 cout << endl;
147 for( auto & sigName : signatureNames() ) {
148 cout << setw(sigNameWidth) << left << sigName << ": " << right;
149 size_t col{0};
150 first = true;
151 for( auto & target : targets() ) {
152 if(first) {
153 first = false;
154 } else {
155 cout << ", ";
156 }
157 cout << setw(tnwidth[col++]) << chainsBySignatureAndTarget(sigName, target).size();
158 }
159 cout << endl;
160 }
161
162
163
164 }
165}
166
boost::property_tree::ptree::value_type TV
Definition HLTMenu.cxx:7
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define x
static const Attributes_t empty
#define max(a, b)
Definition cfImp.cxx:41
virtual const std::string & name() const final
const ptree & data() const
Access to the underlying data, if needed.
DataStructure()
Default constructor, leading to an uninitialized configuration object.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
const std::map< std::string, std::map< std::string, std::vector< std::string > > > & signatures() const
std::vector< std::string > signatureNames() const
names of the monitored signatures
unsigned int smk() const
setter and getter for the supermasterkey
virtual void clear() override
Clearing the configuration data.
unsigned int m_smk
the supermasterkey
std::size_t size() const
Accessor to the number of HLT monitoring chains.
void setSMK(unsigned int psk)
std::vector< std::string > chainsBySignatureAndTarget(const std::string &signature, const std::string &target) const
monitored chains by signature for a given target
void printMonConfig(bool full=false) const
print overview of L1 Menu
const std::set< std::string > & targets() const
names of targets
std::set< std::string > m_targets
names of monitoring targets like shifter, t0, online
std::map< std::string, std::map< std::string, std::vector< std::string > > > m_signatures
internal storage of the information
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
STL namespace.