39 if (
m_parent.m_suppliedElectronEfficiencyTools.size() !=
40 m_parent.m_suppliedElectronScaleFactorTools.size()) {
42 "The numbers of electron tools supplied via the "
43 "'ElectronEfficiencyTools' and 'ElectronScaleFactorTools' properties "
44 "should be identical");
48 if (
m_parent.m_suppliedPhotonEfficiencyTools.size() !=
49 m_parent.m_suppliedPhotonScaleFactorTools.size()) {
51 "The numbers of photon tools supplied via the 'PhotonEfficiencyTools' "
52 "and 'PhotonScaleFactorTools' properties should be identical");
59 for (
auto& kv :
m_parent.m_legsPerTool) {
60 auto& name = kv.first;
73 <<
" mentioned in property 'ListOfLegsPerTool', which is "
74 "only aimed at electron and photon tools");
76 std::string known_tools =
"; the known tools are";
77 for (
auto& tool :
m_parent.m_suppliedElectronEfficiencyTools)
78 known_tools +=
" " + tool.name();
79 for (
auto& tool :
m_parent.m_suppliedElectronScaleFactorTools)
80 known_tools +=
" " + tool.name();
81 for (
auto& tool :
m_parent.m_suppliedPhotonEfficiencyTools)
82 known_tools +=
" " + tool.name();
83 for (
auto& tool :
m_parent.m_suppliedPhotonScaleFactorTools)
84 known_tools +=
" " + tool.name();
86 << name <<
" mentioned in property 'ListOfLegsPerTool'"
95 auto toolsHaveLegInfo = [
this](
auto& effTools,
auto& sfTools,
97 if (effTools.size() < 2)
100 for (
int i = 0; i < 2; ++i) {
101 for (
auto& tool : (i ? effTools : sfTools)) {
102 const std::string& name = tool.name();
106 <<
" associated trigger legs are not indicated in "
107 "'ListOfLegsPerTool', "
108 "doing so is mandatory when several tools are used");
116 toolsHaveLegInfo(
m_parent.m_suppliedElectronEfficiencyTools,
117 m_parent.m_suppliedElectronScaleFactorTools,
"Electron");
119 toolsHaveLegInfo(
m_parent.m_suppliedPhotonEfficiencyTools,
120 m_parent.m_suppliedPhotonScaleFactorTools,
"Photon");
128 if (
m_parent.m_leptonTagDecorations ==
"") {
129 if (
m_parent.m_muonLegsPerTag.size() ||
133 "the property 'LeptonTagDecorations' must be filled when any of "
134 "'ListOfTagsPerTool'"
135 " / 'ListOfLegsPerTag' / 'MuonLegsPerTag' / 'ElectronLegsPerTag' "
143 unsigned nElectronToolsWithTags = 0, nMuonToolsWithTags = 0,
144 nPhotonToolsWithTags = 0;
145 for (
auto& kv :
m_parent.m_tagsPerTool) {
146 auto& name = kv.first;
149 ++nElectronToolsWithTags;
151 ++nMuonToolsWithTags;
154 ++nPhotonToolsWithTags;
157 std::string all_tools =
"; the known tools are";
158 for (
auto& tool :
m_parent.m_suppliedElectronEfficiencyTools)
159 all_tools +=
" " + tool.name();
160 for (
auto& tool :
m_parent.m_suppliedElectronScaleFactorTools)
161 all_tools +=
" " + tool.name();
162 for (
auto& tool :
m_parent.m_suppliedPhotonEfficiencyTools)
163 all_tools +=
" " + tool.name();
164 for (
auto& tool :
m_parent.m_suppliedPhotonScaleFactorTools)
165 all_tools +=
" " + tool.name();
167 << name <<
" mentioned in property 'ListOfTagsPerTool'");
171 if (nMuonToolsWithTags &&
172 (nMuonToolsWithTags !=
m_parent.m_suppliedMuonTools.size())) {
174 "Not all muon tools have been associated with tags in the "
175 "'ListOfTagsPerTool' property");
179 unsigned nSupplied =
m_parent.m_suppliedElectronEfficiencyTools.size() +
180 m_parent.m_suppliedElectronScaleFactorTools.size();
181 if (nElectronToolsWithTags && (nElectronToolsWithTags != nSupplied)) {
183 "Not all electron tools have been associated with tags in the "
184 "'ListOfTagsPerTool' property");
190 nSupplied =
m_parent.m_suppliedPhotonEfficiencyTools.size() +
191 m_parent.m_suppliedPhotonScaleFactorTools.size();
192 if (nPhotonToolsWithTags && (nPhotonToolsWithTags != nSupplied)) {
194 "Not all photon tools have been associated with tags in the "
195 "'ListOfTagsPerTool' property");
252 auto checkConsistency = [
this](
auto& effToolIndex,
auto& sfToolIndex,
254 bool mismatch = (effToolIndex.size() != sfToolIndex.size());
256 for (
auto& kv : sfToolIndex) {
257 auto itr = effToolIndex.find(kv.first);
258 if (itr != effToolIndex.end()) {
259 std::size_t index1 = kv.second, index2 = itr->second;
260 std::flat_set<ToolKey> pairs1, pairs2;
261 for (
auto& kv : sfToolIndex)
262 if (kv.second == index1)
263 pairs1.insert(kv.first);
264 for (
auto& kv : effToolIndex)
265 if (kv.second == index2)
266 pairs2.insert(kv.first);
267 if (pairs1 != pairs2)
275 "There must be a one-to-one correspondence between the "
277 <<
" efficiency and scale factor tools "
278 "(including their associated trigger legs and selection tags)");
283 if (!checkConsistency(
m_parent.m_electronEffToolIndex,
284 m_parent.m_electronSfToolIndex,
"electron"))
286 if (!checkConsistency(
m_parent.m_photonEffToolIndex,
287 m_parent.m_photonSfToolIndex,
"photon"))
291 for (
auto& kv :
m_parent.m_legsPerTag) {
292 std::size_t tag = (kv.first !=
"*") ?
m_parent.m_hasher(kv.first) : 0;
293 for (std::size_t leg :
294 m_parent.listNonOrderedCSValues(kv.second, success)) {
296 m_parent.m_dictionary[leg], success);
298 if (
m_parent.m_electronEffToolIndex.find(ToolKey(leg, tag)) ==
299 m_parent.m_electronEffToolIndex.end()) {
301 "No electron tool provided for the combination of trigger leg '"
302 <<
m_parent.m_dictionary[leg] <<
"' and selection tag '"
303 << kv.first <<
"' mentioned in the property 'ListOfLegsPerTag'");
307 if (
m_parent.m_muonToolIndex.find(ToolKey(0, tag)) ==
310 "No muon tool provided for the combination of trigger leg '"
311 <<
m_parent.m_dictionary[leg] <<
"' and selection tag '"
312 << kv.first <<
"' mentioned in the property 'ListOfLegsPerTag'");
316 if (
m_parent.m_photonEffToolIndex.find(ToolKey(leg, tag)) ==
317 m_parent.m_photonEffToolIndex.end()) {
319 "No photon tool provided for the combination of trigger leg '"
320 <<
m_parent.m_dictionary[leg] <<
"' and selection tag '"
321 << kv.first <<
"' mentioned in the property 'ListOfLegsPerTag'");
326 "Unable to determine which lepton flavour is associated to the "
329 <<
"' in the property 'ListOfLegsPerTag'");
338 auto periods =
m_parent.m_calculator->m_periods;
339 const auto periods_end = periods.end();
340 for (
auto itr1 = periods.begin(); itr1 != periods_end; ++itr1) {
341 auto&
x = itr1->m_boundaries;
342 if (
x.second <
x.first) {
344 "One of the periods specified in TriggerCombination has runMin ("
345 <<
x.first <<
") > runMax (" <<
x.second <<
")");
348 for (
auto itr2 = itr1 + 1; itr2 != periods_end; ++itr2) {
349 auto&
y = itr2->m_boundaries;
350 if ((
x.first >=
y.first &&
x.first <=
y.second) ||
351 (
x.second >=
y.first &&
x.second <=
y.second)) {
352 ATH_MSG_ERROR(
"The periods specified in TriggerCombination overlap");