Performs actual deserialisation loop.
266 {
267
269 std::unique_ptr<char[]>
buff = std::make_unique<char[]>(buffSize);
270
271
272 auto resize = [&buffSize, &
buff](
const size_t neededSize ) ->
void {
273 if ( neededSize > buffSize ) {
274 buffSize = neededSize;
275 buff = std::make_unique<char[]>(buffSize);
276 }
277 };
278
279
280
281
282
283
285 SG::AuxVectorBase* xAODInterfaceContainer = nullptr;
286
289 std::string previousKey;
290 while ( start != dataptr->end() ) {
293 std::string transientTypeName, transientTypeInfoName;
296
299 std::string persistentTypeName{
descr[0] };
302
305
307 continue;
308 }
309
311 " type: "<< transientTypeName << " (" << transientTypeInfoName << ")" <<
312 " persistent type: " << persistentTypeName << " key: " << key << " size: " << bsize );
313 resize( bsize );
315
316
318
321
322
323
324
325
326
327 CxxUtils::FPControl fpcontrol;
328 if (persistentTypeName == "xAOD::BTaggingTrigAuxContainer_v1") {
329 fpcontrol.holdExceptions();
330 }
331
332 size_t usedBytes{ bsize };
333 void*
obj{
nullptr };
334 {
335
336 RootUtils::WithRootErrorHandler hand( handleError(
buff.get(), usedBytes, dataptr, &*start) );
338 }
339
340 ATH_MSG_DEBUG(
"Deserialised object of ptr: " << obj <<
" which used: " << usedBytes <<
341 " bytes from available: " << bsize );
342 if ( obj == nullptr ) {
343 ATH_MSG_ERROR(
"Deserialisation of object of CLID " << clid <<
" and transientTypeName " <<
344 transientTypeName << " # " << key << " failed" );
345 return StatusCode::FAILURE;
346 }
347 const bool isxAODInterfaceContainer = (transientTypeName.rfind("xAOD", 0) != std::string::npos and
348 transientTypeName.find("Aux") == std::string::npos and
349 transientTypeName.find("ElementLink") == std::string::npos);
350 const bool isxAODAuxContainer = (transientTypeName.rfind("xAOD", 0) != std::string::npos and
351 transientTypeName.find("Aux") != std::string::npos);
352 const bool isxAODDecoration = transientTypeName.find("vector") != std::string::npos;
353 const bool isTPContainer = persistentTypeName.find("_p") != std::string::npos;
354 const bool isVersionChange = versionChange(persistentTypeName, transientTypeInfoName);
355
357 isxAODAuxContainer, isxAODDecoration, isTPContainer ) );
358
359 if ( isTPContainer or isVersionChange ) {
360 if ( isVersionChange )
ATH_MSG_DEBUG(
"Version change detected from " << persistentTypeName <<
" to "
361 << transientTypeInfoName << ". Will invoke PT converter." );
362
363 std::string decodedTransientName;
364 void *
converted =
m_tpTool->convertPT( persistentTypeName, obj, decodedTransientName );
367
368
372 }
373
374 if ( isxAODInterfaceContainer or isxAODAuxContainer or isTPContainer ) {
375 BareDataBucket* dataBucket = new BareDataBucket( obj, clid, classDesc );
378 outputName, false, false );
379 if ( proxyPtr == nullptr ) {
380 ATH_MSG_WARNING(
"Recording of object of CLID " << clid <<
" and name " << outputName <<
" failed" );
381 }
382
383 if ( isxAODInterfaceContainer ) {
384
385
386
387 if (xAODInterfaceContainer!=nullptr &&
388 xAODInterfaceContainer->
trackIndices() && currentAuxStore==
nullptr) {
389 ATH_MSG_DEBUG(
"Container with key " << previousKey <<
" is missing its Aux store");
390 xAODInterfaceContainer->
setStore( DataLink<SG::IConstAuxStore>(previousKey+
"Aux.") );
391 }
392 currentAuxStore = nullptr;
393 const SG::BaseInfoBase* bib = getBaseInfo(clid);
394 if(!bib){
395 ATH_MSG_WARNING(
"No BaseInfoBase for CLID "<< clid <<
" and name " << outputName);
396 }
397 xAODInterfaceContainer =
398 bib ? reinterpret_cast<SG::AuxVectorBase*>(
401 : nullptr;
402 } else if (isxAODAuxContainer) {
403
405 ATH_CHECK( currentAuxStore ==
nullptr and xAODInterfaceContainer !=
nullptr );
406 const SG::BaseInfoBase* bib = getBaseInfo(clid);
407 SG::IAuxStore* auxHolder =
408 reinterpret_cast<SG::IAuxStore*>(
411 xAODInterfaceContainer->
setStore(auxHolder);
413 dynamic_cast<SG::IAuxStoreHolder*>(auxHolder)->setStore( currentAuxStore );
414 } else {
415 currentAuxStore = nullptr;
416 xAODInterfaceContainer = nullptr;
417 }
418
419 } else if ( isxAODDecoration ) {
420 if(
m_skipDuplicates and (currentAuxStore ==
nullptr || xAODInterfaceContainer ==
nullptr)) {
421 ATH_MSG_DEBUG(
"Decoration " << key <<
" encountered with no active container. Assume this was already handled.");
422 } else {
423 ATH_CHECK( currentAuxStore !=
nullptr and xAODInterfaceContainer !=
nullptr );
425 currentAuxStore, xAODInterfaceContainer ) );
426 }
427 }
429 }
430 return StatusCode::SUCCESS;
431}
#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
TDA::PayloadIterator toNextFragment(TDA::PayloadIterator start)
Returns starting point of the next fragment, can be == end()
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...
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