From 3196344a53b09bd56e75d1bda7715faca1911dd2 Mon Sep 17 00:00:00 2001 From: Michael Holzbock Date: Tue, 29 Oct 2024 19:02:10 +0100 Subject: [PATCH 1/2] introduce option to run AsgDeadHVCellRemovalTool for electrons --- Root/ElectronSelector.cxx | 24 ++++++++++++++++++++++++ xAODAnaHelpers/ElectronSelector.h | 10 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/Root/ElectronSelector.cxx b/Root/ElectronSelector.cxx index 4fdfdbd2a..ab3f9cfbf 100644 --- a/Root/ElectronSelector.cxx +++ b/Root/ElectronSelector.cxx @@ -151,6 +151,7 @@ EL::StatusCode ElectronSelector :: initialize () m_el_cutflow_all = m_el_cutflowHist_1->GetXaxis()->FindBin("all"); m_el_cutflow_author_cut = m_el_cutflowHist_1->GetXaxis()->FindBin("author_cut"); m_el_cutflow_OQ_cut = m_el_cutflowHist_1->GetXaxis()->FindBin("OQ_cut"); + m_el_cutflow_deadHVCell_cut = m_el_cutflowHist_1->GetXaxis()->FindBin("deadHVCell_cut"); m_el_cutflow_ptmax_cut = m_el_cutflowHist_1->GetXaxis()->FindBin("ptmax_cut"); m_el_cutflow_ptmin_cut = m_el_cutflowHist_1->GetXaxis()->FindBin("ptmin_cut"); m_el_cutflow_eta_cut = m_el_cutflowHist_1->GetXaxis()->FindBin("eta_cut"); // including crack veto, if applied @@ -167,6 +168,7 @@ EL::StatusCode ElectronSelector :: initialize () m_el_cutflow_all = m_el_cutflowHist_2->GetXaxis()->FindBin("all"); m_el_cutflow_author_cut = m_el_cutflowHist_2->GetXaxis()->FindBin("author_cut"); m_el_cutflow_OQ_cut = m_el_cutflowHist_2->GetXaxis()->FindBin("OQ_cut"); + m_el_cutflow_deadHVCell_cut = m_el_cutflowHist_2->GetXaxis()->FindBin("deadHVCell_cut"); m_el_cutflow_ptmax_cut = m_el_cutflowHist_2->GetXaxis()->FindBin("ptmax_cut"); m_el_cutflow_ptmin_cut = m_el_cutflowHist_2->GetXaxis()->FindBin("ptmin_cut"); m_el_cutflow_eta_cut = m_el_cutflowHist_2->GetXaxis()->FindBin("eta_cut"); // including crack veto, if applied @@ -401,6 +403,15 @@ EL::StatusCode ElectronSelector :: initialize () // ********************************************************************************************** + + // Set up the dead HV Removal Tool + m_deadHVTool.setTypeAndName("AsgDeadHVCellRemovalTool/deadHVTool"); + if (m_deadHVTool.retrieve().isFailure()){ + ANA_MSG_ERROR("Failed to retrieve DeadHVTool, aborting"); + return StatusCode::FAILURE; + } + + ANA_MSG_INFO( "ElectronSelector Interface succesfully initialized!" ); return EL::StatusCode::SUCCESS; @@ -860,6 +871,19 @@ int ElectronSelector :: passCuts( const xAOD::Electron* electron, const xAOD::Ve if (!m_isUsedBefore && m_useCutFlow) m_el_cutflowHist_1->Fill( m_el_cutflow_OQ_cut, 1 ); if ( m_isUsedBefore && m_useCutFlow ) { m_el_cutflowHist_2->Fill( m_el_cutflow_OQ_cut, 1 ); } + // ********************************************************************************************************************************************************************* + // + // Dead HV Cell veto (affects only 2016 data) + // + if ( m_applyDeadHVCellVeto ) { + if( !m_deadHVTool->accept(electron) ){ + ANA_MSG_DEBUG( "Electron failed dead HV cell veto." ); + return 0; + } + } + if (!m_isUsedBefore && m_useCutFlow) m_el_cutflowHist_1->Fill( m_el_cutflow_deadHVCell_cut, 1 ); + if ( m_isUsedBefore && m_useCutFlow ) { m_el_cutflowHist_2->Fill( m_el_cutflow_deadHVCell_cut, 1 ); } + // ********************************************************************************************************************************************************************* // // pT max cut diff --git a/xAODAnaHelpers/ElectronSelector.h b/xAODAnaHelpers/ElectronSelector.h index 412718be4..d71374eb5 100644 --- a/xAODAnaHelpers/ElectronSelector.h +++ b/xAODAnaHelpers/ElectronSelector.h @@ -11,6 +11,7 @@ // EDM include(s): #include "xAODEgamma/ElectronContainer.h" #include "xAODTracking/Vertex.h" +#include "EgammaAnalysisInterfaces/IAsgDeadHVCellRemovalTool.h" // package include(s): #include "xAODAnaHelpers/ParticlePIDManager.h" @@ -128,6 +129,8 @@ class ElectronSelector : public xAH::Algorithm bool m_doAuthorCut = true; /// @brief Perform object quality cut bool m_doOQCut = true; + /// @brief Apply veto dead HV cells, affects only 2016 data + bool m_applyDeadHVCellVeto = false; ///// electron PID ///// @@ -199,6 +202,7 @@ class ElectronSelector : public xAH::Algorithm std::string m_isoDecSuffix = ""; + private: /** @@ -247,6 +251,7 @@ class ElectronSelector : public xAH::Algorithm int m_el_cutflow_all; //! int m_el_cutflow_author_cut; //! int m_el_cutflow_OQ_cut; //! + int m_el_cutflow_deadHVCell_cut; //! int m_el_cutflow_ptmax_cut; //! int m_el_cutflow_ptmin_cut; //! int m_el_cutflow_eta_cut; //! @@ -259,6 +264,8 @@ class ElectronSelector : public xAH::Algorithm std::vector m_IsoKeys; //! + + /* tools */ /// @brief MC15 ASG tool for isolation @@ -278,6 +285,9 @@ class ElectronSelector : public xAH::Algorithm /// @brief class to manage cut-based PID selection/decorations - see ISSUE for explaination ElectronCutBasedPIDManager* m_el_CutBased_PIDManager = nullptr; //! + /// @brief tool that selects on dead HV from the 2016 run, according to https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EGammaIdentificationRun2#Removal_of_Electron_Photon_clust + asg::AnaToolHandle m_deadHVTool; + /* other private members */ /** @rst From 8f4e4cbbc88d46a064d4fd643b065b559b93bd59 Mon Sep 17 00:00:00 2001 From: Michael Holzbock Date: Wed, 30 Oct 2024 09:57:12 +0100 Subject: [PATCH 2/2] add warning if dead HV cell veto isn't applied --- Root/ElectronSelector.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Root/ElectronSelector.cxx b/Root/ElectronSelector.cxx index ab3f9cfbf..3f59b6081 100644 --- a/Root/ElectronSelector.cxx +++ b/Root/ElectronSelector.cxx @@ -405,11 +405,15 @@ EL::StatusCode ElectronSelector :: initialize () // Set up the dead HV Removal Tool - m_deadHVTool.setTypeAndName("AsgDeadHVCellRemovalTool/deadHVTool"); - if (m_deadHVTool.retrieve().isFailure()){ + if (m_applyDeadHVCellVeto) + m_deadHVTool.setTypeAndName("AsgDeadHVCellRemovalTool/deadHVTool"); + if (m_deadHVTool.retrieve().isFailure()){ ANA_MSG_ERROR("Failed to retrieve DeadHVTool, aborting"); return StatusCode::FAILURE; } + else { + ANA_MSG_WARNING("Not applying veto of dead HV cells although it's recommended - please double check!"); + } ANA_MSG_INFO( "ElectronSelector Interface succesfully initialized!" );