From b20c0d5ddfb3eb844620eb29d8ef3dba5d8217d7 Mon Sep 17 00:00:00 2001 From: Peter Onyisi <ponyisi@utexas.edu> Date: Sun, 31 May 2020 18:12:44 -0500 Subject: [PATCH] Changes for old-style monitoring in RAWtoALL & various code cleanups --- .../CaloMonitoring/src/CaloClusterVecMon.cxx | 61 +++-- .../CaloClusterVecMon.h | 6 +- .../CaloMonitoring/src/CaloMonToolBase.cxx | 4 +- .../{CaloMonitoring => src}/CaloMonToolBase.h | 0 .../CaloMonitoring/src/CaloTowerVecMon.cxx | 4 +- .../{CaloMonitoring => src}/CaloTowerVecMon.h | 0 .../src/CaloTransverseBalanceVecMon.cxx | 4 +- .../CaloTransverseBalanceVecMon.h | 0 .../CaloMonitoring/src/LArCellBinning.cxx | 4 +- .../{CaloMonitoring => src}/LArCellBinning.h | 0 .../CaloMonitoring/src/LArCellMonAlg.h | 2 +- .../src/LArCellMonSetBinning.cxx | 4 +- .../CaloMonitoring/src/LArCellMonTool.cxx | 19 +- .../{CaloMonitoring => src}/LArCellMonTool.h | 8 +- Calorimeter/CaloMonitoring/src/ROIMon.cxx | 4 +- .../{CaloMonitoring => src}/ROIMon.h | 2 +- .../CaloMonitoring/src/TileCalCellMonTool.cxx | 24 +- .../TileCalCellMonTool.h | 6 +- .../src/components/CaloMonitoring_entries.cxx | 10 +- .../LUCID/LUCID_Monitoring/CMakeLists.txt | 1 - .../src/LUCID_HitsMoniTool.cxx | 69 +++-- .../LUCID_HitsMoniTool.h | 9 +- .../components/LUCID_Monitoring_entries.cxx | 2 +- .../ErrorScaling/InDetMonitoringAlignment.py | 8 +- .../share/InDetMonitoringAlignment.py | 4 +- .../share/InDetMonitoringGlobal.py | 2 +- .../share/InDetMonitoringPixel.py | 3 + .../share/InDetMonitoringTRT.py | 3 +- .../InDetDiMuonMonitoring/CMakeLists.txt | 1 - .../InDetDiMuonMonitoring/src/DiMuMon.cxx | 21 +- .../{InDetDiMuonMonitoring => src}/DiMuMon.h | 5 +- .../InDetDiMuonMonitoring_entries.cxx | 2 +- .../src/InDetGlobalBeamSpotMonTool.h | 4 +- .../src/InDetGlobalPrimaryVertexMonTool.cxx | 4 +- .../share/TrackMonitoring.py | 2 +- .../python/PixelMonitoringConfig.py | 2 + .../src/PixelAthErrorMonAlg.cxx | 2 +- .../src/TRT_Hits_Monitoring_Tool.cxx | 4 +- .../TRT_Hits_Monitoring_Tool.h | 0 .../src/TRT_Monitoring_Tool.cxx | 16 +- .../TRT_Monitoring_Tool.h | 0 .../src/components/TRT_Monitoring_entries.cxx | 4 +- .../src/LArClusterCollisionTimeAlg.cxx | 9 +- .../JetTagMonitoring/src/JetTagMonitoring.cxx | 116 +++------ .../JetTagMonitoring.h | 24 +- .../components/JetTagMonitoring_entries.cxx | 2 +- .../JetMonitoring/JetContainerHistoFiller.h | 2 +- .../Root/JetContainerHistoFiller.cxx | 19 +- .../MissingETMonitoring/METMonTool.h | 25 +- .../MissingETMonitoring/src/METMonTool.cxx | 243 ++++++++---------- .../src/MonitorElectronAlgorithm.cxx | 2 +- .../MonitorElectronAlgorithm.h | 0 .../src/MonitorFwdElectronAlgorithm.cxx | 2 +- .../MonitorFwdElectronAlgorithm.h | 0 .../src/MonitorPhotonAlgorithm.cxx | 2 +- .../MonitorPhotonAlgorithm.h | 0 .../src/MonitorTnPAlgorithm.cxx | 2 +- .../MonitorTnPAlgorithm.h | 0 .../egammaPerformance/src/ZeeTaPMonTool.cxx | 26 +- .../ZeeTaPMonTool.h | 13 +- .../components/egammaPerformance_entries.cxx | 16 +- .../src/egammaMonToolBase.cxx | 15 +- .../egammaMonToolBase.h | 10 +- .../egammaPerformance/src/electronMonTool.cxx | 33 +-- .../electronMonTool.h | 10 +- .../src/forwardElectronMonTool.cxx | 28 +- .../forwardElectronMonTool.h | 9 +- .../egammaPerformance/src/photonMonTool.cxx | 32 +-- .../photonMonTool.h | 10 +- Reconstruction/tauMonitoring/CMakeLists.txt | 1 - .../src/components/tauMonitoring_entries.cxx | 4 +- .../tauMonitoring/src/tauMonTool.cxx | 22 +- .../{tauMonitoring => src}/tauMonTool.h | 14 +- .../tauMonitoring/src/tauMonitorAlgorithm.cxx | 2 +- .../tauMonitorAlgorithm.h | 0 75 files changed, 485 insertions(+), 538 deletions(-) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/CaloClusterVecMon.h (96%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/CaloMonToolBase.h (100%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/CaloTowerVecMon.h (100%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/CaloTransverseBalanceVecMon.h (100%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/LArCellBinning.h (100%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/LArCellMonTool.h (98%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/ROIMon.h (92%) rename Calorimeter/CaloMonitoring/{CaloMonitoring => src}/TileCalCellMonTool.h (92%) rename ForwardDetectors/LUCID/LUCID_Monitoring/{LUCID_Monitoring => src}/LUCID_HitsMoniTool.h (67%) rename InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/{InDetDiMuonMonitoring => src}/DiMuMon.h (92%) rename InnerDetector/InDetMonitoring/TRT_Monitoring/{TRT_Monitoring => src}/TRT_Hits_Monitoring_Tool.h (100%) rename InnerDetector/InDetMonitoring/TRT_Monitoring/{TRT_Monitoring => src}/TRT_Monitoring_Tool.h (100%) rename PhysicsAnalysis/JetTagging/JetTagMonitoring/{JetTagMonitoring => src}/JetTagMonitoring.h (94%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/MonitorElectronAlgorithm.h (100%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/MonitorFwdElectronAlgorithm.h (100%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/MonitorPhotonAlgorithm.h (100%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/MonitorTnPAlgorithm.h (100%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/ZeeTaPMonTool.h (86%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/egammaMonToolBase.h (88%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/electronMonTool.h (93%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/forwardElectronMonTool.h (90%) rename Reconstruction/egamma/egammaPerformance/{egammaPerformance => src}/photonMonTool.h (95%) rename Reconstruction/tauMonitoring/{tauMonitoring => src}/tauMonTool.h (93%) rename Reconstruction/tauMonitoring/{tauMonitoring => src}/tauMonitorAlgorithm.h (100%) diff --git a/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx index 38518c1c7da..9e1d11894ee 100755 --- a/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.cxx @@ -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 */ // ******************************************************************** @@ -19,7 +19,7 @@ //******************************************************************** -#include "CaloMonitoring/CaloClusterVecMon.h" +#include "CaloClusterVecMon.h" #include "AthenaMonitoring/DQBadLBFilterTool.h" #include "AthenaMonitoring/DQAtlasReadyFilterTool.h" @@ -67,8 +67,6 @@ CaloClusterVecMon::CaloClusterVecMon(const std::string& type, const std::string& { declareInterface<IMonitorToolBase>(this); - declareProperty("CaloClusterContainer", m_clusterContainerName="CaloCalTopoClusters"); - declareProperty("TimeGran",m_timeGran="lowStat"); declareProperty("lowEthresh", m_Ethresh[LOW_E]=0.0); @@ -169,6 +167,8 @@ StatusCode CaloClusterVecMon::initialize() { StatusCode sc = StatusCode::SUCCESS; sc = retrieveTools(); + //Initialize read handle key + ATH_CHECK( m_clusterContainerName.initialize() ); sc = ManagedMonitorToolBase::initialize(); if(sc.isFailure()){ @@ -225,7 +225,7 @@ StatusCode CaloClusterVecMon::bookHistograms(){ bookCellHists(theinterval); bookClusterHists(theinterval); bookClusterStatHists(theinterval); - if( m_clusterContainerName == "CaloCalTopoClusters" ) { + if( m_clusterContainerName.key() == "CaloCalTopoClusters" ) { fillTileHistRange(); bookTileHists(theinterval); } @@ -286,11 +286,11 @@ void CaloClusterVecMon::bookCellHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/General", theinterval); - MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/Time_Energy", theinterval); - MonGroup cluster_leadcell_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/LeadCell", theinterval); + MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/General", theinterval); + MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/Time_Energy", theinterval); + MonGroup cluster_leadcell_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/LeadCell", theinterval); - if ( m_clusterContainerName == "LArMuClusterCandidates" ) { + if ( m_clusterContainerName.key() == "LArMuClusterCandidates" ) { m_nCells = new TH1I("NCells","NCellsinCluster",20,0.,20.); }else { m_nCells = new TH1I("NCells","NCellsinCluster",200,0.,200.); @@ -365,16 +365,16 @@ void CaloClusterVecMon::bookClusterHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup cluster_1drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/1d_Rates", theinterval); - MonGroup cluster_2drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_Rates", theinterval); - MonGroup cluster_2drates_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_Rates", theinterval); - MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_AvEnergy", theinterval); - MonGroup cluster_2davge_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_AvEnergy", theinterval); - MonGroup cluster_1davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/1d_AvEnergy", theinterval); - MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/TransEnergy", theinterval); - MonGroup cluster_2dTotale_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/TotalEnergy", theinterval); - MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/Time_Energy", theinterval); - MonGroup cluster_SummaryGroup_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/Summary", theinterval); + MonGroup cluster_1drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/1d_Rates", theinterval); + MonGroup cluster_2drates_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_Rates", theinterval); + MonGroup cluster_2drates_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_Rates", theinterval); + MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_AvEnergy", theinterval); + MonGroup cluster_2davge_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_AvEnergy", theinterval); + MonGroup cluster_1davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/1d_AvEnergy", theinterval); + MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/TransEnergy", theinterval); + MonGroup cluster_2dTotale_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/TotalEnergy", theinterval); + MonGroup cluster_energytime_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/Time_Energy", theinterval); + MonGroup cluster_SummaryGroup_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/Summary", theinterval); bookBaseHists(&cluster_SummaryGroup_expert).ignore(); //from base class @@ -567,18 +567,18 @@ void CaloClusterVecMon::bookClusterStatHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/TransEnergy", theinterval); - MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/General", theinterval); - MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/2d_AvEnergy", theinterval); + MonGroup cluster_2davgEt_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/TransEnergy", theinterval); + MonGroup cluster_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/General", theinterval); + MonGroup cluster_2davge_expert ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/2d_AvEnergy", theinterval); if (m_dataType == AthenaMonManager::cosmics ){ - if ( m_clusterContainerName == "LArMuClusterCandidates" ) { + if ( m_clusterContainerName.key() == "LArMuClusterCandidates" ) { m_nClusters = new TH1I("NClus","NCluster",200,0,200); }else { m_nClusters = new TH1I("NClus","NCluster",50,0,50); } }else { - if ( m_clusterContainerName == "EMTopoCluster" ){ + if ( m_clusterContainerName.key() == "EMTopoCluster" ){ m_nClusters = new TH1I("NClus","NCluster",300,0,300); }else { m_nClusters = new TH1I("NClus","NCluster",600,0,600); @@ -644,7 +644,7 @@ void CaloClusterVecMon::bookTileHists(const Interval_t theinterval){ if (m_triggerChainProp == "") TheTrigger="NoTrigSel"; else TheTrigger = m_triggerChainProp; - MonGroup tile_cluster_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName+TheTrigger+"/General", theinterval); //SHIFT + MonGroup tile_cluster_shift ( this, "/CaloMonitoring/ClusterMon/"+m_clusterContainerName.key()+TheTrigger+"/General", theinterval); //SHIFT m_clustersCellsRatioEta = new TProfile("TileCalXRatioXEta","Ratio: cluster E/ cluster cells",(int)m_binRangeEta[0],m_binRangeEta[1], m_binRangeEta[2]); m_clustersCellsRatioEta->GetXaxis()->SetTitle("Eta"); @@ -707,12 +707,9 @@ StatusCode CaloClusterVecMon::fillHistograms() { sc = checkFilters(ifPass); if(sc.isFailure() || !ifPass) return StatusCode::SUCCESS; - const xAOD::CaloClusterContainer* clusterCont = nullptr; - sc=evtStore()->retrieve( clusterCont, m_clusterContainerName); - if( sc.isFailure() || !clusterCont ) { - ATH_MSG_WARNING( "No CaloCluster container found in TDS"); - return sc; - } + SG::ReadHandle<xAOD::CaloClusterContainer> clusterContHandle{m_clusterContainerName}; + if (! clusterContHandle.isValid()) { ATH_MSG_WARNING("No CaloCluster container found in TDS"); return StatusCode::FAILURE; } + const xAOD::CaloClusterContainer* clusterCont = clusterContHandle.get(); initCounter(); @@ -734,7 +731,7 @@ StatusCode CaloClusterVecMon::fillHistograms() { fillClusterStatHist(clusterCont); - if( m_clusterContainerName == "CaloCalTopoClusters" ) fillTileHist(clusterCont); + if( m_clusterContainerName.key() == "CaloCalTopoClusters" ) fillTileHist(clusterCont); return sc; } diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloClusterVecMon.h b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.h similarity index 96% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloClusterVecMon.h rename to Calorimeter/CaloMonitoring/src/CaloClusterVecMon.h index 8ae3c45e936..45420690513 100755 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloClusterVecMon.h +++ b/Calorimeter/CaloMonitoring/src/CaloClusterVecMon.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 */ // ******************************************************************** @@ -16,7 +16,7 @@ #ifndef CALOClusterVecMon_H #define CALOClusterVecMon_H -#include "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "GaudiKernel/ToolHandle.h" @@ -90,7 +90,7 @@ class CaloClusterVecMon : public CaloMonToolBase { }; // CaloClusterContainer name - std::string m_clusterContainerName; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterContainerName{ this, "CaloClusterContainer", "CaloCalTopoClusters" }; // Time granularity std::string m_timeGran; diff --git a/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx index f5fdee62837..e1815f65702 100644 --- a/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.cxx @@ -1,8 +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 "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "xAODEventInfo/EventInfo.h" #include "LArRecEvent/LArCollisionTime.h" #include "RecBackgroundEvent/BeamBackgroundData.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloMonToolBase.h b/Calorimeter/CaloMonitoring/src/CaloMonToolBase.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloMonToolBase.h rename to Calorimeter/CaloMonitoring/src/CaloMonToolBase.h diff --git a/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx index a14a847faf9..050ba9d02af 100755 --- a/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx @@ -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 */ // ******************************************************************** @@ -13,7 +13,7 @@ // D. Hu (Jun 2011 - May 2012) // L. Sawyer (Dec 2013 - ) // ******************************************************************** -#include "CaloMonitoring/CaloTowerVecMon.h" +#include "CaloTowerVecMon.h" #include "AthenaMonitoring/DQBadLBFilterTool.h" #include "AthenaMonitoring/DQAtlasReadyFilterTool.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloTowerVecMon.h b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloTowerVecMon.h rename to Calorimeter/CaloMonitoring/src/CaloTowerVecMon.h diff --git a/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx index c11b1281282..2cb61e262dd 100755 --- a/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx +++ b/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.cxx @@ -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 */ // ******************************************************************** @@ -11,7 +11,7 @@ //******************************************************************** -#include "CaloMonitoring/CaloTransverseBalanceVecMon.h" +#include "CaloTransverseBalanceVecMon.h" #include "xAODEventInfo/EventInfo.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/CaloTransverseBalanceVecMon.h b/Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/CaloTransverseBalanceVecMon.h rename to Calorimeter/CaloMonitoring/src/CaloTransverseBalanceVecMon.h diff --git a/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx b/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx index a5f4927aced..957b19207bf 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx +++ b/Calorimeter/CaloMonitoring/src/LArCellBinning.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // *********************************************************** @@ -9,7 +9,7 @@ // LArCellMonTools class // // *********************************************************** -#include "CaloMonitoring/LArCellBinning.h" +#include "LArCellBinning.h" #include <iostream> #include "TMath.h" diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/LArCellBinning.h b/Calorimeter/CaloMonitoring/src/LArCellBinning.h similarity index 100% rename from Calorimeter/CaloMonitoring/CaloMonitoring/LArCellBinning.h rename to Calorimeter/CaloMonitoring/src/LArCellBinning.h diff --git a/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h b/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h index 8617b0a2cf2..24a2d7a6940 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h +++ b/Calorimeter/CaloMonitoring/src/LArCellMonAlg.h @@ -20,7 +20,7 @@ #include "TrigDecisionTool/TrigDecisionTool.h" -#include "CaloMonitoring/LArCellBinning.h" +#include "LArCellBinning.h" #include <vector> #include <string> diff --git a/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx b/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx index 3aaf9be6f91..d7f8271769d 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx +++ b/Calorimeter/CaloMonitoring/src/LArCellMonSetBinning.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "CaloMonitoring/LArCellMonTool.h" +#include "LArCellMonTool.h" using namespace CaloMonitoring; void LArCellMonTool::setLArCellBinning() { diff --git a/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx b/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx index f72bd2ec8ad..4c4d89b00d0 100644 --- a/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx +++ b/Calorimeter/CaloMonitoring/src/LArCellMonTool.cxx @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // NAME: LArCellMonTool.cxx // W.Lampl - Spring 2017: Major re-design // ******************************************************************** -#include "CaloMonitoring/LArCellMonTool.h" +#include "LArCellMonTool.h" #include "LArRecConditions/LArBadChannel.h" #include "LArRecConditions/LArBadChanBitPacking.h" @@ -51,9 +51,6 @@ LArCellMonTool::LArCellMonTool(const std::string& type, const std::string& name, declareProperty("DoSaveTempHists",m_doSaveTempHists=false,"Store temporary, intermediate histograms in a /Temp/ directory (for debugging"); - // CaloCellContainer name - declareProperty("CaloCellContainer", m_cellContainerName="AllCalo","SG key of the input cell container"); - // tools declareProperty("useElectronicNoiseOnly",m_useElectronicNoiseOnly=false,"Consider only electronic noise and ignore pile-up contributiuon)"); declareProperty("CaloNoiseTool",m_noiseTool,"Tool Handle for noise Tool"); @@ -150,7 +147,7 @@ LArCellMonTool::~LArCellMonTool() { //////////////////////////////////////////// StatusCode LArCellMonTool::initialize() { - ATH_MSG_INFO("LArCellMonTool::initialize() start"); + ATH_MSG_DEBUG("LArCellMonTool::initialize() start"); //Identfier-helpers ATH_CHECK( detStore()->retrieve(m_LArOnlineIDHelper, "LArOnlineID") ); @@ -207,11 +204,14 @@ StatusCode LArCellMonTool::initialize() { //Fill the LArCellBinning for each layer setLArCellBinning(); + //Initialize read handle key + ATH_CHECK( m_cellContainerName.initialize() ); + //Call base-call initialize methods ATH_CHECK( ManagedMonitorToolBase::initialize() ); ATH_CHECK( CaloMonToolBase::initialize() ); - ATH_MSG_INFO("LArCellMonTool::initialize() is done!"); + ATH_MSG_DEBUG("LArCellMonTool::initialize() is done!"); return StatusCode::SUCCESS; } @@ -660,8 +660,9 @@ StatusCode LArCellMonTool::fillHistograms(){ return StatusCode::FAILURE; } - const CaloCellContainer* cellCont = nullptr; - ATH_CHECK(evtStore()->retrieve(cellCont, m_cellContainerName)); + SG::ReadHandle<CaloCellContainer> cellContHandle{m_cellContainerName}; + if (! cellContHandle.isValid()) { return StatusCode::FAILURE; } + const CaloCellContainer* cellCont = cellContHandle.get(); if (!m_oncePerJobHistosDone) { ATH_CHECK(createPerJobHistograms(cellCont)); diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/LArCellMonTool.h b/Calorimeter/CaloMonitoring/src/LArCellMonTool.h similarity index 98% rename from Calorimeter/CaloMonitoring/CaloMonitoring/LArCellMonTool.h rename to Calorimeter/CaloMonitoring/src/LArCellMonTool.h index ea2539c5bcd..820eaec1263 100644 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/LArCellMonTool.h +++ b/Calorimeter/CaloMonitoring/src/LArCellMonTool.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -10,7 +10,7 @@ #ifndef CALOMONITORING_LARCELLMONTOOL_H #define CALOMONITORING_LARCELLMONTOOL_H -#include "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "GaudiKernel/ToolHandle.h" #include "LArRecConditions/ILArBadChannelMasker.h" @@ -25,7 +25,7 @@ #include "TrigDecisionTool/TrigDecisionTool.h" -#include "CaloMonitoring/LArCellBinning.h" +#include "LArCellBinning.h" #include <vector> #include <string> @@ -155,7 +155,7 @@ private: //Job Properties and other private variables bool m_oncePerJobHistosDone=false; - std::string m_cellContainerName; + SG::ReadHandleKey<CaloCellContainer> m_cellContainerName { this, "CaloCellContainer", "AllCalo", "SG key of the input cell container" }; bool m_useElectronicNoiseOnly; ICalorimeterNoiseTool::CalorimeterNoiseType m_noiseType=ICalorimeterNoiseTool::TOTALNOISE; diff --git a/Calorimeter/CaloMonitoring/src/ROIMon.cxx b/Calorimeter/CaloMonitoring/src/ROIMon.cxx index eb792293282..81c04d27103 100755 --- a/Calorimeter/CaloMonitoring/src/ROIMon.cxx +++ b/Calorimeter/CaloMonitoring/src/ROIMon.cxx @@ -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 */ // ******************************************************************** @@ -7,7 +7,7 @@ // // AUTHORS: F Spano' 06/15/2006 // ******************************************************************** -#include "CaloMonitoring/ROIMon.h" +#include "ROIMon.h" #include <stdint.h> #include <algorithm> diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/ROIMon.h b/Calorimeter/CaloMonitoring/src/ROIMon.h similarity index 92% rename from Calorimeter/CaloMonitoring/CaloMonitoring/ROIMon.h rename to Calorimeter/CaloMonitoring/src/ROIMon.h index ef46a04be75..e1c94190514 100755 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/ROIMon.h +++ b/Calorimeter/CaloMonitoring/src/ROIMon.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 */ //=========================== diff --git a/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx index 87db9b1fc2f..4692e5028c1 100644 --- a/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx +++ b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.cxx @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // NAME: TileCalCellMonTool.cxx -#include "CaloMonitoring/TileCalCellMonTool.h" +#include "TileCalCellMonTool.h" #include "CaloIdentifier/TileID.h" @@ -33,9 +33,6 @@ TileCalCellMonTool::TileCalCellMonTool(const std::string& type, const std::strin { declareInterface<IMonitorToolBase>(this); - // CaloCellContainer name - declareProperty("CaloCellContainer", m_cellContainerName="AllCalo","SG key of the input cell container"); - // tools declareProperty("useElectronicNoiseOnly",m_useElectronicNoiseOnly=false,"Consider only electronic noise and ignore pile-up contributiuon)"); declareProperty("useTwoGaus", m_useTwoGaus=true,"Use double-gaussian noise description for Tile-cells"); @@ -55,7 +52,7 @@ TileCalCellMonTool::~TileCalCellMonTool() { //////////////////////////////////////////// StatusCode TileCalCellMonTool::initialize() { - ATH_MSG_INFO("TileCalCellMonTool::initialize() start"); + ATH_MSG_DEBUG("TileCalCellMonTool::initialize() start"); ATH_CHECK( detStore()->retrieve(m_tile_id) ); @@ -71,11 +68,13 @@ StatusCode TileCalCellMonTool::initialize() { initParam(); - + //Initialize read handle key + ATH_CHECK( m_cellContainerName.initialize() ); + ATH_CHECK( ManagedMonitorToolBase::initialize() ); ATH_CHECK( CaloMonToolBase::initialize() ); - ATH_MSG_INFO("TileCalCellMonTool::initialize() is done!"); + ATH_MSG_DEBUG("TileCalCellMonTool::initialize() is done!"); return StatusCode::SUCCESS; } @@ -299,12 +298,9 @@ StatusCode TileCalCellMonTool::fillHistograms(){ // CaloCell info //============================ - const CaloCellContainer* cellCont = nullptr; - sc=evtStore()->retrieve(cellCont, m_cellContainerName); - if( sc.isFailure() || !cellCont ) { - ATH_MSG_WARNING("No CaloCell container found in TDS"); - return sc; - } + SG::ReadHandle<CaloCellContainer> cellContHandle{m_cellContainerName}; + if (! cellContHandle.isValid()) { ATH_MSG_WARNING("No CaloCell container found in TDS"); return StatusCode::FAILURE; } + const CaloCellContainer* cellCont = cellContHandle.get(); CaloCellContainer::const_iterator it = cellCont->beginConstCalo(CaloCell_ID::TILE); diff --git a/Calorimeter/CaloMonitoring/CaloMonitoring/TileCalCellMonTool.h b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.h similarity index 92% rename from Calorimeter/CaloMonitoring/CaloMonitoring/TileCalCellMonTool.h rename to Calorimeter/CaloMonitoring/src/TileCalCellMonTool.h index 299ff376687..8679cbee697 100644 --- a/Calorimeter/CaloMonitoring/CaloMonitoring/TileCalCellMonTool.h +++ b/Calorimeter/CaloMonitoring/src/TileCalCellMonTool.h @@ -1,13 +1,13 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TILEMONTOOL_H #define TILEMONTOOL_H -#include "CaloMonitoring/CaloMonToolBase.h" +#include "CaloMonToolBase.h" #include "GaudiKernel/ToolHandle.h" @@ -47,7 +47,7 @@ private: void getRMSdevNoise(TProfile *t1, TProfile *t2, TH1F *t3); //Job Properties and other private variables - std::string m_cellContainerName; + SG::ReadHandleKey<CaloCellContainer> m_cellContainerName { this, "CaloCellContainer", "AllCalo", "SG key of the input cell container" }; bool m_useElectronicNoiseOnly; bool m_useTwoGaus; diff --git a/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx b/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx index 6d47955193b..c6da5d71d1e 100755 --- a/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx +++ b/Calorimeter/CaloMonitoring/src/components/CaloMonitoring_entries.cxx @@ -1,8 +1,8 @@ -#include "CaloMonitoring/LArCellMonTool.h" -#include "CaloMonitoring/TileCalCellMonTool.h" -#include "CaloMonitoring/CaloClusterVecMon.h" -#include "CaloMonitoring/CaloTowerVecMon.h" -#include "CaloMonitoring/CaloTransverseBalanceVecMon.h" +#include "../LArCellMonTool.h" +#include "../TileCalCellMonTool.h" +#include "../CaloClusterVecMon.h" +#include "../CaloTowerVecMon.h" +#include "../CaloTransverseBalanceVecMon.h" #include "../CaloBaselineMonAlg.h" #include "../TileCalCellMonAlg.h" #include "../LArCellMonAlg.h" diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt b/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt index 3cec6e9f4fe..985ca52ac1c 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/CMakeLists.txt @@ -23,6 +23,5 @@ atlas_add_component( LUCID_Monitoring LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib LUCID_RawEvent GaudiKernel ) # Install files from the package: -atlas_install_headers( LUCID_Monitoring ) atlas_install_joboptions( share/*.py ) diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx index b0edd2ff031..e37c24136b5 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.cxx @@ -1,27 +1,27 @@ /* - 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 <sstream> -#include "GaudiKernel/IJobOptionsSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/StatusCode.h" - -#include "AthenaMonitoring/AthenaMonManager.h" -#include "LUCID_Monitoring/LUCID_HitsMoniTool.h" +#include "LUCID_HitsMoniTool.h" LUCID_HitsMoniTool::LUCID_HitsMoniTool(const std::string& type, const std::string& name, const IInterface* parent): ManagedMonitorToolBase(type, name, parent) { - m_LUCID_RawDataContainer = 0; } LUCID_HitsMoniTool::~LUCID_HitsMoniTool() {} +StatusCode LUCID_HitsMoniTool::initialize() { + ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_LUCID_RawDataContainerKey.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode LUCID_HitsMoniTool::bookHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_HitsMoniTool::bookHistograms " << endmsg; + ATH_MSG_DEBUG(" LUCID_HitsMoniTool::bookHistograms "); m_LUCID_Histos.clear(); @@ -103,30 +103,27 @@ StatusCode LUCID_HitsMoniTool::bookHistograms() { StatusCode LUCID_HitsMoniTool::fillHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_HitsMoniTool::fillHistograms " << endmsg; + ATH_MSG_DEBUG(" LUCID_HitsMoniTool::fillHistograms "); - StatusCode sc = evtStore()->retrieve(m_LUCID_RawDataContainer, "Lucid_RawData"); + SG::ReadHandle<LUCID_RawDataContainer> rawdata{m_LUCID_RawDataContainerKey}; - if (sc.isFailure()) { if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Could not retireved LUCID_RawDataContainer from StoreGate " << endmsg; return sc; } - else if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_RawDataContainer is retireved from StoreGate " << endmsg; - - LUCID_RawDataContainer::const_iterator LUCID_RawData_itr = m_LUCID_RawDataContainer->begin(); - LUCID_RawDataContainer::const_iterator LUCID_RawData_end = m_LUCID_RawDataContainer->end(); + if (!rawdata.isValid()) { ATH_MSG_WARNING(" Could not retireved LUCID_RawDataContainer from StoreGate "); return StatusCode::FAILURE; } + else ATH_MSG_DEBUG(" LUCID_RawDataContainer is retireved from StoreGate "); - for (; LUCID_RawData_itr != LUCID_RawData_end; LUCID_RawData_itr++) { + for (const auto& LUCID_RawData_itr : *rawdata) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << (*LUCID_RawData_itr); + ATH_MSG_DEBUG(LUCID_RawData_itr); for (int bxID=0; bxID<3; bxID++) { for (int tub=0; tub<m_nLucidTubes; tub++) { - bool isTubeFired = (*LUCID_RawData_itr)->isTubeFired(tub, bxID); + bool isTubeFired = LUCID_RawData_itr->isTubeFired(tub, bxID); - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) - << " bxID: " << std::setw(10) << bxID + ATH_MSG_DEBUG( + " bxID: " << std::setw(10) << bxID << " tub: " << std::setw(10) << tub << " fire: " << std::setw(10) << isTubeFired - << endmsg; + ); if (isTubeFired) m_LUCID_Histos[bxID]->Fill(tub); } @@ -135,8 +132,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { int hitsA, hitsC, hitsT; bool coinFlag; - hitsA = (*LUCID_RawData_itr)->getNhitsPMTsideA(); - hitsC = (*LUCID_RawData_itr)->getNhitsPMTsideC(); + hitsA = LUCID_RawData_itr->getNhitsPMTsideA(); + hitsC = LUCID_RawData_itr->getNhitsPMTsideC(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -148,8 +145,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[7]->Fill(hitsC*coinFlag); m_LUCID_Histos[8]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsFIBsideA(); - hitsC = (*LUCID_RawData_itr)->getNhitsFIBsideC(); + hitsA = LUCID_RawData_itr->getNhitsFIBsideA(); + hitsC = LUCID_RawData_itr->getNhitsFIBsideC(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -161,8 +158,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[13]->Fill(hitsC*coinFlag); m_LUCID_Histos[14]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsPMTsideAprevBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsPMTsideCprevBX(); + hitsA = LUCID_RawData_itr->getNhitsPMTsideAprevBX(); + hitsC = LUCID_RawData_itr->getNhitsPMTsideCprevBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -174,8 +171,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[19]->Fill(hitsC*coinFlag); m_LUCID_Histos[20]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsFIBsideAprevBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsFIBsideCprevBX(); + hitsA = LUCID_RawData_itr->getNhitsFIBsideAprevBX(); + hitsC = LUCID_RawData_itr->getNhitsFIBsideCprevBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -187,8 +184,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[25]->Fill(hitsC*coinFlag); m_LUCID_Histos[26]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsPMTsideAnextBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsPMTsideCnextBX(); + hitsA = LUCID_RawData_itr->getNhitsPMTsideAnextBX(); + hitsC = LUCID_RawData_itr->getNhitsPMTsideCnextBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -200,8 +197,8 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { m_LUCID_Histos[31]->Fill(hitsC*coinFlag); m_LUCID_Histos[32]->Fill(hitsT*coinFlag); - hitsA = (*LUCID_RawData_itr)->getNhitsFIBsideAnextBX(); - hitsC = (*LUCID_RawData_itr)->getNhitsFIBsideCnextBX(); + hitsA = LUCID_RawData_itr->getNhitsFIBsideAnextBX(); + hitsC = LUCID_RawData_itr->getNhitsFIBsideCnextBX(); hitsT = hitsA + hitsC; coinFlag = (hitsA>0 && hitsC>0); @@ -219,11 +216,11 @@ StatusCode LUCID_HitsMoniTool::fillHistograms() { StatusCode LUCID_HitsMoniTool::procHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " LUCID_HitsMoniTool::procHistograms " << endmsg; + ATH_MSG_DEBUG(" LUCID_HitsMoniTool::procHistograms "); if (endOfRunFlag()) { - msg(MSG::DEBUG) << " m_nEvents: " << m_nEvents << endmsg; + ATH_MSG_DEBUG(" m_nEvents: " << m_nEvents); for (int bxID=0; bxID<3; bxID++) m_LUCID_Histos[18+bxID]->Scale(1./m_nEvents); } diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/LUCID_Monitoring/LUCID_HitsMoniTool.h b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.h similarity index 67% rename from ForwardDetectors/LUCID/LUCID_Monitoring/LUCID_Monitoring/LUCID_HitsMoniTool.h rename to ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.h index cb78a7c5d52..129a02bed02 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/LUCID_Monitoring/LUCID_HitsMoniTool.h +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/src/LUCID_HitsMoniTool.h @@ -23,13 +23,14 @@ class LUCID_HitsMoniTool: public ManagedMonitorToolBase { virtual ~LUCID_HitsMoniTool(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; + virtual StatusCode procHistograms() override; protected: - const LUCID_RawDataContainer* m_LUCID_RawDataContainer; + SG::ReadHandleKey<LUCID_RawDataContainer> m_LUCID_RawDataContainerKey{this, "RawDataKey", "Lucid_RawData"}; std::vector<TH1F*> m_LUCID_Histos; diff --git a/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx b/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx index 05a53b223f9..d7328a31be7 100644 --- a/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx +++ b/ForwardDetectors/LUCID/LUCID_Monitoring/src/components/LUCID_Monitoring_entries.cxx @@ -1,3 +1,3 @@ -#include "LUCID_Monitoring/LUCID_HitsMoniTool.h" +#include "../LUCID_HitsMoniTool.h" DECLARE_COMPONENT( LUCID_HitsMoniTool ) diff --git a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py index 4ef34f1cf86..577deebb141 100755 --- a/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py +++ b/InnerDetector/InDetExample/InDetAlignExample/ErrorScaling/InDetMonitoringAlignment.py @@ -108,7 +108,7 @@ if not jobproperties.Beam.beamType()=='cosmics': from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot_noTrig", extrapolator = InDetExtrapolator, - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) #ToolSvc += InDetAlignMonBeamSpot_noTrig @@ -232,7 +232,7 @@ if (InDetFlags.doPrintConfigurables()): from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import IDAlignMonGenericTracks InDetAlignMonGenericTracks_noTrig = IDAlignMonGenericTracks (name = "InDetAlignMonGenericTracks_noTrig", trackSelection = m_alignMonTrackSelectionTool[1], - VxPrimContainerName = InDetKeys.PrimaryVertices()) + VxPrimContainerName = InDetKeys.xAODVertexContainer()) if jobproperties.Beam.beamType()=='cosmics' or jobproperties.Beam.beamType()=='singlebeam': InDetAlignMonGenericTracks_noTrig.tracksName = InDetKeys.Tracks() @@ -375,10 +375,10 @@ else: InDetAlignMonGenericTracks = IDAlignMonGenericTracks (name = "InDetAlignMonGenericTracks", trackSelection = m_alignMonTrackSelectionTool[1], tracksName = InDetKeys.ExtendedTracks(), - VxPrimContainerName = InDetKeys.PrimaryVertices()) + VxPrimContainerName = InDetKeys.xAODVertexContainer()) InDetAlignMonBeamSpot = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot", - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) if jobproperties.Beam.beamType()=='collisions': diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py index 98c7273852e..13db06af68b 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringAlignment.py @@ -111,7 +111,7 @@ if not jobproperties.Beam.beamType()=='cosmics': from InDetAlignmentMonitoring.InDetAlignmentMonitoringConf import InDetAlignMonBeamSpot InDetAlignMonBeamSpot_noTrig = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot_noTrig", extrapolator = InDetExtrapolator, - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) #ToolSvc += InDetAlignMonBeamSpot_noTrig @@ -387,7 +387,7 @@ else: VxPrimContainerName = InDetKeys.xAODVertexContainer()) InDetAlignMonBeamSpot = InDetAlignMonBeamSpot (name = "InDetAlignMonBeamSpot", - vxContainerName = InDetKeys.PrimaryVertices(), + vxContainerName = InDetKeys.xAODVertexContainer(), vxContainerWithBeamConstraint = InDetFlags.useBeamConstraint()) if jobproperties.Beam.beamType()=='collisions': diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py index 7cfffe1a31d..619dd1fbbcf 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobal.py @@ -213,7 +213,7 @@ if InDetFlags.doMonitoringGlobal() or InDetFlags.doMonitoringPrimaryVertexingEnh if InDetFlags.doMonitoringGlobal(): from InDetVertexMonitoring.InDetVertexMonitoringConf import InDetVertexMonitoring InDetVertexMonitoring = InDetVertexMonitoring( name = "InDetVertexMonitoring", - VertexContainer = InDetKeys.PrimaryVertices(), + VertexContainer = InDetKeys.xAODVertexContainer(), DoControlPlots = False, histFolder = "InDetGlobal/PrimaryVertexMultiplicity" ) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py index 1b42891a27f..fc9c9a0f08e 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py @@ -81,6 +81,9 @@ if doErrorMonAlg: pixelAthMonAlgErrorMonAlg = helper.addAlgorithm(PixelAthErrorMonAlg, 'PixelAthErrorMonAlg') for k, v in kwargsErrMonAlg.items(): setattr(pixelAthMonAlgErrorMonAlg, k, v) + from PixelConditionsTools.PixelConditionsToolsConf import PixelByteStreamErrorsTool + # never attempt to write bytestream error objects + pixelAthMonAlgErrorMonAlg.PixelByteStreamErrorsTool = PixelByteStreamErrorsTool(ReadingESD = True) PixelAthErrorMonAlgCfg(helper, pixelAthMonAlgErrorMonAlg, **kwargsErrMonAlg) topSequence += helper.result() diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py index b34c0cd5b11..18736a0d8bf 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringTRT.py @@ -88,7 +88,8 @@ InDetTRT_Monitoring_Tool = TRT_Monitoring_Tool (name = " min_si_hits = minSiHitCut, # default = 3 min_pixel_hits = minPixHitCut, # default = 1 min_sct_hits = 0, - min_trt_hits = 10 + min_trt_hits = 10, + TrigDecisionObjectName = "xTrigDecision" if DQMonFlags.useTrigger else "" ) if jobproperties.Beam.beamType()=='collisions': diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt index e01c086e997..d6839441468 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/CMakeLists.txt @@ -26,6 +26,5 @@ atlas_add_component( InDetDiMuonMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaMonitoringLib xAODMuon xAODTracking GaudiKernel StoreGateLib SGtests ) # Install files from the package: -atlas_install_headers( InDetDiMuonMonitoring ) atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx index c9aabceb83b..8d488de9596 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx @@ -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 */ #include <sstream> @@ -8,8 +8,7 @@ #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/PhysicalConstants.h" -#include "InDetDiMuonMonitoring/DiMuMon.h" -#include "xAODMuon/MuonContainer.h" +#include "DiMuMon.h" #include "xAODMuon/Muon.h" #include <math.h> @@ -41,11 +40,9 @@ DiMuMon::DiMuMon( const std::string & type, const std::string & name, const IInterface* parent ) : ManagedMonitorToolBase( type, name, parent ) , m_triggerChainName("NoTrig") - , m_muonCollection("Muons") { declareProperty( "resonName", m_resonName = "Zmumu" ); declareProperty( "triggerChainName", m_triggerChainName = "NoTrig" ); - declareProperty( "muonCollection", m_muonCollection = "Muons" ); declareProperty( "setDebug", m_setDebug = false ); declareProperty( "minInvmass", m_minInvmass = 60.); declareProperty( "maxInvmass", m_maxInvmass = 120.); @@ -72,6 +69,7 @@ DiMuMon::~DiMuMon() StatusCode DiMuMon::initialize(){ ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_muonCollection.initialize() ); if (m_regions.empty()) { m_regions.push_back("All"); @@ -257,20 +255,17 @@ StatusCode DiMuMon::bookHistograms() StatusCode DiMuMon::fillHistograms() { - // if (m_lumiBlockNum<402 || m_lumiBlockNum>1330) return StatusCode::SUCCESS; - - double muonMass = 105.66*Gaudi::Units::MeV; + const double muonMass = 105.66*Gaudi::Units::MeV; //retrieve all muons - const xAOD::MuonContainer* muons(0); - StatusCode sc = evtStore()->retrieve(muons, m_muonCollection); - if(sc.isFailure()){ + SG::ReadHandle<xAOD::MuonContainer> muons{m_muonCollection}; + if(!muons.isValid()){ ATH_MSG_WARNING("Could not retrieve muon container"); - return sc; + return StatusCode::FAILURE; } else ATH_MSG_DEBUG("Muon container successfully retrieved."); //make a new container xAOD::MuonContainer* goodMuons = new xAOD::MuonContainer( SG::VIEW_ELEMENTS ); - sc = evtStore()->record ( goodMuons, "myGoodMuons" + m_triggerChainName + m_resonName); + StatusCode sc = evtStore()->record ( goodMuons, "myGoodMuons" + m_triggerChainName + m_resonName); if (!sc.isSuccess()) { ATH_MSG_WARNING("Could not record good muon tracks container."); return StatusCode::FAILURE; diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/InDetDiMuonMonitoring/DiMuMon.h b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.h similarity index 92% rename from InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/InDetDiMuonMonitoring/DiMuMon.h rename to InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.h index 07648797421..5e260abc480 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/InDetDiMuonMonitoring/DiMuMon.h +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.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 DiMuMon_H @@ -12,6 +12,7 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" +#include "xAODMuon/MuonContainer.h" class TH1F; @@ -62,7 +63,7 @@ class DiMuMon : public ManagedMonitorToolBase std::string m_resonName{}; std::string m_triggerChainName{}; - std::string m_muonCollection{}; + SG::ReadHandleKey<xAOD::MuonContainer> m_muonCollection{this, "muonCollection", "Muons"}; bool m_doFits{}; bool m_doSaveFits{}; diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx index 0657ecf56b9..aecca645a76 100644 --- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx +++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/components/InDetDiMuonMonitoring_entries.cxx @@ -1,3 +1,3 @@ -#include "InDetDiMuonMonitoring/DiMuMon.h" +#include "../DiMuMon.h" DECLARE_COMPONENT( DiMuMon ) diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h index 9c76bc489d2..d2847b9ea97 100755 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.h +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalBeamSpotMonTool.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 */ // ******************************************************************************** @@ -90,7 +90,7 @@ private: std::string m_stream; bool m_useBeamspot; - SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName{this,"vxContainerName","VxPrimaryCandidate","Vertex Container for Global Beamsport Monitoring"}; + SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName{this,"vxContainerName","PrimaryVertices","Vertex Container for Global Beamsport Monitoring"}; bool m_vxContainerWithBeamConstraint; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackContainerName{this,"trackContainerName","TrackParticle container for Gloabl Beamsport Monitoring"}; diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx index 98bfffcc5ef..8e0bade70f8 100755 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPrimaryVertexMonTool.cxx @@ -80,8 +80,8 @@ StatusCode InDetGlobalPrimaryVertexMonTool::initialize() { if(!sc.isSuccess()) return sc; ATH_CHECK( m_vxContainerName.initialize() ); - ATH_CHECK( m_vxContainerNameWithoutBeamConstraint.initialize() ); - ATH_CHECK( m_vxContainerNameSplit.initialize() ); + ATH_CHECK( m_vxContainerNameWithoutBeamConstraint.initialize(m_doEnhancedMonitoring) ); + ATH_CHECK( m_vxContainerNameSplit.initialize(m_doEnhancedMonitoring) ); return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py index 77939a91475..c2ea2bf8c04 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/TrackMonitoring.py @@ -114,7 +114,7 @@ for trackCollection in trackCollections: tracksName = trackCollection, useExtendedPlots = True, triggerChainName = "all", - VxPrimContainerName = InDetKeys.PrimaryVertices() + VxPrimContainerName = InDetKeys.xAODVertexContainer() ) #ToolSvc += InDetAlignMonGenericTracks InDetAlignMonManager.AthenaMonTools += [ InDetAlignMonGenericTracks ] diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py index 0f6b56933ad..77bdacc15a1 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelMonitoringConfig.py @@ -75,6 +75,8 @@ def PixelMonitoringConfig(flags): pixelAthMonAlgErrorMonAlg = helper.addAlgorithm(PixelAthErrorMonAlg, 'PixelAthErrorMonAlg') for k, v in kwargsErrMonAlg.items(): setattr(pixelAthMonAlgErrorMonAlg, k, v) + from PixelConditionsTools.PixelConditionsToolsConf import PixelByteStreamErrorsTool + pixelAthMonAlgErrorMonAlg.PixelByteStreamErrorsTool = PixelByteStreamErrorsTool(ReadingESD = (flags.DQ.Environment == 'tier0ESD')) PixelAthErrorMonAlgCfg(helper, pixelAthMonAlgErrorMonAlg, **kwargsErrMonAlg) acc.merge(helper.result()) diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx index 2378a8e29b9..5f5669ea3d4 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx @@ -9,7 +9,7 @@ PixelAthErrorMonAlg::PixelAthErrorMonAlg( const std::string& name, ISvcLocator* m_pixelid(nullptr) { //jo flags - declareProperty("ErrorsTool", m_pixelErrorTool); + // declareProperty("ErrorsTool", m_pixelErrorTool); declareProperty("doOnline", m_doOnline = false); declareProperty("doModules", m_doModules = false); declareProperty("doLumiBlock", m_doLumiBlock = false); diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx index c370f9d9b26..111a0cd10aa 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx @@ -1,10 +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 */ #ifdef ONLINE // This tool is only meant for special online monitoring at Point 1 -#include "TRT_Monitoring/TRT_Hits_Monitoring_Tool.h" +#include "TRT_Hits_Monitoring_Tool.h" #include "TRT_ReadoutGeometry/TRT_DetectorManager.h" #include "StoreGate/ReadHandle.h" diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.h similarity index 100% rename from InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h rename to InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.h diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx index 8489cc144ad..88680b033a1 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "TRT_Monitoring/TRT_Monitoring_Tool.h" +#include "TRT_Monitoring_Tool.h" #include "AthContainers/DataVector.h" #include "TRT_ReadoutGeometry/TRT_DetectorManager.h" @@ -589,7 +589,7 @@ StatusCode TRT_Monitoring_Tool::initialize() { ATH_CHECK( m_xAODEventInfoKey.initialize() ); ATH_CHECK( m_TRT_BCIDCollectionKey.initialize() ); ATH_CHECK( m_comTimeObjectKey.initialize() ); - ATH_CHECK( m_trigDecisionKey.initialize() ); + ATH_CHECK( m_trigDecisionKey.initialize(!m_trigDecisionKey.empty()) ); ATH_MSG_INFO("My TRT_DAQ_ConditionsSvc is " << m_DAQSvc); @@ -1131,7 +1131,13 @@ StatusCode TRT_Monitoring_Tool::fillHistograms() { SG::ReadHandle<xAOD::EventInfo> xAODEventInfo(m_xAODEventInfoKey); SG::ReadHandle<InDetTimeCollection> trtBCIDCollection(m_TRT_BCIDCollectionKey); SG::ReadHandle<ComTime> comTimeObject(m_comTimeObjectKey); - SG::ReadHandle<xAOD::TrigDecision> trigDecision(m_trigDecisionKey); + const xAOD::TrigDecision* trigDecision(nullptr); + if (!m_trigDecisionKey.empty()) { + SG::ReadHandle<xAOD::TrigDecision> htrigDecision{m_trigDecisionKey}; + if (htrigDecision.isValid()) { + trigDecision = htrigDecision.get(); + } + } if (!xAODEventInfo.isValid()) { ATH_MSG_ERROR("Could not find event info object " << m_xAODEventInfoKey.key() << @@ -1170,7 +1176,7 @@ StatusCode TRT_Monitoring_Tool::fillHistograms() { " in store"); return StatusCode::FAILURE; } - if (!trigDecision.isValid()) { + if (!m_trigDecisionKey.empty() && !trigDecision) { ATH_MSG_INFO("Could not find trigger decision object " << m_trigDecisionKey.key() << " in store"); } @@ -1180,7 +1186,7 @@ StatusCode TRT_Monitoring_Tool::fillHistograms() { " in store"); } if (m_passEventBurst) { - ATH_CHECK( fillTRTTracks(*trackCollection, trigDecision.ptr(), comTimeObject.ptr()) ); + ATH_CHECK( fillTRTTracks(*trackCollection, trigDecision, comTimeObject.ptr()) ); } } diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h similarity index 100% rename from InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h rename to InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.h diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx index 3cabca0e153..a3d13d00e11 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/components/TRT_Monitoring_entries.cxx @@ -1,5 +1,5 @@ -#include "TRT_Monitoring/TRT_Monitoring_Tool.h" -#include "TRT_Monitoring/TRT_Hits_Monitoring_Tool.h" +#include "../TRT_Monitoring_Tool.h" +#include "../TRT_Hits_Monitoring_Tool.h" DECLARE_COMPONENT( TRT_Monitoring_Tool ) #ifdef ONLINE diff --git a/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx b/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx index 8a0b30657dc..c75c8e931d3 100644 --- a/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx +++ b/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx @@ -10,11 +10,10 @@ LArClusterCollisionTimeAlg:: LArClusterCollisionTimeAlg(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name,pSvcLocator), m_nEvt(0), - m_nCollEvt(0) - { - declareProperty("InputName", m_clusterContainerName="LArClusterEM"); - declareProperty("OutputName",m_outputName="LArClusterCollTime"); - } + m_nCollEvt(0), + m_clusterContainerName{this, "InputName", "LArClusterEM"}, + m_outputName{this, "OutputName", "LArClusterCollTime"} + {} //__________________________________________________________________________ //Destructor diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx index 1022389efe0..1742a1d2303 100755 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx @@ -2,19 +2,13 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "xAODJet/JetContainer.h" #include "xAODJet/JetAttributes.h" #include "xAODBTagging/BTagging.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODMuon/MuonContainer.h" -#include "JetTagMonitoring/JetTagMonitoring.h" +#include "JetTagMonitoring.h" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" +// #include "xAODTracking/TrackParticle.h" +// #include "xAODTracking/Vertex.h" #include "TrigDecisionTool/TrigDecisionTool.h" // added by SARA #include "TrkParticleBase/LinkToTrackParticleBase.h" @@ -39,43 +33,15 @@ #include <string> #include <sstream> -//** --------------------------------------------------------------------------------------------------------------- **// - -// Private methods - -namespace { - - template< class T > - bool retrieveCollection(const ServiceHandle<StoreGateSvc>& sg, const DataHandle<T>& coll, std::string key ) { - - StatusCode sc; - sc = sg->retrieve( coll, key ); - - if (!sc.isSuccess()) - return false; - - return true; - } - -} // unnamed namespace - - //** --------------------------------------------------------------------------------------------------------------- **// JetTagMonitoring::JetTagMonitoring(const std::string & type, const std::string & name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent), - m_storeGate( "StoreGateSvc", name ), m_histogramsCreated(false), - m_switch_off(false) + m_switch_off(false), + m_jetBtagKey(this, "JetBtagKey", m_jetName.key()+".btaggingLink") { - - declareProperty("JetContainer", m_jetName = "AntiKt4EMTopoJets"); - declareProperty("TrackParticleContainer", m_trackParticleName = "InDetTrackParticles"); - declareProperty("PrimaryVertexContainer", m_primaryVertexName = "PrimaryVertices"); - declareProperty("ElectronContainer", m_electronName = "Electrons"); // added by SARA - declareProperty("MuonContainer", m_muonName = "Muons" ); // added by SARA - declareProperty("DQcuts", m_do_cuts = true); declareProperty("PriVtxTrkMinCut", m_pri_vtx_trk_min_cut = 4 ); @@ -174,11 +140,12 @@ StatusCode JetTagMonitoring::initialize() { return sc; } - sc = m_storeGate.retrieve(); - if (!sc.isSuccess()) { - ATH_MSG_WARNING("Unable to retrieve StoreGateSvc handle"); - m_switch_off = true; - } + ATH_CHECK(m_jetName.initialize()); + ATH_CHECK(m_trackParticleName.initialize()); + ATH_CHECK(m_primaryVertexName.initialize()); + ATH_CHECK(m_electronName.initialize()); + ATH_CHECK(m_muonName.initialize()); + ATH_CHECK(m_eventInfoKey.initialize()); if ( m_use_trackselector ) { if ( m_trackSelectorTool.retrieve().isFailure() ) { @@ -588,9 +555,11 @@ StatusCode JetTagMonitoring::fillHistograms() { m_cutflow->Fill(0.); - const xAOD::EventInfo* thisEventInfo; - if (evtStore()->retrieve(thisEventInfo).isFailure()) - ATH_MSG_WARNING("Cannot retrieve EventInfo"); + SG::ReadHandle<xAOD::EventInfo> thisEventInfo{m_eventInfoKey}; + if (!thisEventInfo.isValid()) { + ATH_MSG_ERROR("Cannot retrieve EventInfo"); + return StatusCode::FAILURE; + } m_lumiBlockNum = thisEventInfo->lumiBlock(); @@ -691,16 +660,13 @@ StatusCode JetTagMonitoring::fillHistograms() { unsigned int npv = 0, npv_trk = 0; double xpv = 0., ypv = 0., zpv = 0.; - const xAOD::VertexContainer* vxContainer(0); - // const DataHandle<VxContainer> vxContainer; - StatusCode foundPrimaryVtx = evtStore()->retrieve(vxContainer, m_primaryVertexName); - - if (!foundPrimaryVtx) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_primaryVertexName << "\" from StoreGate"); + SG::ReadHandle<xAOD::VertexContainer> vxContainer{m_primaryVertexName}; + if (!vxContainer.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_primaryVertexName.key() << "\" from StoreGate"); return StatusCode::SUCCESS; } - ATH_MSG_DEBUG("VxContainer \"" << m_primaryVertexName << "\" found with " << vxContainer->size() << " entries"); + ATH_MSG_DEBUG("VxContainer \"" << m_primaryVertexName.key() << "\" found with " << vxContainer->size() << " entries"); npv = vxContainer->size(); m_global_nPrimVtx->Fill((float)npv); @@ -785,18 +751,14 @@ StatusCode JetTagMonitoring::fillHistograms() { /////////////////////////////// - const DataHandle<xAOD::TrackParticleContainer> trackParticles; - bool foundTrackPartColl = retrieveCollection(m_storeGate, trackParticles, m_trackParticleName); - - if (!foundTrackPartColl) { - - ATH_MSG_WARNING("Unable to retrieve \"" << m_trackParticleName << "\" from StoreGate"); + SG::ReadHandle<xAOD::TrackParticleContainer> trackParticles{m_trackParticleName}; + if (!trackParticles.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_trackParticleName.key() << "\" from StoreGate"); return StatusCode::SUCCESS; - } - ATH_MSG_DEBUG("TrackParticleContainer \"" << m_trackParticleName << "\" found with " << trackParticles->size() << " entries"); + ATH_MSG_DEBUG("TrackParticleContainer \"" << m_trackParticleName.key() << "\" found with " << trackParticles->size() << " entries"); xAOD::TrackParticleContainer::const_iterator trackParticleItr = trackParticles->begin(); xAOD::TrackParticleContainer::const_iterator trackParticleEnd = trackParticles->end(); @@ -926,29 +888,25 @@ bool JetTagMonitoring::isTopEvent() { // added by SARA for 2017 data taking // == 1 isolated muon with pT > m_MuonPtCut (normally 25 GeV) // electron and muon of opposite charge - const DataHandle<xAOD::ElectronContainer> electrons; - bool foundElectronColl = retrieveCollection(m_storeGate, electrons, m_electronName); - - if (!foundElectronColl) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_electronName << "\" from StoreGate"); + SG::ReadHandle<xAOD::ElectronContainer> electrons{m_electronName}; + if (!electrons.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_electronName.key() << "\" from StoreGate"); return false; } - ATH_MSG_DEBUG("ElectronContainer \"" << m_electronName << "\" found with " << electrons->size() << " entries"); + ATH_MSG_DEBUG("ElectronContainer \"" << m_electronName.key() << "\" found with " << electrons->size() << " entries"); xAOD::ElectronContainer::const_iterator electronItr = electrons->begin(); xAOD::ElectronContainer::const_iterator electronEnd = electrons->end(); xAOD::ElectronContainer::const_iterator isoElectronItr = electrons->end(); - const DataHandle<xAOD::MuonContainer> muons; - bool foundMuonColl = retrieveCollection(m_storeGate, muons, m_muonName); - - if (!foundMuonColl) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_muonName << "\" from StoreGate"); + SG::ReadHandle<xAOD::MuonContainer> muons{m_muonName}; + if (!muons.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_muonName.key() << "\" from StoreGate"); return false; } - ATH_MSG_DEBUG("MuonContainer \"" << m_muonName << "\" found with " << muons->size() << " entries"); + ATH_MSG_DEBUG("MuonContainer \"" << m_muonName.key() << "\" found with " << muons->size() << " entries"); xAOD::MuonContainer::const_iterator muonItr = muons->begin(); xAOD::MuonContainer::const_iterator muonEnd = muons->end(); @@ -1125,15 +1083,13 @@ void JetTagMonitoring::fillJetHistograms() { //* Jet container *// ///////////////////// - const DataHandle<xAOD::JetContainer> jets; - bool foundJetColl = retrieveCollection(m_storeGate, jets, m_jetName); - - if (!foundJetColl) { - ATH_MSG_WARNING("Unable to retrieve \"" << m_jetName << "\" from StoreGate"); + SG::ReadHandle<xAOD::JetContainer> jets{m_jetName}; + if (!jets.isValid()) { + ATH_MSG_WARNING("Unable to retrieve \"" << m_jetName.key() << "\" from StoreGate"); return; } - ATH_MSG_DEBUG("JetContainer \"" << m_jetName << "\" found with " << jets->size() << " entries"); + ATH_MSG_DEBUG("JetContainer \"" << m_jetName.key() << "\" found with " << jets->size() << " entries"); xAOD::JetContainer::const_iterator jetItr = jets->begin(); xAOD::JetContainer::const_iterator jetEnd = jets->end(); diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.h similarity index 94% rename from PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h rename to PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.h index 91643af204a..aac2f4c94ea 100755 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.h @@ -26,7 +26,14 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "JetTagTools/TrackSelector.h" -#include "xAODJet/Jet.h" +#include "xAODJet/JetContainer.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" +#include "xAODEventInfo/EventInfo.h" + +// #include "xAODJet/Jet.h" #include "TrigDecisionTool/TrigDecisionTool.h" // added by SARA class TH1F_LW; @@ -93,8 +100,6 @@ private: Jet_t getTaggabilityLabel(const xAOD::Jet *jet); bool isTopEvent(); // added by SARA - ServiceHandle<StoreGateSvc> m_storeGate; - ToolHandle< Analysis::TrackSelector > m_trackSelectorTool{this, "TrackSelectorTool", "Analysis::TrackSelector"}; ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool{this, "TrackToVertexTool", "Reco::TrackToVertex"}; @@ -106,15 +111,18 @@ private: const xAOD::Vertex* m_priVtx = nullptr; /** @brief String to retrieve JetContainer from StoreGate. */ - std::string m_jetName; + SG::ReadHandleKey<xAOD::JetContainer> m_jetName {this, "JetContainer", "AntiKt4EMTopoJets"}; /** @brief String to retrieve TrackParticleContainer from StoreGate. */ - std::string m_trackParticleName; + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleName {this, "TrackParticleContainer", "InDetTrackParticles"}; /** @brief String to retrieve PrimaryVertexContainer from StoreGate. */ - std::string m_primaryVertexName; + SG::ReadHandleKey<xAOD::VertexContainer> m_primaryVertexName {this, "PrimaryVertexContainer", "PrimaryVertices"}; /** @brief String to retrieve ElectronContainer from StoreGate. */ - std::string m_electronName; // added by SARA + SG::ReadHandleKey<xAOD::ElectronContainer> m_electronName {this, "ElectronContainer", "Electrons"}; // added by SARA /** @brief String to retrieve MuonContainer from StoreGate. */ - std::string m_muonName; // added by SARA + SG::ReadHandleKey<xAOD::MuonContainer> m_muonName {this, "MuonContainer", "Muons"}; // added by SARA + + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {this, "EventInfoKey", "EventInfo"}; + SG::ReadDecorHandleKey<xAOD::JetContainer> m_jetBtagKey; /** @brief DQ cuts switcher. */ bool m_do_cuts; double m_trk_d0_min_cut; diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx index 31a3b80d3b7..624e604f719 100644 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/components/JetTagMonitoring_entries.cxx @@ -1,4 +1,4 @@ -#include "JetTagMonitoring/JetTagMonitoring.h" +#include "../JetTagMonitoring.h" #include "../JetTagMonitorAlgorithm.h" DECLARE_COMPONENT( JetTagMonitoring ) diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h index 930ba84ed2c..08e34fcf8f1 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetContainerHistoFiller.h @@ -57,7 +57,7 @@ protected: /// The list of histogramming tools ToolHandleArray<JetHistoBase> m_histoTools; /// the jet container to build histos from - std::string m_jetContainerName; + SG::ReadHandleKey<xAOD::JetContainer> m_jetContainerName{this, "JetContainer", ""}; }; #endif diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx index f91740c24a2..6181d034482 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx @@ -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 */ #include "JetMonitoring/JetContainerHistoFiller.h" @@ -7,11 +7,8 @@ JetContainerHistoFiller::JetContainerHistoFiller(const std::string& n) : HistoGroupBase(n) , m_histoTools(this) - , m_jetContainerName("") { declareInterface<JetContainerHistoFiller>(this); - - declareProperty("JetContainer", m_jetContainerName=""); declareProperty("HistoTools", m_histoTools); } @@ -20,12 +17,13 @@ StatusCode JetContainerHistoFiller::initialize() { CHECK( m_histoTools.retrieve() ); - if(m_jetContainerName=="") { + if(m_jetContainerName.empty()) { ATH_MSG_ERROR("Jet Container name not set. Please set the JetContainer property"); return StatusCode::FAILURE; } + CHECK( m_jetContainerName.initialize() ); - if(m_histoDir=="") m_histoDir = m_jetContainerName+"/"; + if(m_histoDir=="") m_histoDir = m_jetContainerName.key()+"/"; return StatusCode::SUCCESS; } @@ -34,7 +32,7 @@ StatusCode JetContainerHistoFiller::initialize() { int JetContainerHistoFiller::fillHistos(){ - ATH_MSG_DEBUG ("Filling hists " << name() << "..." << m_jetContainerName); + ATH_MSG_DEBUG ("Filling hists " << name() << "..." << m_jetContainerName.key()); const xAOD::EventInfo* evtInfo; CHECK(evtStore()->retrieve( evtInfo ), 1); @@ -45,10 +43,9 @@ int JetContainerHistoFiller::fillHistos(){ return 1; } - const xAOD::JetContainer* jCont = 0; - StatusCode sc= evtStore()->retrieve(jCont, m_jetContainerName) ; - if( sc.isFailure() ) { - ATH_MSG_DEBUG (" No container " << m_jetContainerName<< " in Evt store. Returning."); + SG::ReadHandle<xAOD::JetContainer> jCont{m_jetContainerName}; + if( !jCont.isValid() ) { + ATH_MSG_DEBUG (" No container " << m_jetContainerName.key()<< " in Evt store. Returning."); return 0; } diff --git a/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h b/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h index 5385981b6df..456fdb1154b 100755 --- a/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.h +++ b/Reconstruction/MissingETMonitoring/MissingETMonitoring/METMonTool.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 METMonTool_H @@ -17,6 +17,10 @@ #include "JetInterface/IJetSelector.h" +#include "xAODMissingET/MissingETContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODEgamma/ElectronContainer.h" +#include "xAODMuon/MuonContainer.h" #include <string> #include <vector> @@ -70,15 +74,18 @@ class METMonTool : public ManagedMonitorToolBase ToolHandle<GenericMonitoringTool> m_genTool{ this, "GenTool", "", "Generic monitoring tool" }; - Gaudi::Property<std::string> m_suffix{ this, "NameSuffix", "", "" }; + StringProperty m_suffix{ this, "NameSuffix", "", "" }; // TB this needs to be converted into the ReadHandles, for now doing c++11 move - std::vector<std::string> m_metKeys; - std::string m_metFinKey = "MET_RefFinal"; - std::string m_metCalKey = "MET_LocHadTopo"; - std::string m_metRegKey = ""; - std::string m_jetColKey = "AntiKt4LCTopoJets"; - std::string m_eleColKey = "Electrons"; - std::string m_muoColKey = "Muons"; + StringArrayProperty m_metKeys {this, "metKeys", {"MET_Base", "MET_Topo", "MET_Track"}}; + SG::ReadHandleKeyArray<xAOD::MissingETContainer> m_metKeysFull {this, "metKeysFull", {}, "Don't set this manually, please"}; + SG::ReadHandleKey<xAOD::MissingETContainer> m_metForCut {this, "metForCut", "MET_Reference_AntiKt4LCTopo", "MET object for cuts"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey {this, "eventInfoKey", "EventInfo"}; + StringProperty m_metFinKey {this, "metFinKey", "MET_RefFinal"}; + StringProperty m_metCalKey {this, "metCalKey", "MET_Calo"}; + StringProperty m_metRegKey {this, "metRegKey", "", "Set to MET_TruthRegions if desired"}; + SG::ReadHandleKey<xAOD::JetContainer> m_jetColKey {this, "jetColKey", "AntiKt4LCTopoJets"}; + SG::ReadHandleKey<xAOD::ElectronContainer> m_eleColKey {this, "eleColKey", "Electrons"}; + SG::ReadHandleKey<xAOD::MuonContainer> m_muoColKey {this, "muoColKey", "Muons"}; diff --git a/Reconstruction/MissingETMonitoring/src/METMonTool.cxx b/Reconstruction/MissingETMonitoring/src/METMonTool.cxx index 3544071a592..2b2cc489324 100755 --- a/Reconstruction/MissingETMonitoring/src/METMonTool.cxx +++ b/Reconstruction/MissingETMonitoring/src/METMonTool.cxx @@ -18,16 +18,12 @@ #include "xAODEventInfo/EventInfo.h" #include "xAODMissingET/MissingET.h" -#include "xAODMissingET/MissingETContainer.h" #include "xAODMissingET/MissingETComposition.h" #include "xAODJet/Jet.h" -#include "xAODJet/JetContainer.h" #include "xAODEgamma/Electron.h" -#include "xAODEgamma/ElectronContainer.h" #include "xAODMuon/Muon.h" -#include "xAODMuon/MuonContainer.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -77,23 +73,63 @@ static const std::map<std::string, std::pair<std::string, std::string> > key2Sub METMonTool::METMonTool(const std::string& type, const std::string& name, const IInterface* parent) : ManagedMonitorToolBase(type, name, parent) -{ - // declare properties, this will disappear once moved data handles - // fill vector with Missing Et Sources - - declareProperty("metKeys", m_metKeys={"MET_Base", "MET_Topo", "MET_Track"}); - declareProperty("metFinKey", m_metFinKey); - declareProperty("metCalKey", m_metCalKey); - declareProperty("metRegKey", m_metRegKey); - declareProperty("jetColKey", m_jetColKey); - declareProperty("eleColKey", m_eleColKey); - declareProperty("muoColKey", m_muoColKey); -} +{} StatusCode METMonTool::initialize() { - + // If m_metFinKey is not empty then append it to m_metKeys + if (m_metFinKey != "") + { + std::vector<std::string>::iterator it = m_metKeys.begin(); + // Remove m_metFinKey from m_metKeys if it already exists + for (; it != m_metKeys.end();) + { + if ((*it) == m_metFinKey) it = m_metKeys.erase(it); + else it++; + } + m_metKeys.value().push_back(m_metFinKey); + } + + m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0); + + // ...and debug + + ATH_MSG_DEBUG("Using the following keys:"); + ATH_MSG_DEBUG("metCalKey = " << m_metCalKey); + ATH_MSG_DEBUG("metRegKey = " << m_metRegKey); + ATH_MSG_DEBUG("metKeys = "); + std::vector<std::string>::iterator it = m_metKeys.begin(); + for (; it != m_metKeys.end(); it++) + { + ATH_MSG_DEBUG((*it)); + } + ATH_MSG_DEBUG(""); + + // what are the actual storegate keys? + std::unordered_set<std::string> realSGKeys; + for (const auto& k : m_metKeys) { + const auto itr = key2SubSkeyMap.find(k); + if (itr != key2SubSkeyMap.end()) { + realSGKeys.insert(itr->second.first); + } + } + for (const auto& k : std::vector<std::string>{ m_metCalKey, m_metRegKey }) { + const auto itr = key2SubSkeyMap.find(k); + if (itr != key2SubSkeyMap.end()) { + realSGKeys.insert(itr->second.first); + } + } + for (const auto& k : realSGKeys) { + m_metKeysFull.push_back(k); + } + + ATH_CHECK(m_metKeysFull.initialize()); + ATH_CHECK(m_metForCut.initialize()); + ATH_CHECK(m_eventInfoKey.initialize()); + ATH_CHECK(m_jetColKey.initialize(!m_jetColKey.empty())); + ATH_CHECK(m_eleColKey.initialize(!m_eleColKey.empty())); + ATH_CHECK(m_muoColKey.initialize(!m_muoColKey.empty())); //resize vector with number of WARNINGs already displayed for retrieval of a certain container m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0); @@ -125,34 +161,6 @@ StatusCode METMonTool::bookHistograms() { ATH_MSG_DEBUG("in bookHistograms()"); - // If m_metFinKey is not empty then append it to m_metKeys - if (m_metFinKey != "") - { - std::vector<std::string>::iterator it = m_metKeys.begin(); - // Remove m_metFinKey from m_metKeys if it already exists - for (; it != m_metKeys.end();) - { - if ((*it) == m_metFinKey) it = m_metKeys.erase(it); - else it++; - } - m_metKeys.push_back(m_metFinKey); - } - - m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0); - - // ...and debug - - ATH_MSG_DEBUG("Using the following keys:"); - ATH_MSG_DEBUG("metCalKey = " << m_metCalKey); - ATH_MSG_DEBUG("metRegKey = " << m_metRegKey); - ATH_MSG_DEBUG("metKeys = "); - std::vector<std::string>::iterator it = m_metKeys.begin(); - for (; it != m_metKeys.end(); it++) - { - ATH_MSG_DEBUG((*it)); - } - ATH_MSG_DEBUG(""); - // Check consistency between m_etrangeCalFactors and m_calIndices if (m_etrangeCalFactors.size() < m_calIndices) @@ -204,9 +212,9 @@ StatusCode METMonTool::bookHistograms() if (m_metFinKey != "" && i == nSources - 1) { bookSourcesHistograms(m_metKeys[i], met_summary, true).ignore(); - if (m_jetColKey != "") bookProfileHistograms(m_metKeys[i], "Jet", met_jets, &m_iJet).ignore(); - if (m_eleColKey != "") bookProfileHistograms(m_metKeys[i], "Ele", met_electrons, &m_iEle).ignore(); - if (m_muoColKey != "") bookProfileHistograms(m_metKeys[i], "Muo", met_muons, &m_iMuo).ignore(); + if (!m_jetColKey.empty()) bookProfileHistograms(m_metKeys[i], "Jet", met_jets, &m_iJet).ignore(); + if (!m_eleColKey.empty()) bookProfileHistograms(m_metKeys[i], "Ele", met_electrons, &m_iEle).ignore(); + if (!m_muoColKey.empty()) bookProfileHistograms(m_metKeys[i], "Muo", met_muons, &m_iMuo).ignore(); } else bookSourcesHistograms(m_metKeys[i], met_sources, false).ignore(); } @@ -777,10 +785,8 @@ StatusCode METMonTool::fillHistograms() { ATH_MSG_DEBUG("in fillHistograms()"); - const xAOD::EventInfo* thisEventInfo = 0; - StatusCode sc(evtStore()->retrieve(thisEventInfo)); - - if (sc != StatusCode::SUCCESS) + SG::ReadHandle<xAOD::EventInfo> thisEventInfo{m_eventInfoKey}; + if (!thisEventInfo.isValid()) ATH_MSG_DEBUG("No EventInfo object found! Can't access LAr event info status!"); else { @@ -807,12 +813,13 @@ StatusCode METMonTool::fillSourcesHistograms() ATH_MSG_DEBUG("in fillSourcesHistograms()"); const xAOD::JetContainer* xJetCollection = 0; - if (m_jetColKey != "") + if (!m_jetColKey.empty()) { - ATH_CHECK(evtStore()->retrieve(xJetCollection, "AntiKt4LCTopoJets")); + SG::ReadHandle<xAOD::JetContainer> xhJetCollection{m_jetColKey}; + xJetCollection = xhJetCollection.get(); if (!xJetCollection) { - ATH_MSG_WARNING("Unable to retrieve JetContainer: " << "AntiKt4LCTopoJets"); + ATH_MSG_WARNING("Unable to retrieve JetContainer: " << m_jetColKey.key()); } else { @@ -856,12 +863,13 @@ StatusCode METMonTool::fillSourcesHistograms() const xAOD::ElectronContainer* xElectrons = 0; const xAOD::Electron* xhEle = 0; - if (m_eleColKey != "") + if (!m_eleColKey.empty()) { - ATH_CHECK(evtStore()->retrieve(xElectrons, "Electrons")); + SG::ReadHandle<xAOD::ElectronContainer> rhElectrons{m_eleColKey}; + xElectrons = rhElectrons.get(); if (!xElectrons) { - ATH_MSG_WARNING("Unable to retrieve ElectronContainer: " << "Electrons"); + ATH_MSG_WARNING("Unable to retrieve ElectronContainer: " << m_eleColKey.key()); } else { @@ -879,12 +887,13 @@ StatusCode METMonTool::fillSourcesHistograms() const xAOD::MuonContainer* xMuons = 0; const xAOD::Muon* xhMuon = 0; - if (m_muoColKey != "") + if (!m_muoColKey.empty()) { - ATH_CHECK(evtStore()->retrieve(xMuons, "Muons")); + SG::ReadHandle<xAOD::MuonContainer> rhMuons{m_muoColKey}; + xMuons = rhMuons.get(); if (!xMuons) { - ATH_MSG_WARNING("Unable to retrieve muon collection: " << "Muons"); + ATH_MSG_WARNING("Unable to retrieve muon collection: " << m_muoColKey.key()); m_ContainerWarnings_Muon++; } else @@ -907,9 +916,8 @@ StatusCode METMonTool::fillSourcesHistograms() bool doSummary = (m_metKeys.size() > 1); if (m_met_cut_80) { - if (evtStore()->contains<xAOD::MissingETContainer>("MET_Reference_AntiKt4LCTopo")) { - const xAOD::MissingETContainer* xMissEt_forCut = 0; - ATH_CHECK(evtStore()->retrieve(xMissEt_forCut, "MET_Reference_AntiKt4LCTopo")); + SG::ReadHandle<xAOD::MissingETContainer> xMissEt_forCut{m_metForCut}; + if (xMissEt_forCut.isValid()) { float et_RefFinal = (*xMissEt_forCut)["FinalClus"]->met() / CLHEP::GeV; if (et_RefFinal < m_met_cut) return StatusCode::SUCCESS; } @@ -942,11 +950,10 @@ StatusCode METMonTool::fillSourcesHistograms() const xAOD::MissingETContainer* xMissEt = 0; - bool sc_exists = evtStore()->contains<xAOD::MissingETContainer>(xaod_key); + SG::ReadHandle<xAOD::MissingETContainer> xhMissEt{xaod_key}; - if (sc_exists) - { - ATH_CHECK(evtStore()->retrieve(xMissEt, xaod_key)); + if (xhMissEt.isValid()) { + xMissEt = xhMissEt.get(); if (!xMissEt) @@ -1033,23 +1040,19 @@ StatusCode METMonTool::fillCalosHistograms() bool doSummary = (m_calIndices > 1); const xAOD::MissingETContainer* xmetCal = 0; - bool sc_exists = evtStore()->contains<xAOD::MissingETContainer>("MET_Calo"); - if ( not sc_exists ) { - ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << "MET_Calo"); + SG::ReadHandle<xAOD::MissingETContainer> xhmetCal{m_metCalKey}; + if (! xhmetCal.isValid()) { + ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << m_metCalKey); return StatusCode::SUCCESS; } - ATH_CHECK(evtStore()->retrieve(xmetCal, "MET_Calo")); + xmetCal = xhmetCal.get(); - ATH_MSG_DEBUG("Filling histograms per calorimeter subsystem with key " << m_metCalKey); - if (m_met_cut_80) { - if (evtStore()->contains<xAOD::MissingETContainer>("MET_Reference_AntiKt4LCTopo")) { - const xAOD::MissingETContainer* xMissEt_forCut = 0; - ATH_CHECK(evtStore()->retrieve(xMissEt_forCut, "MET_Reference_AntiKt4LCTopo")); + SG::ReadHandle<xAOD::MissingETContainer> xMissEt_forCut{m_metForCut}; + if (xMissEt_forCut.isValid()) { float et_RefFinal = (*xMissEt_forCut)["FinalClus"]->met() / CLHEP::GeV; - if (et_RefFinal < m_met_cut) return StatusCode::SUCCESS; } } @@ -1057,9 +1060,10 @@ StatusCode METMonTool::fillCalosHistograms() if (m_doJetcleaning && !m_badJets) { const xAOD::JetContainer* xJetCollection = 0; - ATH_CHECK(evtStore()->retrieve(xJetCollection, "AntiKt4LCTopoJets")); + SG::ReadHandle<xAOD::JetContainer> xhJetCollection{m_jetColKey}; + xJetCollection = xhJetCollection.get(); if ( xJetCollection == 0 ) { - ATH_MSG_WARNING("Unable to retrieve JetContainer: " << "AntiKt4LCTopoJets"); + ATH_MSG_WARNING("Unable to retrieve JetContainer: " << m_jetColKey.key()); //return StatusCode::FAILURE; } else { @@ -1109,59 +1113,40 @@ StatusCode METMonTool::fillRegionsHistograms() bool doSummary = (m_regIndices > 1); - const xAOD::MissingETContainer* xmetReg = 0; - - bool sc_exists = evtStore()->contains<xAOD::MissingETContainer>("MET_TruthRegions"); - - if (sc_exists) - { - - ATH_CHECK(evtStore()->retrieve(xmetReg, "MET_TruthRegions")); - - if (!xmetReg) - { - ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << "MET_TruthRegions"); - } - else - { + SG::ReadHandle<xAOD::MissingETContainer> xmetReg{m_metRegKey}; + if (xmetReg.isValid()) { //s// ATH_MSG_DEBUG("Filling histograms per calorimeter region with key " << m_metRegKey); //s// metReg = missET->getRegions(); - for (unsigned int i = 0; i < m_regIndices; i++) - { - std::string xaod_truth_region = ""; - if (i == 0) xaod_truth_region = "Int_Central"; - else if (i == 1) xaod_truth_region = "Int_EndCap"; - else if (i == 2) xaod_truth_region = "Int_Forward"; - else xaod_truth_region = "Int_Central"; - - float ex = (*xmetReg)[xaod_truth_region]->mpx() / CLHEP::GeV; - float ey = (*xmetReg)[xaod_truth_region]->mpy() / CLHEP::GeV; - float et = sqrt(ex*ex + ey*ey); - float phi = atan2(ey, ex); - float sumet = (*xmetReg)[xaod_truth_region]->sumet() / CLHEP::GeV; - - if (et > 0.) - { - m_etReg[i]->Fill(et); - m_exReg[i]->Fill(ex); - m_eyReg[i]->Fill(ey); - m_phiReg[i]->Fill(phi); - m_sumetReg[i]->Fill(sumet); - // Mean summaries - if (doSummary) - { - m_exRegMean->Fill(i + 0.5, ex); - m_eyRegMean->Fill(i + 0.5, ey); - m_phiRegMean->Fill(i + 0.5, phi); - } - } - } + for (unsigned int i = 0; i < m_regIndices; i++) { + std::string xaod_truth_region = ""; + if (i == 0) xaod_truth_region = "Int_Central"; + else if (i == 1) xaod_truth_region = "Int_EndCap"; + else if (i == 2) xaod_truth_region = "Int_Forward"; + else xaod_truth_region = "Int_Central"; + + float ex = (*xmetReg)[xaod_truth_region]->mpx() / CLHEP::GeV; + float ey = (*xmetReg)[xaod_truth_region]->mpy() / CLHEP::GeV; + float et = sqrt(ex*ex + ey*ey); + float phi = atan2(ey, ex); + float sumet = (*xmetReg)[xaod_truth_region]->sumet() / CLHEP::GeV; + + if (et > 0.) { + m_etReg[i]->Fill(et); + m_exReg[i]->Fill(ex); + m_eyReg[i]->Fill(ey); + m_phiReg[i]->Fill(phi); + m_sumetReg[i]->Fill(sumet); + // Mean summaries + if (doSummary) { + m_exRegMean->Fill(i + 0.5, ex); + m_eyRegMean->Fill(i + 0.5, ey); + m_phiRegMean->Fill(i + 0.5, phi); } + } } - else - { - ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << "MET_TruthRegions"); - } + } else { + ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << m_metRegKey); + } return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx index 0774cfe1982..4f7d23655bd 100755 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.cxx @@ -5,7 +5,7 @@ 4 May 2020 */ -#include "egammaPerformance/MonitorElectronAlgorithm.h" +#include "MonitorElectronAlgorithm.h" MonitorElectronAlgorithm::MonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorElectronAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorElectronAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx index cb13efe3e84..4566d70901b 100644 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.cxx @@ -5,7 +5,7 @@ 4 May 2020 */ -#include "egammaPerformance/MonitorFwdElectronAlgorithm.h" +#include "MonitorFwdElectronAlgorithm.h" MonitorFwdElectronAlgorithm::MonitorFwdElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorFwdElectronAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorFwdElectronAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorFwdElectronAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx index 0bb0c05d48e..77ed7c5d1ef 100755 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.cxx @@ -5,7 +5,7 @@ 4 May 2020 */ -#include "egammaPerformance/MonitorPhotonAlgorithm.h" +#include "MonitorPhotonAlgorithm.h" MonitorPhotonAlgorithm::MonitorPhotonAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorPhotonAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorPhotonAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx b/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx index 95cf12f768a..62465c2326e 100644 --- a/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.cxx @@ -5,7 +5,7 @@ Author : B. Laforge (laforge@lpnhe.in2p3.fr) 4 May 2020 */ -#include "egammaPerformance/MonitorTnPAlgorithm.h" +#include "MonitorTnPAlgorithm.h" MonitorTnPAlgorithm::MonitorTnPAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) :AthMonitorAlgorithm(name,pSvcLocator) { diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorTnPAlgorithm.h b/Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.h similarity index 100% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/MonitorTnPAlgorithm.h rename to Reconstruction/egamma/egammaPerformance/src/MonitorTnPAlgorithm.h diff --git a/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx index 642284c93d2..3557c514160 100755 --- a/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx @@ -15,7 +15,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/ZeeTaPMonTool.h" +#include "ZeeTaPMonTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -58,7 +58,6 @@ ZeeTaPMonTool::ZeeTaPMonTool(const std::string & type, const std::string & name, m_hLB_N(nullptr) { // Name of the electron collection - declareProperty("ElectronContainer", m_ElectronContainer = "Electrons", "Name of the electron collection" ); declareProperty("massPeak", m_MassPeak = 91188, "Resonance peak position" ); declareProperty("electronEtCut",m_ElectronEtCut = 15*GeV, "Et cut for electrons"); declareProperty("massLowerCut", m_MassLowerCut = 70*GeV,"Lower mass cut"); @@ -74,6 +73,13 @@ ZeeTaPMonTool::~ZeeTaPMonTool() { } +StatusCode ZeeTaPMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_ElectronContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode ZeeTaPMonTool::bookHistograms() { ATH_MSG_DEBUG("ZeeTaPMonTool::bookHistograms()"); @@ -165,15 +171,8 @@ StatusCode ZeeTaPMonTool::fillHistograms() //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -184,11 +183,10 @@ StatusCode ZeeTaPMonTool::fillHistograms() } // Get electron container - const xAOD::ElectronContainer* electron_container=nullptr; - sc = m_storeGate->retrieve(electron_container, m_ElectronContainer); - if(sc.isFailure() || !electron_container){ + SG::ReadHandle<xAOD::ElectronContainer> electron_container{m_ElectronContainer}; + if(!electron_container.isValid()){ ATH_MSG_VERBOSE("no electron container found in TDS"); - return sc; + return StatusCode::FAILURE; } xAOD::ElectronContainer::const_iterator e_iter = electron_container->begin(); diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/ZeeTaPMonTool.h b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.h similarity index 86% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/ZeeTaPMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.h index 4b899a5ff12..e34197ddc44 100755 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/ZeeTaPMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.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 */ ///////////////////////////////////////////////////////////// @@ -12,7 +12,7 @@ #ifndef ZeeTaPMonTool_H #define ZeeTaPMonTool_H -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "xAODEgamma/Electron.h" class ZeeTaPMonTool : public egammaMonToolBase @@ -23,9 +23,10 @@ class ZeeTaPMonTool : public egammaMonToolBase virtual ~ZeeTaPMonTool(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; + virtual StatusCode procHistograms() override; private: void fillElectronProbe(const xAOD::Electron *el, bool isTight, bool isIso, double mass); @@ -33,7 +34,7 @@ class ZeeTaPMonTool : public egammaMonToolBase protected: // Properties - std::string m_ElectronContainer; // Container name for electrons + SG::ReadHandleKey<xAOD::ElectronContainer> m_ElectronContainer{this, "ElectronContainer", "Electrons", "Name of the electron collection"}; // Container name for electrons float m_MassPeak; float m_ElectronEtCut; float m_MassLowerCut; diff --git a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx index af0888d5736..e9e3ac713b7 100644 --- a/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/components/egammaPerformance_entries.cxx @@ -4,15 +4,15 @@ // New Run 3 algorithms -#include "egammaPerformance/MonitorElectronAlgorithm.h" -#include "egammaPerformance/MonitorPhotonAlgorithm.h" -#include "egammaPerformance/MonitorFwdElectronAlgorithm.h" -#include "egammaPerformance/MonitorTnPAlgorithm.h" +#include "../MonitorElectronAlgorithm.h" +#include "../MonitorPhotonAlgorithm.h" +#include "../MonitorFwdElectronAlgorithm.h" +#include "../MonitorTnPAlgorithm.h" // Run 2 algorithms -#include "egammaPerformance/photonMonTool.h" -#include "egammaPerformance/electronMonTool.h" -#include "egammaPerformance/forwardElectronMonTool.h" -#include "egammaPerformance/ZeeTaPMonTool.h" +#include "../photonMonTool.h" +#include "../electronMonTool.h" +#include "../forwardElectronMonTool.h" +#include "../ZeeTaPMonTool.h" // Run 2 Algorithms diff --git a/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx index 9c779277cad..f4ebbe1d87d 100644 --- a/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.cxx @@ -13,7 +13,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -80,9 +80,22 @@ StatusCode egammaMonToolBase::initialize() } } + ATH_CHECK( m_EventInfoKey.initialize() ); + return sc; } +unsigned int egammaMonToolBase::getCurrentLB() +{ + SG::ReadHandle<xAOD::EventInfo> evtInfo{m_EventInfoKey}; + if (evtInfo.isValid()) { + return evtInfo->lumiBlock(); + } else { + ATH_MSG_ERROR("couldn't retrieve event info"); + return -1; + } +} + StatusCode egammaMonToolBase::bookHistograms() { ATH_MSG_DEBUG("egammaMonToolBase::bookHistograms()"); diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/egammaMonToolBase.h b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.h similarity index 88% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/egammaMonToolBase.h rename to Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.h index 4f28d7639cc..29b0852b726 100644 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/egammaMonToolBase.h +++ b/Reconstruction/egamma/egammaPerformance/src/egammaMonToolBase.h @@ -31,10 +31,10 @@ class egammaMonToolBase : public ManagedMonitorToolBase virtual ~egammaMonToolBase(); - virtual StatusCode initialize(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; + virtual StatusCode procHistograms() override; protected: @@ -52,6 +52,7 @@ class egammaMonToolBase : public ManagedMonitorToolBase void fillTH2FperRegion(std::vector<TH2*> &vhist, unsigned int ir, float x, float y); void fillEfficiencies(TH1* h, TH1* href); bool hasGoodTrigger(const std::string& comment); + unsigned int getCurrentLB(); // Data members StoreGateSvc * m_storeGate; @@ -63,6 +64,7 @@ class egammaMonToolBase : public ManagedMonitorToolBase std::string m_GroupExtension; unsigned int m_currentLB; + SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfoKey", "EventInfo"}; private: std::vector<std::string> m_region; diff --git a/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx index 5ec769498af..94e9e819e48 100755 --- a/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.cxx @@ -72,7 +72,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/electronMonTool.h" +#include "electronMonTool.h" electronMonTool::electronMonTool(const std::string & type, const std::string & name, const IInterface* parent) : egammaMonToolBase(type,name,parent), @@ -81,10 +81,6 @@ electronMonTool::electronMonTool(const std::string & type, const std::string & n m_electronIdGroup(nullptr), m_electronLBGroup(nullptr) { - - // Name of the electron collection - declareProperty("ElectronContainer", m_ElectronContainer = "Electrons", "Name of the electron collection" ); - bool WithFullHistList = true; bool WithLimitedHistList = false; @@ -138,6 +134,13 @@ electronMonTool::~electronMonTool() } +StatusCode electronMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_ElectronContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode electronMonTool::bookHistogramsForOneElectronType(electronHist& myHist) { @@ -529,15 +532,8 @@ StatusCode electronMonTool::fillHistograms() { //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -558,9 +554,8 @@ StatusCode electronMonTool::fillHistograms() { } // Get electron container - const xAOD::ElectronContainer* electron_container=nullptr; - sc = m_storeGate->retrieve(electron_container, m_ElectronContainer); - if(sc.isFailure() || !electron_container){ + SG::ReadHandle<xAOD::ElectronContainer> electron_container{m_ElectronContainer}; + if(!electron_container.isValid()){ ATH_MSG_VERBOSE("no electron container found in TDS"); return StatusCode::FAILURE; } @@ -675,9 +670,3 @@ StatusCode electronMonTool::fillHistograms() { return StatusCode::SUCCESS; } - - -StatusCode electronMonTool::procHistograms() -{ - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/electronMonTool.h b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.h similarity index 93% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/electronMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/electronMonTool.h index 80858f4daed..55cdb1cb59c 100755 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/electronMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/electronMonTool.h @@ -18,7 +18,7 @@ #include "StoreGate/StoreGateSvc.h" #include "TH1F.h" #include "TH2F.h" -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/ElectronxAODHelpers.h" @@ -126,20 +126,20 @@ class electronMonTool : public egammaMonToolBase virtual ~electronMonTool(); - virtual StatusCode bookHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; virtual StatusCode bookHistogramsForOneElectronType(electronHist& myHist); - virtual StatusCode fillHistograms(); + virtual StatusCode fillHistograms() override; virtual StatusCode fillHistogramsForOneElectron(xAOD::ElectronContainer::const_iterator e_iter, electronHist& myHist); - virtual StatusCode procHistograms(); private: protected: // Properties - std::string m_ElectronContainer; // Container name for electrons + SG::ReadHandleKey<xAOD::ElectronContainer> m_ElectronContainer{this, "ElectronContainer", "Electrons", "Name of the electron collection"}; // Container name for electrons // LH Loose electrons histograms electronHist *m_LhLooseElectrons; diff --git a/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx index aec9fb057e3..79b02d36aa2 100644 --- a/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.cxx @@ -69,7 +69,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/forwardElectronMonTool.h" +#include "forwardElectronMonTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -97,9 +97,6 @@ forwardElectronMonTool::forwardElectronMonTool(const std::string & type, const s m_hLB_N(nullptr), m_nForwardElectrons(0) { - // Name of the electron collection - declareProperty("ForwardElectronContainer", m_ForwardElectronContainer = "egammaForwardCollection", "Name of the forward electron collection" ); - m_lumiBlockNumber = 0; m_nForwardElectronsInCurrentLB = 0; m_nForwardElectronsPerLumiBlock.clear(); @@ -110,6 +107,13 @@ forwardElectronMonTool::~forwardElectronMonTool() { } +StatusCode forwardElectronMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_ForwardElectronContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode forwardElectronMonTool::bookHistograms() { ATH_MSG_DEBUG("forwardElectronMonTool::bookHistograms()"); @@ -197,15 +201,8 @@ StatusCode forwardElectronMonTool::fillHistograms() //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -216,9 +213,8 @@ StatusCode forwardElectronMonTool::fillHistograms() } // Get electron container - const xAOD::ElectronContainer* electron_container=nullptr; - sc = m_storeGate->retrieve(electron_container, m_ForwardElectronContainer); - if(sc.isFailure() || !electron_container){ + SG::ReadHandle<xAOD::ElectronContainer> electron_container{m_ForwardElectronContainer}; + if(!electron_container.isValid()){ ATH_MSG_VERBOSE("no electron container found in TDS"); return StatusCode::FAILURE; } @@ -363,5 +359,5 @@ StatusCode forwardElectronMonTool::fillHistograms() //} } - return sc; + return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/forwardElectronMonTool.h b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.h similarity index 90% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/forwardElectronMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.h index f1844ba855e..ac8f7781823 100644 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/forwardElectronMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/forwardElectronMonTool.h @@ -11,7 +11,7 @@ #ifndef forwardElectronMonTool_H #define forwardElectronMonTool_H -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" class forwardElectronMonTool : public egammaMonToolBase { @@ -21,14 +21,15 @@ class forwardElectronMonTool : public egammaMonToolBase virtual ~forwardElectronMonTool(); - virtual StatusCode bookHistograms(); - virtual StatusCode fillHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; + virtual StatusCode fillHistograms() override; private: protected: // Properties - std::string m_ForwardElectronContainer; // Container name for forwardElectrons + SG::ReadHandleKey<xAOD::ElectronContainer> m_ForwardElectronContainer{this, "ForwardElectronContainer", "egammaForwardCollection", "Name of the forward electron collection"}; // Container name for forwardElectrons // Loose electrons histograms TH1 * m_hN; // Histogram for number of electrons diff --git a/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx index 03ca696df49..e5a2dfe12b9 100755 --- a/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx +++ b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx @@ -69,7 +69,7 @@ ///////////////////////////////////////////////////////////// -#include "egammaPerformance/photonMonTool.h" +#include "photonMonTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" @@ -90,9 +90,6 @@ photonMonTool::photonMonTool(const std::string & type, const std::string & name, m_photonRegionGroup(nullptr), m_photonLBGroup(nullptr) { - // Name of the photon collection - declareProperty("PhotonContainer", m_PhotonContainer = "PhotonCollection", "Name of the photon collection"); - m_CbTightPhotons = new photonHist(std::string("CbTight")); m_CbTightPhotons->m_lumiBlockNumber = 0; m_CbTightPhotons->m_nPhotonsInCurrentLB = 0; @@ -120,6 +117,13 @@ photonMonTool::~photonMonTool() ATH_MSG_DEBUG("photonMonTool ::: m_CbTightPhotons deleted"); } +StatusCode photonMonTool::initialize() +{ + ATH_CHECK( egammaMonToolBase::initialize() ); + ATH_CHECK( m_PhotonContainer.initialize() ); + return StatusCode::SUCCESS; +} + StatusCode photonMonTool::bookHistogramsForOnePhotonType(photonHist& myHist) { @@ -633,15 +637,8 @@ StatusCode photonMonTool::fillHistograms() { //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - StatusCode sc = m_storeGate->retrieve(evtInfo); - if (sc.isFailure()) { - ATH_MSG_ERROR("couldn't retrieve event info"); - return StatusCode::FAILURE; - } - unsigned int previousLB = m_currentLB; - m_currentLB = evtInfo->lumiBlock(); + m_currentLB = getCurrentLB(); //deal with the change of LB if (m_currentLB>previousLB) { @@ -685,9 +682,8 @@ StatusCode photonMonTool::fillHistograms() { } // Get photon container - const xAOD::PhotonContainer* photon_container=nullptr; - sc = m_storeGate->retrieve(photon_container, m_PhotonContainer); - if(sc.isFailure() || !photon_container){ + SG::ReadHandle<xAOD::PhotonContainer> photon_container{m_PhotonContainer}; + if(!photon_container.isValid()){ ATH_MSG_VERBOSE("no photon container found in TDS"); return StatusCode::FAILURE; } @@ -771,9 +767,3 @@ StatusCode photonMonTool::fillHistograms() { return StatusCode::SUCCESS; } - - -StatusCode photonMonTool::procHistograms() -{ - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/egamma/egammaPerformance/egammaPerformance/photonMonTool.h b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.h similarity index 95% rename from Reconstruction/egamma/egammaPerformance/egammaPerformance/photonMonTool.h rename to Reconstruction/egamma/egammaPerformance/src/photonMonTool.h index cbd3187025f..b439c791c6c 100755 --- a/Reconstruction/egamma/egammaPerformance/egammaPerformance/photonMonTool.h +++ b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.h @@ -18,7 +18,7 @@ #include "StoreGate/StoreGateSvc.h" #include "TH1F.h" #include "TH2F.h" -#include "egammaPerformance/egammaMonToolBase.h" +#include "egammaMonToolBase.h" #include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/ElectronxAODHelpers.h" @@ -178,19 +178,19 @@ class photonMonTool : public egammaMonToolBase photonMonTool(const std::string& type, const std::string& name, const IInterface* parent); virtual ~photonMonTool(); - virtual StatusCode bookHistograms(); + virtual StatusCode initialize() override; + virtual StatusCode bookHistograms() override; virtual StatusCode bookHistogramsForOnePhotonType(photonHist& myHist); - virtual StatusCode fillHistograms(); + virtual StatusCode fillHistograms() override; virtual StatusCode fillHistogramsForOnePhoton(xAOD::PhotonContainer::const_iterator g_iter, photonHist& myHist); - virtual StatusCode procHistograms(); private: protected: // Properties - std::string m_PhotonContainer; // Container name for photons + SG::ReadHandleKey<xAOD::PhotonContainer> m_PhotonContainer{this, "PhotonContainer", "PhotonCollection", "Name of the photon collection"}; // Container name for photons // Loose cut based photons histograms photonHist *m_CbLoosePhotons; diff --git a/Reconstruction/tauMonitoring/CMakeLists.txt b/Reconstruction/tauMonitoring/CMakeLists.txt index 3883a2972e4..6386f5efc0e 100644 --- a/Reconstruction/tauMonitoring/CMakeLists.txt +++ b/Reconstruction/tauMonitoring/CMakeLists.txt @@ -26,6 +26,5 @@ atlas_add_component( tauMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib xAODTau GaudiKernel xAODEventInfo xAODTracking TrigDecisionToolLib ) # Install files from the package: -atlas_install_headers( tauMonitoring ) atlas_install_joboptions( share/*.py ) atlas_install_python_modules( python/*.py ) diff --git a/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx b/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx index 862f5b18869..629ff8320d8 100644 --- a/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx +++ b/Reconstruction/tauMonitoring/src/components/tauMonitoring_entries.cxx @@ -1,5 +1,5 @@ -#include "tauMonitoring/tauMonTool.h" -#include "tauMonitoring/tauMonitorAlgorithm.h" +#include "../tauMonTool.h" +#include "../tauMonitorAlgorithm.h" DECLARE_COMPONENT( tauMonTool ) DECLARE_COMPONENT( tauMonitorAlgorithm ) diff --git a/Reconstruction/tauMonitoring/src/tauMonTool.cxx b/Reconstruction/tauMonitoring/src/tauMonTool.cxx index 315f666b0a6..d209255a18f 100644 --- a/Reconstruction/tauMonitoring/src/tauMonTool.cxx +++ b/Reconstruction/tauMonitoring/src/tauMonTool.cxx @@ -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 */ //********************************************************************* @@ -11,7 +11,7 @@ // Lianyou SHAN ( update for run2 ) //********************************************************************* -#include "tauMonitoring/tauMonTool.h" +#include "tauMonTool.h" #include "xAODEventInfo/EventInfo.h" #include "xAODTracking/TrackParticle.h" #include "TrigDecisionTool/TrigDecisionTool.h" @@ -28,7 +28,6 @@ using Gaudi::Units::GeV; tauMonTool::tauMonTool( const std::string & type, const std::string & name, const IInterface* parent ) :ManagedMonitorToolBase( type, name, parent ), - m_tauJetKey("TauJets"), m_doTrigger(false), m_maxNLB(1000) // m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool") @@ -41,6 +40,13 @@ tauMonTool::tauMonTool( const std::string & type, tauMonTool::~tauMonTool() {} +StatusCode tauMonTool::initialize() { + ATH_CHECK( ManagedMonitorToolBase::initialize() ); + ATH_CHECK( m_tauJetKey.initialize() ); + ATH_CHECK( m_eventInfoKey.initialize() ); + return StatusCode::SUCCESS; +} + //-------------------------------------------------------------------------------- // Book Histograms //-------------------------------------------------------------------------------- @@ -146,8 +152,8 @@ StatusCode tauMonTool::fillHistograms() //-------------------- //figure out current LB //-------------------- - const DataHandle<xAOD::EventInfo> evtInfo; - if ( (evtStore()->retrieve(evtInfo)) . isFailure()) { + SG::ReadHandle<xAOD::EventInfo> evtInfo{m_eventInfoKey}; + if (!evtInfo.isValid()) { ATH_MSG_ERROR("couldn't retrieve event info"); return StatusCode::FAILURE; } @@ -207,9 +213,9 @@ StatusCode tauMonTool::fillHistograms() //-------------------- //Get Tau container //-------------------- - const xAOD::TauJetContainer *tau_container; - if ( (evtStore()->retrieve(tau_container,m_tauJetKey)).isFailure() ) { - ATH_MSG_WARNING("Cannot retrieve " << m_tauJetKey); + SG::ReadHandle<xAOD::TauJetContainer> tau_container{m_tauJetKey}; + if ( !tau_container.isValid() ) { + ATH_MSG_WARNING("Cannot retrieve " << m_tauJetKey.key()); return StatusCode::FAILURE; } diff --git a/Reconstruction/tauMonitoring/tauMonitoring/tauMonTool.h b/Reconstruction/tauMonitoring/src/tauMonTool.h similarity index 93% rename from Reconstruction/tauMonitoring/tauMonitoring/tauMonTool.h rename to Reconstruction/tauMonitoring/src/tauMonTool.h index 38d048bf476..9298bf7e3ff 100644 --- a/Reconstruction/tauMonitoring/tauMonitoring/tauMonTool.h +++ b/Reconstruction/tauMonitoring/src/tauMonTool.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 TAUMONTOOL_H @@ -18,7 +18,7 @@ #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "xAODTau/TauDefs.h" -#include "xAODTau/TauJet.h" +#include "xAODTau/TauJetContainer.h" class tauMonTool : public ManagedMonitorToolBase { @@ -28,14 +28,16 @@ public: // destructor virtual ~tauMonTool(); - StatusCode bookHistograms(); - StatusCode fillHistograms(); - StatusCode procHistograms(); + StatusCode initialize() override; + StatusCode bookHistograms() override; + StatusCode fillHistograms() override; + StatusCode procHistograms() override; StatusCode Book1DHist(TH1 ** hist, MonGroup * monName, std::string histName, std::string histTitle, int NBins, double lowBin, double highBin); StatusCode Book2DHist(TH2 ** hist, MonGroup * monName, std::string histName, std::string histTitle, int NXBins, double lowXBin, double highXBin, int NYBins, double lowYBin, double highYBin); protected: - std::string m_tauJetKey; + SG::ReadHandleKey<xAOD::TauJetContainer> m_tauJetKey{this, "tauJetKey", "TauJets"}; + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo"}; bool m_doTrigger; int m_maxNLB; diff --git a/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx index 32e17fc9a1f..07e39297516 100644 --- a/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx +++ b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "tauMonitoring/tauMonitorAlgorithm.h" +#include "tauMonitorAlgorithm.h" #include "GaudiKernel/SystemOfUnits.h" #include "xAODCore/ShallowCopy.h" diff --git a/Reconstruction/tauMonitoring/tauMonitoring/tauMonitorAlgorithm.h b/Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.h similarity index 100% rename from Reconstruction/tauMonitoring/tauMonitoring/tauMonitorAlgorithm.h rename to Reconstruction/tauMonitoring/src/tauMonitorAlgorithm.h -- GitLab