37 m_specifiedSystematics(),
38 m_recommendedSystematics(),
39 m_nominalSystematicSet(),
48 ATH_MSG_INFO(
" top::GhostTrackSystematicsMaker initialize");
50 ATH_MSG_WARNING(
"Usage of ghost tracks in AnalysisTop is purely EXPERIMENTAL!\n");
59 "Failed to retrieve the ghost track CP tools");
63 const std:: string& syststr =
m_config->systematics();
65 if (
m_config->isSystNominal(syststr)) {
67 }
else if (
m_config->isSystAll(syststr)) {
70 std::set<std::string> syst;
71 bool ok =
m_config->getSystematicsList(syststr, syst);
73 ATH_MSG_ERROR(
" top::GhostTrackSystematicsMaker could not determine systematic list");
74 return StatusCode::FAILURE;
89 " top::GhostTrackSystematicsMaker: Systematic variations of ghost tracks will be done only for jets with pt >= " <<
m_jetPtCut <<
" MeV and eta <= " <<
m_jetEtaCut <<
92 ATH_MSG_INFO(
" top::GhostTrackSystematicsMaker completed initialize");
93 return StatusCode::SUCCESS;
100 static int warningCounter=0;
107 const auto& ghostTracks =
109 std::vector<const xAOD::IParticle*> newGhosts;
111 for (std::size_t iGhost = 0; iGhost < ghostTracks.size(); ++iGhost) {
112 if (ghostTracks[iGhost] ==
nullptr)
continue;
115 newGhosts.push_back(ghostTracks[iGhost]);
118 if (newGhosts.size() == 0 && warningCounter<
warningLimit) {
120 "in GhostTrackSystematicsMaker: All ghost tracks are null pointers. There may be something wrong with your configuration or derivation. Jet pt: " <<
jet->pt() <<
" Jet eta: " <<
129 return StatusCode::SUCCESS;
137 "Failed to configure tool for systematic variation");
142 const auto& ghostTracks =
144 std::vector<const xAOD::IParticle*> newGhosts;
146 for (std::size_t iGhost = 0; iGhost < ghostTracks.size(); ++iGhost) {
147 if (ghostTracks[iGhost] ==
nullptr)
continue;
152 top::check(
tp,
"Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track");
159 newGhosts.push_back(ghostTracks[iGhost]);
162 jet->setAssociatedObjects(
m_config->decoKeyJetGhostTrack(syst.
hash()), newGhosts);
165 return StatusCode::SUCCESS;
173 "Failed to configure tool for systematic variation");
179 std::vector<const xAOD::IParticle*> newGhosts;
182 for (std::size_t iGhost = 0; iGhost < ghostTracks.size(); ++iGhost) {
183 if (ghostTracks[iGhost] ==
nullptr)
continue;
188 top::check(
tp,
"Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track");
195 newGhosts.push_back(ghostTracks[iGhost]);
198 jet->setAssociatedObjects(
m_config->decoKeyJetGhostTrack(syst.
hash()), newGhosts);
201 return StatusCode::SUCCESS;
209 "Failed to configure tool for systematic variation");
211 const std::string sgKey {
213 "_Particles_" + syst.
name()
215 const std::string sgKeyAux {
223 "Failed to record systematically varied track particle container");
226 "Failed to record systematically varied track particle container");
227 newTrackParticles->setStore(newTrackParticlesAux);
233 std::vector<const xAOD::IParticle*> newGhosts;
235 for (std::size_t iGhost = 0; iGhost < ghostTracks.size(); ++iGhost) {
236 if (ghostTracks[iGhost] ==
nullptr)
continue;
242 top::check(
tp,
"Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track");
248 "Failure to apply ghost track systematic");
249 top::check(newTp,
"Systematically varied xAOD::TrackParticle is nullptr");
252 newGhosts.push_back(newTp);
255 jet->setAssociatedObjects(
m_config->decoKeyJetGhostTrack(syst.
hash()), newGhosts);
258 return StatusCode::SUCCESS;
266 "Failed to configure tool for systematic variation");
268 const std::string sgKey {
270 "_Particles_" + syst.
name()
272 const std::string sgKeyAux {
280 "Failed to record systematically varied track particle container");
283 "Failed to record systematically varied track particle container");
284 newTrackParticles->setStore(newTrackParticlesAux);
290 std::vector<const xAOD::IParticle*> newGhosts;
292 for (std::size_t iGhost = 0; iGhost < ghostTracks.size(); ++iGhost) {
293 if (ghostTracks[iGhost] ==
nullptr)
continue;
299 top::check(
tp,
"Failed to convert xAOD::IParticle to xAOD::TrackParticle for ghost track");
305 "Failure to apply ghost track systematic");
306 top::check(newTp,
"Systematically varied xAOD::TrackParticle is nullptr");
309 newGhosts.push_back(newTp);
312 jet->setAssociatedObjects(
m_config->decoKeyJetGhostTrack(syst.
hash()), newGhosts);
315 return StatusCode::SUCCESS;
326 "Failed to retrieve Jets");
330 "Failure to apply GhostTrackSystematic");
335 return StatusCode::SUCCESS;
339 if (executeNominal)
return StatusCode::SUCCESS;
343 for (
const auto& syst :
m_systs.smearing) {
345 "Failure to apply GhostTrackSystematic");
353 biasingTool = &(*
m_tools.bias[0]);
355 top::check(biasingTool,
"Failure to selected biasing tool");
356 for (
const auto& syst :
m_systs.bias) {
358 "Failure to apply GhostTrackSystematic");
365 "Failure to retrieve EventInfo");
367 top::check(ei->isAvailable<
unsigned int>(
"RandomRunNumber"),
368 "Require that RandomRunNumber decoration is available.");
369 auto randomRunNumber = ei->auxdataConst<
unsigned int>(
"RandomRunNumber");
371 if (randomRunNumber == 0) {
372 for (
const auto& syst :
m_systs.bias) {
374 "Failure to apply GhostTrackSystematic");
378 "RandomRunNumber is below valid range.");
380 "RandomRunNumber is above valid range.");
384 biasingTool = &(*
m_tools.bias[
i - 1]);
388 top::check(biasingTool,
"Failure to selected biasing tool");
389 for (
const auto& syst :
m_systs.bias) {
391 "Failure to apply GhostTrackSystematic");
397 for (
const auto& syst :
m_systs.truthFilter) {
399 "Failure to apply GhostTrackSystematic");
403 for (
const auto& syst :
m_systs.jetTrackFilter) {
405 "Failure to apply GhostTrackSystematic");
408 ATH_MSG_DEBUG(
" top::GhostTrackSystematicsMaker completed execute");
409 return StatusCode::SUCCESS;
416 const bool allGhostTrackSystematics =
m_config->contains(specSys,
424 std::set<CP::SystematicSet> systs;
441 systs.insert(
m_systs.truthFilter.begin(),
m_systs.truthFilter.end());
446 systs.insert(
m_systs.jetTrackFilter.begin(),
m_systs.jetTrackFilter.end());
449 for (
const auto&
s : systs) {
451 if (
s.name() ==
"") {
455 if(!
m_config->getTreeFilter()->filterTree(
s.name()))
continue;
462 if (allGhostTrackSystematics) {
467 for (
const auto&
i : specSys) {
469 if (!
filter.filterTree(
s.name())) {
494 "Sanity check failed");
500 std::string smearingToolName {
501 "top::GhostTrackCPTools::InDetTrackSmearingTool"
503 if (asg::ToolStore::contains<InDet::InDetTrackSmearingTool>(smearingToolName)) {
505 asg::ToolStore::get<InDet::InDetTrackSmearingTool>(smearingToolName);
507 ATH_MSG_ERROR(
" Impossible to retrieve " + smearingToolName);
508 return StatusCode::FAILURE;
511 std::string biasToolPrefix {
512 "top::GhostTrackCPTools::InDetTrackBiasingTool"
520 unsigned int end = 0;
528 for (
unsigned int i = 0;
i <
end;
i++) {
529 std::string biasToolName {
538 if (asg::ToolStore::contains<InDet::InDetTrackBiasingTool>(biasToolName)) {
539 m_tools.bias[
i] = asg::ToolStore::get<InDet::InDetTrackBiasingTool>(biasToolName);
542 return StatusCode::FAILURE;
546 std::string truthOriginToolName {
547 "top::GhostTrackCPTools::InDetTrackTruthOriginTool"
549 if (asg::ToolStore::contains<InDet::InDetTrackTruthOriginTool>(truthOriginToolName)) {
550 m_tools.truthOrigin = asg::ToolStore::get<InDet::InDetTrackTruthOriginTool>(truthOriginToolName);
552 ATH_MSG_ERROR(
" Impossible to retrieve " + truthOriginToolName);
553 return StatusCode::FAILURE;
556 std::string truthFilterToolName {
557 "top::GhostTrackCPTools::InDetTrackTruthFilterTool"
559 if (asg::ToolStore::contains<InDet::InDetTrackTruthFilterTool>(truthFilterToolName)) {
560 m_tools.truthFilter = asg::ToolStore::get<InDet::InDetTrackTruthFilterTool>(truthFilterToolName);
562 ATH_MSG_ERROR(
" Impossible to retrieve " + truthFilterToolName);
563 return StatusCode::FAILURE;
566 std::string jetTrackFilterToolName {
567 "top::GhostTrackCPTools::JetTrackFilterTool"
569 if (asg::ToolStore::contains<InDet::JetTrackFilterTool>(jetTrackFilterToolName)) {
570 m_tools.jetTrackFilter = asg::ToolStore::get<InDet::JetTrackFilterTool>(jetTrackFilterToolName);
572 ATH_MSG_ERROR(
" Impossible to retrieve " + jetTrackFilterToolName);
573 return StatusCode::FAILURE;
576 return StatusCode::SUCCESS;