From 08ea44235cd4720d4d13346f13dbf45059fef2ed Mon Sep 17 00:00:00 2001 From: Tomasz Bold <tomasz.bold@gmail.com> Date: Tue, 20 Nov 2018 17:50:43 +0100 Subject: [PATCH] added configuration of dynamic variables Aux to be stored Former-commit-id: e74f7908c18fd143b352f60dcaa5d452b783fab4 --- .../src/TriggerEDMSerialiserTool.cxx | 30 +++++++++++++++---- .../src/TriggerEDMSerialiserTool.h | 14 ++++----- .../TrigUpgradeTest/share/egamma.withViews.py | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.cxx index c2e806c8a96..20c637d47dd 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.cxx @@ -6,6 +6,7 @@ #include <cstring> +#include <boost/algorithm/string.hpp> #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/System.h" #include "AthenaKernel/StorableConversions.h" @@ -25,15 +26,15 @@ StatusCode TriggerEDMSerialiserTool::initialize() { ATH_CHECK( m_serializerSvc.retrieve() ); ATH_CHECK( m_clidSvc.retrieve() ); - for ( std::string typeAndKey: m_collectionsToSerialize ) { - const std::string type = typeAndKey.substr( 0, typeAndKey.find('#') ); + for ( std::string typeKeyAux: m_collectionsToSerialize ) { + const std::string type = typeKeyAux.substr( 0, typeKeyAux.find('#') ); if ( type.find('_') == std::string::npos ) { - ATH_MSG_ERROR( "Unversioned object to be recorded " << typeAndKey ); + ATH_MSG_ERROR( "Unversioned object to be recorded " << typeKeyAux ); return StatusCode::FAILURE; } - const std::string transientType = typeAndKey.substr( 0, typeAndKey.find('_') ); + const std::string transientType = typeKeyAux.substr( 0, typeKeyAux.find('_') ); - const std::string key = typeAndKey.substr( typeAndKey.find('#')+1 ); + const std::string key = typeKeyAux.substr( typeKeyAux.find('#')+1, typeKeyAux.find('.') ); CLID clid; if ( m_clidSvc->getIDOfTypeName(transientType, clid).isFailure() ) { ATH_MSG_ERROR( "Can not find CLID for " << transientType << " that is needed to stream " << key ); @@ -47,7 +48,21 @@ StatusCode TriggerEDMSerialiserTool::initialize() { } ATH_MSG_DEBUG( "Type " << type << " key " << key << " serializable" ); - m_toSerialize.push_back( Address{ type, clid, classDesc, key } ); + + xAOD::AuxSelection sel; + if ( typeKeyAux.find('.') != std::string::npos ) { + ATH_MSG_DEBUG( "with aux content: " ); + std::string allVars = typeKeyAux.substr( typeKeyAux.find('.')+1 ); + std::set<std::string> variableNames; + boost::split( variableNames, allVars, [](const char c){ return c == '.'; } ); + for ( auto el: variableNames ) + ATH_MSG_DEBUG( " " << el ); + sel.selectAux( variableNames ); + } + + + + m_toSerialize.push_back( Address{ type, clid, classDesc, key, sel } ); } return StatusCode::SUCCESS; } @@ -121,6 +136,9 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill ) cons fragment[0] = fragment.size(); ATH_MSG_DEBUG("Fragment size " << fragment.size() ); payload.insert( payload.end(), fragment.begin(), fragment.end() ); + + + if ( mem ) delete [] static_cast<const char*>( mem ); ATH_MSG_DEBUG( "Payload size after inserting " << address.type << "#" << address.key << " " << payload.size()*sizeof(uint32_t) << " bytes" ); diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.h b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.h index ee2b38d8006..43261c2879a 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.h +++ b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerEDMSerialiserTool.h @@ -4,18 +4,15 @@ #ifndef TRIGOUTPUTHANDLING_TriggerEDMSerialiserTool_H #define TRIGOUTPUTHANDLING_TriggerEDMSerialiserTool_H -// STL includes -#include <string> -// FrameWork includes +#include <string> #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" - -// OutputHandling includes -#include "TrigOutputHandling/HLTResultMTMakerTool.h" +#include "xAODCore/AuxSelection.h" #include "AthenaKernel/IClassIDSvc.h" #include "AthenaKernel/IAthenaSerializeSvc.h" #include "AthenaKernel/IDictLoaderSvc.h" +#include "TrigOutputHandling/HLTResultMTMakerTool.h" /** * @class TriggerEDMSerialiserTool is tool responsible for creation of HLT Result filled with streamed EDM collections @@ -36,7 +33,7 @@ class TriggerEDMSerialiserTool: public extends<AthAlgTool, HLTResultMTMakerTool> virtual StatusCode initialize() override; private: - Gaudi::Property<std::vector<std::string>> m_collectionsToSerialize { this, "CollectionsToSerialize", {}, "TYPE#SG key of collections to be streamed (like in StreamAOD), the type has to be an exact type i.e. with _vN not the alias type" }; + Gaudi::Property<std::vector<std::string>> m_collectionsToSerialize { this, "CollectionsToSerialize", {}, "TYPE#SG.aux1.aux2..etc key of collections to be streamed (like in StreamAOD), the type has to be an exact type i.e. with _vN not the alias type" }; Gaudi::Property<int> m_moduleID { this, "ModuleID", 0, "The HLT result fragment to which the output should be added"}; @@ -46,7 +43,8 @@ class TriggerEDMSerialiserTool: public extends<AthAlgTool, HLTResultMTMakerTool> std::string type; CLID clid; RootType rt; - std::string key; + std::string key; + xAOD::AuxSelection sel; }; std::vector< Address > m_toSerialize; // postprocessed configuration info diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index afd1f5302de..db3a6687d23 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -349,7 +349,7 @@ print summMaker serialiser = TriggerEDMSerialiserTool(OutputLevel=VERBOSE) serialiser.CollectionsToSerialize = [ "xAOD::TrigCompositeContainer_v1#EgammaCaloDecisions_remap", - "xAOD::TrigCompositeAuxContainer_v1#EgammaCaloDecisionsAux.", + "xAOD::TrigCompositeAuxContainer_v1#EgammaCaloDecisionsAux.name.seed", "xAOD::TrigElectronContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFex_remap", "xAOD::TrigElectronAuxContainer_v1#HLT_xAOD__TrigElectronContainer_L2ElectronFexAux." ] -- GitLab