ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
xAOD::RAuxStore Class Referenceabstract

#include <RAuxStore.h>

Inheritance diagram for xAOD::RAuxStore:
Collaboration diagram for xAOD::RAuxStore:

Classes

class  RFieldInfo
 

Public Types

enum  EStructMode { kUndefinedStore = 0, kContainerStore = 1, kObjectStore = 2 }
 "Structural" modes of the object More...
 

Public Member Functions

 RAuxStore (const char *prefix="", Bool_t topStore=kTRUE, EStructMode mode=kUndefinedStore)
 
virtual ~RAuxStore ()
 Destructor. More...
 
EStructMode structMode () const
 Return the structure mode of the object. More...
 
StatusCode readFrom (const std::string &fileName, const std::string &ntupleName)
 Connect the object to an input RNTuple. More...
 
StatusCode writeTo (const std::string &fileName, const std::string &ntupleName)
 Connect the object to an output RNTuple. More...
 
::Int_t getEntry (Long64_t entry, ::Int_t getall=0)
 Get entry from the input RNTuple. More...
 
void reset ()
 Reset the store. More...
 
virtual const void * getData (SG::auxid_t auxid) const=0
 Pick up the const version from the base class. More...
 
virtual bool insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t())=0
 Move all elements from other to this store. More...
 
virtual bool setOption (auxid_t, const AuxDataOption &)
 Set an option for a given auxiliary variable. More...
 
virtual const IAuxTypeVector * linkedVector (SG::auxid_t) const
 Return interface for a linked variable. More...
 
Functions implementing the SG::IConstAuxStore interface

Get a pointer to a given array

virtual const void * getData (auxid_t auxid) const override
 Get a pointer to a given array. More...
 
virtual const SG::IAuxTypeVectorgetVector (SG::auxid_t auxid) const override
 Return vector interface for one aux data item. More...
 
virtual const auxid_set_tgetAuxIDs () const override
 Get the types(names) of variables handled by this container. More...
 
virtual const auxid_set_tgetDecorIDs () const override
 Get the types(names) of decorations handled by this container. More...
 
virtual void * getDecoration (auxid_t auxid, size_t size, size_t capacity) override
 Get a pointer to a given array, creating the array if necessary. More...
 
virtual bool isDecoration (auxid_t auxid) const override
 Test if a variable is a decoration. More...
 
virtual void lock () override
 Lock the object, and don't let decorations be added. More...
 
virtual bool clearDecorations () override
 Remove the decorations added so far. More...
 
virtual void lockDecoration (SG::auxid_t auxid) override
 Lock a decoration. More...
 
virtual size_t size () const override
 Return the number of elements in the store. More...
 
virtual SG::IAuxTypeVectorlinkedVector (SG::auxid_t auxid) override
 Return interface for a linked variable. More...
 
virtual const SG::IAuxTypeVectorlinkedVector (SG::auxid_t auxid) const override
 Return const interface for a linked variable. More...
 
Functions implementing the SG::IAuxStore interface
virtual void * getData (auxid_t auxid, size_t size, size_t capacity) override
 Get a pointer to a given array, creating the array if necessary. More...
 
virtual const auxid_set_tgetWritableAuxIDs () const override
 Return a set of writable data identifiers. More...
 
virtual bool resize (size_t size) override
 Resize the arrays to a given size. More...
 
virtual void reserve (size_t size) override
 Reserve a given size for the arrays. More...
 
virtual void shift (size_t pos, ptrdiff_t offs) override
 Shift the contents of the stored arrays. More...
 
virtual bool insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
 Insert contents of another store via move. More...
 
Functions implementing the SG::IAuxStoreIO interface
virtual const void * getIOData (auxid_t auxid) const override
 Get a pointer to the data being stored for one aux data item. More...
 
virtual const std::type_info * getIOType (auxid_t auxid) const override
 Return the type of the data to be stored for one aux data item. More...
 
virtual const auxid_set_tgetDynamicAuxIDs () const override
 Get the types(names) of variables created dynamically. More...
 
virtual void selectAux (const std::set< std::string > &attributes)
 Select dynamic auxiliary attributes for writing. More...
 
virtual auxid_set_t getSelectedAuxIDs () const override
 Get the IDs of the selected aux variables. More...
 

Static Public Attributes

static constexpr bool supportsThinning = true
 Mark that this type supports thinning operations. More...
 

Private Types

typedef SG::auxid_t auxid_t
 Convenience type declaration. More...
 
typedef SG::auxid_set_t auxid_set_t
 Convenience type declaration. More...
 
typedef AthContainers_detail::mutex mutex_t
 Mutex type for multithread synchronization. More...
 
typedef AthContainers_detail::lock_guard< mutex_tguard_t
 Guard type for multithreaded synchronisation. More...
 

Private Member Functions

StatusCode setupInputData (auxid_t auxid)
 Connect a variable to the input tree. More...
 
StatusCode setupOutputData (auxid_t auxid)
 Connect a variable to the output ntuple. More...
 
StatusCode scanInputNtuple ()
 Scan the input RNTuple for auxiliary fields. More...
 
const std::type_info * auxFieldType (const std::string &fieldName, const std::string &auxName, ::Bool_t staticField)
 Find the type_info to use as the aux type for a given field. More...
 
StatusCode setupAuxField (const std::string &fieldName, const std::string &auxName, ::Bool_t staticField)
 Register one input field as an available auxiliary variable. More...
 
::Bool_t isAuxIDSelected (auxid_t auxid) const
 Check if this auxiliary variable needs to go to the output. More...
 
::Bool_t isPrimitiveField (std::string fieldName)
 Check if a field holds a primitive variable or not. More...
 
::Bool_t isContainerField (std::string fieldName, auxid_t auxid) const
 Check if a field describes a container or a single object. More...
 
StatusCode addVectorField (std::string fieldName, std::string fieldTypeName, ::Bool_t isInputFile)
 Add a vector field to a model (either the input or the output one) More...
 
::Bool_t fieldInfosHasAuxid (auxid_t auxid) const
 Checks if the fieldInfos map has an entry for the given auxid. More...
 

Static Private Member Functions

::Bool_t isRegisteredType (auxid_t auxid)
 Check if the auxiliary variable has a registered type. More...
 

Private Attributes

std::string m_prefix
 Static prefix for the field names. More...
 
std::string m_dynPrefix
 Dynamic prefix for the field names. More...
 
::Bool_t m_topStore
 Flag stating whether this is a "top store". More...
 
EStructMode m_structMode
 The "structural" mode of the object. More...
 
std::unique_ptr< RNTupleReaderm_inNtuple
 The ntuple being read from. More...
 
std::unique_ptr< RNTupleReaderm_outNtuple
 The the ntuple being written to. More...
 
::Bool_t m_inputScanned
 "Scan status" of the input RNTuple More...
 
AuxSelection m_selection
 Object helping to select which auxiliary variables to write. More...
 
SG::AuxStoreInternalm_transientStore {}
 Store for the in-memory-only variables. More...
 
auxid_set_t m_auxIDs
 Internal list of variable IDs handled currently by the object. More...
 
auxid_set_t m_decorIDs
 
std::vector< SG::IAuxTypeVector * > m_vecs
 Variables handled currently by the object. More...
 
std::size_t m_size {}
 The current size of the container being described. More...
 
::Bool_t m_locked
 Is this container locked? More...
 
std::vector< ::Bool_t > m_isDecoration
 Flags items as decorations. More...
 
mutex_t m_mutex1
 Mutexes object used for multithreaded synchronisation. More...
 
mutex_t m_mutex2
 
std::string m_inFileName
 The input file that we are reading from. More...
 
std::string m_outFileName
 The output file that we are writing to. More...
 
std::string m_inputNtupleName
 The name of the ntuple that we are reading from. More...
 
std::string m_outputNtupleName
 The name of the ntuple that we are writing to. More...
 
std::unique_ptr< RNTupleModel > m_outModel
 The model of the output ntuple. More...
 
std::unique_ptr< RNTupleModel > m_inModel
 The model of the input ntuple. More...
 
::Long64_t m_entryToLoad
 The entry to load from the ntuple. More...
 
std::map< auxid_t, RFieldInfom_fields
 A way to acces an representation of a field with an auxid. More...
 

Detailed Description

Definition at line 36 of file RAuxStore.h.

Member Typedef Documentation

◆ auxid_set_t

Convenience type declaration.

Definition at line 41 of file RAuxStore.h.

◆ auxid_t

Convenience type declaration.

Definition at line 39 of file RAuxStore.h.

◆ guard_t

typedef AthContainers_detail::lock_guard< mutex_t > xAOD::RAuxStore::guard_t
private

Guard type for multithreaded synchronisation.

Definition at line 220 of file RAuxStore.h.

◆ mutex_t

typedef AthContainers_detail::mutex xAOD::RAuxStore::mutex_t
private

Mutex type for multithread synchronization.

Definition at line 218 of file RAuxStore.h.

Member Enumeration Documentation

◆ EStructMode

"Structural" modes of the object

Enumerator
kUndefinedStore 

The structure mode is not defined.

kContainerStore 

The object describes an entire container.

kObjectStore 

The object describes a single object.

Definition at line 45 of file RAuxStore.h.

45  {
46  kUndefinedStore = 0,
47  kContainerStore = 1,
48  kObjectStore = 2
49  };

Constructor & Destructor Documentation

◆ RAuxStore()

xAOD::RAuxStore::RAuxStore ( const char prefix = "",
Bool_t  topStore = kTRUE,
EStructMode  mode = kUndefinedStore 
)

Definition at line 50 of file RAuxStore.cxx.

51  : SG::IAuxStore(),
52  m_prefix( prefix ),
54  m_topStore( topStore ),
55  m_structMode( mode ),
56  m_inNtuple( nullptr ),
57  m_outNtuple( nullptr ),
58  m_inputScanned( kFALSE ),
59  m_selection(),
60  m_transientStore( 0 ),
61  m_auxIDs(),
62  m_decorIDs(),
63  m_vecs(),
64  m_size( 0 ),
65  m_locked( kFALSE ),
67  m_mutex1(),
68  m_mutex2(),
69  m_inFileName(),
70  m_outFileName(),
73  m_outModel( nullptr ),
74  m_inModel( nullptr ),
75  m_entryToLoad( 0 ),
76  m_fields() {}

◆ ~RAuxStore()

xAOD::RAuxStore::~RAuxStore ( )
virtual

Destructor.

Definition at line 78 of file RAuxStore.cxx.

78  {
79  delete m_transientStore;
80  m_transientStore = nullptr;
81  for( auto& fieldPair : m_fields ) {
82  fieldPair.second.field.release();//not a leak (coverity 17624)
83  }
84  m_fields.clear(); // Ensure m_fields is properly cleared
85  }

Member Function Documentation

◆ addVectorField()

StatusCode xAOD::RAuxStore::addVectorField ( std::string  fieldName,
std::string  fieldTypeName,
::Bool_t  isInputFile 
)
private

Add a vector field to a model (either the input or the output one)

This function creates a base field using the provided field name and type name.

Depending on whether the field is for the input file or the output file, it adds the field to the appropriate ntuple model.

Parameters
fieldNameThe name of the field to be added.
fieldTypeNameThe type name of the field to be added.
isInputFileA boolean flag indicating whether the field is for the input file.
Returns
StatusCode::SUCCESS if the field is added successfully, StatusCode::FAILURE otherwise.

Definition at line 1807 of file RAuxStore.cxx.

1809  {
1810  auto baseFieldResult = RFieldBase::Create( fieldName, fieldTypeName );
1811  if( baseFieldResult ) {
1812  auto baseField = baseFieldResult.Unwrap();
1813  if( isInputFile ) {
1814  if( m_inModel != nullptr ) {
1815  m_inModel->AddField( std::move( baseField ) );
1816  } else {
1817  return StatusCode::FAILURE;
1818  }
1819  } else {
1820  if( m_outModel != nullptr ) {
1821  m_outModel->AddField( std::move( baseField ) );
1822  } else {
1823  return StatusCode::FAILURE;
1824  }
1825  }
1826  }
1827  return StatusCode::SUCCESS;
1828  }

◆ auxFieldType()

const std::type_info * xAOD::RAuxStore::auxFieldType ( const std::string &  fieldName,
const std::string &  auxName,
::Bool_t  isStaticField 
)
private

Find the type_info to use as the aux type for a given field.

This function retrieves the type information for a given auxiliary field.

It uses the field's inspector to determine the type and handles cases where the expected class or collection proxy is not available.

Parameters
fieldNameThe name of the field in the ntuple
auxNameThe name of the auxiliary field.
isStaticFieldkTRUE if this is a static field, and kFALSE if it's a dynamic one

Definition at line 1385 of file RAuxStore.cxx.

1387  {
1388 
1389  auto inspector =
1390  RNTupleInspector::Create( m_inputNtupleName, m_inFileName );
1391  const auto& fieldInspector = inspector->GetFieldTreeInspector( fieldName );
1392 
1393  std::string typeName =
1394  fieldInspector.GetDescriptor().GetTypeName().c_str();
1395  const auto expectedClass = ::TClass::GetClass(
1396  fieldInspector.GetDescriptor().GetTypeName().c_str() );
1397 
1398  if( ( !expectedClass ) && ( m_structMode == kUndefinedStore ) ) {
1400  }
1401 
1402  const std::type_info* ti = 0;
1403  if( m_structMode == kObjectStore ) {
1404  if( expectedClass ) {
1405  ti = expectedClass->GetTypeInfo();
1406  } else {
1407  ti = &( Utils::getTypeInfo( kOther_t ) );
1408  }
1409  } else {
1410  if( !expectedClass ) {
1411  if( ( !isStaticField ) ||
1412  ( strncmp( auxName.c_str(), "m_", 2 ) != 0 ) ) {
1413  ::Warning( "xAOD::RAuxStore::auxFieldType",
1414  "Couldn't get the type of field \"%s\"",
1415  fieldName.c_str() );
1416  }
1417  } else {
1418  ::TVirtualCollectionProxy* prox =
1419  expectedClass->GetCollectionProxy();
1420 
1421  if( !prox ) {
1422  TClass* cl2 = lookupVectorType( expectedClass );
1423  if( cl2 ) prox = cl2->GetCollectionProxy();
1424  }
1425 
1426  if( !prox ) {
1427  if( ( !isStaticField ) ||
1428  ( strncmp( auxName.c_str(), "m_", 2 ) != 0 ) ) {
1429  ::Warning( "xAOD::RAuxStore::auxFieldType",
1430  "Couldn't get the type of field \"%s\"",
1431  fieldName.c_str() );
1432  }
1433  } else {
1434  if( prox->GetValueClass() ) {
1435  ti = prox->GetValueClass()->GetTypeInfo();
1436  } else {
1437  ti = &( Utils::getTypeInfo( prox->GetType() ) );
1438  }
1439  }
1440  }
1441  }
1442  return ti;
1443  }

◆ clearDecorations()

bool xAOD::RAuxStore::clearDecorations ( )
overridevirtual

Remove the decorations added so far.

Only works for transient decorations.

Only works for transient decorations.

Returns
True if any decorations were removed; otherwise, false

Implements SG::IConstAuxStore.

Definition at line 406 of file RAuxStore.cxx.

406  {
407  // Guard against multi-threaded execution:
408  guard_t guard( m_mutex1 );
409 
410  // Clear the transient decorations:
411  bool anycleared = false;
412  if( m_transientStore ) {
414 
415  // Clear the decorations from the transient store:
416  anycleared = m_transientStore->clearDecorations();
417 
418  // Remove ids that were cleared.
419  if( anycleared ) {
420  oldIdSet -= m_transientStore->getAuxIDs();
421  // oldIdSet is now the set of ids that were cleared.
422  m_auxIDs -= oldIdSet;
423  m_decorIDs.clear();
424  }
425  }
426 
427  return anycleared;
428  }

◆ fieldInfosHasAuxid()

Bool_t xAOD::RAuxStore::fieldInfosHasAuxid ( auxid_t  auxid) const
private

Checks if the fieldInfos map has an entry for the given auxid.

Parameters
auxidThe auxid to check for in the fieldInfos map.
Returns
kTRUE if the fieldInfos map has an entry for the given auxid, kFALSE otherwise.

Definition at line 1836 of file RAuxStore.cxx.

1836  {
1837  return !( m_fields.find( auxid ) == m_fields.end() );
1838  }

◆ getAuxIDs()

const RAuxStore::auxid_set_t & xAOD::RAuxStore::getAuxIDs ( ) const
overridevirtual

Get the types(names) of variables handled by this container.

Returns
A constant reference to the set of auxiliary IDs

Implements SG::IConstAuxStore.

Definition at line 276 of file RAuxStore.cxx.

276  {
277  return m_auxIDs;
278  }

◆ getData() [1/3]

const void * xAOD::RAuxStore::getData ( auxid_t  auxid) const
overridevirtual

Get a pointer to a given array.

Parameters
auxidThe auxiliary ID for which to retrieve the data pointer
Returns
Pointer to the data if it exists; otherwise, nullptr

Implements SG::IConstAuxStore.

Definition at line 218 of file RAuxStore.cxx.

218  {
219  const SG::IAuxTypeVector* v = getVector( auxid );
220  if( v ) {
221  return v->toPtr();
222  }
223  return nullptr;
224  }

◆ getData() [2/3]

void * xAOD::RAuxStore::getData ( auxid_t  auxid,
size_t  size,
size_t  capacity 
)
overridevirtual

Get a pointer to a given array, creating the array if necessary.

Retrieves or creates data for a given auxiliary ID.

It handles both transient and output data, ensuring that the data is properly set up and sized.

Parameters
auxidThe auxiliary ID for which data is requested
sizeThe size of the data to be retrieved or created
capacityThe capacity of the data to be retrieved or created
Returns
A pointer to the data for the given auxiliary ID

Implements SG::IAuxStore.

Definition at line 524 of file RAuxStore.cxx.

524  {
525  // Guard against multi-threaded execution:
526  guard_t guard( m_mutex2 );
527 
528  // Remember the size:
529  m_size = size;
530 
531  // Check if we want to write this variable to the output:
532  if( ( !m_outNtuple ) || ( !isAuxIDSelected( auxid ) ) ) {
533  // Create the store only when necessary:
534  if( !m_transientStore ) {
537  if( m_locked ) {
539  }
540  }
541  // Let the transient store create the variable:
542  size_t nids = m_transientStore->getAuxIDs().size();
543  void* result = m_transientStore->getData( auxid, size, capacity );
544  if( result && ( nids != m_transientStore->getAuxIDs().size() ) ) {
545  m_auxIDs.insert( auxid );
546  }
547  // Return the address in the transient memory:
548  return result;
549  }
550 
551  // If the variable exists already, and this is a locked store, then
552  // we are in trouble.
553  if( m_locked && ( auxid < m_vecs.size() ) && m_vecs[auxid] ) {
554  if( !( ( auxid < m_isDecoration.size() ) && m_isDecoration[auxid] ) ) {
555  throw SG::ExcStoreLocked( auxid );
556  }
557  }
558 
559  // Connect this auxiliary variable just to the output:
560  if( setupOutputData( auxid ).isFailure() ) {
561  ::Error( "xAOD::RAuxStore::getData",
562  XAOD_MESSAGE( "Failed to set up variable %s" ),
563  SG::AuxTypeRegistry::instance().getName( auxid ).c_str() );
564  return 0;
565  }
566 
567  // Check whether things make sense:
568  if( ( m_structMode == kObjectStore ) && ( size != 1 ) ) {
569  ::Error( "xAOD::RAuxStore::getData",
570  XAOD_MESSAGE( "Field creation requested with:" ) );
571  ::Error( "xAOD::RAuxStore::getData", XAOD_MESSAGE( " name = %s" ),
572  SG::AuxTypeRegistry::instance().getName( auxid ).c_str() );
573  ::Error( "xAOD::RAuxStore::getData", XAOD_MESSAGE( " size = %i" ),
574  static_cast< int >( size ) );
575  ::Error( "xAOD::RAuxStore::getData",
576  XAOD_MESSAGE( " m_structMode = kObjectStore" ) );
577  return 0;
578  }
579 
580  // Make sure the variable is of the right size:
581  m_vecs[auxid]->reserve( capacity );
582  m_vecs[auxid]->resize( size );
583 
584  // Return the object:
585  return m_vecs[auxid]->toPtr();
586  }

◆ getData() [3/3]

virtual const void* SG::IConstAuxStore::getData
inherited

Pick up the const version from the base class.

◆ getDecoration()

void * xAOD::RAuxStore::getDecoration ( auxid_t  auxid,
size_t  size,
size_t  capacity 
)
overridevirtual

Get a pointer to a given array, creating the array if necessary.

Returns a pointer to the decoration data corresponding to the specified auxid.

If the decoration does not exist, it creates it. Handles locked stores and transient stores appropriately.

Parameters
auxidThe auxiliary ID for which to retrieve or create the decoration.
sizeThe size of the decoration vector.
capacityThe capacity of the decoration vector.
Returns
Pointer to the decoration data if successful; otherwise, nullptr.

Implements SG::IConstAuxStore.

Definition at line 296 of file RAuxStore.cxx.

297  {
298 
299  // Guard against multi-threaded execution:
300  guard_t guard( m_mutex1 );
301 
302  // Remember the requested size:
303  m_size = size;
304 
305  // If this is a locked object, deal with it correctly:
306  if( m_locked ) {
307  // If the variable exists already and it's a decoration, then let's
308  // give it back.
309  if( ( auxid < m_vecs.size() ) && m_vecs[auxid] &&
310  ( auxid < m_isDecoration.size() && m_isDecoration[auxid] ) ) {
311  // Things look okay...
312  m_vecs[auxid]->reserve( capacity );
313  m_vecs[auxid]->resize( size );
314  return m_vecs[auxid]->toPtr();
315  }
316  // If it's in the transient store already, return it from there.
317  // Since in a locked store *everything* is a decoration in the
318  // transient store.
319  if( m_transientStore && m_transientStore->getAuxIDs().test( auxid ) ) {
320  return m_transientStore->getDecoration( auxid, size, capacity );
321  }
322  // If we know this auxiliary ID, but it was not found as a decoration
323  // by the previous checks, then we're in trouble.
324  if( m_auxIDs.test( auxid ) ) {
325  // It may still be a decoration in a transient store. If such
326  // a store exists, leave it up to that store to
327  throw SG::ExcStoreLocked( auxid );
328  }
329  }
330 
331  // Check if we want to write this variable to the output:
332  if( ( !isAuxIDSelected( auxid ) ) || ( !m_outNtuple ) ) {
333 
334  // Create the store only when necessary:
335  if( !m_transientStore ) {
338  if( m_locked ) {
340  }
341  }
342  // Let the transient store create the decoration:
343  const size_t nids = m_transientStore->getAuxIDs().size();
344  void* result =
345  m_transientStore->getDecoration( auxid, size, capacity );
346  if( result && ( nids != m_transientStore->getAuxIDs().size() ) ) {
347  m_auxIDs.insert( auxid );
348  if( m_transientStore->isDecoration( auxid ) ) {
349  m_decorIDs.insert( auxid );
350  }
351  }
352  // Return the memory address from the transient store:
353  return result;
354  }
355 
356  // Doesn't exist yet. So let's make it:
357  void* result = getData( auxid, size, capacity );
358  if( m_locked ) {
359  // If the container is locked, remember that this is a decoration:
360  if( m_isDecoration.size() <= auxid ) {
361  m_isDecoration.resize( auxid + 1 );
362  }
363  m_isDecoration[auxid] = ::kTRUE;
364  m_decorIDs.insert( auxid );
365  }
366  // Return the pointer made by getData(...):
367  return result;
368  }

◆ getDecorIDs()

const RAuxStore::auxid_set_t & xAOD::RAuxStore::getDecorIDs ( ) const
overridevirtual

Get the types(names) of decorations handled by this container.

Retrieves the set of decoration IDs currently associated with this store.

Returns
A constant reference to the set of decoration IDs

Implements SG::IConstAuxStore.

Definition at line 282 of file RAuxStore.cxx.

282  {
283  return m_decorIDs;
284  }

◆ getDynamicAuxIDs()

const SG::auxid_set_t & xAOD::RAuxStore::getDynamicAuxIDs ( ) const
overridevirtual

Get the types(names) of variables created dynamically.

Returns
A const reference to the set of auxiliary IDs

Implements SG::IAuxStoreIO.

Definition at line 848 of file RAuxStore.cxx.

848  {
849 
850  // All the auxiliary decorations handled by this object are considered
851  // dynamic:
852  return getAuxIDs();
853  }

◆ getEntry()

Int_t xAOD::RAuxStore::getEntry ( Long64_t  entry,
::Int_t  getall = 0 
)

Get entry from the input RNTuple.

Definition at line 155 of file RAuxStore.cxx.

155  {
156 
157  // Guard against multi-threaded execution:
158  guard_t guard( m_mutex1 );
159 
161  // Reset the transient store. TEvent::fill() calls this function with
162  // getall==99. When that is happening, we need to keep the transient
163  // store still around. Since the user may want to interact with the
164  // object after it was written out. (And since TEvent::fill() asks for
165  // the transient decorations after calling getEntry(...).)
166  if( m_transientStore && ( getall != 99 ) ) {
167  // Remove the transient auxiliary IDs from the internal list:
170  // Delete the object:
171  delete m_transientStore;
172  m_transientStore = 0;
173  }
174 
175  // Now remove the IDs of the decorations that are getting persistified:
176  if( getall != 99 ) {
177  for( auxid_t auxid = 0; auxid < m_isDecoration.size(); ++auxid ) {
178  if( !m_isDecoration[auxid] ) {
179  continue;
180  }
181  m_auxIDs.erase( auxid );
182  m_decorIDs.erase( auxid );
183  }
184  }
185 
186  // If we don't need everything loaded, return now:
187  if( !getall ) return 0;
188 
189  // Get all the variables at once:
190  ::Int_t minEntryStatus = 1;
191  for( auto& fieldPair : m_fields ) {
192  if( fieldPair.second.field ) {
193  minEntryStatus =
194  std::min( minEntryStatus, ( fieldPair.second ).getEntry(m_entryToLoad) );
195  }
196  }
197  return minEntryStatus;
198  }

◆ getIOData()

const void * xAOD::RAuxStore::getIOData ( SG::auxid_t  auxid) const
overridevirtual

Get a pointer to the data being stored for one aux data item.

Retrieves the input/output data for a given auxiliary ID.

It ensures that the data is properly set up and available in memory.

Parameters
auxidThe auxiliary ID for which data is requested.
Returns
A pointer to the data for the given auxiliary ID, or nullptr if the data is not available.

Implements SG::IAuxStoreIO.

Definition at line 762 of file RAuxStore.cxx.

762  {
763 
764  // Guard against multi-threaded execution:
765  guard_t guard( m_mutex1 );
766 
767  // If the variable is connected to already:
768  if( fieldInfosHasAuxid( auxid ) ) {
769  // Return the pointer:
770  return m_fields.at( auxid ).object;
771  }
772 
773  // Check if it's in the transient store:
774  if( m_transientStore && m_transientStore->getAuxIDs().test( auxid ) ) {
775  return m_transientStore->getIOData( auxid );
776  }
777 
778  // If not, try connecting to it now:
779  auto this_nc ATLAS_THREAD_SAFE =
780  const_cast< RAuxStore* >( this ); // locked above
781  if( !this_nc->setupInputData( auxid ).isSuccess() ) {
782  // This is not actually an error condition anymore. We can end up here
783  // when we decorate constant objects coming from the input file, but
784  // on one event we can't set any decorations. For instance when the
785  // input container is empty. In that case the object will still list
786  // the auxiliary ID belonging to that decoration as being available,
787  // but it really isn't.
788  //
789  // Later on it might be needed to tweak the logic of all of this, but
790  // for now just silently returning 0 seems to do the right thing.
791  return 0;
792  }
793 
794  // Now we should know this variable:
795  if( !fieldInfosHasAuxid( auxid ) ) {
796  ::Fatal( "xAOD::RAuxStore::getIOData",
797  XAOD_MESSAGE( "Internal logic error detected" ) );
798  return 0;
799  }
800 
801  // Return the pointer:
802  return m_fields.at( auxid ).object;
803  }

◆ getIOType()

const std::type_info * xAOD::RAuxStore::getIOType ( SG::auxid_t  auxid) const
overridevirtual

Return the type of the data to be stored for one aux data item.

Implements SG::IAuxStoreIO.

Definition at line 805 of file RAuxStore.cxx.

805  {
806 
807  // Guard against multi-threaded execution:
808  guard_t guard( m_mutex1 );
809 
810  // If the variable is connected to already:
811  if( ( auxid < m_fields.size() ) &&
812  ( m_fields.find( auxid ) == m_fields.end() ) ) {
813  return m_fields.at( auxid ).typeInfo;
814  }
815 
816  // Check if it's in the transient store:
817  if( m_transientStore && m_transientStore->getAuxIDs().test( auxid ) ) {
818  return m_transientStore->getIOType( auxid );
819  }
820 
821  // If not, try connecting to it now:
822  auto this_nc ATLAS_THREAD_SAFE =
823  const_cast< RAuxStore* >( this ); // locked above
824  if( !this_nc->setupInputData( auxid ).isSuccess() ) {
825  ::Error( "xAOD::RAuxStore::getIOType",
826  XAOD_MESSAGE( "Couldn't connect to auxiliary variable "
827  "%i %s" ),
828  static_cast< int >( auxid ),
829  SG::AuxTypeRegistry::instance().getName( auxid ).c_str() );
830  return 0;
831  }
832 
833  // Now we should know this variable:
834  if( ( auxid >= m_fields.size() ) ||
835  ( m_fields.find( auxid ) == m_fields.end() ) ) {
836  ::Fatal( "xAOD::RAuxStore::getIOType",
837  XAOD_MESSAGE( "Internal logic error detected" ) );
838  return 0;
839  }
840 
841  // Return the type info:
842  return m_fields.at( auxid ).typeInfo;
843  }

◆ getSelectedAuxIDs()

SG::auxid_set_t xAOD::RAuxStore::getSelectedAuxIDs ( ) const
overridevirtual

Get the IDs of the selected aux variables.

Retrieves the selected auxiliary IDs.

Returns
A set of selected auxiliary IDs

Reimplemented from SG::IAuxStoreIO.

Definition at line 871 of file RAuxStore.cxx.

871  {
872  // Guard against multi-threaded execution:
873  guard_t guard( m_mutex1 );
874 
875  // Leave the calculation up to the internal object:
877  }

◆ getVector()

const SG::IAuxTypeVector * xAOD::RAuxStore::getVector ( SG::auxid_t  auxid) const
overridevirtual

Return vector interface for one aux data item.

Parameters
auxidThe auxiliary ID for which to retrieve the data vector
Returns
Pointer to the SG::IAuxTypeVector if it exists; otherwise, nullptr

Implements SG::IConstAuxStore.

Definition at line 232 of file RAuxStore.cxx.

232  {
233  // Guard against multi-threaded execution:
234  guard_t guard( m_mutex1 );
235 
236  // Check if the transient store already handles this variable:
237  if( m_transientStore &&
238  ( m_transientStore->getAuxIDs().test( auxid ) ) ) {
239  return m_transientStore->getVector( auxid );
240  }
241 
242  // Connect this auxiliary variable both to the input and output
243  // if needed:
244  if( ( auxid >= m_vecs.size() ) || ( !m_vecs[auxid] ) ||
245  ( !fieldInfosHasAuxid( auxid ) ) ) {
246  auto this_nc ATLAS_THREAD_SAFE =
247  const_cast< RAuxStore* >( this ); // locked above
248  if( ( !this_nc->setupInputData( auxid ).isSuccess() ) ||
249  ( !this_nc->setupOutputData( auxid ).isSuccess() ) ) {
250  return nullptr;
251  }
252  }
253 
254  if( fieldInfosHasAuxid( auxid ) ) {
255  auto it = m_fields.find( auxid );
256  if( it != m_fields.end() ) {
257  const ::Int_t result =
258  const_cast< RFieldInfo& >( it->second ).getEntry(m_entryToLoad);
259  if( result < 0 ) {
260  ::Error(
261  "xAOD::RAuxStore::getData",
262  XAOD_MESSAGE( "Couldn't read in variable %s" ),
263  SG::AuxTypeRegistry::instance().getName( auxid ).c_str() );
264  return nullptr;
265  }
266  }
267  }
268 
269  // Return the pointer to the data vector:
270  return m_vecs[auxid];
271  }

◆ getWritableAuxIDs()

const SG::auxid_set_t & xAOD::RAuxStore::getWritableAuxIDs ( ) const
overridevirtual

Return a set of writable data identifiers.

Retrieves a set of writable auxiliary IDs.

Returns
A const reference to the set of writable auxiliary IDs

Implements SG::IAuxStore.

Definition at line 592 of file RAuxStore.cxx.

592  {
593  return getAuxIDs();
594  }

◆ insertMove() [1/2]

bool xAOD::RAuxStore::insertMove ( size_t  pos,
IAuxStore &  other,
const SG::auxid_set_t ignore 
)
overridevirtual

Insert contents of another store via move.

inserts and moves elements from another auxiliary store into this one, starting at the specified position.

It adjusts the size of the container accordingly.

Parameters
posThe position at which to start inserting elements.
otherThe auxiliary store from which to move elements.
ignore_inA set of auxiliary IDs to ignore during the move.
Returns
True if the move was successful, false otherwise.

Definition at line 708 of file RAuxStore.cxx.

709  {
710  // Guard against multi-threaded execution:
711  guard_t guard( m_mutex1 );
712 
713  // A sanity check:
714  if( m_structMode == kObjectStore ) {
715  ::Error( "xAOD::RAuxStore::insertMove",
716  XAOD_MESSAGE( "Should not have been called for single-object "
717  "store" ) );
718  return false;
719  }
720 
721  bool nomove = true;
722  size_t other_size = other.size();
723 
724  SG::auxid_set_t ignore = ignore_in;
725 
726  for( SG::auxid_t id : m_auxIDs ) {
727  SG::IAuxTypeVector* v_dst = nullptr;
728  if( id < m_vecs.size() ) v_dst = m_vecs[id];
729  if( v_dst && !v_dst->isLinked() ) {
730  ignore.insert( id );
731  if( other.getData( id ) ) {
732  void* src_ptr = other.getData( id, other_size, other_size );
733  if( src_ptr ) {
734  if( !v_dst->insertMove( pos, src_ptr, 0, other_size, other ) )
735  nomove = false;
736  }
737  } else {
738  const void* orig = v_dst->toPtr();
739  v_dst->shift( pos, other_size );
740  if( orig != v_dst->toPtr() ) nomove = false;
741  }
742  }
743  }
744 
745  if( m_transientStore ) {
747  nomove = false;
748  }
749 
750  return nomove;
751  }

◆ insertMove() [2/2]

virtual bool SG::IAuxStore::insertMove ( size_t  pos,
IAuxStore other,
const SG::auxid_set_t ignore = SG::auxid_set_t() 
)
pure virtualinherited

Move all elements from other to this store.

Parameters
posThe starting index of the insertion.
otherStore from which to do the move.
ignoreSet of variables that should not be added to the store.

Let len be the size of other. The store will be increased in size by len elements, with the elements at pos being copied to pos+len. Then, for each auxiliary variable, the entire contents of that variable for other will be moved to this store at index pos. This will be done via move semantics if possible; otherwise, it will be done with a copy. Variables present in this store but not in other will have the corresponding elements default-initialized. Variables in other but not in this store will be added unless they are in ignore.

Returns true if it is known that none of the vectors' memory moved, false otherwise.

Implemented in SG::AuxStoreInternal.

◆ isAuxIDSelected()

Bool_t xAOD::RAuxStore::isAuxIDSelected ( auxid_t  auxid) const
private

Check if this auxiliary variable needs to go to the output.

This function checks whether a given auxiliary ID is selected.

Parameters
auxidThe auxiliary ID that should be checked
Returns
kTRUE if the variable needs to be written out, kFALSE if not

Definition at line 1611 of file RAuxStore.cxx.

1611  {
1612 
1613  // A temporary object:
1614  auxid_set_t auxids;
1615  auxids.insert( auxid );
1616 
1617  // Check if the auxid is returned as a selected ID:
1618  return m_selection.getSelectedAuxIDs( auxids ).size();
1619  }

◆ isContainerField()

Bool_t xAOD::RAuxStore::isContainerField ( std::string  fieldName,
auxid_t  auxid 
) const
private

Check if a field describes a container or a single object.

This function checks whether a given field (determined by the fieldName) corresponds to a container or a single element based on its type information.

Parameters
fieldNameThe name of the field to check.
auxidThe auxiliary ID of the variable to check.
Returns
kTRUE if the field represents a container, code>kFALSE otherwise.

Definition at line 1650 of file RAuxStore.cxx.

1651  {
1652  // For unknown types it doesn't matter if the field describes a
1653  // container or a single element.
1654  if( !isRegisteredType( auxid ) ) return kTRUE;
1655 
1656  auto inspector =
1657  RNTupleInspector::Create( m_inputNtupleName, m_inFileName );
1658  const auto & fieldInspector = inspector->GetFieldTreeInspector( fieldName );
1659 
1660  const std::string & typeName =
1661  fieldInspector.GetDescriptor().GetTypeName();
1662 
1663  const auto tClass = ::TClass::GetClass(
1664  typeName.c_str() );
1665  const std::type_info* ti = tClass->GetTypeInfo();
1666 
1667  TClass* cl = TClass::GetClass( *ti );
1668 
1669  // If there is no class associated with the field then it should be
1670  // a field describing a standalone object. (As it should be a
1671  // "primitive" field in this case.)
1672  if( !cl ) {
1673  return kFALSE;
1674  }
1675 
1676  // If there is a class, ask for the type_info of its type:
1677  const std::type_info* root_ti = cl->GetTypeInfo();
1678  if( !root_ti ) {
1679  // Type name may be saved as "basic_string<char>" rather than "string"
1680  // by Athena I/O.
1681  ::TString typeName( cl->GetName() );
1682  typeName.ReplaceAll( "basic_string<char>", "string" );
1683  ::TClass* newCl = ::TClass::GetClass( typeName );
1684  if( newCl ) {
1685  root_ti = newCl->GetTypeInfo();
1686  }
1687  }
1688  if( !root_ti ) {
1689  ::Error( "xAOD::RAuxStore::isContainerField",
1690  XAOD_MESSAGE( "Couldn't get an std::type_info object out of "
1691  "field \"%s\" of type \"%s\"" ),
1692  m_prefix.c_str(), cl->GetName() );
1693  return kFALSE;
1694  }
1695 
1696  // Ask for the auxiliary type infos:
1697  const std::type_info* aux_obj_ti =
1699  if( !aux_obj_ti ) {
1700  ::Error( "xAOD::RAuxStore::isContainerField",
1701  XAOD_MESSAGE( "Couldn't get std::type_info object for "
1702  "auxiliary id: %i" ),
1703  static_cast< int >( auxid ) );
1704  return kFALSE;
1705  }
1706  const std::type_info* aux_vec_ti =
1708  if( !aux_vec_ti ) {
1709  ::Error( "xAOD::RAuxStore::isContainerField",
1710  XAOD_MESSAGE( "Couldn't get std::type_info object for "
1711  "auxiliary id: %i" ),
1712  static_cast< int >( auxid ) );
1713  return kFALSE;
1714  }
1715 
1716  // Check which one the ROOT type info agrees with:
1717  if( *root_ti == *aux_obj_ti ) {
1718  // This field describes a single object:
1719  return kFALSE;
1720  } else if( *root_ti == *aux_vec_ti ) {
1721  // This field describes a container of objects:
1722  return kTRUE;
1723  }
1724 
1725  // For enum and vector<enum> types (PFO...) the type given by
1726  // the aux type registry is vector<int>. We have to take it into account
1727  // here...
1728  if( cl->GetCollectionProxy() &&
1729  ( *aux_vec_ti == typeid( std::vector< int > ) ) ) {
1730  return kTRUE;
1731  }
1732 
1733  TClass* cl2 = lookupVectorType( cl );
1734  if( cl2 ) {
1735  if( *cl2->GetTypeInfo() == *aux_vec_ti ) return kTRUE;
1736  }
1737 
1738  // If we got this far, the field may have undergone schema evolution. If
1739  // it's one that ROOT can deal with itself, then we should still be able
1740  // to read the field with this code.
1741  TClass* aux_vec_cl =
1742  TClass::GetClass( Utils::getTypeName( *aux_vec_ti ).c_str() );
1743  if( aux_vec_cl &&
1744  aux_vec_cl->GetConversionStreamerInfo( cl, cl->GetClassVersion() ) ) {
1745  return kTRUE;
1746  }
1747  TClass* aux_obj_cl =
1748  TClass::GetClass( Utils::getTypeName( *aux_obj_ti ).c_str() );
1749  if( aux_obj_cl &&
1750  aux_obj_cl->GetConversionStreamerInfo( cl, cl->GetClassVersion() ) ) {
1751  return kFALSE;
1752  }
1753 
1754  // If neither, then something went wrong...
1755  ::Error( "xAOD::RAuxStore::isContainerField",
1756  XAOD_MESSAGE( "Couldn't determine if field describes a single "
1757  "object or a container" ) );
1758  ::Error( "xAOD::RAuxStore::isContainerField",
1759  XAOD_MESSAGE( "ROOT type : %s" ),
1760  Utils::getTypeName( *root_ti ).c_str() );
1761  ::Error( "xAOD::RAuxStore::isContainerField",
1762  XAOD_MESSAGE( "Object type: %s" ),
1763  Utils::getTypeName( *aux_obj_ti ).c_str() );
1764  ::Error( "xAOD::RAuxStore::isContainerField",
1765  XAOD_MESSAGE( "Vector type: %s" ),
1766  Utils::getTypeName( *aux_vec_ti ).c_str() );
1767  return kFALSE;
1768  }

◆ isDecoration()

bool xAOD::RAuxStore::isDecoration ( auxid_t  auxid) const
overridevirtual

Test if a variable is a decoration.

Parameters
auxidThe auxiliary ID for which to check if it is a decoration
Returns
True if the variable is a decoration; otherwise, false

Implements SG::IConstAuxStore.

Definition at line 375 of file RAuxStore.cxx.

375  {
376  if( m_locked ) {
377  if( auxid < m_isDecoration.size() && m_isDecoration[auxid] ) {
378  return true;
379  }
380  if( m_transientStore ) {
381  return m_transientStore->isDecoration( auxid );
382  }
383  }
384  return false;
385  }

◆ isPrimitiveField()

Bool_t xAOD::RAuxStore::isPrimitiveField ( std::string  fieldName)
private

Check if a field holds a primitive variable or not.

This function checks whether the given field corresponds to a primitive data type based on its type information and the auxiliary ID provided.

Parameters
fieldNameThe name of the field to check.
Returns
kTRUE if the field describes a primitive variable, kFALSE otherwise

Definition at line 1777 of file RAuxStore.cxx.

1777  {
1778  auto inspector =
1779  RNTupleInspector::Create( m_inputNtupleName, m_inFileName );
1780  const auto& fieldInspector = inspector->GetFieldTreeInspector( fieldName );
1781 
1782  std::string typeName =
1783  fieldInspector.GetDescriptor().GetTypeName().c_str();
1784  const std::type_info* ti = nullptr;
1785  const auto tClass = ::TClass::GetClass(
1786  fieldInspector.GetDescriptor().GetTypeName().c_str() );
1787  ti = tClass->GetTypeInfo();
1788  ::EDataType dType = kOther_t; // Default to a generic type
1789  dType = TDataType::GetType( *ti );
1790 
1791  // The check is made using the data type variable:
1792  return ( ( dType != kOther_t ) && ( dType != kNoType_t ) &&
1793  ( dType != kVoid_t ) );
1794  }

◆ isRegisteredType()

Bool_t xAOD::RAuxStore::isRegisteredType ( auxid_t  auxid)
staticprivate

Check if the auxiliary variable has a registered type.

This function is used to test if a given auxiliary variable is known in the registry with a proper type.

Parameters
auxidThe auxiliary ID to check
Returns
kTRUE if the full type of the auxiliary property is known, kFALSE otherwise

Definition at line 1628 of file RAuxStore.cxx.

1628  {
1629 
1630  // Cache some data:
1633  static const auxid_t sauxid =
1634  registry.getAuxID< SG::AuxTypePlaceholder >( "AuxTypePlaceholder" );
1635  static const std::type_info* const sti = registry.getVecType( sauxid );
1636 
1637  // Check if the types match:
1638  return ( *sti != *( registry.getVecType( auxid ) ) );
1639  }

◆ linkedVector() [1/3]

const SG::IAuxTypeVector * xAOD::RAuxStore::linkedVector ( SG::auxid_t  auxid) const
overridevirtual

Return const interface for a linked variable.

Looks up a linked variable associated with the provided auxid.

If a linked variable exists within the current vector storage (m_vecs), it returns the corresponding data vector. If not found, it checks the transient store for the linked vector.

Parameters
auxidThe auxiliary ID for which to retrieve the linked variable
Returns
Pointer to the linked variable if found; otherwise, nullptr

Reimplemented from SG::IConstAuxStore.

Definition at line 477 of file RAuxStore.cxx.

478  {
480  auxid_t linked_id = r.linkedVariable( auxid );
481  guard_t guard( m_mutex1 );
482  if( linked_id < m_vecs.size() ) {
483  return m_vecs[linked_id];
484  }
485  if( m_transientStore ) {
487  ->linkedVector( auxid );
488  }
489  return nullptr;
490  }

◆ linkedVector() [2/3]

SG::IAuxTypeVector * xAOD::RAuxStore::linkedVector ( SG::auxid_t  auxid)
overridevirtual

Return interface for a linked variable.

(const version) Looks up a linked variable associated with the provided auxid.

If a linked variable exists within the current vector storage (m_vecs), it returns the corresponding data vector. If not found, it checks the transient store for the linked vector.

Parameters
auxidThe auxiliary ID for which to retrieve the linked variable
Returns
Pointer to the linked variable if found; otherwise, nullptr

Reimplemented from SG::IAuxStore.

Definition at line 500 of file RAuxStore.cxx.

500  {
502  auxid_t linked_id = r.linkedVariable( auxid );
503  guard_t guard( m_mutex1 );
504  if( linked_id < m_vecs.size() ) {
505  return m_vecs[linked_id];
506  }
507  if( m_transientStore ) {
508  return m_transientStore->linkedVector( auxid );
509  }
510  return nullptr;
511  }

◆ linkedVector() [3/3]

virtual const IAuxTypeVector* SG::IConstAuxStore::linkedVector
inlineinherited

Return interface for a linked variable.

Parameters
auxidThe ID of the parent variable.

If auxid has a linked variable, then return the IAuxTypeVector describing it. Otherwise, return nullptr. May return nullptr unconditionally if this store does not support linked variables.

Definition at line 189 of file IConstAuxStore.h.

190  { return nullptr; }

◆ lock()

void xAOD::RAuxStore::lock ( )
overridevirtual

Lock the object, and don't let decorations be added.

Implements SG::IConstAuxStore.

Definition at line 389 of file RAuxStore.cxx.

389  {
390  // Guard against multi-threaded execution:
391  guard_t guard( m_mutex1 );
392 
393  m_locked = true;
394  if( m_transientStore ) {
396  }
397 
398  return;
399  }

◆ lockDecoration()

void xAOD::RAuxStore::lockDecoration ( SG::auxid_t  auxid)
overridevirtual

Lock a decoration.

Parameters
auxidThe auxiliary ID for which to lock the decoration

Implements SG::IConstAuxStore.

Definition at line 434 of file RAuxStore.cxx.

434  {
435  if( m_transientStore ) {
437  }
438  m_decorIDs.erase( auxid );
439  }

◆ readFrom()

StatusCode xAOD::RAuxStore::readFrom ( const std::string &  fileName,
const std::string &  ntupleName 
)

Connect the object to an input RNTuple.

This function is called by the infrastructure to connect the object to an input RNTuple whenever a new input file is opened.

Parameters
fileNamePointer to the file that is being read from
ntupleNameName of the ntuple that is being read from
Returns
kTRUE if successful, kFALSE otherwise

Definition at line 103 of file RAuxStore.cxx.

104  {
105 
106  // Remember the file name:
108  // Remember the ntuple name:
109  m_inputNtupleName = ntupleName;
110 
111  // load the ntuple:
112  try {
113  // Try to access RNTuple.
114  m_inNtuple = RNTupleReader::Open( m_inputNtupleName, fileName );
115  } catch( ... ) {
116  // Handle the case where the RNTuple is not found.
117  ::Warning( "xAOD::RAuxStore::readFrom",
118  "RNTuple %s not found in file %s", m_inputNtupleName.c_str(),
119  m_inFileName.c_str() );
120  m_inNtuple = nullptr;
121  }
122 
123  // Catalogue all the fields:
124  RETURN_CHECK( "xAOD::RAuxStore::readFrom", scanInputNtuple() );
125 
126  return StatusCode::SUCCESS;
127  }

◆ reserve()

void xAOD::RAuxStore::reserve ( size_t  size)
overridevirtual

Reserve a given size for the arrays.

Reserves space for the auxiliary data vectors.

It ensures that the vectors have enough capacity to hold the specified number of elements.

Parameters
sizeThe number of elements to reserve space for.

Implements SG::IAuxStore.

Definition at line 635 of file RAuxStore.cxx.

635  {
636  // Guard against multi-threaded execution:
637  guard_t guard( m_mutex1 );
638 
639  // A sanity check:
640  if( ( m_structMode == kObjectStore ) && ( size != 1 ) ) {
641  ::Error( "xAOD::RAuxStore::reserve",
642  XAOD_MESSAGE( "size = %i for single-object store" ),
643  static_cast< int >( size ) );
644  return;
645  }
646 
647  for( SG::IAuxTypeVector* v : m_vecs ) {
648  if( v && !v->isLinked() ) {
649  v->reserve( size );
650  }
651  }
652 
653  if( m_transientStore ) {
655  }
656 
657  return;
658  }

◆ reset()

void xAOD::RAuxStore::reset ( )

Reset the store.

This function resets the store to its initial state.

Definition at line 202 of file RAuxStore.cxx.

202  {
203  for( auto& fieldPair : m_fields ) {
204  fieldPair.second.field.release();//not a leak (coverity 17638)
205  }
206  m_fields.clear(); // Ensure m_fields is properly cleared
207  // Remember that the input RNTuple needs to be re-scanned:
208  m_inputScanned = kFALSE;
209  }

◆ resize()

bool xAOD::RAuxStore::resize ( size_t  size)
overridevirtual

Resize the arrays to a given size.

Parameters
sizeThe size to which the arrays should be resized
Returns
True if the resize was successful; otherwise, false

Implements SG::IAuxStore.

Definition at line 601 of file RAuxStore.cxx.

601  {
602  // Guard against multi-threaded execution:
603  guard_t guard( m_mutex1 );
604 
605  // A sanity check:
606  if( ( m_structMode == kObjectStore ) && ( size != 1 ) ) {
607  ::Error( "xAOD::RAuxStore::resize",
608  XAOD_MESSAGE( "size = %i for single-object store" ),
609  static_cast< int >( size ) );
610  return false;
611  }
612 
613  // Remember the new size:
614  m_size = size;
615 
616  bool nomoves = true;
617  for( SG::IAuxTypeVector* v : m_vecs ) {
618  if( v && !v->isLinked() ) {
619  if( !v->resize( size ) ) nomoves = false;
620  }
621  }
622  if( m_transientStore ) {
623  if( !m_transientStore->resize( size ) ) nomoves = false;
624  }
625 
626  return nomoves;
627  }

◆ scanInputNtuple()

StatusCode xAOD::RAuxStore::scanInputNtuple ( )
private

Scan the input RNTuple for auxiliary fields.

Scans the input ntuple for auxiliary data fields and sets up the necessary structures to access them.

It ensures that the input ntuple is properly scanned and the auxiliary data fields are set up.

Returns
kTRUE if successful, kFALSE otherwise

Definition at line 887 of file RAuxStore.cxx.

887  {
888  // Check if an input ntuple is even available:
889  if( !m_inNtuple ) {
890  // It's not an error if it isn't.
891  return StatusCode::SUCCESS;
892  }
893 
894  // Check if the input was already scanned:
895  if( m_inputScanned ) {
896  return StatusCode::SUCCESS;
897  }
898 
899  m_inNtuple->LoadEntry( 0 );
900  for( const auto& field :
901 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 33, 0 )
902  m_inNtuple->GetModel().GetConstFieldZero().GetSubFields()
903 #else
904  m_inNtuple->GetModel().GetFieldZero().GetSubFields()
905 #endif
906  ) {
907  auto fieldName = field->GetQualifiedFieldName();
908 
909  if( m_topStore && ( fieldName == m_prefix ) ) {
910  // loop over the subfields of the top store
911  for( const auto& subField :
912 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 33, 0 )
913  m_inNtuple->GetModel()
914  .GetConstField( fieldName )
915  .GetSubFields()
916 #else
917  m_inNtuple->GetModel()
918  .GetField( fieldName )
919  .GetSubFields()
920 #endif
921  ) {
922  auto fieldName = subField->GetQualifiedFieldName();
923  auto auxName = fieldName.substr( fieldName.find( "." ) + 1 );
924 
925  // Skip this entry if it refers to a base class:
926  if( ( auxName.rfind( "xAOD::", 0 ) == 0 ) ||
927  ( auxName.rfind( "SG::", 0 ) == 0 ) ||
928  ( auxName.rfind( "ILockable", 0 ) == 0 ) ) {
929  continue;
930  }
931 
933  ::Fatal( "xAOD::RAuxStore::scanInputNtuple",
934  XAOD_MESSAGE( "Logic error detected" ) );
935  return StatusCode::FAILURE;
936  }
937 
938  RETURN_CHECK( "xAOD::RAuxStore::scanInputNtuple",
939  setupAuxField( fieldName, auxName, kTRUE ) );
940  }
941  // Don't check the rest of the loop's body:
942  continue;
943  }
944 
945  // if fieldname doesnt start with the value of m_dynPrefix, skip
946  if( fieldName.rfind( m_dynPrefix, 0 ) != 0 ) {
947  continue;
948  }
949  if( fieldName == m_dynPrefix ) {
950  ::Warning( "xAOD::RAuxStore::scanInputNtuple",
951  "Dynamic field with empty name found on container: %s",
952  m_prefix.c_str() );
953  continue;
954  }
955  // The auxiliary property name:
956  const auto auxName = fieldName.substr( fieldName.find( ":" ) + 1 );
957  // Leave the rest up to the function that is shared with the
958  // dynamic fields:
959  RETURN_CHECK( "xAOD::RAuxStore::scanInputNtuple",
960  setupAuxField( fieldName, auxName, kFALSE ) );
961  }
962  // the input was successfully scanned:
963  m_inputScanned = kTRUE;
964 
965  return StatusCode::SUCCESS;
966  }

◆ selectAux()

void xAOD::RAuxStore::selectAux ( const std::set< std::string > &  attributes)
virtual

Select dynamic auxiliary attributes for writing.

Selects the auxiliary attributes specified in the input set.

Parameters
attributesA set of attribute names to be selected

Definition at line 859 of file RAuxStore.cxx.

859  {
860 
861  // Guard against multi-threaded execution:
862  guard_t guard( m_mutex1 );
863 
865  }

◆ setOption()

virtual bool SG::IAuxStore::setOption ( auxid_t  ,
const AuxDataOption  
)
inlinevirtualinherited

Set an option for a given auxiliary variable.

Parameters
auxidThe identifier of the desired aux data item.
optionThe option to set.

The interpretation of the option depends on the particular representation of the variable.

Returns true if the option setting was successful; false otherwise.

Reimplemented in xAOD::AuxContainerBase, xAOD::AuxInfoBase, and SG::AuxStoreInternal.

Definition at line 173 of file IAuxStore.h.

174  { return false; }

◆ setupAuxField()

StatusCode xAOD::RAuxStore::setupAuxField ( const std::string &  fieldName,
const std::string &  auxName,
::Bool_t  isStaticField 
)
private

Register one input field as an available auxiliary variable.

This function sets up an auxiliary field by determining its type and attempting to register it with the auxiliary type registry.

If the field type is not known, it tries to create a factory for the field's type. The function handles both static and dynamic fields and updates the set of known auxiliary IDs upon success.

Parameters
fieldNameThe name of the field in the ntuple
auxNameThe name of the auxiliary field
isStaticFieldkTRUE if this is a static field, and kFALSE if it's a dynamic one
Returns
kTRUE if successful, kFALSE if not

Definition at line 1456 of file RAuxStore.cxx.

1458  {
1459 
1460  std::string expectedClassName;
1461  const std::type_info* ti = auxFieldType( fieldName, auxName, isStaticField );
1462 
1463  // Get the registry:
1465 
1466  // Check if the registry already knows this variable name. If yes, let's
1467  // use the type known by the registry. To be able to deal with simple
1468  // schema evolution in dynamic fields.
1469  const auxid_t regAuxid = registry.findAuxID( auxName );
1470  if( regAuxid != SG::null_auxid ) {
1471  m_auxIDs.insert( regAuxid );
1472  return StatusCode::SUCCESS;
1473  }
1474 
1475  // If we didn't find a type_info for the field
1476  if( !ti ) {
1477  return StatusCode::SUCCESS;
1478  }
1479 
1481  SG::auxid_t linkedAuxId = SG::null_auxid;
1482 
1483  if( SG::AuxTypeRegistry::isLinkedName( auxName ) ) {
1485  } else if( SG::AuxTypeRegistry::classNameHasLink( expectedClassName ) ) {
1486  std::string linkedAttr = SG::AuxTypeRegistry::linkedName( auxName );
1487  std::string linkedFieldName =
1489  const std::type_info* linkedTi = nullptr;
1490  if( Utils::fieldExists( linkedFieldName, *m_inNtuple ) ) {
1491  linkedTi = auxFieldType( std::move(linkedFieldName), linkedAttr, isStaticField );
1492  }
1493  if( linkedTi ) {
1494  linkedAuxId = registry.getAuxID(
1495  *linkedTi, linkedAttr, "",
1497  }
1498  if( linkedAuxId == SG::null_auxid ) {
1499  ::Error( "xAOD::RAuxStore::setupAuxField",
1500  "Could not find linked variable for %s type %s",
1501  auxName.c_str(), expectedClassName.c_str() );
1502  }
1503  }
1504 
1505  // Check for an auxiliary ID for this field:
1506  auxid_t auxid = registry.getAuxID( *ti, auxName, "", flags, linkedAuxId );
1507 
1508  // First try to find a compiled factory for the vector type:
1509  if( auxid == SG::null_auxid ) {
1510  // Construct the name of the factory's class:
1511  // But be careful --- if we don't exactly match the name
1512  // in TClassTable, then we may trigger autoparsing. Besides the
1513  // resource usage that implies, that can lead to crashes in dbg
1514  // builds due to cling bugs.
1515  std::string typeName = Utils::getTypeName( *ti );
1516  if( typeName.starts_with( "std::vector<" ) ) typeName.erase( 0, 5 );
1517  std::string factoryClassName =
1518  "SG::AuxTypeVectorFactory<" + typeName + ",allocator<" + typeName;
1519  if( factoryClassName[factoryClassName.size() - 1] == '>' ) {
1520  factoryClassName += ' ';
1521  }
1522  factoryClassName += "> >";
1523 
1524  // Look for the dictionary of this type:
1525  ::TClass* factoryClass = TClass::GetClass( factoryClassName.c_str() );
1526  if( factoryClass && factoryClass->IsLoaded() ) {
1527  ::TClass* baseClass =
1528  ::TClass::GetClass( "SG::IAuxTypeVectorFactory" );
1529  if( baseClass && baseClass->IsLoaded() ) {
1530  const Int_t offset =
1531  factoryClass->GetBaseClassOffset( baseClass );
1532  if( offset >= 0 ) {
1533  void* factoryVoidPointer = factoryClass->New();
1534  if( factoryVoidPointer ) {
1535  unsigned long tmp = reinterpret_cast< unsigned long >(
1536  factoryVoidPointer ) +
1537  offset;
1538  SG::IAuxTypeVectorFactory* factory =
1539  reinterpret_cast< SG::IAuxTypeVectorFactory* >( tmp );
1540  registry.addFactory(
1541  *ti, *factory->tiAlloc(),
1542  std::unique_ptr< SG::IAuxTypeVectorFactory >(
1543  factory ) );
1544  auxid = registry.getAuxID( *ti, auxName, "", flags,
1545  linkedAuxId );
1546  }
1547  }
1548  }
1549  }
1550  }
1551 
1552  // If that didn't succeed, let's assign a generic factory to this type:
1553  if( auxid == SG::null_auxid && linkedAuxId == SG::null_auxid ) {
1554  // Construct the name of the vector type:
1555  std::string vectorClassName =
1556  "std::vector<" + Utils::getTypeName( *ti );
1557  if( vectorClassName[vectorClassName.size() - 1] == '>' ) {
1558  vectorClassName += ' ';
1559  }
1560  vectorClassName += '>';
1561 
1562  // Get the dictionary for the type:
1563  ::TClass* vectorClass = ::TClass::GetClass( vectorClassName.c_str() );
1564  if( vectorClass && vectorClass->IsLoaded() ) {
1565  auto factory = std::make_unique< TAuxVectorFactory >( vectorClass );
1566  if( factory->tiAlloc() ) {
1567  const std::type_info* tiAlloc = factory->tiAlloc();
1568  registry.addFactory( *ti, *tiAlloc, std::move( factory ) );
1569  } else {
1570  std::string tiAllocName = factory->tiAllocName();
1571  registry.addFactory( *ti, tiAllocName, std::move( factory ) );
1572  }
1573  auxid = registry.getAuxID( *ti, auxName, "",
1575  } else {
1576  ::Warning( "xAOD::RAuxStore::setupAuxField",
1577  "Couldn't find dictionary for type: %s",
1578  vectorClassName.c_str() );
1579  }
1580  }
1581  // Check if we succeeded:
1582  if( auxid == SG::null_auxid ) {
1583  if( linkedAuxId != SG::null_auxid ) {
1584  ::Error(
1585  "xAOD::RAuxStore::setupAuxField",
1586  XAOD_MESSAGE( "Dynamic ROOT vector factory not implemented for "
1587  "linked types; field "
1588  "\"%s\"" ),
1589  fieldName.c_str() );
1590  } else {
1591  ::Error( "xAOD::RAuxStore::setupAuxField",
1592  XAOD_MESSAGE( "Couldn't assign auxiliary ID to field "
1593  "\"%s\"" ),
1594  fieldName.c_str() );
1595  }
1596  return StatusCode::FAILURE;
1597  }
1598 
1599  // Remember the auxiliary ID:
1600  m_auxIDs.insert( auxid );
1601 
1602  return StatusCode::SUCCESS;
1603  }

◆ setupInputData()

StatusCode xAOD::RAuxStore::setupInputData ( auxid_t  auxid)
private

Connect a variable to the input tree.

This internal function takes care of connecting to an individual (sub-)field in the input file for a given auxiliary variable.

Parameters
auxidThe ID of the variable to connect to
Returns
kTRUE if successful, kFALSE otherwise

Definition at line 974 of file RAuxStore.cxx.

974  {
975  // Return right away if we already know that the field is not found:
976  if( fieldInfosHasAuxid( auxid ) &&
978  return StatusCode::RECOVERABLE;
979  }
980 
981  // Make sure the internal storage is large enough:
982  if( m_vecs.size() <= auxid ) {
983  m_vecs.resize( auxid + 1 );
984  }
985 
986  // Check if we need to do anything:
987  if( m_vecs[auxid] && fieldInfosHasAuxid( auxid ) ) {
988  return StatusCode::SUCCESS;
989  }
990 
991  // A little sanity check:
992  if( !m_inNtuple ) {
993  ::Error( "xAOD::RAuxStore::setupInputData",
994  XAOD_MESSAGE( "No input RNTuple set up!" ) );
995  return StatusCode::FAILURE;
996  }
997 
998  // Another sanity check:
999  if( m_vecs[auxid] || fieldInfosHasAuxid( auxid ) ) {
1000  ::Error( "xAOD::RAuxStore::setupInputData",
1001  XAOD_MESSAGE( "The internal variables of the object got "
1002  "messed up?!?" ) );
1003  return StatusCode::FAILURE;
1004  }
1005 
1007 
1008  // Get the property name:
1009  const TString statFieldName = m_prefix + r.getName( auxid ).c_str();
1010  const TString dynFieldName = m_dynPrefix + r.getName( auxid ).c_str();
1011 
1012  // Check if the field exists:
1013  TString fieldName = statFieldName;
1014 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 33, 0 )
1015  std::unique_ptr< RNTupleView< void > >
1016 #else
1017  std::unique_ptr< RNTupleView< void, true > >
1018 #endif
1019  field;
1020  if( !Utils::fieldExists( statFieldName.Data(), *m_inNtuple ) ) {
1021  if( !Utils::fieldExists( dynFieldName.Data(), *m_inNtuple ) ) {
1022  m_fields[auxid].status = RAuxStore::RFieldInfo::NotFound;
1023  return StatusCode::RECOVERABLE;
1024  }
1025  // We have a dynamic field:
1026  fieldName = dynFieldName;
1027  }
1028 
1029  // Check if it's a "primitive field":
1030  const Bool_t primitiveField = isPrimitiveField( fieldName.Data() );
1031  // Check if it's a "container field":
1032  const Bool_t containerField =
1033  ( primitiveField ? kFALSE
1034  : isContainerField( fieldName.Data(), auxid ) );
1035 
1036  // Set the structure mode if it has not been defined externally:
1037  if( m_structMode == kUndefinedStore ) {
1038  m_structMode = ( containerField ? kContainerStore : kObjectStore );
1039  }
1040 
1041  // Check that the field type makes sense:
1042  if( ( containerField && ( m_structMode != kContainerStore ) &&
1043  !r.isLinked( auxid ) ) ||
1044  ( ( !containerField ) && ( m_structMode != kObjectStore ) ) ) {
1045  ::Error( "xAOD::RAuxStore::setupInputData",
1046  XAOD_MESSAGE( "Field type and requested structure mode "
1047  "differ for field: %s" ),
1048  fieldName.Data() );
1049  return StatusCode::FAILURE;
1050  }
1051  // Get the field's type:
1052  auto inspector =
1053  RNTupleInspector::Create( m_inputNtupleName, m_inFileName );
1054  const auto & fieldInspector = inspector->GetFieldTreeInspector(
1056 
1057  std::string typeName =
1058  fieldInspector.GetDescriptor().GetTypeName().c_str();
1059  const std::type_info* ti = nullptr;
1060  const auto tClass = ::TClass::GetClass(
1061  fieldInspector.GetDescriptor().GetTypeName().c_str() );
1062  ti = tClass->GetTypeInfo();
1063  TClass* clDummy = TClass::GetClass( *ti );
1064 
1065  ::EDataType dType = kOther_t; // Default to a generic type
1066  dType = TDataType::GetType( *ti );
1067 
1068  // Get the property type:
1069  const std::type_info* fieldType = 0;
1070  if( isRegisteredType( auxid ) ) {
1071  // Get the type from the auxiliary type registry:
1072  fieldType =
1073  ( containerField ? r.getVecType( auxid ) : r.getType( auxid ) );
1074  } else {
1075  // Get the type from the input field itself:
1076  fieldType = ( clDummy ? clDummy->GetTypeInfo()
1077  : &( Utils::getTypeInfo( dType ) ) );
1078  }
1079  if( !fieldType ) {
1080  ::Error( "xAOD::RAuxStore::setupInputData",
1081  XAOD_MESSAGE( "Can't read/copy variable %s (%s)" ),
1082  fieldName.Data(), clDummy->GetName() );
1083  return StatusCode::RECOVERABLE;
1084  }
1085  const TString fieldTypeName = Utils::getTypeName( *fieldType ).c_str();
1086 
1087  // Check if we have the needed dictionary for an object field:
1088  ::TClass* fieldClass = 0;
1089  if( !primitiveField ) {
1090  // Get the property's class:
1091  fieldClass = ::TClass::GetClass( *fieldType, kTRUE, kTRUE );
1092  if( !fieldClass ) {
1093  fieldClass = ::TClass::GetClass( fieldTypeName );
1094  }
1095  if( !fieldClass ) {
1096  ::Error( "xAOD::RAuxStore::setupInputData",
1097  XAOD_MESSAGE( "No dictionary available for class \"%s\"" ),
1098  fieldTypeName.Data() );
1099  return StatusCode::FAILURE;
1100  }
1101  }
1102 
1103  // Create the smart object holding this vector:
1104  if( isRegisteredType( auxid ) ) {
1105  m_vecs[auxid] = r.makeVector( auxid, (size_t)0, (size_t)0 ).release();
1106  if( !containerField ) {
1107  m_vecs[auxid]->resize( 1 );
1108  }
1109  if( clDummy &&
1110  strncmp( clDummy->GetName(), "SG::PackedContainer<", 20 ) == 0 ) {
1111  SG::IAuxTypeVector* packed = m_vecs[auxid]->toPacked().release();
1112  std::swap( m_vecs[auxid], packed );
1113  delete packed;
1114  }
1115  } else {
1116  ::Error( "xAOD::RAuxStore::setupInputData",
1117  XAOD_MESSAGE( "Couldn't create in-memory vector for "
1118  "variable %s (%i)" ),
1119  fieldName.Data(), static_cast< int >( auxid ) );
1120  return StatusCode::FAILURE;
1121  }
1122 
1123  if( m_inModel == nullptr ) {
1124  m_inModel = RNTupleModel::Create();
1125  }
1126 
1127  if( primitiveField ) {
1128  auto fieldResult = RFieldBase::Create( fieldName.Data(),
1129  fieldTypeName.Data() );
1130  if( fieldResult ) {
1131  auto field = fieldResult.Unwrap();
1132  m_inModel->AddField( std::move( field ) );
1133  }
1134  } else {
1135  RETURN_CHECK(
1136  "xAOD::RAuxStore::setupInputData",
1137  addVectorField( fieldName.Data(), fieldTypeName.Data(), kTRUE ) );
1138  }
1139 
1140  // Since we just moved the model, we need to reset it
1141  m_inModel = RNTupleModel::Create();
1142  RETURN_CHECK(
1143  "xAOD::RAuxStore::setupInputData",
1144  addVectorField( fieldName.Data(), fieldTypeName.Data(), kTRUE ) );
1145 
1146  m_fields[auxid].field =
1147 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 33, 0 )
1148  std::make_unique< RNTupleView< void > > (
1149 #else
1150  std::make_unique< RNTupleView< void, true > >(
1151 #endif
1152  m_inNtuple->GetView< void >( fieldName.Data(), nullptr )
1153  );
1155  m_fields[auxid].fieldTypeName = fieldTypeName.Data();
1156  m_fields[auxid].ntupleName = m_inputNtupleName;
1157  m_fields[auxid].object = ( containerField ? m_vecs[auxid]->toVector()
1158  : m_vecs[auxid]->toPtr() );
1159  m_fields[auxid].typeInfo = const_cast< std::type_info* >( fieldType );
1160 
1161  // Remember which variable got created:
1162  m_auxIDs.insert( auxid );
1163 
1164  // Check if we just replaced a generic object:
1165  if( isRegisteredType( auxid ) ) {
1166  // The name of the variable we just created:
1167  const std::string auxname = r.getName( auxid );
1168  // Check if there's another variable with this name already:
1169  for( auxid_t i = 0; i < m_vecs.size(); ++i ) {
1170  // Check if we have this aux ID:
1171  if( !m_vecs[i] ) continue;
1172  // Ingore the object that we *just* created:
1173  if( i == auxid ) continue;
1174  // The name of the variable:
1175  const std::string testname = r.getName( i );
1176  // Check if it has the same name:
1177  if( testname != auxname ) continue;
1178  // Check that the other one is a non-registered type:
1179  if( isRegisteredType( i ) ) {
1180  ::Error( "xAOD::RAuxStore::setupInputData",
1181  XAOD_MESSAGE( "Internal logic error!" ) );
1182  continue;
1183  }
1184  // Okay, we do need to remove this object:
1185  delete m_vecs[i];
1186  m_vecs[i] = 0;
1187  m_auxIDs.erase( i );
1188  }
1189  }
1190 
1191  SG::auxid_t linked_auxid = r.linkedVariable( auxid );
1192  if( linked_auxid != SG::null_auxid ) {
1193  return setupInputData( linked_auxid );
1194  }
1195 
1196  // Return gracefully:
1197  return StatusCode::SUCCESS;
1198  }

◆ setupOutputData()

StatusCode xAOD::RAuxStore::setupOutputData ( auxid_t  auxid)
private

Connect a variable to the output ntuple.

This function is used internally to create an output field with the contents of a single auxiliary variable.

Parameters
auxidThe ID of the variable to create an output field for
Returns
kTRUE if the operation was successful, kFALSE if not

Definition at line 1207 of file RAuxStore.cxx.

1207  {
1208  // Check whether we need to do anything:
1209  if( !m_outNtuple ) return StatusCode::SUCCESS;
1210  // Check if the variable needs to be written out:
1211  if( !isAuxIDSelected( auxid ) ) return StatusCode::SUCCESS;
1212 
1213  // Make sure that containers are large enough:
1214  if( m_vecs.size() <= auxid ) {
1215  m_vecs.resize( auxid + 1 );
1216  }
1217 
1218  // Check if the variable was put into the transient store as a
1219  // decoration, and now needs to be put into the output file:
1220  if( ( !m_vecs[auxid] ) && m_transientStore &&
1221  ( m_transientStore->getAuxIDs().test( auxid ) ) ) {
1222 
1223  // Get the variable from the transient store:
1224  const void* pptr = m_transientStore->getData( auxid );
1225  if( !pptr ) {
1226  ::Fatal( "xAOD::RAuxStore::setupOutputData",
1227  XAOD_MESSAGE( "Internal logic error detected" ) );
1228  return StatusCode::FAILURE;
1229  }
1230 
1231  // The registry:
1233 
1234  // Inside it's own scope to ensure that the lock is released
1235  {
1236  std::lock_guard<std::mutex> lock(m_mutex1);
1237  // Create the new object:
1238  m_vecs[auxid] = reg.makeVector(auxid, m_size, m_size).release();
1239  }
1240  void* ptr = m_vecs[auxid]->toPtr();
1241  if( !ptr ) {
1242  ::Error( "xAOD::RAuxStore::setupOutputData",
1243  XAOD_MESSAGE( "Couldn't create decoration in memory "
1244  "for writing" ) );
1245  return StatusCode::FAILURE;
1246  }
1247 
1248  // Get the type of this variable:
1249  const std::type_info* type = reg.getType( auxid );
1250 
1251  if( !type ) {
1252  ::Error( "xAOD::RAuxStore::setupOutputData",
1253  XAOD_MESSAGE( "Couldn't get the type of transient "
1254  "variable %i" ),
1255  static_cast< int >( auxid ) );
1256  return StatusCode::FAILURE;
1257  }
1258  // Now get the factory for this variable:
1259  const SG::IAuxTypeVectorFactory* factory = reg.getFactory( auxid );
1260  if( !factory ) {
1261  ::Error( "xAOD::RAuxStore::setupOutputData",
1262  XAOD_MESSAGE( "No factory found for transient variable "
1263  "%i" ),
1264  static_cast< int >( auxid ) );
1265  return StatusCode::FAILURE;
1266  }
1267 
1268  // Finally, do the copy:
1269  factory->copy( auxid, SG::AuxVectorInterface( *this ), 0,
1271  m_size );
1272 
1273  // And now remember that this is a decoration:
1274  if( m_isDecoration.size() <= auxid ) {
1275  m_isDecoration.resize( auxid + 1 );
1276  }
1277  m_isDecoration[auxid] = ::kTRUE;
1278  }
1279 
1280  // Check if we know about this variable to be on the input,
1281  // but haven't connected to it yet:
1282  if( ( m_auxIDs.test( auxid ) ) && ( !m_vecs[auxid] ) &&
1283  ( !fieldInfosHasAuxid( auxid ) ) ) {
1284  RETURN_CHECK( "xAOD::RAuxStore::setupOutputData",
1285  setupInputData( auxid ) );
1286  }
1287 
1288  // Check that we know the store's type:
1289  if( ( m_structMode != kContainerStore ) &&
1290  ( m_structMode != kObjectStore ) ) {
1291  ::Error( "xAOD::RAuxStore::setupOutputData",
1292  XAOD_MESSAGE( "Structure mode unknown for variable %s" ),
1293  SG::AuxTypeRegistry::instance().getName( auxid ).c_str() );
1294  return StatusCode::FAILURE;
1295  }
1296 
1297  // Check if the variable exists already in memory:
1298  if( !m_vecs[auxid] ) {
1300  .makeVector( auxid, (size_t)0, (size_t)0 )
1301  .release();
1302  if( m_structMode == kObjectStore ) {
1303  m_vecs[auxid]->resize( 1 );
1304  }
1305  }
1306  if( !m_outNtuple ) {
1307  }
1308 
1309  // if we have not called this method before, the model will be null
1310  if( m_outModel == nullptr ) {
1311  m_outModel = RNTupleModel::Create();
1312  }
1313 
1314  const TString fieldName =
1316  const std::type_info* fieldType =
1320  const TString fieldTypeName = Utils::getTypeName( *fieldType ).c_str();
1321  // If it is a primitive field, it only has 1 character (e.g. 'f' for
1322  // float)
1323  const Bool_t isPrimitiveField = ( strlen( fieldTypeName.Data() ) == 1 );
1324 
1325  if( isPrimitiveField ) {
1326  auto fieldResult = RFieldBase::Create( fieldName.Data(),
1327  fieldTypeName.Data() );
1328  if( fieldResult ) {
1329  auto field = fieldResult.Unwrap();
1330  m_outModel->AddField( std::move( field ) );
1331  }
1332  } else {
1333  RETURN_CHECK( "xAOD::RAuxStore::setupOutputData",
1334  addVectorField( fieldName.Data(),
1335  fieldTypeName.Data(), kFALSE ) );
1336  }
1337 
1338  auto file = ::TFile::Open( m_outFileName.c_str(), "UPDATE" );
1339 
1340  // Inside it's own scope to ensure it is not open when we try to read from
1341  // it
1342  {
1343  auto ntuple =
1344  RNTupleWriter::Append( std::move( m_outModel ),
1346  ntuple->Fill();
1347  }
1348 
1349  // Since we just moved the model, we need to reset it
1350  m_outModel = RNTupleModel::Create();
1351  RETURN_CHECK( "xAOD::RAuxStore::setupOutputData",
1352  addVectorField( fieldName.Data(),
1353  fieldTypeName.Data(), kFALSE ) );
1354  auto ntuple = RNTupleReader::Open( m_outputNtupleName, m_outFileName );
1355  m_fields[auxid].field =
1356 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 33, 0 )
1357  std::make_unique< RNTupleView< void > >
1358 #else
1359  std::make_unique< RNTupleView< void, true > >
1360 #endif
1361  ( ntuple->GetView< void >( fieldName, nullptr ) );
1363  m_fields[auxid].fieldTypeName = fieldTypeName.Data();
1364  m_fields[auxid].ntupleName = m_inputNtupleName;
1365  m_fields[auxid].object =
1366  ( m_structMode == kObjectStore ? m_vecs[auxid]->toVector()
1367  : m_vecs[auxid]->toPtr() );
1368  m_fields[auxid].typeInfo = const_cast< std::type_info* >( fieldType );
1369 
1370  // Also, remember that we now handle this variable:
1371  m_auxIDs.insert( auxid );
1372  // We were successful:
1373  return StatusCode::SUCCESS;
1374  }

◆ shift()

void xAOD::RAuxStore::shift ( size_t  pos,
ptrdiff_t  offs 
)
overridevirtual

Shift the contents of the stored arrays.

Shifts the elements in the auxiliary data vectors by a specified offset.

It adjusts the size of the container accordingly.

Parameters
posThe position at which to start shifting.
offsThe offset by which to shift the elements.

Implements SG::IAuxStore.

Definition at line 666 of file RAuxStore.cxx.

666  {
667  // Guard against multi-threaded execution:
668  guard_t guard( m_mutex1 );
669 
670  // A sanity check:
671  if( m_structMode == kObjectStore ) {
672  ::Error( "xAOD::RAuxStore::shift",
673  XAOD_MESSAGE( "Should not have been called for single-object "
674  "store" ) );
675  return;
676  }
677 
678  // Adjust the size of the container:
679  if( ( static_cast< std::size_t >( std::abs( offs ) ) > m_size ) &&
680  ( offs < 0 ) ) {
681  m_size = 0;
682  } else {
683  m_size += offs;
684  }
685 
686  for( SG::IAuxTypeVector* v : m_vecs ) {
687  if( v && !v->isLinked() ) {
688  v->shift( pos, offs );
689  }
690  }
691 
692  if( m_transientStore ) {
693  m_transientStore->shift( pos, offs );
694  }
695 
696  return;
697  }

◆ size()

size_t xAOD::RAuxStore::size ( ) const
overridevirtual

Return the number of elements in the store.

Returns
The number of elements in the store

Implements SG::IConstAuxStore.

Definition at line 445 of file RAuxStore.cxx.

445  {
446  // First, try to find a managed vector in the store:
447  for( SG::auxid_t id : m_auxIDs ) {
448  // Make sure that we are still within the bounds of our vector:
449  if( id >= m_vecs.size() ) break;
450  // Skip non-existent or linked objects:
451  if( !m_vecs[id] || m_vecs[id]->isLinked() ) continue;
452  // Ask the vector for its size:
453  const size_t size = m_vecs[id]->size();
454  // Only accept a non-zero size. Not sure why...
455  if( size > 0 ) {
456  return size;
457  }
458  }
459 
460  // Check if we have a transient store, and get the size from that:
461  if( m_transientStore ) {
462  return m_transientStore->size();
463  }
464 
465  // Apparently the store is empty:
466  return 0;
467  }

◆ structMode()

RAuxStore::EStructMode xAOD::RAuxStore::structMode ( ) const

Return the structure mode of the object.

This function gets the structure mode of the object.

Returns
The structure mode of the object

Definition at line 91 of file RAuxStore.cxx.

91  {
92 
93  return m_structMode;
94  }

◆ writeTo()

StatusCode xAOD::RAuxStore::writeTo ( const std::string &  fileName,
const std::string &  ntupleName 
)

Connect the object to an output RNTuple.

This function is called by the infrastructure to connect the object to an output RNTuple.

Parameters
fileNamePointer to the file that is being written to
ntupleNameName of the ntuple that is being written to
Returns
kTRUE if successful, kFALSE otherwise

Definition at line 136 of file RAuxStore.cxx.

137  {
138  // Look for any auxiliary fields that have not been connected to yet:
139  RETURN_CHECK( "xAOD::RAuxStore::writeTo", scanInputNtuple() );
141  m_outputNtupleName = ntupleName;
142  m_outNtuple = RNTupleReader::Open( m_outputNtupleName, m_outFileName );
143 
144  // Create all the variables that we already know about. Notice that the
145  // code makes a copy of the auxid set on purpose. Because the underlying
146  // AuxSelection object gets modified while doing the for loop.
147  const auxid_set_t selAuxIDs = getSelectedAuxIDs();
148  for( SG::auxid_t id : selAuxIDs ) {
149  RETURN_CHECK( "xAOD::RAuxStore::writeTo", setupOutputData( id ) );
150  }
151 
152  return StatusCode::SUCCESS;
153  }

Member Data Documentation

◆ m_auxIDs

auxid_set_t xAOD::RAuxStore::m_auxIDs
private

Internal list of variable IDs handled currently by the object.

Definition at line 205 of file RAuxStore.h.

◆ m_decorIDs

auxid_set_t xAOD::RAuxStore::m_decorIDs
private

Definition at line 206 of file RAuxStore.h.

◆ m_dynPrefix

std::string xAOD::RAuxStore::m_dynPrefix
private

Dynamic prefix for the field names.

Definition at line 184 of file RAuxStore.h.

◆ m_entryToLoad

::Long64_t xAOD::RAuxStore::m_entryToLoad
private

The entry to load from the ntuple.

Definition at line 237 of file RAuxStore.h.

◆ m_fields

std::map< auxid_t, RFieldInfo > xAOD::RAuxStore::m_fields
private

A way to acces an representation of a field with an auxid.

Definition at line 271 of file RAuxStore.h.

◆ m_inFileName

std::string xAOD::RAuxStore::m_inFileName
private

The input file that we are reading from.

Definition at line 225 of file RAuxStore.h.

◆ m_inModel

std::unique_ptr< RNTupleModel > xAOD::RAuxStore::m_inModel
private

The model of the input ntuple.

Definition at line 235 of file RAuxStore.h.

◆ m_inNtuple

std::unique_ptr< RNTupleReader > xAOD::RAuxStore::m_inNtuple
private

The ntuple being read from.

Definition at line 192 of file RAuxStore.h.

◆ m_inputNtupleName

std::string xAOD::RAuxStore::m_inputNtupleName
private

The name of the ntuple that we are reading from.

Definition at line 229 of file RAuxStore.h.

◆ m_inputScanned

::Bool_t xAOD::RAuxStore::m_inputScanned
private

"Scan status" of the input RNTuple

Definition at line 197 of file RAuxStore.h.

◆ m_isDecoration

std::vector< ::Bool_t > xAOD::RAuxStore::m_isDecoration
private

Flags items as decorations.

Definition at line 215 of file RAuxStore.h.

◆ m_locked

::Bool_t xAOD::RAuxStore::m_locked
private

Is this container locked?

Definition at line 213 of file RAuxStore.h.

◆ m_mutex1

mutex_t xAOD::RAuxStore::m_mutex1
mutableprivate

Mutexes object used for multithreaded synchronisation.

Definition at line 222 of file RAuxStore.h.

◆ m_mutex2

mutex_t xAOD::RAuxStore::m_mutex2
private

Definition at line 222 of file RAuxStore.h.

◆ m_outFileName

std::string xAOD::RAuxStore::m_outFileName
private

The output file that we are writing to.

Definition at line 227 of file RAuxStore.h.

◆ m_outModel

std::unique_ptr< RNTupleModel > xAOD::RAuxStore::m_outModel
private

The model of the output ntuple.

Definition at line 233 of file RAuxStore.h.

◆ m_outNtuple

std::unique_ptr< RNTupleReader > xAOD::RAuxStore::m_outNtuple
private

The the ntuple being written to.

Definition at line 194 of file RAuxStore.h.

◆ m_outputNtupleName

std::string xAOD::RAuxStore::m_outputNtupleName
private

The name of the ntuple that we are writing to.

Definition at line 231 of file RAuxStore.h.

◆ m_prefix

std::string xAOD::RAuxStore::m_prefix
private

Static prefix for the field names.

Definition at line 182 of file RAuxStore.h.

◆ m_selection

AuxSelection xAOD::RAuxStore::m_selection
private

Object helping to select which auxiliary variables to write.

Definition at line 200 of file RAuxStore.h.

◆ m_size

std::size_t xAOD::RAuxStore::m_size {}
private

The current size of the container being described.

Definition at line 210 of file RAuxStore.h.

◆ m_structMode

EStructMode xAOD::RAuxStore::m_structMode
private

The "structural" mode of the object.

Definition at line 189 of file RAuxStore.h.

◆ m_topStore

::Bool_t xAOD::RAuxStore::m_topStore
private

Flag stating whether this is a "top store".

Definition at line 186 of file RAuxStore.h.

◆ m_transientStore

SG::AuxStoreInternal* xAOD::RAuxStore::m_transientStore {}
private

Store for the in-memory-only variables.

Definition at line 202 of file RAuxStore.h.

◆ m_vecs

std::vector< SG::IAuxTypeVector* > xAOD::RAuxStore::m_vecs
private

Variables handled currently by the object.

Definition at line 208 of file RAuxStore.h.

◆ supportsThinning

constexpr bool SG::IAuxStore::supportsThinning = true
staticconstexprinherited

Mark that this type supports thinning operations.

See AthContainers/supportsThinning.h and AthenaPoolCnvSvc/T_AthenaPoolCnv.h. Helps guide which pool converter template will be used. If false, the default pool converter will be used rather than the aux store-specific one. Ordinary xAOD type should not touch this, but may be overridden in a derived class to handle certain special cases.

Definition at line 199 of file IAuxStore.h.


The documentation for this class was generated from the following files:
SG::AuxTypeRegistry::getFactory
const IAuxTypeVectorFactory * getFactory(const std::type_info &ti, const std::type_info &ti_alloc)
Return the vector factory for a given vector element type.
Definition: AuxTypeRegistry.cxx:1110
SG::AuxStoreInternal::reserve
virtual void reserve(size_t sz) override
Change the capacity of all aux data vectors.
Definition: AuxStoreInternal.cxx:267
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
xAOD::RAuxStore::m_structMode
EStructMode m_structMode
The "structural" mode of the object.
Definition: RAuxStore.h:189
SG::IAuxTypeVector::shift
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
SG::IAuxTypeVector::isLinked
bool isLinked() const
Return true if this variable is linked from another one.
Definition: IAuxTypeVector.h:226
beamspotman.r
def r
Definition: beamspotman.py:676
RETURN_CHECK
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Definition: ReturnCheck.h:26
xAOD::RAuxStore::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Guard type for multithreaded synchronisation.
Definition: RAuxStore.h:220
xAOD::RAuxStore::m_inModel
std::unique_ptr< RNTupleModel > m_inModel
The model of the input ntuple.
Definition: RAuxStore.h:235
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::RAuxStore::kContainerStore
@ kContainerStore
The object describes an entire container.
Definition: RAuxStore.h:47
xAOD::RAuxStore::m_prefix
std::string m_prefix
Static prefix for the field names.
Definition: RAuxStore.h:182
SG::AuxStoreInternal::getDecoration
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
Definition: AuxStoreInternal.cxx:198
SG::SkipNameCheck
@ SkipNameCheck
Definition: AuxTypes.h:81
xAOD::RAuxStore::m_size
std::size_t m_size
The current size of the container being described.
Definition: RAuxStore.h:210
xAOD::RAuxStore::isPrimitiveField
::Bool_t isPrimitiveField(std::string fieldName)
Check if a field holds a primitive variable or not.
Definition: RAuxStore.cxx:1777
xAOD::RAuxStore::m_outModel
std::unique_ptr< RNTupleModel > m_outModel
The model of the output ntuple.
Definition: RAuxStore.h:233
xAOD::RAuxStore::m_transientStore
SG::AuxStoreInternal * m_transientStore
Store for the in-memory-only variables.
Definition: RAuxStore.h:202
xAOD::RAuxStore::m_auxIDs
auxid_set_t m_auxIDs
Internal list of variable IDs handled currently by the object.
Definition: RAuxStore.h:205
SG::AuxStoreInternal::getData
virtual const void * getData(SG::auxid_t auxid) const override
Return the data vector for one aux data item.
Definition: AuxStoreInternal.cxx:83
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
xAOD::RAuxStore::m_outputNtupleName
std::string m_outputNtupleName
The name of the ntuple that we are writing to.
Definition: RAuxStore.h:231
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition: AuxTypeRegistry.cxx:881
SG::ExcStoreLocked
Exception — Attempted to modify auxiliary data in a locked store.
Definition: Control/AthContainers/AthContainers/exceptions.h:183
skel.it
it
Definition: skel.GENtoEVGEN.py:396
xAOD::Utils::dynFieldPrefix
std::string dynFieldPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary field coming from a container call...
Definition: Control/xAODRootAccess/Root/Utils.cxx:170
xAOD::RAuxStore::auxFieldType
const std::type_info * auxFieldType(const std::string &fieldName, const std::string &auxName, ::Bool_t staticField)
Find the type_info to use as the aux type for a given field.
Definition: RAuxStore.cxx:1385
xAOD::other
@ other
Definition: TrackingPrimitives.h:509
xAOD::RAuxStore::isRegisteredType
::Bool_t isRegisteredType(auxid_t auxid)
Check if the auxiliary variable has a registered type.
Definition: RAuxStore.cxx:1628
xAOD::RAuxStore::getSelectedAuxIDs
virtual auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected aux variables.
Definition: RAuxStore.cxx:871
xAOD::RAuxStore::auxid_t
SG::auxid_t auxid_t
Convenience type declaration.
Definition: RAuxStore.h:39
SG::IAuxTypeVector::insertMove
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
xAOD::RAuxStore::m_decorIDs
auxid_set_t m_decorIDs
Definition: RAuxStore.h:206
xAOD::RAuxStore::fieldInfosHasAuxid
::Bool_t fieldInfosHasAuxid(auxid_t auxid) const
Checks if the fieldInfos map has an entry for the given auxid.
Definition: RAuxStore.cxx:1836
SG::AuxTypeRegistry::linkedName
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
Definition: AuxTypeRegistry.cxx:1302
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
xAOD::RAuxStore::setupOutputData
StatusCode setupOutputData(auxid_t auxid)
Connect a variable to the output ntuple.
Definition: RAuxStore.cxx:1207
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
xAOD::RAuxStore::RFieldInfo::NotFound
@ NotFound
Definition: RAuxStore.h:246
SG::AuxTypeRegistry::classNameHasLink
static bool classNameHasLink(const std::string &className)
Test to see if a class name corresponds to a class with a linked variable.
Definition: AuxTypeRegistry.cxx:1312
xAOD::RAuxStore::m_inNtuple
std::unique_ptr< RNTupleReader > m_inNtuple
The ntuple being read from.
Definition: RAuxStore.h:192
xAOD::RAuxStore::isAuxIDSelected
::Bool_t isAuxIDSelected(auxid_t auxid) const
Check if this auxiliary variable needs to go to the output.
Definition: RAuxStore.cxx:1611
xAOD::RAuxStore::m_outNtuple
std::unique_ptr< RNTupleReader > m_outNtuple
The the ntuple being written to.
Definition: RAuxStore.h:194
CxxUtils::ConcurrentBitset::clear
ConcurrentBitset & clear()
Clear all bits in the set.
dumpTruth.getName
getName
Definition: dumpTruth.py:34
SG::AuxStoreInternal::getAuxIDs
virtual const SG::auxid_set_t & getAuxIDs() const override
Return a set of identifiers for existing data items in this store.
Definition: AuxStoreInternal.cxx:400
xAOD::RAuxStore::addVectorField
StatusCode addVectorField(std::string fieldName, std::string fieldTypeName, ::Bool_t isInputFile)
Add a vector field to a model (either the input or the output one)
Definition: RAuxStore.cxx:1807
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:61
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
SG::Linked
@ Linked
Mark that this variable is linked to another one.
Definition: AuxTypes.h:77
xAOD::RAuxStore::m_mutex2
mutex_t m_mutex2
Definition: RAuxStore.h:222
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::AuxTypeRegistry::getType
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
Definition: AuxTypeRegistry.cxx:908
H5Utils::internal::packed
H5::CompType packed(H5::CompType in)
Definition: common.cxx:16
xAOD::RAuxStore::m_locked
::Bool_t m_locked
Is this container locked?
Definition: RAuxStore.h:213
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
CxxUtils::ConcurrentBitset::size
bit_t size() const
Count the number of 1 bits in the set.
xAOD::Utils::getFirstFieldMatch
std::string getFirstFieldMatch(RNTupleReader &ntupleReader, const std::string &pre)
This function is used to search for a field in an RNTupleReader that contains a given substring.
Definition: Control/xAODRootAccess/Root/Utils.cxx:375
xAOD::RAuxStore::RFieldInfo::Initialized
@ Initialized
Definition: RAuxStore.h:246
xAOD::Utils::getTypeName
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
Definition: Control/xAODRootAccess/Root/Utils.cxx:310
lumiFormat.i
int i
Definition: lumiFormat.py:85
CxxUtils::ConcurrentBitset::insert
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
xAOD::RAuxStore::getEntry
::Int_t getEntry(Long64_t entry, ::Int_t getall=0)
Get entry from the input RNTuple.
Definition: RAuxStore.cxx:155
xAOD::RAuxStore::m_dynPrefix
std::string m_dynPrefix
Dynamic prefix for the field names.
Definition: RAuxStore.h:184
SG::AuxStoreInternal::clearDecorations
virtual bool clearDecorations() override
Clear all decorations.
Definition: AuxStoreInternal.cxx:581
SG::IAuxTypeVectorFactory
Interface for factory objects that create vectors.
Definition: IAuxTypeVectorFactory.h:50
SG::AuxStoreInternal::lock
virtual void lock() override
Lock the container.
Definition: AuxStoreInternal.cxx:564
SG::AuxStoreInternal::lockDecoration
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Definition: AuxStoreInternal.cxx:753
SG::IAuxTypeVectorFactory::tiAlloc
virtual const std::type_info * tiAlloc() const =0
Return the type_info of the vector allocator.
taskman.fieldName
fieldName
Definition: taskman.py:492
xAOD::RAuxStore::m_inputScanned
::Bool_t m_inputScanned
"Scan status" of the input RNTuple
Definition: RAuxStore.h:197
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
file
TFile * file
Definition: tile_monitor.h:29
SG::AuxStoreInternal::shift
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.
Definition: AuxStoreInternal.cxx:301
xAOD::RAuxStore::RAuxStore
RAuxStore(const char *prefix="", Bool_t topStore=kTRUE, EStructMode mode=kUndefinedStore)
Definition: RAuxStore.cxx:50
SG::AuxTypePlaceholder
Used as type_info when we read an aux data item but it doesn't exist in the registry.
Definition: AuxTypes.h:34
Preparation.mode
mode
Definition: Preparation.py:94
SG::AuxStoreInternal::insertMove
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t(0)) override
Move all elements from other to this store.
Definition: AuxStoreInternal.cxx:332
SG::AuxTypeRegistry::isLinkedName
static bool isLinkedName(const std::string &name)
Test if a variable name corresponds to a linked variable.
Definition: AuxTypeRegistry.cxx:1292
SG::IAuxTypeVectorFactory::copy
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors.
SG::AuxTypeRegistry::getVecType
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
Definition: AuxTypeRegistry.cxx:936
SG::AuxStoreInternal::getIOType
virtual const std::type_info * getIOType(SG::auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
Definition: AuxStoreInternal.cxx:532
SG::AuxStoreInternal::size
virtual size_t size() const override
Return the number of elements in the store.
Definition: AuxStoreInternal.cxx:602
xAOD::RAuxStore::getAuxIDs
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Definition: RAuxStore.cxx:276
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
SG::AuxStoreInternal::linkedVector
virtual IAuxTypeVector * linkedVector(SG::auxid_t auxid) override
Return interface for a linked variable.
Definition: AuxStoreInternal.cxx:769
SG::AuxStoreInternal::getIOData
virtual const void * getIOData(SG::auxid_t auxid) const override
Return a pointer to the data to be stored for one aux data item.
Definition: AuxStoreInternal.cxx:515
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
xAOD::RAuxStore::m_mutex1
mutex_t m_mutex1
Mutexes object used for multithreaded synchronisation.
Definition: RAuxStore.h:222
xAOD::RAuxStore::m_inFileName
std::string m_inFileName
The input file that we are reading from.
Definition: RAuxStore.h:225
xAOD::RAuxStore::getVector
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
Definition: RAuxStore.cxx:232
SG::AuxTypeRegistry::makeVector
std::unique_ptr< IAuxTypeVector > makeVector(SG::auxid_t auxid, size_t size, size_t capacity) const
Construct a new vector to hold an aux item.
Definition: AuxTypeRegistry.cxx:817
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
xAOD::RAuxStore::setupAuxField
StatusCode setupAuxField(const std::string &fieldName, const std::string &auxName, ::Bool_t staticField)
Register one input field as an available auxiliary variable.
Definition: RAuxStore.cxx:1456
CxxUtils::as_const_ptr
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
Definition: as_const_ptr.h:32
xAOD::Utils::fieldExists
::Bool_t fieldExists(std::string fieldName, RNTupleReader &ntupleReader)
This function is used to check if a field exists in an RNTupleReader.
Definition: Control/xAODRootAccess/Root/Utils.cxx:403
xAOD::RAuxStore::m_inputNtupleName
std::string m_inputNtupleName
The name of the ntuple that we are reading from.
Definition: RAuxStore.h:229
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
xAOD::RAuxStore::setupInputData
StatusCode setupInputData(auxid_t auxid)
Connect a variable to the input tree.
Definition: RAuxStore.cxx:974
xAOD::Utils::getTypeInfo
const std::type_info & getTypeInfo(EDataType type)
This function is used when reading a primitive branch from an input file without the user explicitly ...
Definition: Control/xAODRootAccess/Root/Utils.cxx:194
xAOD::RAuxStore::m_vecs
std::vector< SG::IAuxTypeVector * > m_vecs
Variables handled currently by the object.
Definition: RAuxStore.h:208
xAOD::RAuxStore::getData
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
Definition: RAuxStore.cxx:218
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
SG::AuxStoreInternal
An auxiliary data store that holds data internally.
Definition: AuxStoreInternal.h:43
python.PyAthena.v
v
Definition: PyAthena.py:154
SG::AuxVectorInterface
Make an AuxVectorData object from either a raw array or an aux store.
Definition: AuxVectorInterface.h:33
xAOD::RAuxStore::lock
virtual void lock() override
Lock the object, and don't let decorations be added.
Definition: RAuxStore.cxx:389
SG::AuxStoreInternal::getVector
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
Definition: AuxStoreInternal.cxx:99
SG::AuxStoreInternal::isDecoration
virtual bool isDecoration(auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
Definition: AuxStoreInternal.cxx:420
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::RAuxStore::scanInputNtuple
StatusCode scanInputNtuple()
Scan the input RNTuple for auxiliary fields.
Definition: RAuxStore.cxx:887
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
xAOD::RAuxStore::m_topStore
::Bool_t m_topStore
Flag stating whether this is a "top store".
Definition: RAuxStore.h:186
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
SG::AuxStoreInternal::resize
virtual bool resize(size_t sz) override
Change the size of all aux data vectors.
Definition: AuxStoreInternal.cxx:243
SG::AuxStoreInternal::getDecorIDs
virtual const SG::auxid_set_t & getDecorIDs() const override
Return a set of identifiers for decorations in this store.
Definition: AuxStoreInternal.cxx:410
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
collListGuids.attributes
attributes
Definition: collListGuids.py:46
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
merge.status
status
Definition: merge.py:17
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
xAOD::RAuxStore::kUndefinedStore
@ kUndefinedStore
The structure mode is not defined.
Definition: RAuxStore.h:46
xAOD::AuxSelection::selectAux
virtual void selectAux(const std::set< std::string > &attributes)
Select which variables should be written out.
Definition: AuxSelection.cxx:47
CxxUtils::ConcurrentBitset::erase
ConcurrentBitset & erase(bit_t bit)
Turn off one bit.
xAOD::RAuxStore::m_entryToLoad
::Long64_t m_entryToLoad
The entry to load from the ntuple.
Definition: RAuxStore.h:237
xAOD::AuxSelection::getSelectedAuxIDs
virtual SG::auxid_set_t getSelectedAuxIDs(const SG::auxid_set_t &fullset) const
Return which variables were selected to be written out.
Definition: AuxSelection.cxx:62
xAOD::RAuxStore::m_fields
std::map< auxid_t, RFieldInfo > m_fields
A way to acces an representation of a field with an auxid.
Definition: RAuxStore.h:271
xAOD::RAuxStore::size
virtual size_t size() const override
Return the number of elements in the store.
Definition: RAuxStore.cxx:445
xAOD::RAuxStore::kObjectStore
@ kObjectStore
The object describes a single object.
Definition: RAuxStore.h:48
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
xAOD::RAuxStore::m_isDecoration
std::vector< ::Bool_t > m_isDecoration
Flags items as decorations.
Definition: RAuxStore.h:215
xAOD::RAuxStore::m_outFileName
std::string m_outFileName
The output file that we are writing to.
Definition: RAuxStore.h:227
SG::IAuxTypeVector::toPtr
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
xAOD::RAuxStore::auxid_set_t
SG::auxid_set_t auxid_set_t
Convenience type declaration.
Definition: RAuxStore.h:41
xAOD::RAuxStore::isContainerField
::Bool_t isContainerField(std::string fieldName, auxid_t auxid) const
Check if a field describes a container or a single object.
Definition: RAuxStore.cxx:1650
xAOD::RAuxStore::m_selection
AuxSelection m_selection
Object helping to select which auxiliary variables to write.
Definition: RAuxStore.h:200
CxxUtils::ConcurrentBitset::test
bool test(bit_t bit) const
Test to see if a bit is set.