diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx index e048eb9a69c2d22baa503d6dd0da9620eaee2d6b..66feffc33ff7694b63fce84aa20333ec1159f8a9 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "./EMTauInputProvider.h" #include <math.h> -#include "TH1.h" -#include "TH2.h" #include "GaudiKernel/ITHistSvc.h" @@ -59,22 +57,45 @@ EMTauInputProvider::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); - m_hEMEt = new TH1I( "EMTOBEt", "EM TOB Et", 40, 0, 200); - m_hEMEt->SetXTitle("E_{T}"); - m_hEMEtaPhi = new TH2I( "EMTOBPhiEta", "EM TOB Location", 25, -50, 50, 64, 0, 64); - m_hEMEtaPhi->SetXTitle("#eta"); - m_hEMEtaPhi->SetYTitle("#phi"); - - m_hTauEt = new TH1I( "TauTOBEt", "Tau TOB Et", 40, 0, 200); - m_hTauEt->SetXTitle("E_{T}"); - m_hTauEtaPhi = new TH2I( "TauTOBPhiEta", "Tau TOB Location", 25, -50, 50, 64, 0, 64); - m_hTauEtaPhi->SetXTitle("#eta"); - m_hTauEtaPhi->SetYTitle("#phi"); - - m_histSvc->regHist( histPath + "EMTOBEt", m_hEMEt ).ignore(); - m_histSvc->regHist( histPath + "EMTOBPhiEta", m_hEMEtaPhi ).ignore(); - m_histSvc->regHist( histPath + "TauTOBEt", m_hTauEt ).ignore(); - m_histSvc->regHist( histPath + "TauTOBPhiEta", m_hTauEtaPhi ).ignore(); + auto hEMEt = std::make_unique<TH1I>( "EMTOBEt", "EM TOB Et", 40, 0, 200); + hEMEt->SetXTitle("E_{T}"); + auto hEMEtaPhi = std::make_unique<TH2I>( "EMTOBPhiEta", "EM TOB Location", 25, -50, 50, 64, 0, 64); + hEMEtaPhi->SetXTitle("#eta"); + hEMEtaPhi->SetYTitle("#phi"); + + auto hTauEt = std::make_unique<TH1I>( "TauTOBEt", "Tau TOB Et", 40, 0, 200); + hTauEt->SetXTitle("E_{T}"); + auto hTauEtaPhi = std::make_unique<TH2I>( "TauTOBPhiEta", "Tau TOB Location", 25, -50, 50, 64, 0, 64); + hTauEtaPhi->SetXTitle("#eta"); + hTauEtaPhi->SetYTitle("#phi"); + + + if (m_histSvc->regShared( histPath + "EMTOBEt", std::move(hEMEt), m_hEMEt ).isSuccess()){ + ATH_MSG_DEBUG("EMTOBEt histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register EMTOBEt histogram for EMTauProvider"); + } + if (m_histSvc->regShared( histPath + "EMTOBPhiEta", std::move(hEMEtaPhi), m_hEMEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("EMTOBPhiEta histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register EMTOBPhiEta histogram for EMTauProvider"); + } + + if (m_histSvc->regShared( histPath + "TauTOBEt", std::move(hTauEt), m_hTauEt ).isSuccess()){ + ATH_MSG_DEBUG("TauTOBEt histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TauTOBEt histogram for EMTauProvider"); + } + if (m_histSvc->regShared( histPath + "TauTOBPhiEta", std::move(hTauEtaPhi), m_hTauEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("TauTOBPhiEta histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TauTOBPhiEta histogram for EMTauProvider"); + } + } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.h index 30f40226a9e5a5980846a17e5982112c78bdc753..08dc853663212c301b6c504ea4edd3791a74b1c1 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProvider.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_EMTauInputProvider @@ -8,9 +8,11 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/LockedHandle.h" #include "TrigT1CaloEvent/CPCMXTopoData.h" -class TH1I; -class TH2I; + +#include "TH1.h" +#include "TH2.h" class ITHistSvc; @@ -38,10 +40,10 @@ namespace LVL1 { SG::ReadHandleKey<DataVector<LVL1::CPCMXTopoData>> m_emTauLocation; //!< EMTAU ROI SG key - TH1I * m_hEMEt {nullptr}; - TH2I * m_hEMEtaPhi {nullptr}; - TH1I * m_hTauEt {nullptr}; - TH2I * m_hTauEtaPhi {nullptr}; + mutable LockedHandle<TH1> m_hEMEt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hEMEtaPhi ATLAS_THREAD_SAFE; + mutable LockedHandle<TH1> m_hTauEt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hTauEtaPhi ATLAS_THREAD_SAFE; }; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx index 08cbc65a5d294f00410e15b6a780dfe1a8302735..b99ac3bb035138077e2b4c2ab141d23218623263 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "./EMTauInputProviderFEX.h" #include <math.h> -#include "TH1.h" -#include "TH2.h" #include "GaudiKernel/ITHistSvc.h" @@ -57,22 +55,45 @@ EMTauInputProviderFEX::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); - m_hEMEt = new TH1I( "EMTOBEt", "EM TOB Et", 40, 0, 200); - m_hEMEt->SetXTitle("E_{T}"); - m_hEMEtaPhi = new TH2I( "EMTOBPhiEta", "EM TOB Location", 25, -50, 50, 64, 0, 64); - m_hEMEtaPhi->SetXTitle("#eta"); - m_hEMEtaPhi->SetYTitle("#phi"); - - m_hTauEt = new TH1I( "TauTOBEt", "Tau TOB Et", 40, 0, 200); - m_hTauEt->SetXTitle("E_{T}"); - m_hTauEtaPhi = new TH2I( "TauTOBPhiEta", "Tau TOB Location", 25, -50, 50, 64, 0, 64); - m_hTauEtaPhi->SetXTitle("#eta"); - m_hTauEtaPhi->SetYTitle("#phi"); - - m_histSvc->regHist( histPath + "EMTOBEt", m_hEMEt ).ignore(); - m_histSvc->regHist( histPath + "EMTOBPhiEta", m_hEMEtaPhi ).ignore(); - m_histSvc->regHist( histPath + "TauTOBEt", m_hTauEt ).ignore(); - m_histSvc->regHist( histPath + "TauTOBPhiEta", m_hTauEtaPhi ).ignore(); + auto hEMEt = std::make_unique<TH1I>( "EMTOBEt", "EM TOB Et", 40, 0, 200); + hEMEt->SetXTitle("E_{T}"); + auto hEMEtaPhi = std::make_unique<TH2I>( "EMTOBPhiEta", "EM TOB Location", 25, -50, 50, 64, 0, 64); + hEMEtaPhi->SetXTitle("#eta"); + hEMEtaPhi->SetYTitle("#phi"); + + auto hTauEt = std::make_unique<TH1I>( "TauTOBEt", "Tau TOB Et", 40, 0, 200); + hTauEt->SetXTitle("E_{T}"); + auto hTauEtaPhi = std::make_unique<TH2I>( "TauTOBPhiEta", "Tau TOB Location", 25, -50, 50, 64, 0, 64); + hTauEtaPhi->SetXTitle("#eta"); + hTauEtaPhi->SetYTitle("#phi"); + + + if (m_histSvc->regShared( histPath + "EMTOBEt", std::move(hEMEt), m_hEMEt ).isSuccess()){ + ATH_MSG_DEBUG("EMTOBEt histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register EMTOBEt histogram for EMTauProvider"); + } + if (m_histSvc->regShared( histPath + "EMTOBPhiEta", std::move(hEMEtaPhi), m_hEMEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("EMTOBPhiEta histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register EMTOBPhiEta histogram for EMTauProvider"); + } + + if (m_histSvc->regShared( histPath + "TauTOBEt", std::move(hTauEt), m_hTauEt ).isSuccess()){ + ATH_MSG_DEBUG("TauTOBEt histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TauTOBEt histogram for EMTauProvider"); + } + if (m_histSvc->regShared( histPath + "TauTOBPhiEta", std::move(hTauEtaPhi), m_hTauEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("TauTOBPhiEta histogram has been registered successfully for EMTauProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TauTOBPhiEta histogram for EMTauProvider"); + } + } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.h index bc8237941fe4dc9395c443ac551cdb9cae9f5d46..a53fa6b4707c780e39168b6669f6136cb8a44be7 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_EMTauInputProviderFEX @@ -8,13 +8,14 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/LockedHandle.h" //EM/Tau EDMs #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "xAODTrigger/EmTauRoIContainer.h" -class TH1I; -class TH2I; +#include "TH1.h" +#include "TH2.h" class ITHistSvc; @@ -42,10 +43,10 @@ namespace LVL1 { StringProperty m_eFEXClusterLoc; - TH1I * m_hEMEt {nullptr}; - TH2I * m_hEMEtaPhi {nullptr}; - TH1I * m_hTauEt {nullptr}; - TH2I * m_hTauEtaPhi {nullptr}; + mutable LockedHandle<TH1> m_hEMEt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hEMEtaPhi ATLAS_THREAD_SAFE; + mutable LockedHandle<TH1> m_hTauEt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hTauEtaPhi ATLAS_THREAD_SAFE; }; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx index aa2f926aade62ddb8492fee623eb1e4b1c470b86..917a952fc02cee4a0f807357f3be1f26cd12b3c6 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.cxx @@ -1,12 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <math.h> /* atan2 */ -#include "TH1.h" -#include "TH2.h" - #include "GaudiKernel/ITHistSvc.h" #include "EnergyInputProvider.h" @@ -58,15 +55,24 @@ EnergyInputProvider::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); + auto hPt = std::make_unique<TH1I>( "MET", "Missing ET TOB", 200, 0, 2000); + hPt->SetXTitle("p_{T}"); - m_hPt = new TH1I( "MET", "Missing ET TOB", 200, 0, 2000); - m_hPt->SetXTitle("p_{T}"); - - m_hPhi = new TH1I( "METPhi", "MET TOB Phi", 32, -3.2, 3.2); - m_hPhi->SetXTitle("#phi"); + auto hPhi = std::make_unique<TH1I>( "METPhi", "MET TOB Phi", 32, -3.2, 3.2); + hPhi->SetXTitle("#phi"); - m_histSvc->regHist( histPath + "MET", m_hPt ).ignore(); - m_histSvc->regHist( histPath + "METPhi", m_hPhi ).ignore(); + if (m_histSvc->regShared( histPath + "MET", std::move(hPt), m_hPt ).isSuccess()){ + ATH_MSG_DEBUG("MET histogram has been registered successfully for EnergyProvider."); + } + else{ + ATH_MSG_WARNING("Could not register MET histogram for EnergyProvider"); + } + if (m_histSvc->regShared( histPath + "METPhi", std::move(hPhi), m_hPhi ).isSuccess()){ + ATH_MSG_DEBUG("METPhi histogram has been registered successfully for EnergyProvider."); + } + else{ + ATH_MSG_WARNING("Could not register METPhi histogram for EnergyProvider"); + } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.h index 58fdc52aa9ae3ce4942a09d93bfafb51e682941f..0be0d8f412bf97488e5e8fde27ac4c2c58463af4 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProvider.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_EnergyInputProvider @@ -8,9 +8,10 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/LockedHandle.h" #include "TrigT1CaloEvent/EnergyTopoData.h" -class TH1I; +#include "TH1.h" class ITHistSvc; @@ -35,8 +36,8 @@ namespace LVL1 { SG::ReadHandleKey< LVL1::EnergyTopoData > m_energyLocation; //!< EnergyROI SG key - TH1I * m_hPt {nullptr}; - TH1I * m_hPhi {nullptr}; + mutable LockedHandle<TH1> m_hPt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH1> m_hPhi ATLAS_THREAD_SAFE; }; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.cxx index 24fc6c2d3b00f796f40e608233fea10687eba7a6..2c1716b6fad9ff810cbdd1c99c6bc5f423772b5c 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.cxx @@ -1,12 +1,9 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <math.h> /* atan2 */ -#include "TH1.h" -#include "TH2.h" - #include "GaudiKernel/ITHistSvc.h" #include "EnergyInputProviderFEX.h" @@ -58,14 +55,24 @@ EnergyInputProviderFEX::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); - m_hPt = new TH1I( "MET", "Missing ET TOB", 200, 0, 2000); - m_hPt->SetXTitle("p_{T}"); - - m_hPhi = new TH1I( "METPhi", "MET TOB Phi", 32, -3.2, 3.2); - m_hPhi->SetXTitle("#phi"); - - m_histSvc->regHist( histPath + "MET", m_hPt ).ignore(); - m_histSvc->regHist( histPath + "METPhi", m_hPhi ).ignore(); + auto hPt = std::make_unique<TH1I>( "MET", "Missing ET TOB", 200, 0, 2000); + hPt->SetXTitle("p_{T}"); + + auto hPhi = std::make_unique<TH1I>( "METPhi", "MET TOB Phi", 32, -3.2, 3.2); + hPhi->SetXTitle("#phi"); + + if (m_histSvc->regShared( histPath + "MET", std::move(hPt), m_hPt ).isSuccess()){ + ATH_MSG_DEBUG("MET histogram has been registered successfully for EnergyProvider."); + } + else{ + ATH_MSG_WARNING("Could not register MET histogram for EnergyProvider"); + } + if (m_histSvc->regShared( histPath + "METPhi", std::move(hPhi), m_hPhi ).isSuccess()){ + ATH_MSG_DEBUG("METPhi histogram has been registered successfully for EnergyProvider."); + } + else{ + ATH_MSG_WARNING("Could not register METPhi histogram for EnergyProvider"); + } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.h index 77374767313b1154d2d518da654390d1c6e8e8d8..c50010f19b997ed237ea0caaa991f4b1b25dbd8f 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EnergyInputProviderFEX.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_EnergyInputProviderFEX @@ -8,9 +8,10 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/LockedHandle.h" #include "xAODTrigger/EnergySumRoI.h" -class TH1I; +#include "TH1.h" class ITHistSvc; @@ -35,8 +36,8 @@ namespace LVL1 { StringProperty m_gFEXMETLoc; //!< EnergyROI SG key - TH1I * m_hPt {nullptr}; - TH1I * m_hPhi {nullptr}; + mutable LockedHandle<TH1> m_hPt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH1> m_hPhi ATLAS_THREAD_SAFE; }; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx index dc82afbd64e589270d497e6a5e6e66a9ec8d1f3e..e9f930800425e9b782074d23b165499eb785521f 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.cxx @@ -1,10 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <math.h> -#include "TH1.h" -#include "TH2.h" #include "GaudiKernel/ITHistSvc.h" @@ -54,19 +52,36 @@ JetInputProvider::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); - m_hPt1 = new TH1I( "TOBPt1", "Jet TOB Pt 1", 40, 0, 200); - m_hPt1->SetXTitle("p_{T}"); + auto hPt1 = std::make_unique<TH1I>( "TOBPt1", "Jet TOB Pt 1", 40, 0, 200); + hPt1->SetXTitle("p_{T}"); - m_hPt2 = new TH1I( "TOBPt2", "Jet TOB Pt 2", 40, 0, 200); - m_hPt2->SetXTitle("p_{T}"); + auto hPt2 = std::make_unique<TH1I>( "TOBPt2", "Jet TOB Pt 2", 40, 0, 200); + hPt2->SetXTitle("p_{T}"); - m_hEtaPhi = new TH2I( "TOBPhiEta", "Jet TOB Location", 25, -50, 50, 64, 0, 64); - m_hEtaPhi->SetXTitle("#eta"); - m_hEtaPhi->SetYTitle("#phi"); + auto hEtaPhi = std::make_unique<TH2I>( "TOBPhiEta", "Jet TOB Location", 25, -50, 50, 64, 0, 64); + hEtaPhi->SetXTitle("#eta"); + hEtaPhi->SetYTitle("#phi"); - m_histSvc->regHist( histPath + "TOBPt1", m_hPt1 ).ignore(); - m_histSvc->regHist( histPath + "TOBPt2", m_hPt2 ).ignore(); - m_histSvc->regHist( histPath + "TOBPhiEta", m_hEtaPhi ).ignore(); + + if (m_histSvc->regShared( histPath + "TOBPt1", std::move(hPt1), m_hPt1 ).isSuccess()){ + ATH_MSG_DEBUG("TOBPt1 histogram has been registered successfully for JetProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPt1 histogram for JetProvider"); + } + + if (m_histSvc->regShared( histPath + "TOBPt2", std::move(hPt2), m_hPt2 ).isSuccess()){ + ATH_MSG_DEBUG("TOBPt2 histogram has been registered successfully for JetProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPt2 histogram for JetProvider"); + } + if (m_histSvc->regShared( histPath + "TOBPhiEta", std::move(hEtaPhi), m_hEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("TOBPhiEta histogram has been registered successfully for JetProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPhiEta histogram for JetProvider"); + } } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.h index 2d5f82f1acc6f834a6fb18015a0d3b667702353f..8ed7b933dd9eefd6b77e25eaff7c5acac4dc052e 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProvider.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_JetInputProvider @@ -8,10 +8,11 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/LockedHandle.h" #include "TrigT1CaloEvent/JetCMXTopoDataCollection.h" -class TH1I; -class TH2I; +#include "TH1.h" +#include "TH2.h" class ITHistSvc; @@ -36,9 +37,9 @@ namespace LVL1 { SG::ReadHandleKey< DataVector<JetCMXTopoData> > m_jetLocation; //!< Jet ROIs SG key - TH1I * m_hPt1 {nullptr}; - TH1I * m_hPt2 {nullptr}; - TH2I * m_hEtaPhi {nullptr}; + mutable LockedHandle<TH1> m_hPt1 ATLAS_THREAD_SAFE; + mutable LockedHandle<TH1> m_hPt2 ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hEtaPhi ATLAS_THREAD_SAFE; }; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.cxx index 363bdd27e4dd91db6c79c9c92aede04fae2582b7..d476533b8a86617982cacf14cc3ac5688e58f32a 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.cxx @@ -1,10 +1,8 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include <math.h> -#include "TH1.h" -#include "TH2.h" #include "GaudiKernel/ITHistSvc.h" @@ -57,19 +55,37 @@ JetInputProviderFEX::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); - m_hPt1 = new TH1I( "TOBPt1", "Jet TOB Pt 1", 40, 0, 200); - m_hPt1->SetXTitle("p_{T}"); + auto hPt1 = std::make_unique<TH1I>( "TOBPt1", "Jet TOB Pt 1", 40, 0, 200); + hPt1->SetXTitle("p_{T}"); + + auto hPt2 = std::make_unique<TH1I>( "TOBPt2", "Jet TOB Pt 2", 40, 0, 200); + hPt2->SetXTitle("p_{T}"); + + auto hEtaPhi = std::make_unique<TH2I>( "TOBPhiEta", "Jet TOB Location", 25, -50, 50, 64, 0, 64); + hEtaPhi->SetXTitle("#eta"); + hEtaPhi->SetYTitle("#phi"); + + + if (m_histSvc->regShared( histPath + "TOBPt1", std::move(hPt1), m_hPt1 ).isSuccess()){ + ATH_MSG_DEBUG("TOBPt1 histogram has been registered successfully for JetProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPt1 histogram for JetProvider"); + } + + if (m_histSvc->regShared( histPath + "TOBPt2", std::move(hPt2), m_hPt2 ).isSuccess()){ + ATH_MSG_DEBUG("TOBPt2 histogram has been registered successfully for JetProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPt2 histogram for JetProvider"); + } + if (m_histSvc->regShared( histPath + "TOBPhiEta", std::move(hEtaPhi), m_hEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("TOBPhiEta histogram has been registered successfully for JetProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPhiEta histogram for JetProvider"); + } - m_hPt2 = new TH1I( "TOBPt2", "Jet TOB Pt 2", 40, 0, 200); - m_hPt2->SetXTitle("p_{T}"); - - m_hEtaPhi = new TH2I( "TOBPhiEta", "Jet TOB Location", 25, -50, 50, 64, 0, 64); - m_hEtaPhi->SetXTitle("#eta"); - m_hEtaPhi->SetYTitle("#phi"); - - m_histSvc->regHist( histPath + "TOBPt1", m_hPt1 ).ignore(); - m_histSvc->regHist( histPath + "TOBPt2", m_hPt2 ).ignore(); - m_histSvc->regHist( histPath + "TOBPhiEta", m_hEtaPhi ).ignore(); } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.h index 89242cfadf4522d10ae23688d8860fbd970acde1..54bca7b8f9621d32a1ced2414dcf8b6d978710cc 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/JetInputProviderFEX.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Based on handling of gFEX objects implemeted in Trigger/TrigT1/TrigT1CTP/src/CTPEmulation by Joerg Stelzer. @@ -10,11 +10,12 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/LockedHandle.h" #include "xAODTrigger/JetRoIContainer.h" //jets from gFEX -class TH1I; -class TH2I; +#include "TH1.h" +#include "TH2.h" class ITHistSvc; @@ -38,9 +39,9 @@ namespace LVL1 { StringProperty m_gFEXJetLoc {""}; - TH1I * m_hPt1 {nullptr}; - TH1I * m_hPt2 {nullptr}; - TH2I * m_hEtaPhi {nullptr}; + mutable LockedHandle<TH1> m_hPt1 ATLAS_THREAD_SAFE; + mutable LockedHandle<TH1> m_hPt2 ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hEtaPhi ATLAS_THREAD_SAFE; }; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx index 8b3019d0c546c3a12d66b6f698e02ad87b7b4b1d..b1c2c5d1c887f08fb13bf9f47eb2f9e30691de83 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonInputProvider.h" #include <math.h> -#include "TH1.h" -#include "TH2.h" #include "GaudiKernel/ITHistSvc.h" @@ -99,15 +97,25 @@ MuonInputProvider::handle(const Incident& incident) { string histPath = "/EXPERT/" + name() + "/"; replace( histPath.begin(), histPath.end(), '.', '/'); - m_hPt = new TH1I( "MuonTOBPt", "Muon TOB Pt", 40, 0, 200); - m_hPt->SetXTitle("p_{T}"); - - m_hEtaPhi = new TH2I( "MuonTOBPhiEta", "Muon TOB Location", 25, -50, 50, 32, -32, 32); - m_hEtaPhi->SetXTitle("#eta"); - m_hEtaPhi->SetYTitle("#phi"); - - m_histSvc->regHist( histPath + "TOBPt", m_hPt ).ignore(); - m_histSvc->regHist( histPath + "TOBPhiEta", m_hEtaPhi ).ignore(); + auto hPt = std::make_unique<TH1I>("MuonTOBPt", "Muon TOB Pt", 40, 0, 200); + hPt->SetXTitle("p_{T}"); + + auto hEtaPhi = std::make_unique<TH2I>("MuonTOBPhiEta", "Muon TOB Location", 25, -50, 50, 32, -32, 32); + hEtaPhi->SetXTitle("#eta"); + hEtaPhi->SetYTitle("#phi"); + + if (m_histSvc->regShared( histPath + "TOBPt", std::move(hPt), m_hPt ).isSuccess()){ + ATH_MSG_DEBUG("TOBPt histogram has been registered successfully for MuonProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPt histogram for MuonProvider"); + } + if (m_histSvc->regShared( histPath + "TOBPhiEta", std::move(hEtaPhi), m_hEtaPhi ).isSuccess()){ + ATH_MSG_DEBUG("TOBPhiEta histogram has been registered successfully for MuonProvider."); + } + else{ + ATH_MSG_WARNING("Could not register TOBPhiEta histogram for MuonProvider"); + } } @@ -146,8 +154,8 @@ MuonInputProvider::createMuonTOB(const MuCTPIL1TopoCandidate & roi) const { muon.setEtaDouble( etaTopo ); muon.setPhiDouble( phiTopo ); - m_hPt->Fill(muon.Et()); - m_hEtaPhi->Fill(muon.eta(),muon.phi()); + m_hPt->Fill(muon.Et()); + m_hEtaPhi->Fill(muon.eta(),muon.phi()); return muon; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h index 899ca5f4b0077bdcb7285802e281627d19de291c..9f089981a9383e25af0c0834e76335f52cce8215 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/MuonInputProvider.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_MuonInputProvider @@ -9,14 +9,15 @@ #include "L1TopoSimulation/IInputTOBConverter.h" #include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/LockedHandle.h" #include "TrigT1Interfaces/MuCTPIL1Topo.h" #include <vector> #include "TrigT1Result/RoIBResult.h" #include "TrigT1Interfaces/MuCTPIToRoIBSLink.h" #include "TrigT1Interfaces/TrigT1StoreGateKeys.h" -class TH1I; -class TH2I; +#include "TH1.h" +#include "TH2.h" class ITHistSvc; @@ -87,8 +88,8 @@ namespace LVL1 { SG::ReadHandleKey<LVL1::MuCTPIL1Topo> m_MuCTPItoL1TopoLocationPlusOne { this, "BCPlusOneLocation", "", "Storegate key for MuCTPItoL1TopoPlusOne"}; Gaudi::Property<uint16_t> m_MuonEncoding {this, "MuonEncoding", 0, "0=full granularity Mu ROIs, 1=MuCTPiToTopo granularity"}; - TH1I * m_hPt {nullptr}; - TH2I * m_hEtaPhi {nullptr}; + mutable LockedHandle<TH1> m_hPt ATLAS_THREAD_SAFE; + mutable LockedHandle<TH2> m_hEtaPhi ATLAS_THREAD_SAFE; }; }