27 #include <boost/algorithm/string.hpp>
42 m_rc = std::unique_ptr<RCJet> (
new RCJet(
"RCJet"));
47 if (
m_config->useVarRCJets() ==
true) {
54 std::string
name =
rho + mass_scale;
57 top::check(
m_VarRC[
name]->setProperty(
"VarRCjets",
true),
"Failed to set VarRCjets property of VarRCJet");
59 rho),
"Failed to set VarRCjets rho property of VarRCJet");
62 "Failed to set VarRCjets mass scale property of VarRCJet");
68 return StatusCode::SUCCESS;
87 event.m_hashValue =
hash;
90 event.m_ttreeIndex = currentSystematic.
ttreeIndex();
97 event.m_systematicEvent = currentSystematicPtr;
100 if (
evtStore()->contains<xAOD::VertexContainer>(
m_config->sgKeyPrimaryVertices())) {
102 m_config->sgKeyPrimaryVertices()),
"Failed to retrieve Primary Vertices");
106 if (
m_config->saveBootstrapWeights()) {
109 second_seed =
event.m_info->mcChannelNumber();
111 second_seed =
event.m_info->runNumber();
114 event.m_info->eventNumber(),
116 event.m_info->auxdecor< std::vector<int> >(
"weight_poisson") = weight_poisson;
125 hash)),
"Failed to retrieve electrons");
135 top::check((
save && saveAux),
"Failed to store object in TStore");
141 hash)),
"Failed to retrieve electrons");
145 if (currentSystematic.
isAvailable< std::vector<unsigned int> >(
"overlapsEl")) {
146 std::vector<unsigned int> overlapsEl =
147 currentSystematic.
auxdataConst< std::vector<unsigned int> >(
"overlapsEl");
148 if (overlapsEl.size() == calibratedElectronsTDS->
size()) {
150 for (
auto x : *calibratedElectronsTDS) {
151 x->auxdecor<
char>(
"overlaps") = overlapsEl.at(
counter);
158 event.m_electrons.push_back(calibratedElectronsTDS->
at(
index));
170 hash)),
"Failed to retrieve fwd electrons");
176 *calibratedFwdElectrons);
182 top::check((
save && saveAux),
"Failed to store object in TStore");
188 hash)),
"Failed to retrieve fwd electrons");
191 event.m_fwdElectrons.push_back(calibratedFwdElectronsTDS->
at(
index));
214 top::check((
save && saveAux),
"Failed to store object in TStore");
220 hash)),
"Failed to retrieve photons");
223 event.m_photons.push_back(calibratedPhotonsTDS->
at(
index));
243 top::check((
save && saveAux),
"Failed to store object in TStore");
251 if (currentSystematic.
isAvailable< std::vector<unsigned int> >(
"overlapsMu")) {
252 std::vector<unsigned int> overlapsMu =
253 currentSystematic.
auxdataConst< std::vector<unsigned int> >(
"overlapsMu");
254 if (overlapsMu.size() == calibratedMuonsTDS->
size()) {
256 for (
auto x : *calibratedMuons) {
257 x->auxdecor<
char>(
"overlaps") = overlapsMu.at(
counter);
264 event.m_muons.push_back(calibratedMuonsTDS->
at(
index));
283 *calibratedSoftMuons);
288 top::check((
save && saveAux),
"Failed to store object in TStore");
294 hash)),
"Failed to retrieve soft muons");
299 event.m_softmuons.push_back(calibratedSoftMuonsTDS->
at(
index));
320 top::check((
save && saveAux),
"Failed to store object in TStore");
328 event.m_tauJets.push_back(calibratedTausTDS->
at(
index));
339 bool looseJets(
false);
340 if (
m_config->applyElectronInJetSubtraction()) {
348 std::string sgKeyCalibrated(
m_config->sgKeyJets(
hash, looseJets));
349 std::string sgKeyTmp =
"tmp_" + sgKeyCalibrated;
350 std::string sgKeyTmpAux = sgKeyTmp +
"Aux.";
363 top::check((
save && saveAux),
"Failed to store object in TStore");
369 looseJets)),
"Failed to retrieve taus");
379 " Can't find jet decoration \"JET_SF_jvt\" - we need it to calculate the jet scale-factors!");
380 if (
jet->auxdataConst<
float>(
"JET_SF_jvt") > 0) {
381 event.m_jvtSF *=
jet->auxdataConst<
float>(
"JET_SF_jvt");
385 if (
m_config->getfJVTWP() !=
"None") {
388 " Can't find jet decoration \"JET_SF_fjvt\" - we need it to calculate the forward jet scale-factors!");
389 event.m_fjvtSF *=
jet->auxdataConst<
float>(
"JET_SF_fjvt");
395 " Can't find jet decoration \"JET_SF_jvt_UP\" - we need it to calculate the jet scale-factors!");
396 event.m_jvtSF_UP *=
jet->auxdataConst<
float>(
"JET_SF_jvt_UP");
399 " Can't find jet decoration \"JET_SF_jvt_DOWN\" - we need it to calculate the jet scale-factors!");
400 event.m_jvtSF_DOWN *=
jet->auxdataConst<
float>(
"JET_SF_jvt_DOWN");
403 if (
m_config->getfJVTWP() !=
"None") {
406 " Can't find jet decoration \"JET_SF_fjvt_UP\" - we need it to calculate the forward jet scale-factors!");
407 event.m_fjvtSF_UP *=
jet->auxdataConst<
float>(
"JET_SF_fjvt_UP");
410 " Can't find jet decoration \"JET_SF_fjvt_DOWN\" - we need it to calculate the forward jet scale-factors!");
411 event.m_fjvtSF_DOWN *=
jet->auxdataConst<
float>(
"JET_SF_fjvt_DOWN");
418 " Can't find jet decoration \"passJVT\" - we need it to decide if we should keep the jet in the top::Event instance or not!");
421 top::check(
jet->isAvailable<
char>(
"AnalysisTop_fJVTdecision"),
422 " Can't find jet decoration \"AnalysisTop_fJVTdecision\" - we need it to decide if we should keep forward jets in the top::Event instance or not!");
423 passfJVT =
jet->auxdataConst<
char>(
"AnalysisTop_fJVTdecision");
424 if (
m_config->saveFailForwardJVTJets()) {
425 if (!passfJVT)
event.m_failFJvt_jets.push_back(calibratedJetsTDS->
at(
index));
428 if (
m_config->getfJVTWP() ==
"None") passfJVT =
true;
431 if (
jet->auxdataConst<
char>(
"passJVT") && passfJVT)
event.m_jets.push_back(calibratedJetsTDS->
at(
index));
433 if (!
jet->auxdataConst<
char>(
"passJVT"))
event.m_failJvt_jets.push_back(calibratedJetsTDS->
at(
index));
449 std::string rcJetContainerName =
m_rc->rcjetContainerName(
event.m_hashValue,
event.m_isLoose);
453 for (
auto rcjet : *rc_jets) {
456 " Can't find jet decoration \"PassedSelection\" - we need it to decide if we should keep the reclustered jet in the top::Event instance or not!");
457 if (rcjet->auxdataConst<
bool>(
"PassedSelection"))
event.m_RCJets.push_back((
xAOD::Jet*) rcjet);
465 std::string
name =
rho + mass_scale;
469 std::string varRCJetContainerName =
m_VarRC[
name]->rcjetContainerName(
event.m_hashValue,
event.m_isLoose);
476 for (
auto vrcjet : *vrc_jets) {
479 " Can't find jet decoration \"PassedSelection\" - we need it to decide if we should keep the variable-R reclustered jet in the top::Event instance or not!");
480 if (vrcjet->auxdataConst<
bool>(
"PassedSelection"))
event.m_VarRCJets[
name]->push_back((
xAOD::Jet*) vrcjet);
492 "Failed to retrieve largeR jets");
502 top::check((
save && saveAux),
"Failed to store object in TStore");
508 hash)),
"Failed to retrieve largeR jets");
511 event.m_largeJets.push_back(calibratedJetsTDS->
at(
index));
533 top::check((
save && saveAux),
"Failed to store object in TStore");
539 hash)),
"Failed to retrieve track jets");
543 event.m_trackJets.push_back(calibratedJetsTDS->
at(
index));
560 std::pair< xAOD::TrackParticleContainer*, xAOD::ShallowAuxContainer* > shallow_tracks =
xAOD::shallowCopyContainer(*calibratedTracks);
565 top::check((
save && saveAux),
"Failed to store object in TStore");
573 event.m_tracks.push_back(calibratedTracksTDS->
at(
index));
591 event.m_met = (*mets)[
"FinalTrk"];
596 if (
m_config->useTruthParticles()) {
598 m_config->sgKeyMCParticle()),
"Failed to retrieve truth particles");
604 if (!hasTruthEvent) {
605 ATH_MSG_WARNING(
"Failed to retrieve truth Event. TopEvent::m_truthEvent will be nullptr!");
611 if (
m_config->doTopPartonHistory()) {
612 if (
evtStore()->contains<xAOD::PartonHistoryContainer>(
m_config->sgKeyTopPartonHistory())) {
615 m_config->sgKeyTopPartonHistory()),
"Failed to retrieve Top Parton History");
616 if (partonHistory->
size() == 1) {
617 event.m_partonHistory = partonHistory->
at(0);
640 jet->auxdecor<
int>(
"AT_SoftMuonIndex")=-1;
641 jet->auxdecor<
float>(
"AT_SoftMuonDR")=-1;
649 int nearestJetIndex=-1;
654 if(
dr<dRmin && dr<m_config->softmuonDRJetcut())
657 nearestJetIndex=ijet;
661 sm->
auxdecor<
int>(
"AT_SMTJetIndex")=nearestJetIndex;
662 sm->
auxdecor<
float>(
"AT_SMTJetDR")=dRmin;
664 if(nearestJetIndex>=0)
667 if(
jet->auxdecor<
int>(
"AT_SoftMuonIndex")<0)
669 jet->auxdecor<
int>(
"AT_SoftMuonIndex")=imuon;
670 jet->auxdecor<
float>(
"AT_SoftMuonDR")=dRmin;