42 if (
m_parent.m_suppliedElectronEfficiencyTools.size() !=
43 m_parent.m_suppliedElectronScaleFactorTools.size()) {
45 "The numbers of electron tools supplied via the "
46 "'ElectronEfficiencyTools' and 'ElectronScaleFactorTools' properties "
47 "should be identical");
51 if (
m_parent.m_suppliedPhotonEfficiencyTools.size() !=
52 m_parent.m_suppliedPhotonScaleFactorTools.size()) {
54 "The numbers of photon tools supplied via the 'PhotonEfficiencyTools' "
55 "and 'PhotonScaleFactorTools' properties should be identical");
62 for (
auto& kv :
m_parent.m_legsPerTool) {
63 auto& name = kv.first;
76 <<
" mentioned in property 'ListOfLegsPerTool', which is "
77 "only aimed at electron and photon tools");
79 std::string known_tools =
"; the known tools are";
80 for (
auto& tool :
m_parent.m_suppliedElectronEfficiencyTools)
81 known_tools +=
" " + tool.name();
82 for (
auto& tool :
m_parent.m_suppliedElectronScaleFactorTools)
83 known_tools +=
" " + tool.name();
84 for (
auto& tool :
m_parent.m_suppliedPhotonEfficiencyTools)
85 known_tools +=
" " + tool.name();
86 for (
auto& tool :
m_parent.m_suppliedPhotonScaleFactorTools)
87 known_tools +=
" " + tool.name();
89 << name <<
" mentioned in property 'ListOfLegsPerTool'"
98 auto toolsHaveLegInfo = [
this](
auto& effTools,
auto& sfTools,
100 if (effTools.size() < 2)
103 for (
int i = 0; i < 2; ++i) {
104 for (
auto& tool : (i ? effTools : sfTools)) {
105 const std::string& name = tool.name();
109 <<
" associated trigger legs are not indicated in "
110 "'ListOfLegsPerTool', "
111 "doing so is mandatory when several tools are used");
119 toolsHaveLegInfo(
m_parent.m_suppliedElectronEfficiencyTools,
120 m_parent.m_suppliedElectronScaleFactorTools,
"Electron");
122 toolsHaveLegInfo(
m_parent.m_suppliedPhotonEfficiencyTools,
123 m_parent.m_suppliedPhotonScaleFactorTools,
"Photon");
131 if (
m_parent.m_leptonTagDecorations ==
"") {
132 if (
m_parent.m_muonLegsPerTag.size() ||
136 "the property 'LeptonTagDecorations' must be filled when any of "
137 "'ListOfTagsPerTool'"
138 " / 'ListOfLegsPerTag' / 'MuonLegsPerTag' / 'ElectronLegsPerTag' "
146 unsigned nElectronToolsWithTags = 0, nMuonToolsWithTags = 0,
147 nPhotonToolsWithTags = 0;
148 for (
auto& kv :
m_parent.m_tagsPerTool) {
149 auto& name = kv.first;
152 ++nElectronToolsWithTags;
154 ++nMuonToolsWithTags;
157 ++nPhotonToolsWithTags;
160 std::string all_tools =
"; the known tools are";
161 for (
auto& tool :
m_parent.m_suppliedElectronEfficiencyTools)
162 all_tools +=
" " + tool.name();
163 for (
auto& tool :
m_parent.m_suppliedElectronScaleFactorTools)
164 all_tools +=
" " + tool.name();
165 for (
auto& tool :
m_parent.m_suppliedPhotonEfficiencyTools)
166 all_tools +=
" " + tool.name();
167 for (
auto& tool :
m_parent.m_suppliedPhotonScaleFactorTools)
168 all_tools +=
" " + tool.name();
170 << name <<
" mentioned in property 'ListOfTagsPerTool'");
174 if (nMuonToolsWithTags &&
175 (nMuonToolsWithTags !=
m_parent.m_suppliedMuonTools.size())) {
177 "Not all muon tools have been associated with tags in the "
178 "'ListOfTagsPerTool' property");
182 unsigned nSupplied =
m_parent.m_suppliedElectronEfficiencyTools.size() +
183 m_parent.m_suppliedElectronScaleFactorTools.size();
184 if (nElectronToolsWithTags && (nElectronToolsWithTags != nSupplied)) {
186 "Not all electron tools have been associated with tags in the "
187 "'ListOfTagsPerTool' property");
193 nSupplied =
m_parent.m_suppliedPhotonEfficiencyTools.size() +
194 m_parent.m_suppliedPhotonScaleFactorTools.size();
195 if (nPhotonToolsWithTags && (nPhotonToolsWithTags != nSupplied)) {
197 "Not all photon tools have been associated with tags in the "
198 "'ListOfTagsPerTool' property");
255 auto checkConsistency = [
this](
auto& effToolIndex,
auto& sfToolIndex,
257 bool mismatch = (effToolIndex.size() != sfToolIndex.size());
259 for (
auto& kv : sfToolIndex) {
260 auto itr = effToolIndex.find(kv.first);
261 if (itr != effToolIndex.end()) {
262 std::size_t index1 = kv.second, index2 = itr->second;
264 for (
auto& kv : sfToolIndex)
265 if (kv.second == index1)
266 pairs1.insert(kv.first);
267 for (
auto& kv : effToolIndex)
268 if (kv.second == index2)
269 pairs2.insert(kv.first);
270 if (pairs1 != pairs2)
278 "There must be a one-to-one correspondence between the "
280 <<
" efficiency and scale factor tools "
281 "(including their associated trigger legs and selection tags)");
286 if (!checkConsistency(
m_parent.m_electronEffToolIndex,
287 m_parent.m_electronSfToolIndex,
"electron"))
289 if (!checkConsistency(
m_parent.m_photonEffToolIndex,
290 m_parent.m_photonSfToolIndex,
"photon"))
294 for (
auto& kv :
m_parent.m_legsPerTag) {
295 std::size_t tag = (kv.first !=
"*") ?
m_parent.m_hasher(kv.first) : 0;
296 for (std::size_t leg :
297 m_parent.listNonOrderedCSValues(kv.second, success)) {
299 m_parent.m_dictionary[leg], success);
301 if (
m_parent.m_electronEffToolIndex.find(ToolKey(leg, tag)) ==
302 m_parent.m_electronEffToolIndex.end()) {
304 "No electron tool provided for the combination of trigger leg '"
305 <<
m_parent.m_dictionary[leg] <<
"' and selection tag '"
306 << kv.first <<
"' mentioned in the property 'ListOfLegsPerTag'");
310 if (
m_parent.m_muonToolIndex.find(ToolKey(0, tag)) ==
313 "No muon tool provided for the combination of trigger leg '"
314 <<
m_parent.m_dictionary[leg] <<
"' and selection tag '"
315 << kv.first <<
"' mentioned in the property 'ListOfLegsPerTag'");
319 if (
m_parent.m_photonEffToolIndex.find(ToolKey(leg, tag)) ==
320 m_parent.m_photonEffToolIndex.end()) {
322 "No photon tool provided for the combination of trigger leg '"
323 <<
m_parent.m_dictionary[leg] <<
"' and selection tag '"
324 << kv.first <<
"' mentioned in the property 'ListOfLegsPerTag'");
329 "Unable to determine which lepton flavour is associated to the "
332 <<
"' in the property 'ListOfLegsPerTag'");
341 auto periods =
m_parent.m_calculator->m_periods;
342 const auto periods_end = periods.end();
343 for (
auto itr1 = periods.begin(); itr1 != periods_end; ++itr1) {
344 auto&
x = itr1->m_boundaries;
345 if (
x.second <
x.first) {
347 "One of the periods specified in TriggerCombination has runMin ("
348 <<
x.first <<
") > runMax (" <<
x.second <<
")");
351 for (
auto itr2 = itr1 + 1; itr2 != periods_end; ++itr2) {
352 auto&
y = itr2->m_boundaries;
353 if ((
x.first >=
y.first &&
x.first <=
y.second) ||
354 (
x.second >=
y.first &&
x.second <=
y.second)) {
355 ATH_MSG_ERROR(
"The periods specified in TriggerCombination overlap");