diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx index 900e6dee5d63b2b8c7fb0cfebf3180d65e5f898c..6059974dd64dbc52020422b09f99c045c57fa762 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/ObjectLoaderStandardCuts.cxx @@ -76,7 +76,8 @@ namespace top { new top::StandardIsolation( topConfig->electronIsolation() , topConfig->electronIsolationLoose() ), - topConfig->applyTTVACut() + topConfig->applyTTVACut(), + topConfig->useElectronChargeIDSelection() ) ); } else { diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx index b9d6b0aff989b82951941faaa559b1cd0523e270..252a650f0017e35a4bb4acc4c2ed2499391f4c9d 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx @@ -267,7 +267,7 @@ StatusCode EgammaCPTools::setupScaleFactors() { // Charge ID cannot use maps at the moment so we defualt to the old method // for the moment only for MediumLH and FixedCutTight isolation // either at Tight or Loose level - if ( ( electronIDLoose == "MediumLLH" && electronIsolationLoose == "FixedCutTight" ) || ( electronID == "MediumLLH" && electronIsolation == "FixedCutTight" ) ) { + if(m_config->useElectronChargeIDSelection()){ // We need to update the implementation according to new recommendations // Charge ID file (no maps) m_electronEffSFChargeIDFile = electronSFFilePath("ChargeID", "MediumLLH"); // The tools want the files in vectors: remove this with function diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx index 22ecca30e1d4a8781bf93ed5f192d5726a1b8434..5dc9fb88bd0ba4512e3c58e03b73a942b87fbaf3 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx @@ -54,6 +54,7 @@ ConfigurationSettings::ConfigurationSettings() : m_configured(false) { registerParameter("ElectronIsolationSF", "Force electron isolation SF (e.g. None). EXPERIMENTAL!", " "); registerParameter("ElectronIsolationSFLoose", "Force electron isolation SF (e.g. None). EXPERIMENTAL!", " "); registerParameter("ElectronVetoLArCrack", "True/False. Set to False to disable LAr crack veto (not recommended).", "True"); + registerParameter("UseElectronChargeIDSelection", "True/False. Switch on/off electron charge ID selection (Default False).", "False"); registerParameter("PhotonPt", "Photon pT cut for object selection (in MeV). Default 25 GeV.", "25000."); registerParameter("PhotonEta", "Absolute Photon 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 dcd31f1bf7dfa840ddd13d68ccbe6d3f79e64f5c..83563cbb7ddaabd1ae12ebd396770f2e8cccc59d 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopConfig.cxx @@ -169,6 +169,7 @@ namespace top{ m_electronIsoSFs(true), m_electronIDDecoration("SetMe"), m_electronIDLooseDecoration("SetMe"), + m_useElectronChargeIDSelection(false), // Muon configuration m_muonPtcut(25000.), @@ -666,9 +667,13 @@ namespace top{ if (this->electronIsolation() == "FixedCutHighPtCaloOnly" || this->electronIsolationLoose() == "FixedCutHighPtCaloOnly"){ std::cout << "TopConfig - ElectronIsolation - FixedCutHighPtCaloOnly can only be used with an electron pT cut > 60 GeV" << std::endl; } + this->useElectronChargeIDSelection(settings->value("UseElectronChargeIDSelection")); + if( m_useElectronChargeIDSelection )throw std::runtime_error{"TopConfig: UseElectronChargeIDSelection True \n Electron Charge ID selection not available in this release."}; this->electronPtcut( std::stof(settings->value("ElectronPt")) ); + + m_electronIDDecoration = "AnalysisTop_" + m_electronID; m_electronIDLooseDecoration = "AnalysisTop_" + m_electronIDLoose; @@ -2377,6 +2382,7 @@ namespace top{ out->m_electronIDLoose = m_electronIDLoose; out->m_electronIsolation = m_electronIsolation; out->m_electronIsolationLoose = m_electronIsolationLoose; + out->m_useElectronChargeIDSelection = m_useElectronChargeIDSelection; out->m_muon_trigger_SF = m_muon_trigger_SF; out->m_muonQuality = m_muonQuality; @@ -2506,6 +2512,7 @@ TopConfig::TopConfig( const top::TopPersistentSettings* settings ) : m_electronIDLoose = settings->m_electronIDLoose; m_electronIsolation = settings->m_electronIsolation; m_electronIsolationLoose = settings->m_electronIsolationLoose; + m_useElectronChargeIDSelection = settings->m_useElectronChargeIDSelection; m_muon_trigger_SF = settings->m_muon_trigger_SF; m_muonQuality = settings->m_muonQuality; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx index e73eff20d723f5797ac2e62339ec295009a1c5bc..7282a7c6a97bcaf9e04c9793a21f6c6a11d7af84 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/TopPersistentSettings.cxx @@ -31,6 +31,7 @@ namespace top{ m_electronIDLoose("SetMe"), m_electronIsolation("SetMe"), m_electronIsolationLoose("SetMe"), + m_useElectronChargeIDSelection(false), m_muon_trigger_SF("SetMe"), m_muonQuality("SetMe"), diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h index c4430497a82511c0f48b48367fd07302415a40ea..e17755ecf698070e434f407475f82b30fc9e7a5d 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopConfig.h @@ -438,6 +438,7 @@ class TopConfig final { inline virtual void electronIsolationLoose(const std::string& iso) {if(!m_configFixed){m_electronIsolationLoose = iso;}} void electronIsolationSF(std::string const & iso) {if(!m_configFixed){m_electronIsolationSF = iso;}} void electronIsolationSFLoose(std::string const & iso) {if(!m_configFixed){m_electronIsolationSFLoose = iso;}} + inline virtual void useElectronChargeIDSelection(const std::string& s){if(!m_configFixed){ m_useElectronChargeIDSelection = (s=="True" || s=="true");}} inline virtual const std::string& egammaSystematicModel(){return m_egammaSystematicModel;} inline virtual const std::string& electronID() const {return m_electronID; } @@ -451,6 +452,7 @@ class TopConfig final { inline virtual bool electronIsoSFs() const {return m_electronIsoSFs;} inline const std::string& electronIDDecoration() const {return m_electronIDDecoration;} inline const std::string& electronIDLooseDecoration() const {return m_electronIDLooseDecoration;} + inline bool useElectronChargeIDSelection() const {return m_useElectronChargeIDSelection;} // Photon configuration inline virtual void photonPtcut(const float pt) {if(!m_configFixed){m_photon_configuration.pt = pt;}} @@ -1112,6 +1114,7 @@ class TopConfig final { std::string m_electronIDDecoration; std::string m_electronIDLooseDecoration; + bool m_useElectronChargeIDSelection; // Muon configuration float m_muonPtcut; // muon object selection pT cut diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h index 8e73578f1f20ee4f67bc52196801e721899b62e8..9216c9ee2a8361f175225ee7d43ec581561caeab 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/TopPersistentSettings.h @@ -57,6 +57,7 @@ namespace top{ std::string m_electronIDLoose; std::string m_electronIsolation; std::string m_electronIsolationLoose; + bool m_useElectronChargeIDSelection; std::string m_muon_trigger_SF; std::string m_muonQuality; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx index f38903e21d3de6955e553a9aa27ad56bf17f8282..0ff77d5b2628f0c696bf08bc93a2a37a8fa99078 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/Root/ElectronLikelihoodMC15.cxx @@ -10,7 +10,7 @@ namespace top { ElectronLikelihoodMC15::ElectronLikelihoodMC15(const double ptcut, const bool vetoCrack, const std::string& operatingPoint, - const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut) : + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut,const bool applyChargeIDCut) : m_ptcut(ptcut), m_vetoCrack(vetoCrack), m_operatingPoint("SetMe"), @@ -19,7 +19,7 @@ namespace top { m_operatingPointLoose_DF("SetMe"), m_isolation(isolation), m_applyTTVACut(applyTTVACut), - m_applyChargeIDCut(false) + m_applyChargeIDCut(applyChargeIDCut) { /** Egamma use different naming styles for the likelihood in: * Trigger = HLT_e24_lhmedium_iloose_L1EM20VH HLT_e60_lhmedium @@ -50,9 +50,7 @@ namespace top { m_operatingPoint = operatingPoint; m_operatingPointLoose = operatingPointLoose; - // currently implemented only for this working point - if (m_operatingPoint == "MediumLH" && (m_isolation->tightLeptonIsolation() == "FixedCutTight" || m_isolation->looseLeptonIsolation() == "FixedCutTight")) - m_applyChargeIDCut = true; + // We cannot allow the HighPtCaloOnly isolation to be implemented for pt cut which is lower than the non-isolation triggers if( (m_isolation->tightLeptonIsolation() == "FixedCutHighPtCaloOnly" || m_isolation->looseLeptonIsolation() == "FixedCutHighPtCaloOnly") && m_ptcut < 60000){ @@ -65,9 +63,9 @@ namespace top { ElectronLikelihoodMC15::ElectronLikelihoodMC15(const bool, const double ptcut, const bool vetoCrack, const std::string& operatingPoint, - const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut) : + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut,const bool applyChargeIDCut) : ElectronLikelihoodMC15::ElectronLikelihoodMC15(ptcut, vetoCrack, operatingPoint, - operatingPointLoose, isolation, applyTTVACut) {} + operatingPointLoose, isolation, applyTTVACut,applyChargeIDCut) {} bool ElectronLikelihoodMC15::passSelection(const xAOD::Electron& el) const { if (!passSelectionNoIsolation(el, m_operatingPoint_DF, m_operatingPoint)) @@ -215,14 +213,9 @@ bool ElectronLikelihoodMC15::passTTVACuts(const xAOD::Electron& el) const bool ElectronLikelihoodMC15::passChargeIDCut(const xAOD::Electron& el) const { - - // Electron Charge ID Selector Tool - // see https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ElectronChargeFlipTaggerTool - if ( asg::ToolStore::contains<AsgElectronChargeIDSelectorTool> ("ECIDS_medium") ) { - AsgElectronChargeIDSelectorTool* electronChargeIDSelectorTool = asg::ToolStore::get<AsgElectronChargeIDSelectorTool> ("ECIDS_medium"); - if (!electronChargeIDSelectorTool->accept(&el)) return false; - } - return true; + static SG::AuxElement::ConstAccessor<char> acc_ECIDS("DFCommonElectronsECIDS"); + top::check(acc_ECIDS.isAvailable(el),"ElectronLikelihoodMC15::passChargeIDCut: DFCommonElectronsECIDS is not available"); + return acc_ECIDS(el) ? true : false; } void ElectronLikelihoodMC15::print(std::ostream& os) const { diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h index 81833bcf8864dd6db9519bb40645c02f8cca1e1c..e8579494654deb9401e1c3b54387b84fd3894088 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/TopObjectSelectionTools/ElectronLikelihoodMC15.h @@ -30,11 +30,11 @@ namespace top { * want any isolation cuts to be applied then leave this as a nullptr. */ ElectronLikelihoodMC15(const double ptcut, const bool vetoCrack, const std::string& operatingPoint, - const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut=true); + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut=true,const bool applyChargeIDCut=false); // this constructor is kept for backward compatibility - isPrimaryxAOD is not needed anymore ElectronLikelihoodMC15(const bool, const double ptcut, const bool vetoCrack, const std::string& operatingPoint, - const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut=true); + const std::string& operatingPointLoose, StandardIsolation* isolation, const bool applyTTVACut=true,const bool applyChargeIDCut=false); virtual ~ElectronLikelihoodMC15(){} /** * @brief Selection for the main analysis (i.e. tight object definitions).