From eed9ac0594d1ef25e07744255231fcb743ae88c8 Mon Sep 17 00:00:00 2001 From: Tomasz Bold <tomasz.bold@gmail.com> Date: Mon, 17 Sep 2018 14:23:29 +0200 Subject: [PATCH] Further tests of serialisation Former-commit-id: 71127002d1552a9a20a3bbe01df54e8cdaf9d3e2 --- .../TrigOutputHandling/CMakeLists.txt | 8 ++----- .../src/HLTResultCreatorByteStream.cxx | 24 +++++-------------- .../src/HLTResultCreatorByteStream.h | 2 +- .../TrigUpgradeTest/share/egamma.withViews.py | 10 +++++--- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt b/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt index 2791775faf2..add2343bdbb 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigOutputHandling/CMakeLists.txt @@ -28,12 +28,8 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_library( TrigOutputHandlingLib src/*.cxx PUBLIC_HEADERS TrigOutputHandling - LINK_LIBRARIES GaudiKernel AthViews AthenaBaseComps TrigSteeringEvent -<<<<<<< HEAD - xAODTrigCalo xAODTrigEgamma xAODTrigger xAODTracking TrigSerializeResult ) -======= - xAODTrigCalo xAODTrigEgamma xAODTrigger xAODTracking xAODTrigMuon xAODMuon ) ->>>>>>> upstream/master + LINK_LIBRARIES GaudiKernel AthViews AthenaBaseComps TrigSteeringEvent TrigSerializeResult + xAODTrigCalo xAODTrigEgamma xAODTrigger xAODTracking xAODTrigMuon xAODMuon ) atlas_add_component( TrigOutputHandling src/components/*.cxx diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.cxx index 1fcfea11a5e..2cf88f28e6a 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.cxx @@ -27,15 +27,6 @@ StatusCode HLTResultCreatorByteStream::initialize() { ATH_CHECK( m_hltResultKey.initialize() ); ATH_CHECK( m_serializerSvc.retrieve() ); - ATH_CHECK( m_dictLoaderSvc.retrieve() ); - - // System::ImageHandle handle = 0; - // if ( System::loadDynamicLib( "xAODTrigger", &handle) != 1 ) { - // ATH_MSG_WARNING("Can not load the lib"); - // } else { - // ATH_MSG_DEBUG("Could load the lib"); - // } - for ( std::string typeAndKey: m_collectionsToSerialize ) { @@ -62,7 +53,6 @@ StatusCode HLTResultCreatorByteStream::initialize() { ATH_MSG_DEBUG( "Type " << type << " key " << key << " serializable" ); m_toSerialize.push_back( Address{ type, clid, classDesc, key } ); } - return StatusCode::SUCCESS; } @@ -78,8 +68,6 @@ void HLTResultCreatorByteStream::makeHeader(const Address& address, std::vector< buffer.insert( buffer.end(), serializedLabel.begin(), serializedLabel.end() ); // plain SG key } - - void HLTResultCreatorByteStream::fillPayload( void* data, size_t sz, std::vector<uint32_t>& buffer ) const { buffer.push_back( sz ); // size in bytes const size_t neededSize = sz/sizeof(uint32_t) + (sz%sizeof(uint32_t) ? 1 : 0); @@ -117,15 +105,15 @@ StatusCode HLTResultCreatorByteStream::createOutput(const EventContext& context } ATH_MSG_DEBUG("Obtained raw pointer " << rawptr ); - // const RootType rt = m_dictLoaderSvc->load_type(address.type); + RootType classDesc = RootType::ByName( address.type ); size_t sz=0; void* mem = m_serializerSvc->serialize( rawptr, classDesc, sz ); ATH_MSG_DEBUG( "Streamed to buffer at address " << mem << " of " << sz << " bytes" ); - if ( mem == nullptr and sz == 0 ) { - ATH_MSG_WARNING( "Serialisation of " << address.type <<"#" << address.key << " unsuccessful" ); - continue; + if ( mem == nullptr or sz == 0 ) { + ATH_MSG_ERROR( "Serialisation of " << address.type <<"#" << address.key << " unsuccessful" ); + return StatusCode::FAILURE; } // prepare fragment @@ -140,9 +128,9 @@ StatusCode HLTResultCreatorByteStream::createOutput(const EventContext& context if ( mem ) delete [] static_cast<const char*>( mem ); ATH_MSG_DEBUG( "Navigation size after inserting " << address.type << "#" << address.key << " " << place.size()*sizeof(uint32_t) << " bytes" ); } - + auto resultHandle = SG::makeHandle( m_hltResultKey, context ); - ATH_CHECK( resultHandle.record( std::move(result) ) ); + ATH_CHECK( resultHandle.record( std::move( result ) ) ); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.h b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.h index 0cf201b6f7f..088466183e7 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.h +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTResultCreatorByteStream.h @@ -57,7 +57,7 @@ class HLTResultCreatorByteStream: public extends<AthAlgTool, IHLTOutputTool> ServiceHandle<IClassIDSvc> m_clidSvc{ this, "ClassIDSvc", "ClassIDSvc", "Service to translate class name to CLID" }; ServiceHandle<IAthenaSerializeSvc> m_serializerSvc{ this, "Serializer", "AthenaRootSerializeSvc", "Service that translates transient to persistent respresenation" }; - ServiceHandle<IDictLoaderSvc> m_dictLoaderSvc{ this, "DictLoaderSvc", "AthDictLoaderSvc", "Service managing ROOT dictionaries for EDM classes" }; + /** * Given the ID if the collection (in address arg) insert basic streaming info into the buffer. diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index b616d45773f..1807e9272a2 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -230,12 +230,16 @@ egammaViewsMerger.OutputLevel = VERBOSE svcMgr.StoreGateSvc.OutputLevel = INFO -streamnigTool = HLTResultCreatorByteStream(OutputLevel=VERBOSE) +streamingTool = HLTResultCreatorByteStream(OutputLevel=VERBOSE) -streamnigTool.CollectionsToSerialize = [ "xAOD::TrigCompositeContainer_v1#EgammaCaloDecisions" ] #, "xAOD::TrigElectronContainer#HLT_xAOD__TrigElectronContainer_L2ElectronFex", "xAOD::TrigElectronAuxContainer#HLT_xAOD__TrigElectronContainer_L2ElectronFexAux." ] -summary.OutputTools = [ egammaViewsMerger, streamnigTool ] +streamingTool.CollectionsToSerialize = [ "xAOD::TrigCompositeContainer_v1#EgammaCaloDecisions", + "xAOD::TrigCompositeAuxContainer_v1#EgammaCaloDecisionsAux.", + "xAOD::TrigElectronContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "xAOD::TrigElectronAuxContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFexAux." ] + +summary.OutputTools = [ egammaViewsMerger, streamingTool ] summary.OutputLevel = DEBUG -- GitLab