From 3465119ff3097a3a13f0433b170cb6b2552070d9 Mon Sep 17 00:00:00 2001 From: Vakho Tsulaia <vakhtang.tsulaia@cern.ch> Date: Thu, 7 Mar 2019 16:50:37 +0100 Subject: [PATCH] TrackCaloClusterRecValidation migrated to xAOD::EventInfo Also moved all header files over to src. This is a component package --- .../CMakeLists.txt | 8 ++---- .../src/CalibrationNtupleMakerTool.cxx | 22 ++++++---------- .../CalibrationNtupleMakerTool.h | 6 ++++- .../src/TrackCaloClusterRecValidationTool.cxx | 25 +++++++------------ .../TrackCaloClusterRecValidationTool.h | 10 +++++--- .../TrackCaloClusterRecValidation_entries.cxx | 4 +-- 6 files changed, 33 insertions(+), 42 deletions(-) rename Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/{TrackCaloClusterRecValidation => src}/CalibrationNtupleMakerTool.h (93%) rename Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/{TrackCaloClusterRecValidation => src}/TrackCaloClusterRecValidationTool.h (92%) diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/CMakeLists.txt b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/CMakeLists.txt index 879eba5ca639..036d10a76047 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/CMakeLists.txt +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/CMakeLists.txt @@ -16,7 +16,6 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODTruth Event/xAOD/xAODEventInfo Event/xAOD/xAODPFlow - Event/EventInfo GaudiKernel InnerDetector/InDetValidation/InDetPhysValMonitoring Tracking/TrkValidation/TrkValHistUtils @@ -45,10 +44,7 @@ atlas_add_component( TrackCaloClusterRecValidation INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaMonitoringLib xAODCore xAODTracking xAODTruth xAODPFlow GaudiKernel TrkValHistUtils InDetPhysValMonitoringLib - AsgTools AthenaKernel GeoPrimitives EventPrimitives xAODBase xAODParticleEvent xAODEventInfo EventInfo xAODJet PathResolver) + AsgTools AthenaKernel GeoPrimitives EventPrimitives xAODBase xAODParticleEvent xAODEventInfo xAODJet PathResolver) # Install files from the package: -atlas_install_headers( TrackCaloClusterRecValidation ) -#atlas_install_python_modules( python/*.py ) -#atlas_install_runtime( share/*.hdef share/*.xml share/*.xsl} ) atlas_install_runtime( share/*.xml share/*.xsl ) -#atlas_install_runtime( test/TrackCaloClusterRecValidation_TestConfiguration.xml ) \ No newline at end of file + diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.cxx b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.cxx index b432633df7da..970fa1863c59 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.cxx +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -7,15 +7,9 @@ // CalibrationNtupleMakerTool.cxx, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// -#include "TrackCaloClusterRecValidation/CalibrationNtupleMakerTool.h" +#include "CalibrationNtupleMakerTool.h" #include "xAODJet/JetContainer.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODEventInfo/EventAuxInfo.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventType.h" - #include "xAODPFlow/TrackCaloClusterContainer.h" #include "xAODParticleEvent/IParticleLink.h" @@ -89,6 +83,8 @@ StatusCode CalibrationNtupleMakerTool::initialize() return StatusCode::FAILURE; } + ATH_CHECK( m_evt.initialize() ); + return StatusCode::SUCCESS; } @@ -165,14 +161,12 @@ StatusCode CalibrationNtupleMakerTool::execute() { m_h_events->Fill(0); - const EventInfo* info = nullptr; - if (evtStore()->retrieve(info).isFailure()){ + SG::ReadHandle<xAOD::EventInfo> evt(m_evt); + if(!evt.isValid()) { ATH_MSG_FATAL( "Unable to retrieve Event Info" ); - return StatusCode::FAILURE; } + float ev_weight = evt->mcEventWeight(); - float ev_weight = info->event_type()->mc_event_weight(); - const auto truths = getContainer<xAOD::JetContainer>(m_truthJetContainerName); if (not truths) return StatusCode::FAILURE; @@ -180,7 +174,7 @@ StatusCode CalibrationNtupleMakerTool::execute() if (not vertices) return StatusCode::FAILURE; // get mu - float mu= info->averageInteractionsPerCrossing(); + float mu= evt->averageInteractionsPerCrossing(); //get NPV float npv = 0.; diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/TrackCaloClusterRecValidation/CalibrationNtupleMakerTool.h b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.h similarity index 93% rename from Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/TrackCaloClusterRecValidation/CalibrationNtupleMakerTool.h rename to Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.h index 60418e47ef79..8fcc05094071 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/TrackCaloClusterRecValidation/CalibrationNtupleMakerTool.h +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/CalibrationNtupleMakerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef TRACKCALOCLUSTERREC_TRACKCALOCLUSTERRECVALIDATION_CALIBRATIONNTUPLEMAKERTOOL_H #define TRACKCALOCLUSTERREC_TRACKCALOCLUSTERRECVALIDATION_CALIBRATIONNTUPLEMAKERTOOL_H @@ -7,6 +7,8 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "xAODJet/JetContainer.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODEventInfo/EventInfo.h" #include <vector> @@ -87,6 +89,8 @@ private: std::vector < double >* m_eTrue; std::vector < double >* m_mTrue; + // EventInfo + SG::ReadHandleKey<xAOD::EventInfo> m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}; }; diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.cxx b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.cxx index 482ead05926f..8480da339ffc 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.cxx +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.cxx @@ -1,18 +1,10 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "TrackCaloClusterRecValidation/TrackCaloClusterRecValidationTool.h" +#include "TrackCaloClusterRecValidationTool.h" // #include "xAODTruth/TruthParticle.h" #include "xAODJet/JetContainer.h" -#include "xAODEventInfo/EventInfo.h" -#include "xAODEventInfo/EventAuxInfo.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "EventInfo/EventType.h" -#include "EventInfo/PileUpEventInfo.h" -#include "EventInfo/PileUpTimeEventIndex.h" #include "xAODCaloEvent/CaloClusterContainer.h" #include "xAODCore/ShallowCopy.h" @@ -26,7 +18,6 @@ #include <algorithm> #include <limits> #include <cmath> // to get std::isnan(), std::abs etc. -// #include <functional> // to get std::plus #include <utility> #include <cstdlib> // to getenv #include <vector> @@ -129,17 +120,19 @@ TrackCaloClusterRecValidationTool::initialize() { } } + ATH_CHECK( m_evt.initialize() ); + return StatusCode::SUCCESS; } StatusCode TrackCaloClusterRecValidationTool::fillHistograms() { - - const EventInfo* info = nullptr; - if (evtStore()->retrieve(info).isFailure()){ + + SG::ReadHandle<xAOD::EventInfo> evt(m_evt); + if(!evt.isValid()) { ATH_MSG_FATAL( "Unable to retrieve Event Info" ); } - float mcEventWeight = info->event_type()->mc_event_weight(); + float mcEventWeight = evt->mcEventWeight(); if (m_saveJetInfo) { ATH_MSG_DEBUG("Filling hists " << name() << "..."); @@ -474,4 +467,4 @@ const xAOD::JetContainer* TrackCaloClusterRecValidationTool::calibrateAndRecordS } return jetContainerShallowCopy; -} \ No newline at end of file +} diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/TrackCaloClusterRecValidation/TrackCaloClusterRecValidationTool.h b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.h similarity index 92% rename from Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/TrackCaloClusterRecValidation/TrackCaloClusterRecValidationTool.h rename to Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.h index f74b647bebd4..7f6aa4213750 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/TrackCaloClusterRecValidation/TrackCaloClusterRecValidationTool.h +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/TrackCaloClusterRecValidationTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef TRACKCALOCLUSTERREC_TRACKCALOCLUSTERRECVALIDATION_TRACKCALOCLUSTERRECVALIDATIONTOOL_H #define TRACKCALOCLUSTERREC_TRACKCALOCLUSTERRECVALIDATION_TRACKCALOCLUSTERRECVALIDATIONTOOL_H @@ -23,7 +23,8 @@ #include <vector> #include "xAODJet/JetContainer.h" -#include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODEventInfo/EventInfo.h" class TCCPlots; class IJetCalibrationTool; @@ -108,6 +109,9 @@ private: //histograms std::map<std::string, TCCPlots*> m_tccPlots; + + // EventInfo + SG::ReadHandleKey<xAOD::EventInfo> m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}; }; template<class T> @@ -119,4 +123,4 @@ inline const T* TrackCaloClusterRecValidationTool::getContainer(const std::strin return ptr; } -#endif //TRACKCALOCLUSTERREC_TRACKCALOCLUSTERRECVALIDATION_TRACKCALOCLUSTERRECVALIDATIONTOOL_H \ No newline at end of file +#endif //TRACKCALOCLUSTERREC_TRACKCALOCLUSTERRECVALIDATION_TRACKCALOCLUSTERRECVALIDATIONTOOL_H diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/components/TrackCaloClusterRecValidation_entries.cxx b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/components/TrackCaloClusterRecValidation_entries.cxx index b4fa76c4ece9..0fe6cec787a9 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/components/TrackCaloClusterRecValidation_entries.cxx +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecValidation/src/components/TrackCaloClusterRecValidation_entries.cxx @@ -1,5 +1,5 @@ -#include "TrackCaloClusterRecValidation/TrackCaloClusterRecValidationTool.h" -#include "TrackCaloClusterRecValidation/CalibrationNtupleMakerTool.h" +#include "../TrackCaloClusterRecValidationTool.h" +#include "../CalibrationNtupleMakerTool.h" DECLARE_COMPONENT( TrackCaloClusterRecValidationTool ) DECLARE_COMPONENT( CalibrationNtupleMakerTool ) -- GitLab