Skip to content
Snippets Groups Projects
Commit ab7e4d01 authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon:
Browse files

Merge branch 'advance-on-deserialisation' into 'master'

Advance on deserialisation of Trigger EDM from the HLTResultMT

See merge request atlas/athena!20161
parents 3c1f4a87 a71beab9
No related merge requests found
......@@ -27,17 +27,17 @@ public:
virtual ~AthenaRootSerializeSvc();
/// Gaudi Service Interface method implementations:
StatusCode initialize();
StatusCode finalize();
StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
StatusCode initialize() override;
StatusCode finalize() override;
StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface) override;
void* serialize(const void* object, const std::string& name, size_t& nbytes) const;
void* serialize(const void* object, const Guid& id, size_t& nbytes) const;
void* serialize(const void* object, const RootType& cltype, size_t& nbytes) const;
void* serialize(const void* object, const std::string& name, size_t& nbytes) const override;
void* serialize(const void* object, const Guid& id, size_t& nbytes) const override;
void* serialize(const void* object, const RootType& cltype, size_t& nbytes) const override;
void* deserialize(void* buffer, size_t& nbytes, const std::string& name) const;
void* deserialize(void* buffer, size_t& nbytes, const Guid& id) const;
void* deserialize(void* buffer, size_t& nbytes, const RootType& cltype) const;
void* deserialize(void* buffer, size_t& nbytes, const std::string& name) const override;
void* deserialize(void* buffer, size_t& nbytes, const Guid& id) const override;
void* deserialize(void* buffer, size_t& nbytes, const RootType& cltype) const override;
};
#endif
......@@ -8,7 +8,8 @@
#include "TrigSerializeResult/StringSerializer.h"
#include "TriggerEDMDeserialiserAlg.h"
#include "BareDataBucket.h"
#include "TBufferFile.h"
#include "TClass.h"
......@@ -26,6 +27,7 @@ StatusCode TriggerEDMDeserialiserAlg::initialize()
ATH_CHECK( m_resultKey.initialize() );
ATH_CHECK( m_clidSvc.retrieve() );
ATH_CHECK( m_serializerSvc.retrieve() );
return StatusCode::SUCCESS;
}
......@@ -63,13 +65,14 @@ StatusCode TriggerEDMDeserialiserAlg::execute(const EventContext& context) const
const size_t bsize{ dataSize( start ) };
std::string transientType;
ATH_CHECK( m_clidSvc->getTypeNameOfID( clid, transientType ) );
ATH_MSG_DEBUG( "fragment: clid, name, size " << clid << " " << transientType<< "#" << name << " " << bsize );
const std::string actualTypeName{ name.substr(0, name.find('#')) };
const std::string key{ name.substr( name.find('#') ) };
ATH_MSG_DEBUG( "fragment: clid, type, key, size " << clid << " " << transientType<< " " << actualTypeName << " " << key << " " << bsize );
resize( bsize );
toBuffer( start, buff.get() );
/* TODO find out how to read the type informatin that is encoded in the payload, we will need to have less configuration, and thus more robust decoding
// this code is commented but will be used once this one bit is understood
RootType classDesc = RootType::ByName( transientType+"_v1" );
RootType classDesc = RootType::ByName( actualTypeName );
size_t usedBytes{ bsize };
void* obj = m_serializerSvc->deserialize( buff.get(), usedBytes, classDesc );
ATH_MSG_DEBUG( "Obtained object " << obj << " which used " << usedBytes << " bytes from available " << bsize );
......@@ -77,15 +80,15 @@ StatusCode TriggerEDMDeserialiserAlg::execute(const EventContext& context) const
if ( obj ) {
BareDataBucket* dataBucket = new BareDataBucket( obj, clid, classDesc);
const std::string outputName = m_prefix + name;
const std::string outputName = m_prefix + key;
auto proxyPtr = evtStore()->recordObject( SG::DataObjectSharedPtr<BareDataBucket>( dataBucket ), outputName, false, false );
if ( proxyPtr == nullptr ) {
ATH_MSG_WARNING( "Recording of object of CLID " << clid << " and name " << name << " failed" );
ATH_MSG_WARNING( "Recording of object of CLID " << clid << " and name " << outputName << " failed" );
}
} else {
ATH_MSG_WARNING( "Deserialisation of object of CLID " << clid << " and name " << name << " failed" );
ATH_MSG_WARNING( "Deserialisation of object of CLID " << clid << " and type#name " << name << " failed" );
}
*/
start = toNextFragment( start );
}
......
......@@ -39,8 +39,8 @@ public:
private:
SG::ReadHandleKey<HLT::HLTResultMT> m_resultKey { this, "ResultKey", "HLTResultMT", "Key of object that is read" };
Gaudi::Property<std::string > m_prefix{ this, "Prefix", "", "Set for testing to avoid clash with the input collections" };
Gaudi::Property<int > m_moduleID{ this, "ModuleID", 0, "Module ID of HLT result ROB, default 0 is the main HLT result, others are for TLA, calibration etc." };
Gaudi::Property<std::string> m_prefix{ this, "Prefix", "", "Set for testing to avoid clash with the input collections" };
Gaudi::Property<int> m_moduleID{ this, "ModuleID", 0, "Module ID of HLT result ROB, default 0 is the main HLT result, others are for TLA, calibration etc." };
Gaudi::Property<int> m_initialSerialisationBufferSize{ this, "InitialSerialisationBufferSize", 1024*1024, "Initial serialisation buffer size in bytes, can be set large to avoid reallocations in every event" };
ServiceHandle<IClassIDSvc> m_clidSvc{ this, "ClassIDSvc", "ClassIDSvc", "Service to translate CLID to class namex" };
......
......@@ -67,8 +67,7 @@ StatusCode TriggerEDMSerialiserTool::initialize() {
const bool isAux = key.find("Aux") != std::string::npos;
m_toSerialize.push_back( Address{ type, clid, key, isAux, sel } );
m_toSerialize.push_back( Address{ type+"#"+key, type, clid, key, isAux, sel } );
}
return StatusCode::SUCCESS;
}
......@@ -80,7 +79,7 @@ StatusCode TriggerEDMSerialiserTool::makeHeader(const Address& address, std::vec
std::vector<uint32_t> serializedLabel;
StringSerializer ss;
ss.serialize( address.key, serializedLabel );
ss.serialize( address.typeKey, serializedLabel );
buffer.push_back( serializedLabel.size() );
buffer.insert( buffer.end(), serializedLabel.begin(), serializedLabel.end() ); // plain SG key
return StatusCode::SUCCESS;
......@@ -152,7 +151,7 @@ StatusCode TriggerEDMSerialiserTool::fillDynAux( const Address& address, DataObj
}
std::vector<uint32_t> fragment;
Address auxAddress = { typeName, clid, address.key+"."+name, false };
Address auxAddress = { "", typeName, clid, address.key+"."+name, false };
ATH_CHECK( makeHeader( auxAddress, fragment ) );
ATH_CHECK( fillPayload( mem, sz, fragment ) );
fragment[0] = fragment.size();
......@@ -174,11 +173,11 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill ) cons
std::vector<uint32_t> payload;
for ( const Address& address: m_toSerialize ) {
ATH_MSG_DEBUG( "Streaming " << address.type << "#" << address.key );
ATH_MSG_DEBUG( "Streaming " << address.typeKey );
// obtain object
DataObject* dObj = evtStore()->accessData( address.clid, address.key );
if ( dObj == nullptr ) {
ATH_MSG_DEBUG("Data Object with key " << address.key << " is missing");
ATH_MSG_DEBUG("Data Object with the CLID " << address.clid <<" and the key " << address.key << " is missing");
continue;
}
......@@ -199,7 +198,7 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill ) cons
ATH_MSG_DEBUG( "Streamed to buffer at address " << mem << " of " << sz << " bytes" );
if ( mem == nullptr or sz == 0 ) {
ATH_MSG_ERROR( "Serialisation of " << address.type <<"#" << address.key << " unsuccessful" );
ATH_MSG_ERROR( "Serialisation of " << address.typeKey << " unsuccessful" );
return StatusCode::FAILURE;
}
......@@ -220,7 +219,7 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill ) cons
fragment[0] = fragment.size();
payload.insert( payload.end(), fragment.begin(), fragment.end() );
ATH_MSG_DEBUG( "Payload size after inserting " << address.type << "#" << address.key << " " << payload.size()*sizeof(uint32_t) << " bytes" );
ATH_MSG_DEBUG( "Payload size after inserting " << address.typeKey << " " << payload.size()*sizeof(uint32_t) << " bytes" );
}
......
......@@ -41,6 +41,7 @@ class TriggerEDMSerialiserTool: public extends<AthAlgTool, HLTResultMTMakerTool>
// internal structure to keep configuration organised conveniently
struct Address {
std::string typeKey;
std::string type;
CLID clid;
std::string key;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment