Performs actual deserialisation loop.
254 {
255
257 std::unique_ptr<char[]>
buff = std::make_unique<char[]>(buffSize);
258
259
260 auto resize = [&buffSize, &
buff](
const size_t neededSize ) ->
void {
261 if ( neededSize > buffSize ) {
262 buffSize = neededSize;
263 buff = std::make_unique<char[]>(buffSize);
264 }
265 };
266
267
268
269
270
271
272 std::unique_ptr<WritableAuxStore> currentAuxStoreOwner;
274 SG::AuxVectorBase* xAODInterfaceContainer = nullptr;
275
278 std::string previousKey;
279 while ( start != dataptr->end() ) {
282 std::string transientTypeName, transientTypeInfoName;
285
288 std::string persistentTypeName{
descr[0] };
291
294
296 continue;
297 }
298
300 " type: "<< transientTypeName << " (" << transientTypeInfoName << ")" <<
301 " persistent type: " << persistentTypeName << " key: " << key << " size: " << bsize );
304
305
307
310
311
312
313
314
315
316 CxxUtils::FPControl fpcontrol;
317 if (persistentTypeName == "xAOD::BTaggingTrigAuxContainer_v1") {
318 fpcontrol.holdExceptions();
319 }
320
321 size_t usedBytes{ bsize };
322 void*
obj{
nullptr };
323 {
324
325 RootUtils::WithRootErrorHandler hand( handleError(
buff.get(), usedBytes, dataptr, &*start) );
327 }
328
329 ATH_MSG_DEBUG(
"Deserialised object of ptr: " << obj <<
" which used: " << usedBytes <<
330 " bytes from available: " << bsize );
331 if ( obj == nullptr ) {
332 ATH_MSG_ERROR(
"Deserialisation of object of CLID " << clid <<
" and transientTypeName " <<
333 transientTypeName << " # " << key << " failed" );
334 return StatusCode::FAILURE;
335 }
336 const bool isxAODInterfaceContainer = (transientTypeName.starts_with("xAOD") and
337 not transientTypeName.contains("Aux") and
338 not transientTypeName.contains("ElementLink"));
339 const bool isxAODAuxContainer = (transientTypeName.starts_with("xAOD") and
340 transientTypeName.contains("Aux"));
341 const bool isxAODDecoration = transientTypeName.contains("vector");
342 const bool isTPContainer = persistentTypeName.contains("_p");
343 const bool isVersionChange = versionChange(persistentTypeName, transientTypeInfoName);
344
346 isxAODAuxContainer, isxAODDecoration, isTPContainer ) );
347
348 if ( isTPContainer or isVersionChange ) {
349 if ( isVersionChange )
ATH_MSG_DEBUG(
"Version change detected from " << persistentTypeName <<
" to "
350 << transientTypeInfoName << ". Will invoke PT converter." );
351
352 std::string decodedTransientName;
353 void *
converted =
m_tpTool->convertPT( persistentTypeName, obj, decodedTransientName );
356
357
361 }
362
363 if ( isxAODInterfaceContainer or isxAODAuxContainer or isTPContainer ) {
364 BareDataBucket* dataBucket = new BareDataBucket( obj, clid, std::move(classDesc) );
367 outputName, false, false );
368 if ( proxyPtr == nullptr ) {
369 ATH_MSG_WARNING(
"Recording of object of CLID " << clid <<
" and name " << outputName <<
" failed" );
370 }
371
372 if ( isxAODInterfaceContainer ) {
373
374
375
376 if (xAODInterfaceContainer!=nullptr &&
377 xAODInterfaceContainer->
trackIndices() && currentAuxStore==
nullptr) {
378 ATH_MSG_DEBUG(
"Container with key " << previousKey <<
" is missing its Aux store");
379 xAODInterfaceContainer->
setStore( DataLink<SG::IConstAuxStore>(previousKey+
"Aux.") );
380 }
381 currentAuxStore = nullptr;
382 const SG::BaseInfoBase* bib = getBaseInfo(clid);
383 if(!bib){
384 ATH_MSG_WARNING(
"No BaseInfoBase for CLID "<< clid <<
" and name " << outputName);
385 }
386 xAODInterfaceContainer =
387 bib ? reinterpret_cast<SG::AuxVectorBase*>(
390 : nullptr;
391 } else if (isxAODAuxContainer) {
392
394 ATH_CHECK( currentAuxStore ==
nullptr and xAODInterfaceContainer !=
nullptr );
395 const SG::BaseInfoBase* bib = getBaseInfo(clid);
396 SG::IAuxStore* auxHolder =
397 reinterpret_cast<SG::IAuxStore*>(
400
401 xAODInterfaceContainer->
setStore(auxHolder);
402 currentAuxStoreOwner = std::make_unique<WritableAuxStore>();
403 currentAuxStore = currentAuxStoreOwner.get();
404 auto p =
dynamic_cast<SG::IAuxStoreHolder*
>(auxHolder);
406
407 p->setStore( currentAuxStoreOwner.release() );
408 } else {
409 currentAuxStore = nullptr;
410 xAODInterfaceContainer = nullptr;
411 }
412
413 } else if ( isxAODDecoration ) {
414 if(
m_skipDuplicates and (currentAuxStore ==
nullptr || xAODInterfaceContainer ==
nullptr)) {
415 ATH_MSG_DEBUG(
"Decoration " << key <<
" encountered with no active container. Assume this was already handled.");
416 } else {
417 ATH_CHECK( currentAuxStore !=
nullptr and xAODInterfaceContainer !=
nullptr );
419 currentAuxStore, xAODInterfaceContainer ) );
420 }
421 }
423 }
424 return StatusCode::SUCCESS;
425}
#define ATH_CHECK
Evaluate an expression and check for errors.
uint32_t CLID
The Class ID type.
int fragmentCount(uint32_t data, int id)
ServiceHandle< StoreGateSvc > & evtStore()
virtual void * object() override
void setStore(SG::IAuxStore *store)
Set the store associated with this object.
bool trackIndices() const
Return true if index tracking is enabled for this container.
void * cast(void *p, CLID clid) const
Cast to a base pointer.
static TScopeAdapter ByNameNoQuiet(const std::string &name, Bool_t load=kTRUE)
void Destruct(void *place) const
Bool_t IsComplete() const
Gaudi::Property< int > m_initialSerialisationBufferSize
Payload::const_iterator PayloadIterator
ServiceHandle< IAthenaSerializeSvc > m_serializerSvc
ToolHandle< TrigSerTPTool > m_tpTool
Gaudi::Property< std::string > m_prefix
StatusCode deserialiseDynAux(const std::string &transientTypeName, const std::string &persistentTypeName, const std::string &decorationName, void *obj, WritableAuxStore *currentAuxStore, SG::AuxVectorBase *interface) const
Handle decoration.
Gaudi::Property< bool > m_skipDuplicates
StatusCode checkSanity(const std::string &transientTypeName, bool isxAODInterfaceContainer, bool isxAODAuxContainer, bool isDecoration, bool isTPContainer) const
Checker for data integrity, one and only one of the passed booleans can be true, else FAILURE is retu...
ServiceHandle< IClassIDSvc > m_clidSvc
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
constexpr TDA::PayloadIterator toNextFragment(TDA::PayloadIterator start)
Returns starting point of the next fragment, can be == end().
constexpr size_t dataSize(TDA::PayloadIterator start)
Size in bytes of the buffer that is needed to decode next fragment data content.
std::vector< std::string > collectionDescription(TDA::PayloadIterator start)
String description of the collection stored in the next fragment, returns persistent type name and th...
constexpr CLID collectionCLID(TDA::PayloadIterator start)
CLID of the collection stored in the next fragment.
void toBuffer(TDA::PayloadIterator start, char *buffer)
Copies fragment to the buffer, no size checking, use dataSize to do so.
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
virtual bool resize(size_t sz) override
Change the size of all aux data vectors.
static constexpr CLID ID()