From 047339ac52f564009b4b49fa83b16bcf2fd9d70b Mon Sep 17 00:00:00 2001 From: Dag Gillberg <dag.gillberg@cern.ch> Date: Mon, 27 Feb 2017 15:03:42 +0000 Subject: [PATCH] Cleanup --- Root/TruthWeightTool.cxx | 16 ++++++---------- TruthWeightTools/TruthWeightTool.h | 3 --- util/TruthMetaDataTest.cxx | 18 ++++++++---------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/Root/TruthWeightTool.cxx b/Root/TruthWeightTool.cxx index c62b7931f343..12e887e9a72a 100644 --- a/Root/TruthWeightTool.cxx +++ b/Root/TruthWeightTool.cxx @@ -14,7 +14,8 @@ namespace xAOD { StatusCode TruthWeightTool::initialize() { ATH_MSG_DEBUG( "Initialising... " ); - return StatusCode::SUCCESS; + // AsgMetadataTool needs to call sysInitize to be registered in the incident svc + return sysInitialize(); //StatusCode::SUCCESS; } std::shared_ptr<IIndexRetriever> TruthWeightTool::spawnIndexRetriever(std::string weightName) { @@ -57,23 +58,18 @@ namespace xAOD { if( m_uninitialized || ( mcChannelNumber != m_mcChanNo ) ) { - for( auto metaDataIterator = m_metaDataContainer->begin(); - metaDataIterator != m_metaDataContainer->end(); metaDataIterator++) { + for (auto metaData:*m_metaDataContainer) { - if( (*metaDataIterator)->mcChannelNumber() == mcChannelNumber) - { + if ( metaData->mcChannelNumber() == mcChannelNumber) { m_uninitialized = false; m_mcChanNo = mcChannelNumber; - m_metaData = *metaDataIterator; + m_metaData = metaData; this->onNewMetaData(); - m_weightIndices.clear(); - for (auto weightName:m_metaData->weightNames()) - m_weightIndices.push_back(getWeightIndex(weightName)); return StatusCode::SUCCESS; } } + ATH_MSG_ERROR( "No matching TruthMetaData found" ); return StatusCode::FAILURE; - ATH_MSG_ERROR( "No matching meta data found" ); } return StatusCode::SUCCESS; } diff --git a/TruthWeightTools/TruthWeightTool.h b/TruthWeightTools/TruthWeightTool.h index 348f26baf9e9..76c4c3e46112 100644 --- a/TruthWeightTools/TruthWeightTool.h +++ b/TruthWeightTools/TruthWeightTool.h @@ -105,9 +105,6 @@ namespace xAOD { /// a previous event bool m_uninitialized; - /// Vector with weight indeces in same order as weight names - std::vector<size_t> m_weightIndices; - /// Event info const xAOD::EventInfo *m_evtInfo; diff --git a/util/TruthMetaDataTest.cxx b/util/TruthMetaDataTest.cxx index 977d2c52ee88..4d3dd187f343 100644 --- a/util/TruthMetaDataTest.cxx +++ b/util/TruthMetaDataTest.cxx @@ -4,18 +4,14 @@ #include <memory> // ROOT include(s): -#ifdef ROOTCORE -# include <TFile.h> -# include <TError.h> -#endif // ROOTCORE +#include <TFile.h> +#include <TError.h> // Infrastructure include(s): -#ifdef ROOTCORE -# include "xAODRootAccess/Init.h" -# include "xAODRootAccess/TEvent.h" -# include "xAODRootAccess/tools/ReturnCheck.h" -# include "xAODEventInfo/EventInfo.h" -#endif // ROOTCORE +#include "xAODRootAccess/Init.h" +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/tools/ReturnCheck.h" +#include "xAODEventInfo/EventInfo.h" // ASG include(s): #include "AsgTools/ToolHandle.h" @@ -45,6 +41,7 @@ int main( int argc, char* argv[] ) { xAOD::TruthWeightTool weightTool( "TruthWeightTool" ); weightTool.setProperty( "OutputLevel", MSG::INFO ).ignore(); + /* // Try creating ToolHandles for this tool: ToolHandle< xAOD::ITruthWeightTool > handle( "TruthWeightTool" ); ToolHandleArray< xAOD::ITruthWeightTool > handleArray{ "TruthWeightTool" }; @@ -55,6 +52,7 @@ int main( int argc, char* argv[] ) { "Couldn't retrieve the tested tool through tool handles" ); return 1; } + */ // Loop over the files: for( int i = 1; i < argc; ++i ) { -- GitLab