28 m_specifiedSystematics(),
29 m_recommendedSystematics(),
32 m_met_maker(
"met::METMaker"),
33 m_met_systematics(
"met::METSystematicsTool"),
34 m_metSignif(
"metSignificance"){
42 ATH_MSG_INFO(
" top::MissingETObjectCollectionMaker initialize");
48 std::string jet_collection =
m_config->sgKeyJets();
49 jet_collection.erase(jet_collection.length() - 4);
54 const std:: string& syststr =
m_config->systematics();
55 std::set<std::string> syst;
58 bool ok =
m_config->getSystematicsList(syststr, syst);
60 ATH_MSG_ERROR(
" top::MissingETObjectCollectionMaker could not determine systematic list");
61 return StatusCode::FAILURE;
65 if (
m_config->contains(syst,
"AllMET")) {
74 return StatusCode::SUCCESS;
88 m_config->sgKeyTopSystematicEvents() +
"Nominal"),
89 "Failed to retrieve nominal TopEvents");
92 m_config->sgKeyTopSystematicEvents()),
"Failed to retrieve TopEvents");
94 for (
auto x : *systEvents) {
96 if (!executeNominal &&
m_config->isSystNominal(
m_config->systematicName(
x->hashValue())))
continue;
97 if (executeNominal && !
m_config->isSystNominal(
m_config->systematicName(
x->hashValue())))
continue;
105 if (executeNominal) {
107 m_config->sgKeyTopSystematicEventsLoose() +
"Nominal"),
108 "Failed to retrieve nominal TopEventsLoose");
111 m_config->sgKeyTopSystematicEventsLoose()),
112 "Failed to retrieve TopEventsLoose");
115 for (
auto x : *systEventsLoose) {
117 if (!executeNominal &&
m_config->isSystNominal(
m_config->systematicName(
x->hashValue())))
continue;
118 if (executeNominal && !
m_config->isSystNominal(
m_config->systematicName(
x->hashValue())))
continue;
124 return StatusCode::SUCCESS;
129 const bool forceUseLooseObjects,
130 const std::string& outputContainerSuffix) {
132 std::string passPreORSelection =
"passPreORSelection";
133 std::string jet_collection =
m_config->sgKeyJets();
134 jet_collection.erase(jet_collection.length() - 4);
136 const bool is_loose_event = (
event->isLooseEvent() == 1 ? true :
false);
139 bool looseLeptonOR(is_loose_event);
140 if (
m_config->doOverlapRemovalOnLooseLeptonDef() || (is_loose_event &&
m_config->useLooseObjectsInMETInLooseTree()) || (!is_loose_event &&
m_config->useLooseObjectsInMETInNominalTree()) || forceUseLooseObjects) {
141 looseLeptonOR =
true;
143 passPreORSelection =
"passPreORSelectionLoose";
146 const std::size_t
hash =
event->hashValue();
151 new_met_container->setStore(new_met_aux_container);
154 const std::string metAssocKey =
"METAssoc_" + jet_collection;
171 for (
const auto *
el: *xaod_el)
172 if (
el->isAvailable<
char>(passPreORSelection)
173 &&
el->auxdata<
char>(passPreORSelection) == 1) met_electrons.
push_back(
el);
181 "Failed to rebuild electron MET term");
192 for (
const auto *
photon: *xaod_photon)
193 if (
photon->isAvailable<
char>(passPreORSelection)
201 "Failed to rebuild photon MET term");
212 for (
const auto *tau: *xaod_tau)
213 if (tau->isAvailable<
char>(passPreORSelection)
214 && tau->auxdata<
char>(passPreORSelection) == 1) met_taus.
push_back(tau);
221 "Failed to rebuild tau MET term");
232 return StatusCode::FAILURE;
236 for (
const auto *
mu: *xaod_mu)
237 if (
mu->isAvailable<
char>(passPreORSelection)
238 &&
mu->auxdata<
char>(passPreORSelection) == 1) met_muons.
push_back(
mu);
246 "Failed to rebuild muon MET term");
260 "Failed to rebuild muon MET term");
274 "Failed to rebuild jet MET term");
279 if (systematic.hash() ==
event->hashValue() && systematic.hash() !=
m_config->nominalHashValue()) {
288 if (softClusMet !=
nullptr) {
294 if (softTrkMet !=
nullptr) {
306 "Failed to rebuild Final Track MET");
313 for (
auto mets : *new_met_container){
314 mets->auxdecor<
float>(
"metSigET") =
m_metSignif->GetMETOverSqrtSumET();
315 mets->auxdecor<
float>(
"metSigHT") =
m_metSignif->GetMETOverSqrtHT();
316 mets->auxdecor<
float>(
"metSig") =
m_metSignif->GetSignificance();
317 mets->auxdecor<
float>(
"metSigRho") =
m_metSignif->GetRho();
318 mets->auxdecor<
float>(
"metSigVarL") =
m_metSignif->GetVarL();
319 mets->auxdecor<
float>(
"metSigVarT") =
m_metSignif->GetVarT();
332 std::string outputSGKey =
m_config->sgKeyMissingEt(
hash);
333 if (is_loose_event) outputSGKey =
m_config->sgKeyMissingEtLoose(
hash);
335 outputSGKey+=outputContainerSuffix;
336 const std::string outputSGKeyAux = outputSGKey +
"Aux.";
339 StatusCode saveAux =
evtStore()->tds()->record(new_met_aux_container, outputSGKeyAux);
341 if (
save.isFailure() || saveAux.isFailure()) {
342 return StatusCode::FAILURE;
346 return StatusCode::SUCCESS;
354 for (
auto s : systList) {
356 if(!
m_config->getTreeFilter()->filterTree(
s.name()))
continue;
360 if (
s.name().find(
"SoftCalo") == std::string::npos) {
362 if (
s.name() ==
"") {
376 if (!
filter.filterTree(
s.name())) {