ATLAS Offline Software
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 
9 using TV = boost::property_tree::ptree::value_type; // tree-value type
10 using namespace std;
11 
13 {}
14 
17 {
18  load();
19 }
20 
21 void
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 
50 const std::set<std::string> &
52  return m_targets;
53 }
54 
55 const std::map<std::string, std::map<std::string, std::vector<std::string>>> &
57  return m_signatures;
58 }
59 
60 std::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 
70 std::vector<std::string>
71 TrigConf::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 
81 std::size_t
83  return data().get_child("signatures").size();
84 }
85 
86 void
88 {
89  m_smk = 0;
90  m_name = "";
91 }
92 
93 unsigned int
95  return m_smk;
96 }
97 
98 void
100  m_smk = smk;
101 }
102 
103 void
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 
python.TIDAMonTool.monGroup
def monGroup(analysis_chain)
Definition: TIDAMonTool.py:297
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TrigConf::HLTMonitoring::signatures
const std::map< std::string, std::map< std::string, std::vector< std::string > > > & signatures() const
Definition: HLTMonitoring.cxx:56
TrigConf::HLTMonitoring::HLTMonitoring
HLTMonitoring()
Constructor.
Definition: HLTMonitoring.cxx:12
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
max
#define max(a, b)
Definition: cfImp.cxx:41
TrigConf::HLTMonitoring::setSMK
void setSMK(unsigned int psk)
Definition: HLTMonitoring.cxx:99
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
RunEBWeightsComputation.smk
smk
Definition: RunEBWeightsComputation.py:87
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
athena.value
value
Definition: athena.py:124
TrigConf::HLTMonitoring::size
std::size_t size() const
Accessor to the number of HLT monitoring chains.
Definition: HLTMonitoring.cxx:82
TrigConf::HLTMonitoring::chainsBySignatureAndTarget
std::vector< std::string > chainsBySignatureAndTarget(const std::string &signature, const std::string &target) const
monitored chains by signature for a given target
Definition: HLTMonitoring.cxx:71
x
#define x
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
TrigConf::HLTMonitoring::targets
const std::set< std::string > & targets() const
names of targets
Definition: HLTMonitoring.cxx:51
TrigConf::HLTMonitoring::load
void load()
Definition: HLTMonitoring.cxx:22
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TrigConf::HLTMonitoring::signatureNames
std::vector< std::string > signatureNames() const
names of the monitored signatures
Definition: HLTMonitoring.cxx:61
calibdata.exception
exception
Definition: calibdata.py:496
TrigConf::HLTMonitoring::clear
virtual void clear() override
Clearing the configuration data.
Definition: HLTMonitoring.cxx:87
TrigConf::HLTMonitoring::smk
unsigned int smk() const
setter and getter for the supermasterkey
Definition: HLTMonitoring.cxx:94
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigConf::DataStructure
Base class for Trigger configuration data and wrapper around underlying representation.
Definition: DataStructure.h:37
find_data.full
full
Definition: find_data.py:27
query_example.col
col
Definition: query_example.py:7
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
copySelective.target
string target
Definition: copySelective.py:37
DeMoScan.first
bool first
Definition: DeMoScan.py:536
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
TrigConf::HLTMonitoring::printMonConfig
void printMonConfig(bool full=false) const
print overview of L1 Menu
Definition: HLTMonitoring.cxx:104
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TV
boost::property_tree::ptree::value_type TV
Definition: HLTMenu.cxx:7
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
HLTMonitoring.h