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
273 SG::AuxVectorBase* xAODInterfaceContainer = nullptr;
274
277 std::string previousKey;
278 while ( start != dataptr->end() ) {
281 std::string transientTypeName, transientTypeInfoName;
284
287 std::string persistentTypeName{
descr[0] };
290
293
295 continue;
296 }
297
299 " type: "<< transientTypeName << " (" << transientTypeInfoName << ")" <<
300 " persistent type: " << persistentTypeName << " key: " << key << " size: " << bsize );
303
304
306
309
310
311
312
313
314
315 CxxUtils::FPControl fpcontrol;
316 if (persistentTypeName == "xAOD::BTaggingTrigAuxContainer_v1") {
317 fpcontrol.holdExceptions();
318 }
319
320 size_t usedBytes{ bsize };
321 void*
obj{
nullptr };
322 {
323
324 RootUtils::WithRootErrorHandler hand( handleError(
buff.get(), usedBytes, dataptr, &*start) );
326 }
327
328 ATH_MSG_DEBUG(
"Deserialised object of ptr: " << obj <<
" which used: " << usedBytes <<
329 " bytes from available: " << bsize );
330 if ( obj == nullptr ) {
331 ATH_MSG_ERROR(
"Deserialisation of object of CLID " << clid <<
" and transientTypeName " <<
332 transientTypeName << " # " << key << " failed" );
333 return StatusCode::FAILURE;
334 }
335 const bool isxAODInterfaceContainer = (transientTypeName.rfind("xAOD", 0) != std::string::npos and
336 transientTypeName.find("Aux") == std::string::npos and
337 transientTypeName.find("ElementLink") == std::string::npos);
338 const bool isxAODAuxContainer = (transientTypeName.rfind("xAOD", 0) != std::string::npos and
339 transientTypeName.find("Aux") != std::string::npos);
340 const bool isxAODDecoration = transientTypeName.find("vector") != std::string::npos;
341 const bool isTPContainer = persistentTypeName.find("_p") != std::string::npos;
342 const bool isVersionChange = versionChange(persistentTypeName, transientTypeInfoName);
343
345 isxAODAuxContainer, isxAODDecoration, isTPContainer ) );
346
347 if ( isTPContainer or isVersionChange ) {
348 if ( isVersionChange )
ATH_MSG_DEBUG(
"Version change detected from " << persistentTypeName <<
" to "
349 << transientTypeInfoName << ". Will invoke PT converter." );
350
351 std::string decodedTransientName;
352 void *
converted =
m_tpTool->convertPT( persistentTypeName, obj, decodedTransientName );
355
356
360 }
361
362 if ( isxAODInterfaceContainer or isxAODAuxContainer or isTPContainer ) {
363 BareDataBucket* dataBucket = new BareDataBucket( obj, clid, classDesc );
366 outputName, false, false );
367 if ( proxyPtr == nullptr ) {
368 ATH_MSG_WARNING(
"Recording of object of CLID " << clid <<
" and name " << outputName <<
" failed" );
369 }
370
371 if ( isxAODInterfaceContainer ) {
372
373
374
375 if (xAODInterfaceContainer!=nullptr &&
376 xAODInterfaceContainer->
trackIndices() && currentAuxStore==
nullptr) {
377 ATH_MSG_DEBUG(
"Container with key " << previousKey <<
" is missing its Aux store");
378 xAODInterfaceContainer->
setStore( DataLink<SG::IConstAuxStore>(previousKey+
"Aux.") );
379 }
380 currentAuxStore = nullptr;
381 const SG::BaseInfoBase* bib = getBaseInfo(clid);
382 if(!bib){
383 ATH_MSG_WARNING(
"No BaseInfoBase for CLID "<< clid <<
" and name " << outputName);
384 }
385 xAODInterfaceContainer =
386 bib ? reinterpret_cast<SG::AuxVectorBase*>(
389 : nullptr;
390 } else if (isxAODAuxContainer) {
391
393 ATH_CHECK( currentAuxStore ==
nullptr and xAODInterfaceContainer !=
nullptr );
394 const SG::BaseInfoBase* bib = getBaseInfo(clid);
395 SG::IAuxStore* auxHolder =
396 reinterpret_cast<SG::IAuxStore*>(
399 xAODInterfaceContainer->
setStore(auxHolder);
401 dynamic_cast<SG::IAuxStoreHolder*
>(auxHolder)->
setStore( currentAuxStore );
402 } else {
403 currentAuxStore = nullptr;
404 xAODInterfaceContainer = nullptr;
405 }
406
407 } else if ( isxAODDecoration ) {
408 if(
m_skipDuplicates and (currentAuxStore ==
nullptr || xAODInterfaceContainer ==
nullptr)) {
409 ATH_MSG_DEBUG(
"Decoration " << key <<
" encountered with no active container. Assume this was already handled.");
410 } else {
411 ATH_CHECK( currentAuxStore !=
nullptr and xAODInterfaceContainer !=
nullptr );
413 currentAuxStore, xAODInterfaceContainer ) );
414 }
415 }
417 }
418 return StatusCode::SUCCESS;
419}
#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.
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
static constexpr CLID ID()