diff --git a/Root/TruthWeightTool.cxx b/Root/TruthWeightTool.cxx index c62b7931f34351dadb4b7ceef5ab150b027ec189..12e887e9a72a15a7f0f7a6abf3c393c7ed35e1fc 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 348f26baf9e9de20a05a6dd5a41b36d169ca6487..76c4c3e461128c88691d34f63a735a405467bdda 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 977d2c52ee882d75a6205c93296e0348a35e3285..4d3dd187f3435bb8ca803b90bee027386876133e 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 ) {