Performs actual deserialisation loop.
255 {
256
258 std::unique_ptr<char[]>
buff = std::make_unique<char[]>(buffSize);
259
260
261 auto resize = [&buffSize, &
buff](
const size_t neededSize ) ->
void {
262 if ( neededSize > buffSize ) {
263 buffSize = neededSize;
264 buff = std::make_unique<char[]>(buffSize);
265 }
266 };
267
268
269
270
271
272
273 std::unique_ptr<WritableAuxStore> currentAuxStoreOwner;
275 SG::AuxVectorBase* xAODInterfaceContainer = nullptr;
276
279 std::string previousKey;
280 while ( start != dataptr->end() ) {
283 std::string transientTypeName, transientTypeInfoName;
286
289 std::string persistentTypeName{
descr[0] };
292
295
297 continue;
298 }
299
301 " type: "<< transientTypeName << " (" << transientTypeInfoName << ")" <<
302 " persistent type: " << persistentTypeName << " key: " << key << " size: " << bsize );
305
306
308
311
312
313
314
315
316
317 CxxUtils::FPControl fpcontrol;
318 if (persistentTypeName == "xAOD::BTaggingTrigAuxContainer_v1") {
319 fpcontrol.holdExceptions();
320 }
321
322 size_t usedBytes{ bsize };
323 void*
obj{
nullptr };
324 {
325
326 RootUtils::WithRootErrorHandler hand( handleError(
buff.get(), usedBytes, dataptr, &*start) );
328 }
329
330 ATH_MSG_DEBUG(
"Deserialised object of ptr: " << obj <<
" which used: " << usedBytes <<
331 " bytes from available: " << bsize );
332 if ( obj == nullptr ) {
333 ATH_MSG_ERROR(
"Deserialisation of object of CLID " << clid <<
" and transientTypeName " <<
334 transientTypeName << " # " << key << " failed" );
335 return StatusCode::FAILURE;
336 }
337 const bool isxAODInterfaceContainer = (transientTypeName.starts_with("xAOD") and
338 not transientTypeName.contains("Aux") and
339 not transientTypeName.contains("ElementLink"));
340 const bool isxAODAuxContainer = (transientTypeName.starts_with("xAOD") and
341 transientTypeName.contains("Aux"));
342 const bool isxAODDecoration = transientTypeName.contains("vector");
343 const bool isTPContainer = persistentTypeName.contains("_p");
344 const bool isVersionChange = versionChange(persistentTypeName, transientTypeInfoName);
345
347 isxAODAuxContainer, isxAODDecoration, isTPContainer ) );
348
349 if ( isTPContainer or isVersionChange ) {
350 if ( isVersionChange )
ATH_MSG_DEBUG(
"Version change detected from " << persistentTypeName <<
" to "
351 << transientTypeInfoName << ". Will invoke PT converter." );
352
353 std::string decodedTransientName;
354 void *
converted =
m_tpTool->convertPT( persistentTypeName, obj, decodedTransientName );
357
358
362 }
363
364 if ( isxAODInterfaceContainer or isxAODAuxContainer or isTPContainer ) {
365 BareDataBucket* dataBucket = new BareDataBucket( obj, clid, std::move(classDesc) );
368 outputName, false, false );
369 if ( proxyPtr == nullptr ) {
370 ATH_MSG_WARNING(
"Recording of object of CLID " << clid <<
" and name " << outputName <<
" failed" );
371 }
372
373 if ( isxAODInterfaceContainer ) {
374
375
376
377 if (xAODInterfaceContainer!=nullptr &&
378 xAODInterfaceContainer->
trackIndices() && currentAuxStore==
nullptr) {
379 ATH_MSG_DEBUG(
"Container with key " << previousKey <<
" is missing its Aux store");
380 xAODInterfaceContainer->
setStore( DataLink<SG::IConstAuxStore>(previousKey+
"Aux.") );
381 }
382 currentAuxStore = nullptr;
383 const SG::BaseInfoBase* bib = getBaseInfo(clid);
384 if(!bib){
385 ATH_MSG_WARNING(
"No BaseInfoBase for CLID "<< clid <<
" and name " << outputName);
386 }
387 xAODInterfaceContainer =
388 bib ? reinterpret_cast<SG::AuxVectorBase*>(
391 : nullptr;
392 } else if (isxAODAuxContainer) {
393
395 ATH_CHECK( currentAuxStore ==
nullptr and xAODInterfaceContainer !=
nullptr );
396 const SG::BaseInfoBase* bib = getBaseInfo(clid);
397 SG::IAuxStore* auxHolder =
398 reinterpret_cast<SG::IAuxStore*>(
402
403 xAODInterfaceContainer->
setStore(auxHolder);
404 currentAuxStoreOwner = std::make_unique<WritableAuxStore>();
405 currentAuxStore = currentAuxStoreOwner.get();
406 auto p =
dynamic_cast<SG::IAuxStoreHolder*
>(auxHolder);
408
409 p->setStore( currentAuxStoreOwner.release() );
410 } else {
411 currentAuxStore = nullptr;
412 xAODInterfaceContainer = nullptr;
413 }
414
415 } else if ( isxAODDecoration ) {
416 if(
m_skipDuplicates and (currentAuxStore ==
nullptr || xAODInterfaceContainer ==
nullptr)) {
417 ATH_MSG_DEBUG(
"Decoration " << key <<
" encountered with no active container. Assume this was already handled.");
418 } else {
419 ATH_CHECK( currentAuxStore !=
nullptr and xAODInterfaceContainer !=
nullptr );
421 transientTypeName, persistentTypeName, key, obj,
422 currentAuxStore, xAODInterfaceContainer ) );
423 }
424 }
426 }
427 return StatusCode::SUCCESS;
428}
#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.
virtual void toTransient(const EventContext &ctx)=0
Perform post-read processing on this store.
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
StatusCode deserialiseDynAux(const EventContext &ctx, const std::string &transientTypeName, const std::string &persistentTypeName, const std::string &decorationName, void *obj, WritableAuxStore *currentAuxStore, SG::AuxVectorBase *interface) const
Handle decoration.
ToolHandle< TrigSerTPTool > m_tpTool
Gaudi::Property< std::string > m_prefix
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()