33 ATH_MSG_INFO(
"top::FlavorTaggingCPTools: no need to initialise anything on truth DxAOD");
34 return StatusCode::SUCCESS;
38 ATH_MSG_INFO(
"top::FlavorTaggingCPTools: no need to initialise anything since not using jets");
39 return StatusCode::SUCCESS;
43 static const std::string cdi_file_default_MC20 =
44 "xAODBTaggingEfficiency/13TeV/2023-22-13TeV-MC20-CDI-2023-09-13_v1.root ";
45 static const std::string cdi_file_default_MC21 =
46 "xAODBTaggingEfficiency/13p6TeV/2023-22-13TeV-MC21-CDI-2023-09-13_v1.root";
48 if (
m_config->bTaggingCDIPath() !=
"Default") {
50 if (
m_config->bTaggingCDIPath() != cdi_file_default_MC21) {
51 m_config->setPrintCDIpathWarning(
true);
55 if (
m_config->bTaggingCDIPath() != cdi_file_default_MC20) {
56 m_config->setPrintCDIpathWarning(
true);
74 m_efficiency_maps =
"default;default;410470;410250;default;410464;411233;default;700122;600666;700660;412116";
77 m_efficiency_maps =
"default;default;601229;doesnotexist;doesnotexist;doesnotexist;601414;doesnotexist;doesnotexist;doesnotexist;700660;doesnotexist";
80 const std::string caloJets_collection =
m_config->sgKeyJets();
81 const std::string trackJets_collection =
m_config->sgKeyTrackJets();
92 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP()) {
94 "Failed to initialize btag selection tool");
96 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP_calib()) {
98 "Failed to initialize btag selection tool");
102 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP_trkJet()) {
104 "Failed to initialize btag selection tool");
106 for (
const auto& TaggerBtagWP :
m_config->bTagAlgoWP_calib_trkJet()) {
108 "Failed to initialize btag selection tool");
112 return StatusCode::SUCCESS;
116 const std::string& jetCollection,
117 double jetPtCut,
double jetEtaCut,
119 const std::string bTagWPName = btag_algo_WP.first +
"_" + btag_algo_WP.second;
123 std::string btagsel_tool_name =
"BTaggingSelectionTool_" + bTagWPName +
"_" + jetCollection;
125 const std::string jetAuthor = (trackJets ?
erasePV0fromJetsName(jetCollection) : jetCollection);
128 top::check(btagsel->setProperty(
"TaggerName", btag_algo_WP.first),
129 "Failed to set b-tagging selecton tool TaggerName");
130 top::check(btagsel->setProperty(
"JetAuthor", jetAuthor),
131 "Failed to set b-tagging selection JetAuthor");
133 "Failed to set b-tagging selection tool CDI file");
134 top::check(btagsel->setProperty(
"OperatingPoint", btag_algo_WP.second),
135 "Failed to set b-tagging selection tool OperatingPoint");
136 top::check(btagsel->setProperty(
"MinPt", jetPtCut),
137 "Failed to set b-tagging selection tool MinPt");
138 top::check(btagsel->setProperty(
"MaxEta", jetEtaCut),
139 "Failed to set b-tagging selection tool MaxEta");
141 "Failed to initialize b-tagging selection tool: " + btagsel_tool_name);
146 m_config->addBTagAlgo(btag_algo_WP.first, btagsel_tool_name, trackJets);
148 return StatusCode::SUCCESS;
152 const std::string& jetCollection,
155 const std::string bTagWPName = btag_algo_WP.first +
"_" + btag_algo_WP.second;
156 std::string btageff_tool_name =
"BTaggingEfficiencyTool_" + bTagWPName +
"_" + jetCollection;
158 const std::string jetAuthor = (trackJets ?
erasePV0fromJetsName(jetCollection) : jetCollection);
161 top::check(btageff->setProperty(
"TaggerName", btag_algo_WP.first),
162 "Failed to set b-tagging TaggerName");
163 top::check(btageff->setProperty(
"OperatingPoint", btag_algo_WP.second),
164 "Failed to set b-tagging OperatingPoint");
165 top::check(btageff->setProperty(
"JetAuthor", jetAuthor),
166 "Failed to set b-tagging JetAuthor");
167 top::check(btageff->setProperty(
"MinPt", jetPtCut),
168 "Failed to set b-tagging selection tool MinPt");
170 "Failed to set path to b-tagging CDI file");
172 "Failed to set path to b-tagging CDI file");
173 top::check(btageff->setProperty(
"ScaleFactorBCalibration",
m_config->bTaggingCalibration_B()),
174 "Failed to set b-tagging calibration (B): " +
m_config->bTaggingCalibration_B());
175 top::check(btageff->setProperty(
"ScaleFactorCCalibration",
m_config->bTaggingCalibration_C()),
176 "Failed to set b-tagging calibration (C): " +
m_config->bTaggingCalibration_C());
178 top::check(btageff->setProperty(
"ScaleFactorTCalibration",
m_config->bTaggingCalibration_C()),
179 "Failed to set b-tagging calibration (T): " +
m_config->bTaggingCalibration_C());
180 top::check(btageff->setProperty(
"ScaleFactorLightCalibration",
m_config->bTaggingCalibration_Light()),
181 "Failed to set b-tagging calibration (Light): " +
m_config->bTaggingCalibration_Light());
186 "Failed to set " + jet_flav +
"-calibrations efficiency maps");
189 "Failed to set b-tagging systematics to exclude from EV treatment");
196 return StatusCode::SUCCESS;
200 const std::string pv0 =
"PV0";
211 if (excludedSysts ==
"")
return StatusCode::SUCCESS;
214 std::vector<std::string> listOfExcludedSysts;
216 ATH_MSG_INFO(
" ------------------------------------------------ ");
217 ATH_MSG_INFO(
" ------------- EXPERIMENTAL FEATURE ------------- ");
218 ATH_MSG_INFO(
" ------ Please provide feedback to TopReco ------ ");
219 ATH_MSG_INFO(
" ------------- EXPERIMENTAL FEATURE ------------- ");
220 ATH_MSG_INFO(
" ------------------------------------------------ ");
221 ATH_MSG_INFO(
" AnalysisTop - Checking excludedSysts for flavour tagging EV");
222 ATH_MSG_INFO(
" This has been split on the semi-colon delimiter to find...");
223 for (
const auto&
s : listOfExcludedSysts)
ATH_MSG_INFO(
"... " +
s);
226 std::vector<std::string> listOfScaleFactorSystematics;
228 for (
auto sys : flavour.second) {
229 listOfScaleFactorSystematics.push_back(
sys);
234 std::set<std::string> setOfExcludedSysts, setOfScaleFactorSystematics;
236 for (
auto sys : listOfExcludedSysts) {
237 setOfExcludedSysts.insert(
sys);
240 for (
auto sys : listOfScaleFactorSystematics) {
241 setOfScaleFactorSystematics.insert(
sys);
245 std::vector<std::string> unionOfSystematics;
247 setOfScaleFactorSystematics.begin(), setOfScaleFactorSystematics.end(),
248 std::back_inserter(unionOfSystematics));
250 if (unionOfSystematics.size() != listOfExcludedSysts.size()) {
251 ATH_MSG_WARNING(
"Have not found all systematics listed to be excluded from b-tagging eigenvector method");
253 for (
const auto&
sys : setOfScaleFactorSystematics) {
256 return StatusCode::FAILURE;
259 for (
const auto& sysRemove : listOfExcludedSysts) {
260 std::string flavourAffected =
"";
262 for (
auto sysCDI : flavour.second) {
263 if (sysRemove == sysCDI) flavourAffected += flavour.first;
266 ATH_MSG_INFO(
" ... " + sysRemove +
" -> Removed from calibration(s) : [" + flavourAffected +
"]");
268 ATH_MSG_INFO(
" These will be dynamically matched to systematic tree names (if available)");
269 ATH_MSG_INFO(
" All systematics are accepted by CDI file ");
273 ATH_MSG_INFO(
" ------------------------------------------------ ");
274 return StatusCode::SUCCESS;