49 ATH_MSG_INFO(
"top::MuonCPTools: no need to initialise anything on truth DxAOD");
50 return StatusCode::SUCCESS;
54 ATH_MSG_INFO(
"top::MuonCPTools: no need to initialise anything since not using muons");
55 return StatusCode::SUCCESS;
64 return StatusCode::SUCCESS;
73 m_config->muonUse2stationMuonsHighPt());
78 m_config->muonUse2stationMuonsHighPtLoose());
84 m_config->muonUse2stationMuonsHighPt());
87 m_config->muonMuonDoExtraSmearingHighPt(),
88 m_config->muonMuonDoSmearing2stationHighPt());
98 return StatusCode::SUCCESS;
105 if (!
m_config->isMC())
return StatusCode::SUCCESS;
139 std::string muonQuality_name =
m_config->muonQuality();
140 if (
m_config->muonQuality() ==
"HighPt" && !(
m_config->muonUse2stationMuonsHighPt()) ) muonQuality_name =
"HighPt3Layers";
141 if (
m_config->muonQuality() ==
"LowPt" &&
m_config->muonUseMVALowPt()) muonQuality_name =
"LowPtMVA";
144 muonQuality_name,
false);
146 std::string muonQualityLoose_name =
m_config->muonQualityLoose();
147 if (
m_config->muonQualityLoose() ==
"HighPt" && !(
m_config->muonUse2stationMuonsHighPtLoose()) ) muonQualityLoose_name =
"HighPt3Layers";
148 if (
m_config->muonQualityLoose() ==
"LowPt" &&
m_config->muonUseMVALowPtLoose()) muonQualityLoose_name =
"LowPtMVA";
151 muonQualityLoose_name,
false);
153 if (
m_config->muonQuality() ==
"HighPt" ||
m_config->muonQualityLoose() ==
"HighPt") {
156 "BadMuonVeto_HighPt",
false);
160 std::string softmuonQuality_name =
m_config->softmuonQuality();
161 if (
m_config->softmuonQuality() ==
"LowPt" &&
m_config->softmuonUseMVALowPt()) softmuonQuality_name =
"LowPtMVA";
165 softmuonQuality_name,
false);
176 if (
m_config->muonIsolationSF() !=
"None") {
178 std::string muon_isolation =
m_config->muonIsolationSF() +
"Iso";
181 muon_isolation,
true);
185 if (
m_config->muonIsolationSFLoose() !=
"None") {
187 std::string muon_isolation =
m_config->muonIsolationSFLoose() +
"Iso";
190 muon_isolation,
true);
205 if ((
m_config->muonQuality() !=
"Loose" &&
m_config->muonIsolationSF() ==
"PromptLepton")
206 || (
m_config->muonQualityLoose() !=
"Loose" &&
m_config->muonIsolationSFLoose() ==
"PromptLepton")) {
208 "Cannot use PromptLeptonIsolation on muons without using Loose quality - Scale factors are not available");
209 return StatusCode::FAILURE;
212 return StatusCode::SUCCESS;
217 std::map<std::string, int> muon_quality_map = {
218 {
"Tight", 0}, {
"Medium", 1}, {
"Loose", 2}, {
"VeryLoose", 3}, {
"HighPt", 4}, {
"LowPt", 5}
222 qual_int = muon_quality_map.at(quality);
223 }
catch (
const std::out_of_range& oor_exc) {
225 + quality +
") for " +
name
226 +
". Valid options are: "
237 if (asg::ToolStore::contains<CP::IMuonSelectionTool>(
name)) {
238 tool = asg::ToolStore::get<CP::IMuonSelectionTool>(
name);
242 "Failed to set IsRun3Geo for " +
name);
244 "Failed to set MuQuality for " +
name);
246 "Failed to set MaxEta for " +
name);
248 "Failed to set UseMVALowPt for " +
name +
" tool");
249 top::check(asg::setProperty(
tool,
"Use2stationMuonsHighPt", use2stationMuonsHighPt),
250 "Failed to set Use2stationMuonsHighPt for " +
name +
" tool");
259 if (asg::ToolStore::contains<CP::IMuonTriggerScaleFactors>(
name)) {
260 tool = asg::ToolStore::get<CP::IMuonTriggerScaleFactors>(
name);
264 "Failed to set MuonQuality for " +
name);
266 "Failed to set AllowZeroSF for " +
name);
267 if (
m_config->muonSFCustomInputFolderTrigger() !=
" ") {
269 "Failed to set CustomInputFolder property for MuonTriggerScaleFactors tool");
271 if (
m_config->muonForcePeriod() !=
" ") {
273 "Failed to set forcePeriod property for MuonTriggerScaleFactors tool");
275 if (
m_config->muonForceYear() != -1) {
277 "Failed to set forceYear property for MuonTriggerScaleFactors tool");
287 if (asg::ToolStore::contains<CP::IMuonEfficiencyScaleFactors>(
name)) {
288 tool = asg::ToolStore::get<CP::MuonEfficiencyScaleFactors>(
name);
292 "Failed to set WP for " +
name +
" tool");
293 top::check(asg::setProperty(
tool,
"CloseJetDRDecorator",
"dRMuJet_AT_usingWeirdNameToAvoidUsingOnTheFlyCalculation"),
294 "Failed to set WP for " +
name +
" tool");
295 if (
m_config->muonSFCustomInputFolder() !=
" ") {
297 "Failed to set CustomInputFolder property for MuonEfficiencyScaleFactors tool");
301 top::check(asg::setProperty(
tool,
"CalibrationRelease",
"230309_Preliminary_r22run3"),
302 "Failed to set CalibrationRelease property for MuonEfficiencyScaleFactors tool");
305 "Failed to set BreakDownSystematics for " +
name +
" tool");
307 "Failed to set initialize " +
name);
316 if (asg::ToolStore::contains<CP::IMuonCalibrationAndSmearingTool>(
name)) {
317 tool = asg::ToolStore::get<CP::IMuonCalibrationAndSmearingTool>(
name);
321 top::check(asg::setProperty(
tool,
"doExtraSmearing", doExtraSmearingHighPt),
322 "Failed to set doExtraSmearing for " +
name +
" tool");
323 top::check(asg::setProperty(
tool,
"do2StationsHighPt", do2StationsHighPt),
324 "Failed to set do2StationsHighPt for " +
name +
" tool");
326 "Failed to set IsRun3Geo for " +
name +
" tool");
329 "Failed to set useRandomRunNumber for " +
name +
" tool");
333 top::check(asg::setProperty(
tool,
"release",
"Recs2022_08_16_Run3PreRecs"),
334 "Failed to set Run 2 release for " +
name +
" tool");
336 if (
m_config->muonCalibMode() ==
"correctData_CB")
337 top::check(asg::setProperty(
tool,
"calibMode", CP::MuonCalibTool::CalibMode::correctData_CB),
"Failed to set calibrationMode for " +
name +
" tool");
338 else if (
m_config->muonCalibMode() ==
"correctData_IDMS")
339 top::check(asg::setProperty(
tool,
"calibMode", CP::MuonCalibTool::CalibMode::correctData_IDMS),
"Failed to set calibrationMode for " +
name +
" tool");
340 else if (
m_config->muonCalibMode() ==
"notCorrectData_IDMS")
341 top::check(asg::setProperty(
tool,
"calibMode", CP::MuonCalibTool::CalibMode::notCorrectData_IDMS),
"Failed to set calibrationMode for " +
name +
" tool");
342 top::check(asg::setProperty(
tool,
"systematicScheme",
m_config->muonSmearingSystematicModel()),
"Failed to set systematicScheme for " +
name +
" tool");
344 "Failed to set initialize " +
name);