ATLAS Offline Software
TopCorrectionsTools.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include <iostream>
7 
9 using namespace TopCorrections;
10 
11 namespace top {
12  // B-tagging naming tool
13  std::string bTagNamedSystCheck(std::shared_ptr<top::TopConfig> config,
14  const std::string& systCollection,
15  const std::string& tagWP,
16  const bool isTrackJet,
17  const bool verbose = false) {
18  // TODO -- to be reworked to use new message level settings to be implemented
19  if (verbose) ATH_MSG_INFO("Searching for " << systCollection << " for WP " << tagWP);
20  if (isTrackJet) {
21  for (const std::string& name : config->trkjet_btagging_namedSysts(tagWP)) {
22  if (verbose) ATH_MSG_INFO("...Possible matches : ");
23  if (systCollection.find(betterBtagNamedSyst(name)) != std::string::npos) {
24  if (verbose) ATH_MSG_INFO("......Matched!");
25  if (systCollection.find("up") != std::string::npos) return name + "__1up";
26  else if (systCollection.find("down") != std::string::npos) return name + "__1down";
27  else return name;
28  }
29  }
30  } else {
31  for (const std::string& name : config->btagging_namedSysts(tagWP)) {
32  if (verbose) ATH_MSG_INFO("...Possible matches : ");
33  if (systCollection.find(betterBtagNamedSyst(name)) != std::string::npos) {
34  if (verbose) ATH_MSG_INFO("......Matched!");
35  if (systCollection.find("up") != std::string::npos) return name + "__1up";
36  else if (systCollection.find("down") != std::string::npos) return name + "__1down";
37  else return name;
38  }
39  }
40  }
41  return "";
42  }
43 
44  // B-tagging naming tool
45  std::string betterBtagNamedSyst(const std::string& name) {
46  // remove "FT_EFF_", spaces, and "-" in named systematics
47  std::string str = "FT_EFF_";
48  std::string out = name;
49  if (out.find(str) != std::string::npos) {
50  out.replace(out.find(str), str.length(), "");
51  }
52  str = " ";
53  while (out.find(str) != std::string::npos) {
54  out.replace(out.find(str), str.length(), "_");
55  }
56  str = "-";
57  while (out.find(str) != std::string::npos) {
58  out.replace(out.find(str), str.length(), "_");
59  }
60  return out;
61  }
62 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
top::betterBtagNamedSyst
std::string betterBtagNamedSyst(const std::string &name)
Definition: TopCorrectionsTools.cxx:45
top::bTagNamedSystCheck
std::string bTagNamedSystCheck(std::shared_ptr< top::TopConfig > config, const std::string &systCollection, const std::string &tagWP, const bool isTrackJet, const bool verbose=false)
Definition: TopCorrectionsTools.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TopCorrectionsTools.h
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
str
Definition: BTagTrackIpAccessor.cxx:11
MsgCategory.h