From f1e0dc00f639a258af365f01904e4452ef9b64d2 Mon Sep 17 00:00:00 2001 From: Tomas Dado Date: Wed, 13 Apr 2022 11:33:40 +0200 Subject: [PATCH] AnalysisTop: Rename muon related settings and add an option to set electron trigger string --- .../xAOD/TopCPTools/Root/TopEgammaCPTools.cxx | 14 ++++---- .../xAOD/TopCPTools/Root/TopMuonCPTools.cxx | 8 ++--- .../TopCPTools/Root/TopTriggerCPTools.cxx | 8 ++--- .../Root/ConfigurationSettings.cxx | 9 ++++-- .../xAOD/TopConfiguration/Root/TopConfig.cxx | 23 +++++++------ .../TopConfiguration/TopConfig.h | 32 ++++++++++++------- .../Root/MuonScaleFactorCalculator.cxx | 4 +-- 7 files changed, 58 insertions(+), 40 deletions(-) diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx index 9c20c007f0f..2b5f544dc24 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx @@ -328,13 +328,15 @@ namespace top { } // Define the trigger string for scale factors - const std::string trigger_string = "SINGLE_E_2015_e24_lhmedium_L1EM20VH_" - "OR_e60_lhmedium_" - "OR_e120_lhloose_" - "2016_2018_e26_lhtight_nod0_ivarloose_" - "OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"; - + std::string trigger_string = "SINGLE_E_2015_e24_lhmedium_L1EM20VH_" + "OR_e60_lhmedium_" + "OR_e120_lhloose_" + "2016_2018_e26_lhtight_nod0_ivarloose_" + "OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"; + if (m_config->electronForceTrigger() != " " ) { + trigger_string = m_config->electronForceTrigger(); + } // Define the tool prefix name const std::string elSFPrefix = "AsgElectronEfficiencyCorrectionTool_"; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx index 620e88c8ab5..aea8caf9cb9 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx @@ -266,12 +266,12 @@ namespace top { top::check(asg::setProperty(tool, "CustomInputFolder", m_config->muonSFCustomInputFolder()), "Failed to set CustomInputFolder property for MuonTriggerScaleFactors tool"); } - if (m_config->forcePeriod() != " ") { - top::check(asg::setProperty(tool, "forcePeriod", m_config->forcePeriod()), + if (m_config->muonForcePeriod() != " ") { + top::check(asg::setProperty(tool, "forcePeriod", m_config->muonForcePeriod()), "Failed to set forcePeriod property for MuonTriggerScaleFactors tool"); } - if (m_config->forceYear() != -1) { - top::check(asg::setProperty(tool, "forceYear", m_config->forceYear()), + if (m_config->muonForceYear() != -1) { + top::check(asg::setProperty(tool, "forceYear", m_config->muonForceYear()), "Failed to set forceYear property for MuonTriggerScaleFactors tool"); } top::check(tool->initialize(), "Failed to init. " + name); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx index 48cc5d407cb..3bcd3bba30a 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopTriggerCPTools.cxx @@ -313,13 +313,13 @@ namespace top { if (m_config->muonSFCustomInputFolder() != " ") { top::check(m_muonTool.setProperty("CustomInputFolder", m_config->muonSFCustomInputFolder()), "Failed to set CustomInputFolder property for MuonTriggerScaleFactors tool"); } - if (m_config->forcePeriod() != " ") { - top::check(m_muonTool.setProperty("forcePeriod", m_config->forcePeriod()), "Failed to set forcePeriod property for MuonTriggerScaleFactors tool"); + if (m_config->muonForcePeriod() != " ") { + top::check(m_muonTool.setProperty("forcePeriod", m_config->muonForcePeriod()), "Failed to set forcePeriod property for MuonTriggerScaleFactors tool"); } else{ top::check(m_muonTool.setProperty("forcePeriod", ""), "Failed to set forcePeriod property for MuonTriggerScaleFactors tool"); } - if (m_config->forceYear() != -1) { - top::check(m_muonTool.setProperty("forceYear", m_config->forceYear()), "Failed to set forceYear property for MuonTriggerScaleFactors tool"); + if (m_config->muonForceYear() != -1) { + top::check(m_muonTool.setProperty("forceYear", m_config->muonForceYear()), "Failed to set forceYear property for MuonTriggerScaleFactors tool"); } top::check(m_muonTool.initialize(), "Failed to initialise"); muonTools.push_back(m_muonTool.getHandle()); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx index 21667b35829..4377221b9b3 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx @@ -177,19 +177,22 @@ namespace top { registerParameter("MuonSFCustomInputFolder", "EXPERT OPTION! Tells the MuonEfficiencyScaleFactors tools to use a custom input folder path. If set to \" \" will use the default", " "); - registerParameter("forceYear", + registerParameter("MuonForceYear", "EXPERT OPTION! Tells the MuonEfficiencyScaleFactors tools to use a custom Year. If set to -1 will use the default", "-1"); - registerParameter("forcePeriod", + registerParameter("MuonForcePeriod", "EXPERT OPTION! Tells the MuonEfficiencyScaleFactors tools to use a custom Period. If set to \" \" will use the default", " "); - registerParameter("forceTrigger", + registerParameter("MuonForceTrigger", "EXPERT OPTION! Tells the MuonEfficiencyScaleFactors tools to use a custom Trigger. If set to \" \" will use the default", " "); registerParameter("MuonBreakDownSystematics", "Tells the MuonEfficiencyScaleFactors tools to use a more complex systematic model, if set to True. Default is False", "False", {"True", "False"}); + registerParameter("ElectronForceTrigger", + "EXPERT OPTION! Tells the tools to use a custom electron Trigger. If set to \" \" will use the default", + " "); registerParameter("JetPt", "Jet pT cut for object selection (in MeV). Default 25 GeV.", "25000."); registerParameter("JetEta", "Absolute Jet eta cut for object selection. Default 2.5.", "2.5"); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx index 9608c89624e..84fa76b15d3 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx @@ -241,9 +241,10 @@ namespace top { m_muonMuonDoExtraSmearingHighPt(false), m_muonBreakDownSystematics(false), m_muonSFCustomInputFolder(" "), - m_forcePeriod(" "), - m_forceYear(-1), - m_forceTrigger(" "), + m_muonForcePeriod(" "), + m_muonForceYear(-1), + m_muonForceTrigger(" "), + m_electronForceTrigger(" "), // Soft Muon configuration m_softmuonPtcut(4000.), @@ -1272,18 +1273,22 @@ namespace top { this->muonSFCustomInputFolder(customMuonSF); } { - int customforceYear = std::stoi(settings->value("forceYear")); - this->forceYear(customforceYear); + int customMuonForceYear = std::stoi(settings->value("MuonForceYear")); + this->muonForceYear(customMuonForceYear); } { - std::string const& customforcePeriod = settings->value("forcePeriod"); - this->forcePeriod(customforcePeriod); + std::string const& customMuonForcePeriod = settings->value("MuonForcePeriod"); + this->muonForcePeriod(customMuonForcePeriod); } { - std::string const& customforceTrigger = settings->value("forceTrigger"); - this->forceTrigger(customforceTrigger); + std::string const& customMuonForceTrigger = settings->value("MuonForceTrigger"); + this->muonForceTrigger(customMuonForceTrigger); } if (settings->value("UseAntiMuons") == "True") this->m_useAntiMuons = true; + { + std::string const& customElectronForceTrigger = settings->value("ElectronForceTrigger"); + this->electronForceTrigger(customElectronForceTrigger); + } // Soft Muon configuration this->softmuonPtcut(readFloatOption(settings, "SoftMuonPt")); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h index 8976d53e070..51354652b53 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h @@ -1105,22 +1105,29 @@ namespace top { m_muonSFCustomInputFolder = s; } } - int forceYear() const {return m_forceYear;} - void forceYear(int s) { + int muonForceYear() const {return m_muonForceYear;} + void muonForceYear(int s) { if (!m_configFixed) { - m_forceYear = s; + m_muonForceYear = s; } } - std::string const& forcePeriod() const {return m_forcePeriod;} - void forcePeriod(const std::string& s) { + std::string const& muonForcePeriod() const {return m_muonForcePeriod;} + void muonForcePeriod(const std::string& s) { if (!m_configFixed) { - m_forcePeriod = s; + m_muonForcePeriod = s; } } - std::string const& forceTrigger() const {return m_forceTrigger;} - void forceTrigger(const std::string& s) { + std::string const& muonForceTrigger() const {return m_muonForceTrigger;} + void muonForceTrigger(const std::string& s) { if (!m_configFixed) { - m_forceTrigger = s; + m_muonForceTrigger = s; + } + } + + std::string const& electronForceTrigger() const {return m_electronForceTrigger;} + void electronForceTrigger(const std::string& s) { + if (!m_configFixed) { + m_electronForceTrigger = s; } } @@ -2419,9 +2426,10 @@ namespace top { bool m_muonMuonDoExtraSmearingHighPt; //to turn on/off a special correction for the muon with high momenta. bool m_muonBreakDownSystematics; //to turn on/off a more complex systematic model std::string m_muonSFCustomInputFolder; - std::string m_forcePeriod; - int m_forceYear; - std::string m_forceTrigger; + std::string m_muonForcePeriod; + int m_muonForceYear; + std::string m_muonForceTrigger; + std::string m_electronForceTrigger; //Soft muon configuration float m_softmuonPtcut; // soft muon object selection pT cut diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx index 65f86868d67..6bc46bb8265 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx @@ -278,8 +278,8 @@ namespace top { m_muon_trigger_sf_config = "HLT_mu26_ivarmedium_OR_HLT_mu50"; } - if (m_config->forceTrigger() != " "){ - m_muon_trigger_sf_config = m_config->forceTrigger(); + if (m_config->muonForceTrigger() != " "){ + m_muon_trigger_sf_config = m_config->muonForceTrigger(); } ATH_MSG_DEBUG("Muon trigger scale factor config is : " + m_muon_trigger_sf_config); -- GitLab