ATLAS Offline Software
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
REventClass Class Reference

Class used for the test. More...

Inheritance diagram for REventClass:
Collaboration diagram for REventClass:

Public Types

enum  EAuxMode { kBranchAccess = 0, kClassAccess = 1, kAthenaAccess = 2, kUndefinedAccess = 3 }
 Auxiliary store "mode". More...
 
using sgkey_t = SG::sgkey_t
 

Public Member Functions

 REventClass (xAOD::Experimental::REvent::EAuxMode mode)
 Constructor. More...
 
StatusCode loadInputObjects ()
 Function loading all interface objects of the event. More...
 
EAuxMode auxMode () const
 Get what auxiliary access mode the object was constructed with. More...
 
std::string dump ()
 Function creating a user-readable dump of the current input. More...
 
void printIOStats () const
 Function printing the I/O statistics of the current process. More...
 
void setPrintEventProxyWarnings (bool)
 Function to silence warnings associated with broken element links. More...
 
template<typename T >
bool retrieve (const T *&obj, sgkey_t key=DEFAULT_KEY, bool silent=false)
 Function retrieving an object from the event (constant version) More...
 
template<typename T >
bool retrieve (const T *&obj, const std::string &key, bool silent=false)
 Function retrieving an object from the event (constant version) More...
 
template<typename T >
void keys (std::vector< std::string > &vkeys, bool metadata=false) const
 provide list of all keys associated with provided type. More...
 
Setup functions
StatusCode readFrom (const std::string &fileName)
 This function takes care of connecting the event object to a new input file. More...
 
void setActive () const
 Set this event object as the currently active one. More...
 
void setAuxItemList (const std::string &containerKey, const std::string &itemList)
 Configure which dynamic variables to write out for a given store. More...
 
StatusCode addListener (TVirtualIncidentListener *listener)
 Register an incident listener object. More...
 
StatusCode removeListener (TVirtualIncidentListener *listener)
 Remove an incident listener object. More...
 
void clearListeners ()
 Remove all listeners from the object. More...
 
StatusCode addNameRemap (const std::string &onfile, const std::string &newName)
 Add a name re-mapping rule. More...
 
void clearNameRemap ()
 Clear the current name re-mapping. More...
 
void printNameRemap () const
 Print the current name re-mapping rules. More...
 
Event data accessor/modifier functions
template<typename T >
::Bool_t contains (const std::string &key)
 Function checking if an object is available from the store. More...
 
template<typename T >
::Bool_t transientContains (const std::string &key) const
 Function checking if an object is already in memory. More...
 
template<typename T >
StatusCode retrieve (const T *&obj, const std::string &key)
 Retrieve either an input or an output object from the event. More...
 
template<typename T >
StatusCode retrieve (T *&obj, const std::string &key)
 Retrieve an output object from the event. More...
 
Metadata accessor/modifier functions
template<typename T >
::Bool_t containsMeta (const std::string &key)
 Function checking if a meta-object is available from the store. More...
 
template<typename T >
::Bool_t transientContainsMeta (const std::string &key) const
 Function checking if a meta-object is already in memory. More...
 
template<typename T >
StatusCode retrieveMetaInput (const T *&obj, const std::string &key)
 Retrieve an input metadata object. More...
 
template<typename T >
StatusCode retrieveMetaOutput (const T *&obj, const std::string &key)
 Retrieve an output metadata object. More...
 
template<typename T >
StatusCode recordMeta (T *obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=1)
 Add an object to the output file's metadata. More...
 
template<typename T >
StatusCode recordMeta (std::unique_ptr< T > obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=1)
 Add an object to the output file's metadata, explicitly taking ownership of it. More...
 
Persistent data accessor/modifier functions
::Long64_t getEntries () const
 Get how many entries are available from the current input file(s) More...
 
::Int_t getEntry (::Long64_t entry, ::Int_t getall=0)
 Function loading a given entry of the input TTree. More...
 
const EventFormat * inputEventFormat () const
 RDS: Only valid for TChains, i.e. More...
 
Setup functions
StatusCode readFrom (const std::string &fileName)
 This function takes care of connecting the event object to a new input file. More...
 
void setActive () const
 Set this event object as the currently active one. More...
 
void setAuxItemList (const std::string &containerKey, const std::string &itemList)
 Configure which dynamic variables to write out for a given store. More...
 
StatusCode addListener (TVirtualIncidentListener *listener)
 Register an incident listener object. More...
 
StatusCode removeListener (TVirtualIncidentListener *listener)
 Remove an incident listener object. More...
 
void clearListeners ()
 Remove all listeners from the object. More...
 
StatusCode addNameRemap (const std::string &onfile, const std::string &newName)
 Add a name re-mapping rule. More...
 
void clearNameRemap ()
 Clear the current name re-mapping. More...
 
void printNameRemap () const
 Print the current name re-mapping rules. More...
 
Event data accessor/modifier functions
template<typename T >
::Bool_t contains (const std::string &key)
 Function checking if an object is available from the store. More...
 
template<typename T >
::Bool_t transientContains (const std::string &key) const
 Function checking if an object is already in memory. More...
 
template<typename T >
StatusCode retrieve (const T *&obj, const std::string &key)
 Retrieve either an input or an output object from the event. More...
 
template<typename T >
StatusCode retrieve (T *&obj, const std::string &key)
 Retrieve an output object from the event. More...
 
Metadata accessor/modifier functions
template<typename T >
::Bool_t containsMeta (const std::string &key)
 Function checking if a meta-object is available from the store. More...
 
template<typename T >
::Bool_t transientContainsMeta (const std::string &key) const
 Function checking if a meta-object is already in memory. More...
 
template<typename T >
StatusCode retrieveMetaInput (const T *&obj, const std::string &key)
 Retrieve an input metadata object. More...
 
template<typename T >
StatusCode retrieveMetaOutput (const T *&obj, const std::string &key)
 Retrieve an output metadata object. More...
 
template<typename T >
StatusCode recordMeta (T *obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=1)
 Add an object to the output file's metadata. More...
 
template<typename T >
StatusCode recordMeta (std::unique_ptr< T > obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=1)
 Add an object to the output file's metadata, explicitly taking ownership of it. More...
 
Persistent data accessor/modifier functions
::Long64_t getEntries () const
 Get how many entries are available from the current input file(s) More...
 
::Int_t getEntry (::Long64_t entry, ::Int_t getall=0)
 Function loading a given entry of the input TTree. More...
 
const EventFormat * inputEventFormat () const
 RDS: Only valid for TChains, i.e. More...
 

Static Public Attributes

static constexpr sgkey_t DEFAULT_KEY = ~static_cast<sgkey_t>(0)
 Key for retrieving the "default" object of a given type. More...
 
static constexpr sgkey_t KEY_MASK = DEFAULT_KEY >> 2
 Mask for the keys, used mostly internally. More...
 

Protected Types

typedef std::unordered_map< std::string, TVirtualManager * > Object_t
 Definition of the internal data structure type. More...
 
typedef std::vector< TVirtualIncidentListener * > Listener_t
 Definition of the structure type holding on to listeners. More...
 

Protected Member Functions

::Bool_t contains (const std::string &key, const std::type_info &ti, ::Bool_t metadata=kFALSE)
 Internal function checking if an object is in the input. More...
 
::Bool_t transientContains (const std::string &key, const std::type_info &ti, ::Bool_t metadata=kFALSE) const
 Internal function checking if an object is already in memory. More...
 
void * getOutputObject (const std::string &key, const std::type_info &ti, ::Bool_t metadata=kFALSE) const
 This function does the heavy lifting of retrieving object from the list of output objects. More...
 
const void * getInputObject (const std::string &key, const std::type_info &ti, ::Bool_t silent=kFALSE, ::Bool_t metadata=kFALSE)
 Function for retrieving an input object in a non-template way. More...
 
StatusCode initStats ()
 Function to initialise the statistics for all Tree content. More...
 
StatusCode connectBranch (const std::string &key, ::Bool_t silent=kFALSE)
 Function setting up access to a particular branch. More...
 
StatusCode connectMetaBranch (const std::string &key, ::Bool_t silent=kFALSE)
 Function setting up access to a branch in the metadata tree. More...
 
StatusCode connectAux (const std::string &prefix, ::Bool_t standalone)
 Function setting up access to a set of auxiliary branches. More...
 
StatusCode connectMetaAux (const std::string &prefix, ::Bool_t standalone)
 Function setting up access to a set of auxiliary branches for a metadata object. More...
 
StatusCode setUpDynamicStore (TObjectManager &mgr, ::TTree *tree)
 Function adding dynamic variable reading capabilities to an auxiliary store object metadata still uses TTree: More...
 
StatusCode setUpDynamicStore (RObjectManager &mgr, ROOT::RNTupleReader *ntupleReader)
 event uses RNTupleReader: More...
 
StatusCode setAuxStore (RObjectManager &mgr, ::Bool_t metadata=kFALSE)
 Function connecting a DV object to its auxiliary store. More...
 
StatusCode setAuxStore (TObjectManager &mgr)
 Function connecting a DV object to its auxiliary store - using TTree, for metadata only. More...
 
Functions implementing the IProxyDict interface
SG::DataProxyproxy (const void *const pTransient) const override
 get proxy for a given data object address in memory More...
 
SG::DataProxyproxy (const CLID &id, const std::string &key) const override
 get proxy with given id and key. Returns 0 to flag failure More...
 
SG::DataProxyproxy_exact (SG::sgkey_t sgkey) const override
 Get proxy given a hashed key+clid. More...
 
StatusCode addToStore (CLID id, SG::DataProxy *proxy) override
 Add a new proxy to the store. More...
 
std::vector< const SG::DataProxy * > proxies () const override
 return the list of all current proxies in store More...
 
SG::sgkey_t stringToKey (const std::string &str, CLID clid) override
 Find the string corresponding to a given key. More...
 
const std::string * keyToString (SG::sgkey_t key) const override
 Find the string corresponding to a given key. More...
 
const std::string * keyToString (SG::sgkey_t key, CLID &clid) const override
 Find the string and CLID corresponding to a given key. More...
 
void registerKey (SG::sgkey_t key, const std::string &str, CLID clid) override
 Remember an additional mapping from key to string/CLID. More...
 
SG::DataProxyrecordObject (SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override
 Record an object in the store. More...
 
const std::string & name () const override
 Get the name of the instance. More...
 
Helper functions for the IProxyDict interface
const xAOD::EventFormatElementgetEventFormatElement (SG::sgkey_t sgkey) const
 Get the metadata object for a given "SG key". More...
 
const BranchInfogetBranchInfo (SG::sgkey_t sgkey) const
 Get the object describing one object/branch. More...
 
Functions implementing the IProxyDict interface
SG::DataProxyproxy (const void *const pTransient) const override
 get proxy for a given data object address in memory More...
 
SG::DataProxyproxy (const CLID &id, const std::string &key) const override
 get proxy with given id and key. Returns 0 to flag failure More...
 
SG::DataProxyproxy_exact (SG::sgkey_t sgkey) const override
 Get proxy given a hashed key+clid. More...
 
StatusCode addToStore (CLID id, SG::DataProxy *proxy) override
 Add a new proxy to the store. More...
 
std::vector< const SG::DataProxy * > proxies () const override
 return the list of all current proxies in store More...
 
SG::sgkey_t stringToKey (const std::string &str, CLID clid) override
 Find the string corresponding to a given key. More...
 
const std::string * keyToString (SG::sgkey_t key) const override
 Find the string corresponding to a given key. More...
 
const std::string * keyToString (SG::sgkey_t key, CLID &clid) const override
 Find the string and CLID corresponding to a given key. More...
 
void registerKey (SG::sgkey_t key, const std::string &str, CLID clid) override
 Remember an additional mapping from key to string/CLID. More...
 
SG::DataProxyrecordObject (SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override
 Record an object in the store. More...
 
const std::string & name () const override
 Get the name of the instance. More...
 
Helper functions for the IProxyDict interface
const xAOD::EventFormatElementgetEventFormatElement (SG::sgkey_t sgkey) const
 Get the metadata object for a given "SG key". More...
 
const BranchInfogetBranchInfo (SG::sgkey_t sgkey) const
 Get the object describing one object/branch. More...
 

Static Protected Member Functions

::Bool_t hasAuxStore (const THolder &holder)
 RDS: for the three following methods, moving to directly take THolder rather than have one for TObjectManager and another for RObjectManager. More...
 
::Bool_t isAuxStore (const THolder &holder)
 Function checking if a given object may be an auxiliary store. More...
 
::Bool_t isStandalone (const THolder &holder)
 Function checking if an object is standalone (not a container) More...
 

Protected Attributes

EAuxMode m_auxMode
 The auxiliary access mode. More...
 
std::unique_ptr< ROOT::RNTupleReader > m_inNtupleReader
 The main event reader: RNTupleReader. More...
 
::TTree * m_inMetaTree
 Pointer to the metadata tree in the input file. More...
 
::Bool_t m_inMetaTreeIsTTree
 Boolean indicating the technology of the metadata tree, i.e. TTree of RNTuple. More...
 
::Long64_t m_entry
 The entry to look at from the input tree. More...
 
::TTree * m_outTree
 The tree that we are writing to. More...
 
Object_t m_inputObjects
 Collection of all the managed input objects. More...
 
std::set< std::string > m_inputMissingObjects
 Objects that have been asked for, but were found to be missing in the current input. More...
 
Object_t m_outputObjects
 Collection of all the managed output object. More...
 
Object_t m_inputMetaObjects
 Collection of all the managed input meta-objects. More...
 
Object_t m_outputMetaObjects
 Collection of all the managed output meta-objects. More...
 
EventFormat m_inputEventFormat
 Format of the current input file. More...
 
EventFormat * m_outputEventFormat
 Format of the current output file. More...
 
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
 Rules for selecting which auxiliary branches to write. More...
 
Listener_t m_listeners
 Listeners who should be notified when certain incidents happen. More...
 
std::unordered_map< std::string, std::string > m_nameRemapping
 Container name re-mapping rules. More...
 
Bool_t m_printEventProxyWarnings = true
 Option to silence common warnings that seem to be harmless. More...
 

Static Protected Attributes

static const ::Int_t CACHE_SIZE = -1
 Size of a possible TTreeCache (30 MB) More...
 
static const char *const EVENT_RNTUPLE_NAME = "EventData"
 Name of the event tree. More...
 
static const char *const METADATA_TREE_NAME = "MetaData"
 Name of the metadata tree. More...
 

Functions implementing the xAOD::TVirtualEvent interface

SG::sgkey_t getHash (const std::string &key) const override
 Function returning the hash describing an object name. More...
 
SG::sgkey_t getKey (const void *obj) const override
 Function returning the hash describing a known object. More...
 
const std::string & getName (const void *obj) const override
 Function returning the key describing a known object. More...
 
const std::string & getName (SG::sgkey_t hash) const override
 Function returning the key describing a known object. More...
 
StatusCode record (void *obj, const std::string &typeName, const std::string &key)
 Internal function for recording an object into the output. More...
 
void * getOutputObject (SG::sgkey_t key, const std::type_info &ti) override
 This function is used by the TVirtualEvent interface to access an output object with a given hashed key. More...
 
const void * getInputObject (SG::sgkey_t key, const std::type_info &ti, bool silent=false) override
 Function for retrieving an input object in a non-template way. More...
 
void getNames (const std::string &targetClassName, std::vector< std::string > &vkeys, bool metadata=false) const override
 Function determining the list keys associated with a type name. More...
 

Variable(s) used in the IProxyDict implementation

typedef AthContainers_detail::upgrade_mutex upgrade_mutex_t
 Mutex and lock for multithread synchronization. More...
 
typedef AthContainers_detail::upgrading_lock< upgrade_mutex_tupgrading_lock_t
 
upgrade_mutex_t m_branchesMutex
 
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
 Map from hashed sgkey to BranchInfo. More...
 

Detailed Description

Class used for the test.

Definition at line 36 of file xAODRNFileReadTest.cxx.

Member Typedef Documentation

◆ Listener_t

typedef std::vector< TVirtualIncidentListener* > xAOD::Experimental::REvent::Listener_t
protectedinherited

Definition of the structure type holding on to listeners.

Definition at line 460 of file REvent.h.

◆ Object_t

typedef std::unordered_map< std::string, TVirtualManager* > xAOD::Experimental::REvent::Object_t
protectedinherited

Definition of the internal data structure type.

Definition at line 458 of file REvent.h.

◆ sgkey_t

Definition at line 35 of file TVirtualEvent.h.

◆ upgrade_mutex_t

typedef AthContainers_detail::upgrade_mutex xAOD::Experimental::REvent::upgrade_mutex_t
protectedinherited

Mutex and lock for multithread synchronization.

Definition at line 530 of file REvent.h.

◆ upgrading_lock_t

Definition at line 531 of file REvent.h.

Member Enumeration Documentation

◆ EAuxMode

Auxiliary store "mode".

Enumerator
kBranchAccess 

Access auxiliary data branch-by-branch.

kClassAccess 

Access auxiliary data using the aux containers.

kAthenaAccess 

Access containers/objects like Athena does.

kUndefinedAccess 

Undefined, to be selected by the object.

Definition at line 118 of file REvent.h.

118  {
119  kBranchAccess = 0,
120  kClassAccess = 1,
121  kAthenaAccess = 2,
122  kUndefinedAccess = 3
123  };

Constructor & Destructor Documentation

◆ REventClass()

REventClass::REventClass ( xAOD::Experimental::REvent::EAuxMode  mode)
inline

Constructor.

Definition at line 39 of file xAODRNFileReadTest.cxx.

Member Function Documentation

◆ addListener()

StatusCode xAOD::Experimental::REvent::addListener ( TVirtualIncidentListener listener)
inherited

Register an incident listener object.

This function works pretty much like IIncidentSvc::addListener does in Athena.

It tells the REvent object that when certain "interesting incidents" happen, a given object should be notified about it.

Parameters
listenerPointer to the object that should be notified
Returns
The usual StatusCode types

Definition at line 754 of file REvent.cxx.

754  {
755 
756  // Check that we received a valid pointer:
757  if( ! listener ) {
758  ::Error( "xAOD::REvent::addListener",
759  XAOD_MESSAGE( "Received a null pointer for the listener" ) );
760  return StatusCode::FAILURE;
761  }
762 
763  // Check if this listener is already in our list:
764  bool listenerKnown = false;
765  for( TVirtualIncidentListener* l : m_listeners ) {
766  if( l == listener ) {
767  ::Warning( "xAOD::REvent::addListener",
768  "Listener %p was added previously already",
769  static_cast< void* >( listener ) );
770  listenerKnown = true;
771  break;
772  }
773  }
774 
775  // If we don't know it yet, let's add it now:
776  if( ! listenerKnown ) {
777  m_listeners.push_back( listener );
778  }
779 
780  // Return gracefully:
781  return StatusCode::SUCCESS;
782  }

◆ addNameRemap()

StatusCode xAOD::Experimental::REvent::addNameRemap ( const std::string &  onfile,
const std::string &  newName 
)
inherited

Add a name re-mapping rule.

The names of containers can change during the lifetime of the experiment.

One such change happened after the DC14 exercise, when many containers got a new name. (Like "ElectronCollection" became simply "Electrons".)

This function allows us to create aliases with which certain containers should be accessible. So that the analyser would be able to access older files, while using the latest container name(s).

Parameters
onfileThe name of the container as it was saved into the input file
newNameThe alias with which the object/container should be accessible
Returns
The usual StatusCode types

Save the new name association:

Definition at line 834 of file REvent.cxx.

835  {
836 
837  // Check if this name is known on the input or output already. As that's
838  // not good.
840  ::Error( "xAOD::REvent::addNameRemap",
841  XAOD_MESSAGE( "Can't use \"%s\" as the target name in the"
842  "\"%s\" -> \"%s\" remapping" ),
843  newName.c_str(), onfile.c_str(), newName.c_str() );
844  return StatusCode::FAILURE;
845  }
846 
847  // Check if this name was remapped to something already:
848  auto itr = m_nameRemapping.find( newName );
849  if( itr != m_nameRemapping.end() ) {
850  ::Warning( "xAOD::REvent::addNameRemap",
851  "Overriding existing name remapping \"%s\" -> \"%s\"",
852  itr->second.c_str(), itr->first.c_str() );
853  ::Warning( "xAOD::REvent::addNameRemap", " with: \"%s\" -> \"%s\"",
854  onfile.c_str(), newName.c_str() );
855  }
856 
858  m_nameRemapping[ newName ] = onfile;
859 
860  // Return gracefully:
861  return StatusCode::SUCCESS;
862  }

◆ addToStore()

StatusCode xAOD::Experimental::REvent::addToStore ( CLID  clid,
SG::DataProxy proxy 
)
overrideprotectedinherited

Add a new proxy to the store.

Smart pointers to objects that don't exist in the input event, can end up calling this function.

In this case warn the user that something fishy is happening, and take posession of the received proxy.

Parameters
clidThe CLID of the type. Not taken into account.
proxyThe proxy to take posession of. Not used for anything useful.

Definition at line 396 of file REventProxyDict.cxx.

396  {
397 
399 
400  // Warn the user that the function got called:
401  static std::atomic_flag warningPrinted ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT;
402  if ( ! warningPrinted.test_and_set() && m_printEventProxyWarnings) {
403  ::Warning( "xAOD::REvent::addToStore",
404  "Function should only be called through an invalid "
405  "ElementLink" );
406  }
407 
408  // Hold on to the proxy with some non-existent, hopefully unique key:
409  const ::TString uniqueKey = ::TString::Format( "NonExistentKey_%lu",
410  m_branches.size() );
411  BranchInfo bi;
412  bi.m_proxy.reset( proxy );
413  lock.upgrade();
414  m_branches.insert( std::make_pair( stringToKey( uniqueKey.Data(),
415  clid ),
416  std::move( bi ) ) );
417 
418  // Return gracefully:
419  return StatusCode::SUCCESS;
420  }

◆ auxMode()

REvent::EAuxMode xAOD::Experimental::REvent::auxMode ( ) const
inherited

Get what auxiliary access mode the object was constructed with.

Returns
The auxiliary data access mode currently in use

Definition at line 209 of file REvent.cxx.

209  {
210 
211  return m_auxMode;
212  }

◆ clearListeners()

void xAOD::Experimental::REvent::clearListeners ( )
inherited

Remove all listeners from the object.

This function can be used to remove all the listeners from the internal list.

Should not be necessary under regular circumstances.

Definition at line 814 of file REvent.cxx.

814  {
815 
816  m_listeners.clear();
817  return;
818  }

◆ clearNameRemap()

void xAOD::Experimental::REvent::clearNameRemap ( )
inherited

Clear the current name re-mapping.

This function simply clears out any existing name remapping declarations.

In case the remapping rules need to be changed in the code in some complicated way.

Definition at line 868 of file REvent.cxx.

868  {
869 
870  m_nameRemapping.clear();
871  return;
872  }

◆ connectAux()

StatusCode xAOD::Experimental::REvent::connectAux ( const std::string &  prefix,
::Bool_t  standalone 
)
protectedinherited

Function setting up access to a set of auxiliary branches.

This function is used internally to connect an auxiliary object to the input.

Based on the configuration of the object it will either use TAuxStore, or the EDM object that was used to write the auxiliary information in Athena.

Parameters
prefixThe prefix (main branch name) of the auxiliary data
standaloneType of the auxiliary store that should be created
Returns
kTRUE if the connection was successful, or kFALSE if it was not

Definition at line 2697 of file REvent.cxx.

2698  {
2699 
2700  // A simple test...
2701  if( ! m_inNtupleReader ) {
2702  ::Error( "xAOD::REvent::connectAux",
2703  XAOD_MESSAGE( "No input tree is available" ) );
2704  return StatusCode::FAILURE;
2705  }
2706 
2707  // RDS: I am not sure how to check if an object of name prefix 'exists' - so skip the check for the moment
2708 
2709  // // Check if we know anything about this auxiliary object:
2710  // if( ( ! m_inNtupleReader->GetView<void>(prefix.c_str(), nullptr) ) &&
2711  // ( m_auxMode == kClassAccess || m_auxMode == kAthenaAccess ) ) {
2712  // // If not, then let's just return right away. Not having
2713  // // an auxiliary object with this name is not an error per se.
2714  // return StatusCode::SUCCESS;
2715  // }
2716 
2717  // Check if the branch is already connected:
2718  if( m_inputObjects.find( prefix ) != m_inputObjects.end() ) {
2719  return StatusCode::SUCCESS;
2720  }
2721 
2722  // Do different things based on the "auxiliary mode" we are in:
2724 
2725  // In "class access mode" let's first connect the concrete auxiliary
2726  // object to the input:
2727  auto result = connectBranch( prefix );
2728  if( ! result.isSuccess() ) {
2729  ::Error( "xAOD::REvent::connectAux", XAOD_MESSAGE( "Failed to execute connectBranch : for prefix %s" ),
2730  prefix.c_str() );
2731  return result;
2732  }
2733 
2734  // Access the object's manager:
2735  Object_t::const_iterator mgr_itr = m_inputObjects.find( prefix );
2736  if( mgr_itr == m_inputObjects.end() ) {
2737  ::Fatal( "xAOD::REvent::connectAux",
2738  XAOD_MESSAGE( "There's a logic error in the code" ) );
2739  }
2740  const RObjectManager* omgr =
2741  dynamic_cast< const RObjectManager* >( mgr_itr->second );
2742  if( ! omgr ) {
2743  ::Fatal( "xAOD::REvent::connectAux",
2744  XAOD_MESSAGE( "There's a logic error in the code" ) );
2745  return StatusCode::FAILURE;
2746  }
2747 
2748  // Check if we can switch out the internal store of this object:
2749  static const TClass* const holderClass =
2750  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
2751  if( ! omgr->holder()->getClass()->InheritsFrom( holderClass ) ) {
2752  // Nope... So let's just end the journey here.
2753  return StatusCode::SUCCESS;
2754  }
2755 
2756  // Try to get the object as an IAuxStoreHolder:
2757  SG::IAuxStoreHolder* storeHolder =
2758  reinterpret_cast< SG::IAuxStoreHolder* >(
2759  omgr->holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
2760  if( ! storeHolder ) {
2761  ::Fatal( "xAOD::REvent::connectAux",
2762  XAOD_MESSAGE( "There's a logic error in the code" ) );
2763  }
2764 
2765  // A sanity check to see whether the store's type is in sync with the
2766  // object's type that it will be connected to:
2767  if( ( standalone && ( storeHolder->getStoreType() !=
2769  ( ( ! standalone ) &&
2770  ( storeHolder->getStoreType() !=
2772  ::Error( "xAOD::REvent::connectAux",
2773  XAOD_MESSAGE( "Requested store types inconsistent "
2774  "for: %s" ), prefix.c_str() );
2775  ::Error( "xAOD::REvent::connectAux",
2776  XAOD_MESSAGE( "standalone = %s, getStoreType() = %i" ),
2777  ( standalone ? "kTRUE" : "kFALSE" ),
2778  static_cast< int >( storeHolder->getStoreType() ) );
2779  return StatusCode::FAILURE;
2780  }
2781 
2782  // Return gracefully:
2783  return StatusCode::SUCCESS;
2784 
2785  } else if( m_auxMode == kBranchAccess ) {
2786 
2787  // In "branch access mode" let's create a TAuxStore object, and let
2788  // that take care of the auxiliary store access:
2789  RAuxStore* store =
2790  new RAuxStore( prefix, kTRUE,
2793  // We're using this object to read from the input, it needs to be
2794  // locked:
2795  store->lock();
2796  RAuxManager* mgr = new RAuxManager( store, m_entry );
2797  m_inputObjects[ prefix ] = mgr;
2798 
2799  // Now connect the object to the input tree:
2800  RETURN_CHECK( "xAOD::REvent::connectAux",
2801  store->readFrom( *m_inNtupleReader ) );
2802 
2803  // Return gracefully:
2804  return StatusCode::SUCCESS;
2805  }
2806 
2807  // There was some problem:
2808  ::Error( "xAOD::REvent::connectAux",
2809  XAOD_MESSAGE( "Unknown auxiliary access mode set (%i)" ),
2810  static_cast< int >( m_auxMode ) );
2811  return StatusCode::FAILURE;
2812  }

◆ connectBranch()

StatusCode xAOD::Experimental::REvent::connectBranch ( const std::string &  key,
::Bool_t  silent = kFALSE 
)
protectedinherited

Function setting up access to a particular branch.

This is one of the more important functions of the class.

It connects the event object to a given branch of the input TTree.

The type that is read in to memory is not actually determined by the type written to the tree itself, but from the xAOD::EventFormat object. Which is there to make it possible to possibly use ROOT read rules in the future to read a different type than what's on disk.

Everything else is fairly basic ROOT stuff, the code just has to make sure that the memory management is set up correctly for the created object.

Parameters
keyThe name of the branch to connect to
silentSet to kTRUE to make the code fail silently in case the branch can't be connected to
Returns
kTRUE if the connection was successful, or kFALSE if it was not

Definition at line 2417 of file REvent.cxx.

2418  {
2419 
2420  // A little sanity check:
2421  if( ! m_inNtupleReader ) {
2422  ::Error( "xAOD::REvent::connectBranch",
2423  XAOD_MESSAGE( "Function called on un-initialised object" ) );
2424  return StatusCode::FAILURE;
2425  }
2426 
2427  // Increment the access counter on this container:
2429 
2430  // Check if the branch is already connected:
2431  if( m_inputObjects.find( key ) != m_inputObjects.end() ) {
2432  return StatusCode::SUCCESS;
2433  }
2434  // Check if it was already found to be missing.
2435  if( m_inputMissingObjects.find( key ) != m_inputMissingObjects.end() ) {
2436  if( ! silent ) {
2437  ::Warning( "xAOD::REvent::connectBranch",
2438  "Branch \"%s\" not available on input",
2439  key.c_str() );
2440  }
2441  return StatusCode::RECOVERABLE;
2442  }
2443 
2444  // Check if we have metadata about this branch:
2445  const xAOD::EventFormatElement* ef = 0;
2446 
2447  // RNTuples are missing '.' for <cont>Aux.
2448  auto key_ef = key;
2449  auto key_to_read = key;
2450  if (key.rfind("Aux.") != std::string::npos) {
2451  // key_ef.pop_back();
2452  std::replace(key_to_read.begin(), key_to_read.end(), '.', ':');
2453  }
2454 
2455  if( ! m_inputEventFormat.exists( key_ef ) ) {
2456  if( ! silent ) {
2457  ::Warning( "xAOD::REvent::connectBranch",
2458  "No metadata available for branch: %s ef key %s",
2459  key.c_str(), key_ef.c_str() );
2460  }
2461  } else {
2462  ef = m_inputEventFormat.get( key_ef );
2463  }
2464 
2465 
2466  // Check if the field exists in our input RNTuple: RDS: still need to check if this works for missing fields
2467  if (m_inNtupleReader->GetDescriptor().FindFieldId(key_to_read.c_str()) == ROOT::kInvalidDescriptorId) {
2468  // Field doesn't exist
2469  if( ! silent ) {
2470  ::Warning( "xAOD::REvent::connectBranch", "Key \"%s\" not available on input", key.c_str() );
2471  }
2472  m_inputMissingObjects.insert( key );
2473  return StatusCode::RECOVERABLE;
2474  }
2475 
2476 
2477  // RDS: may need some logic here to get type from inputEventFormat rather than the view
2478  // to read in with automatic schema evolution
2479 
2480  // Get class name from the field
2481  ROOT::RNTupleView<void> view = m_inNtupleReader->GetView<void>(key_to_read.c_str(), nullptr);
2482  std::string className = view.GetField().GetTypeName();
2483 
2484  if( className == "" ) {
2485  if( ef ) {
2486  // This is a fairly weird situation, but let's fall back to taking
2487  // the class name from the metadata object in this case.
2488  className = ef->className();
2489  } else {
2490  ::Error( "xAOD::REvent::connectBranch",
2491  XAOD_MESSAGE( "Couldn't find an appropriate type with a "
2492  "dictionary for branch \"%s\"" ),
2493  key.c_str() );
2494  return StatusCode::FAILURE;
2495  }
2496  }
2497  ::TClass* realClass = ::TClass::GetClass( className.c_str() );
2498  if( ( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) && ef ) {
2499  // We may need to do an actual schema evolution here, in which
2500  // case let's fall back on the class name coming from the metadata
2501  // object.
2502  className = ef->className();
2503  realClass = ::TClass::GetClass( className.c_str() );
2504  }
2505  if( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) {
2506  // Now we're in trouble...
2507  ::Error( "xAOD::REvent::connectBranch",
2508  XAOD_MESSAGE( "Couldn't find an appropriate type with a "
2509  "dictionary for branch \"%s\"" ),
2510  key.c_str() );
2511  return StatusCode::FAILURE;
2512  }
2513 
2514  // Make sure that the current object is the "active event":
2515  setActive();
2516 
2517  // // The data type is always "other" for us:
2518  // static const ::EDataType dataType = kOther_t;
2519 
2520  // Check if the output already has this object. If it does, let's
2521  // assume that we have been copying the object to the output. Which
2522  // means that we need to resume filling the same memory address that
2523  // the output holder points to.
2524  void* ptr = 0;
2525 
2526  // RDS: no output yet
2527 
2528  // Object_t::const_iterator out_itr = m_outputObjects.find( key );
2529  // if( out_itr != m_outputObjects.end() ) {
2530  // // It needs to be an object manager...
2531  // TObjectManager* mgr =
2532  // dynamic_cast< TObjectManager* >( out_itr->second );
2533  // if( ! mgr ) {
2534  // ::Error( "xAOD::REvent::connectBranch",
2535  // XAOD_MESSAGE( "Couldn't access output manager for: %s" ),
2536  // key.c_str() );
2537  // return StatusCode::FAILURE;
2538  // }
2539  // // Get the pointer out of it:
2540  // ptr = mgr->holder()->get();
2541  // }
2542 
2543  // If there is no output object, then let's create one ourselves.
2544  // This is the only way in which we can have the memory management of
2545  // THolder do the right thing with this object.
2546  if( ! ptr ) {
2547  ptr = realClass->New();
2548  }
2549 
2550  // Create the new manager object that will hold this EDM object:
2551  THolder* hldr = new THolder( ptr, realClass );
2552 
2553  RObjectManager* mgr =
2554  new RObjectManager( m_inNtupleReader->GetView<void>(key_to_read.c_str(), hldr->get()),
2555  m_entry, hldr, ( m_auxMode == kAthenaAccess ) );
2556  m_inputObjects[ key ] = mgr;
2557 
2558  // If it's an auxiliary store object, set it up correctly:
2559  if( isAuxStore( *mgr->holder() ) ) {
2560  RETURN_CHECK( "xAOD::REvent::connectBranch",
2561  setUpDynamicStore( *mgr, m_inNtupleReader.get() ) );
2562  // setUpDynamicStore( *mgr, m_inNtupleReader ) );
2563  }
2564 
2565  // Return here if the object can't have an auxiliary store:
2566  if( ! hasAuxStore( *mgr->holder() ) ) return StatusCode::SUCCESS;
2567 
2568  // If there may be an auxiliary object connected to this one,
2569  // connect that as well:
2570  return connectAux( key + "Aux.", isStandalone( *mgr->holder() ) );
2571  // RDS: comment - "Aux:" with ":" is only needed REvent::setAuxStore, I think!
2572  // return connectAux( key + "Aux:", isStandalone( *mgr->holder() ) );
2573  }

◆ connectMetaAux()

StatusCode xAOD::Experimental::REvent::connectMetaAux ( const std::string &  prefix,
::Bool_t  standalone 
)
protectedinherited

Function setting up access to a set of auxiliary branches for a metadata object.

This function is used internally to connect an auxiliary metadata object to the input.

Based on the configuration of the object it will either use TAuxStore, or the EDM object that was used to write the auxiliary information in Athena.

Parameters
prefixThe prefix (main branch name) of the auxiliary data
standaloneType of the auxiliary store that should be created
Returns
The usual StatusCode types

Definition at line 2823 of file REvent.cxx.

2824  {
2825 
2826  // Check if the branch is already connected:
2827  if( m_inputMetaObjects.find( prefix ) != m_inputMetaObjects.end() ) {
2828  return StatusCode::SUCCESS;
2829  }
2830 
2831  // A sanity check:
2832  if( ! m_inMetaTree ) {
2833  ::Fatal( "xAOD::REvent::connectMetaAux",
2834  XAOD_MESSAGE( "Internal logic error detected" ) );
2835  return StatusCode::FAILURE;
2836  }
2837 
2838  // Do different things based on the "auxiliary mode" we are in:
2840 
2841  // In "class access mode" let's first connect the concrete auxiliary
2842  // object to the input:
2843  RETURN_CHECK( "xAOD::REvent::connectMetaAux",
2845 
2846  // Access the object's manager:
2847  Object_t::const_iterator mgr_itr = m_inputMetaObjects.find( prefix );
2848  if( mgr_itr == m_inputMetaObjects.end() ) {
2849  ::Fatal( "xAOD::REvent::connectMetaAux",
2850  XAOD_MESSAGE( "There's a logic error in the code" ) );
2851  }
2852  const TObjectManager* omgr =
2853  dynamic_cast< const TObjectManager* >( mgr_itr->second );
2854  if( ! omgr ) {
2855  ::Fatal( "xAOD::REvent::connectMetaAux",
2856  XAOD_MESSAGE( "There's a logic error in the code" ) );
2857  return StatusCode::FAILURE;
2858  }
2859 
2860  // Check if we can switch out the internal store of this object:
2861  static const TClass* const holderClass =
2862  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
2863  if( ! omgr->holder()->getClass()->InheritsFrom( holderClass ) ) {
2864  // Nope... So let's just end the journey here.
2865  return StatusCode::SUCCESS;
2866  }
2867 
2868  // Try to get the object as an IAuxStoreHolder:
2869  SG::IAuxStoreHolder* storeHolder =
2870  reinterpret_cast< SG::IAuxStoreHolder* >(
2871  omgr->holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
2872  if( ! storeHolder ) {
2873  ::Fatal( "xAOD::REvent::connectMetaAux",
2874  XAOD_MESSAGE( "There's a logic error in the code" ) );
2875  }
2876 
2877  // A sanity check to see whether the store's type is in sync with the
2878  // object's type that it will be connected to:
2879  if( ( standalone && ( storeHolder->getStoreType() !=
2881  ( ( ! standalone ) &&
2882  ( storeHolder->getStoreType() !=
2884  ::Error( "xAOD::REvent::connectMetaAux",
2885  XAOD_MESSAGE( "Requested store types inconsistent" ) );
2886  ::Error( "xAOD::REvent::connectMetaAux",
2887  XAOD_MESSAGE( "standalone = %s, getStoreType() = %i" ),
2888  ( standalone ? "kTRUE" : "kFALSE" ),
2889  static_cast< int >( storeHolder->getStoreType() ) );
2890  return StatusCode::FAILURE;
2891  }
2892 
2893  // Return gracefully:
2894  return StatusCode::SUCCESS;
2895 
2896  } else if( m_auxMode == kBranchAccess ) {
2897 
2898  // In "branch access mode" let's create a TAuxStore object, and let
2899  // that take care of the auxiliary store access:
2900  TAuxStore* store =
2901  new TAuxStore( prefix, kTRUE,
2904  // We use this object to read data from the input, it needs to be
2905  // locked:
2906  store->lock();
2907  TAuxManager* mgr = new TAuxManager( store );
2909 
2910  // Now connect the object to the input tree:
2911  RETURN_CHECK( "xAOD::REvent::connectMetaAux",
2912  store->readFrom( *m_inMetaTree ) );
2913 
2914  // Tell the auxiliary store which entry to use:
2915  store->getEntry( 0 );
2916 
2917  // Return gracefully:
2918  return StatusCode::SUCCESS;
2919  }
2920 
2921  // There was some problem:
2922  ::Error( "xAOD::REvent::connectMetaAux",
2923  XAOD_MESSAGE( "Unknown auxiliary access mode set (%i)" ),
2924  static_cast< int >( m_auxMode ) );
2925  return StatusCode::FAILURE;
2926  }

◆ connectMetaBranch()

StatusCode xAOD::Experimental::REvent::connectMetaBranch ( const std::string &  key,
::Bool_t  silent = kFALSE 
)
protectedinherited

Function setting up access to a branch in the metadata tree.

This is the function doing the heavy lifting with creating metadata objects in memory out of the payload of the input file.

Parameters
keyThe key (branch name) of the metadata object to retrieve
silentSet to kTRUE to make the code fail silently in case the branch can't be connected to
Returns
The usual StatusCode types

Definition at line 2583 of file REvent.cxx.

2584  {
2585 
2586  // A little sanity check:
2587  if( ! m_inMetaTree ) {
2588  ::Error( "xAOD::REvent::connectMetaBranch",
2589  XAOD_MESSAGE( "Function called on un-initialised object" ) );
2590  return StatusCode::FAILURE;
2591  }
2592 
2593  // Check if the branch is already connected:
2594  if( m_inputMetaObjects.find( key ) != m_inputMetaObjects.end() ) {
2595  return StatusCode::SUCCESS;
2596  }
2597 
2598  // Check if the branch exists in our metadata tree:
2599  ::TBranch* br = m_inMetaTree->GetBranch( key.c_str() );
2600  if( ! br ) {
2601  if( ! silent ) {
2602  ::Warning( "xAOD::REvent::connectMetaBranch",
2603  "Branch \"%s\" not available on input",
2604  key.c_str() );
2605  }
2606  return StatusCode::RECOVERABLE;
2607  }
2608 
2609  // Check that we have an entry in the branch:
2610  if( ! br->GetEntries() ) {
2611  if( ! silent ) {
2612  ::Warning( "xAOD::REvent::connectMetaBranch",
2613  "Branch \"%s\" doesn't hold any data",
2614  key.c_str() );
2615  }
2616  return StatusCode::RECOVERABLE;
2617  }
2618 
2619  // Make sure that it's not in "MakeClass mode":
2620  br->SetMakeClass( 0 );
2621 
2622  // Extract the type of the branch:
2623  ::TClass* cl = 0;
2624  ::EDataType dt = kOther_t;
2625  if( br->GetExpectedType( cl, dt ) || ( ! cl ) ) {
2626  ::Error( "xAOD::REvent::connectMetaBranch",
2627  XAOD_MESSAGE( "Couldn't get the type for metadata "
2628  "branch %s" ), key.c_str() );
2629  return StatusCode::FAILURE;
2630  }
2631 
2632  // Create the object, and all of the managers around it:
2633  void* ptr = cl->New();
2634  THolder* hldr = new THolder( ptr, cl );
2635  TObjectManager* mgr =
2636  new TObjectManager( 0, hldr, m_auxMode == kAthenaAccess );
2637  m_inputMetaObjects[ key ] = mgr;
2638 
2639  // Now try to connect to the branch:
2640  const ::Int_t status = m_inMetaTree->SetBranchAddress( key.c_str(),
2641  hldr->getPtr(),
2642  mgr->branchPtr(),
2643  cl, dt,
2644  kTRUE );
2645  if( status < 0 ) {
2646  ::Error( "xAOD::REvent::connectMetaBranch",
2647  XAOD_MESSAGE( "Couldn't connect variable of type \"%s\" to "
2648  "input branch \"%s\". Return code: %i" ),
2649  cl->GetName(), key.c_str(), status );
2650  // Clean up:
2651  *( hldr->getPtr() ) = 0;
2652  delete mgr;
2653  m_inputMetaObjects.erase( key );
2654  return StatusCode::FAILURE;
2655  }
2656 
2657  // Read in the object:
2658  if( mgr->getEntry() < 0 ) {
2659  ::Error( "xAOD::REvent::connectMetaBranch",
2660  XAOD_MESSAGE( "Couldn't read in metadata object with key "
2661  "\"%s\"" ), key.c_str() );
2662  return StatusCode::FAILURE;
2663  }
2664 
2665  // If it's an auxiliary store object, set it up correctly:
2666  if( isAuxStore( *mgr->holder() ) ) {
2667  RETURN_CHECK( "xAOD::REvent::connectMetaBranch",
2669  }
2670 
2671  // Return here if the object can't have an auxiliary store:
2672  if( ! hasAuxStore( *mgr->holder() ) ) return StatusCode::SUCCESS;
2673 
2674  // If there may be an auxiliary object connected to this one,
2675  // connect that as well:
2676  RETURN_CHECK( "xAOD::REvent::connectMetaBranch",
2677  connectMetaAux( key + "Aux.", isStandalone( *mgr->holder() ) ) );
2678 
2679  // And now connect the first object to its auxiliary store:
2680  RETURN_CHECK( "xAOD::REvent::connectMetaBranch",
2681  setAuxStore( *mgr ) );
2682 
2683  // We succeeded:
2684  return StatusCode::SUCCESS;
2685  } // connectMetaBranch

◆ contains() [1/2]

template<typename T >
::Bool_t xAOD::Experimental::REvent::contains ( const std::string &  key)
inherited

Function checking if an object is available from the store.

◆ contains() [2/2]

Bool_t xAOD::Experimental::REvent::contains ( const std::string &  key,
const std::type_info &  ti,
::Bool_t  metadata = kFALSE 
)
protectedinherited

Internal function checking if an object is in the input.

Created a non-template version of the call internally to be able to use it from xAOD::MakeTransientTree.

Parameters
keyThe key to check
tiThe type of the object to check
metadataFlag deciding whether we are looking for a metadata object or not
Returns
kTRUE if such an object is held by the event object at the moment, kFALSE otherwise

Definition at line 3787 of file REvent.cxx.

3789  {
3790 
3791  return ( getOutputObject( key, ti, metadata ) ||
3792  getInputObject( key, ti, kTRUE, metadata ) );
3793  }

◆ containsMeta()

template<typename T >
::Bool_t xAOD::Experimental::REvent::containsMeta ( const std::string &  key)
inherited

Function checking if a meta-object is available from the store.

◆ dump()

std::string xAOD::Experimental::REvent::dump ( )
inherited

Function creating a user-readable dump of the current input.

This function behaves exactly like StoreGateSvc::dump().

It doesn't actually print anything to the screen, it just returns a user readable dump of the contents of the current input file/chain.

It is a pretty dumb implementation for the moment. Should be made nicer later on.

Returns
The user-readable contents of the current input file/chain

Definition at line 223 of file REvent.cxx.

223  {
224 
225  // The internal stream object:
226  std::ostringstream ost;
227  ost << "<<<<<<<<<<<<<<<<<<<< xAOD::REvent Dump >>>>>>>>>>>>>>>>>>>>\n";
228 
229  // Loop over the EventFormat object:
232  for( ; ef_itr != ef_end; ++ef_itr ) {
233 
234  // Construct the type name:
235  std::string typeName = ef_itr->second.className();
236  removeVersionNames( typeName );
237 
238  // Get the type:
239  ::TClass* cl =
240  ::TClass::GetClass( ef_itr->second.className().c_str() );
241  const std::type_info* ti = ( cl ? cl->GetTypeInfo() : nullptr );
242  if( ( ! cl ) || ( ! cl->IsLoaded() ) || ( ! ti ) ) {
243  Warning( "xAOD::REvent::dump",
244  "Unknown type (%s) found in the event format",
245  ef_itr->second.className().c_str() );
246  continue;
247  }
248 
249  // Skip containers that are not available anyway:
250  if( ! contains( ef_itr->second.branchName(), *ti ) ) {
251  continue;
252  }
253 
254  // Do the printout:
255  ost << " Hash: 0x" << std::setw( 8 ) << std::setfill( '0' )
256  << std::hex << ef_itr->second.hash()
257  << " Key: \"" << ef_itr->second.branchName() << "\"\n";
258 
259  ost << " type: " << typeName << "\n";
260  const bool isNonConst = transientContains( ef_itr->second.branchName(),
261  *ti );
262  ost << " isConst: " << ( isNonConst ? "No" : "Yes" ) << "\n";
263  ost << " Data: "
264  << ( isNonConst ? getOutputObject( ef_itr->second.branchName(),
265  *ti ) :
266  getInputObject( ef_itr->second.branchName(), *ti ) ) << "\n";
267  }
268 
269  // Finish with the construction:
270  ost << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
271  return ost.str();
272  }

◆ getBranchInfo()

const REvent::BranchInfo * xAOD::Experimental::REvent::getBranchInfo ( SG::sgkey_t  sgkey) const
protectedinherited

Get the object describing one object/branch.

Definition at line 279 of file REventProxyDict.cxx.

279  {
280 
281  {
282  // We can only hold the lock (even though it's a shared lock) for
283  // this limited scope because the call to getInputObject below
284  // leads to a recursion and dead-lock if not released immediately.
286 
287  // If the object already exists, return it:
288  auto it = m_branches.find( sgkey );
289  if( it != m_branches.end() ) {
290  return &( it->second );
291  }
292  }
293 
294  // If not, construct it now:
295  BranchInfo bi;
297  if( ! efe ) {
298  // Apparently this key is not known:
299  return nullptr;
300  }
301 
302  // Helper variable(s).
303  static const bool SILENT = true;
304  static const bool METADATA = false;
305 
306  // The name of the requested object.
307  const std::string& name = getName( sgkey );
308  // This is a bit perverse... In order to let the "base class" figure
309  // out the exact type of this object, we ask for it with a REvent
310  // pointer. I use that type because I need something that has a
311  // dictionary, and which should always be available when this code
312  // runs. In the end it doesn't matter that the object can't be
313  // retrieved as that type (of course...), it only matters that it gets
314  // "set up" following these calls.
315  REvent* nc_this = const_cast< REvent* >( this );
316  static const std::type_info& dummy = typeid( REvent );
317  nc_this->getInputObject( name, dummy, SILENT, METADATA );
318  auto itr = m_outputObjects.find( name );
319  if( itr == m_outputObjects.end() ) {
320  itr = m_inputObjects.find( name );
321  if( itr == m_inputObjects.end() ) {
322  // We didn't find this object in the store...
323  return nullptr;
324  }
325  }
326  const RObjectManager* mgr =
327  dynamic_cast< const RObjectManager* >( itr->second );
328  if( ! mgr ) {
329  ::Error( "xAOD::REvent::getBranchInfo",
330  XAOD_MESSAGE( "Internal logic error found" ) );
331  return nullptr;
332  }
333  bi.m_class = mgr->holder()->getClass();
334  // There's no need to check whether this is a "proper" dictionary
335  // at this point, since if REvent is holding on to it, the type
336  // must have a proper compiled dictionary.
337 
338 #ifndef XAOD_STANDALONE
339  // Create a proper proxy for the input branch:
340  SG::TransientAddress* taddr =
341  new SG::TransientAddress( CLID_NULL, efe->branchName(),
342  new GenericAddress() );
343  taddr->setSGKey( sgkey );
344  xAODPrivate::RLoader* loader =
345  new xAODPrivate::RLoader (*nc_this,
346  getName( sgkey ),
347  *bi.m_class->GetTypeInfo());
348  bi.m_proxy.reset( new SG::DataProxy( taddr, loader ) );
349  loader->setProxy (*bi.m_proxy.get());
350 #endif // not XAOD_STANDALONE
351 
352  // Add the branch info to our list:
354  lock.upgrade();
355  auto ret = m_branches.insert( std::make_pair( sgkey, std::move( bi ) ) );
356 
357  // Return a pointer to the branch info:
358  return &( ret.first->second );
359  }

◆ getEntries()

Long64_t xAOD::Experimental::REvent::getEntries ( ) const
inherited

Get how many entries are available from the current input file(s)

Returns
The number of events in the input file(s)

Definition at line 1137 of file REvent.cxx.

1137  {
1138 
1139  if( m_inNtupleReader ) {
1140  return m_inNtupleReader->GetNEntries();
1141  } else {
1142  ::Error( "xAOD::REvent::getEntries",
1143  XAOD_MESSAGE( "Function called on an uninitialised "
1144  "object" ) );
1145  return 0;
1146  }
1147  }

◆ getEntry()

Int_t xAOD::Experimental::REvent::getEntry ( ::Long64_t  entry,
::Int_t  getall = 0 
)
inherited

Function loading a given entry of the input TTree.

This function is used to move to looking at a new entry from the input tree.

It doesn't do any I/O operation at this point, it just remembers which entry the objects should be loaded from later on.

Unless one calls the function with getall==1. In that case all input is force-read. This is necessary when writing out an event that was processed in a load-on-request manner.

Parameters
entryThe entry from the input tree to load
getallParameter deciding if partial reading should be used or not.
Returns
The number of bytes read, or a negative number in case of an error

Definition at line 1163 of file REvent.cxx.

1163  {
1164 
1165  // A little sanity check:
1166  if( ( ! m_inNtupleReader ) ) {
1167  ::Error( "xAOD::REvent::getEntry",
1168  XAOD_MESSAGE( "Function called on an uninitialised "
1169  "object" ) );
1170  return -1;
1171  }
1172 
1173  // Set entry value
1174  m_entry = entry;
1175 
1176  // Stats counter needs to know it's the next event:
1178 
1179  // If force-reading is not requested, we're done:
1180  if( ! getall ) {
1181 
1182  // Notify the listeners that a new event was loaded:
1183  const TIncident incident( IncidentType::BeginEvent );
1184  Listener_t::iterator l_itr = m_listeners.begin();
1185  Listener_t::iterator l_end = m_listeners.end();
1186  for( ; l_itr != l_end; ++l_itr ) {
1187  ( *l_itr )->handle( incident );
1188  }
1189 
1190  // No real reading was done:
1191  return 0;
1192  }
1193 
1194  // Loop over all input object managers, and force them to load their
1195  // content:
1196  ::Int_t result = 0;
1197  if( m_auxMode == kAthenaAccess ) {
1198  // In kAthenaAccess mode we need to use getInputObject(...) to load
1199  // all the input objects correctly.
1200  for( auto& inObj : m_inputObjects ) {
1201  static const std::string dynStorePostfix = "Aux.Dynamic";
1202  if( inObj.first.find( dynStorePostfix ) ==
1203  ( inObj.first.size() - dynStorePostfix.size() ) ) {
1204  // Ignore the dynamic store objects. They get loaded through
1205  // their parents.
1206  } else {
1207  // Load the objects and their auxiliary stores through the
1208  // getInputObject(...) function, which takes care of correctly
1209  // setting them up. The type is irrelevant here. We don't
1210  // really care about the exact type of the objects.
1211  getInputObject( inObj.first, typeid( int ), kTRUE, kFALSE );
1212  }
1213  }
1214  } else {
1215  // In a "reasonable" access mode, we do something very simple:
1216  for( auto& inObj : m_inputObjects ) {
1217  result += inObj.second->getEntry( getall );
1218  }
1219  }
1220 
1221  // Notify the listeners that a new event was loaded:
1222  const TIncident incident( IncidentType::BeginEvent );
1223  Listener_t::iterator l_itr = m_listeners.begin();
1224  Listener_t::iterator l_end = m_listeners.end();
1225  for( ; l_itr != l_end; ++l_itr ) {
1226  ( *l_itr )->handle( incident );
1227  }
1228 
1229  // Return the number of bytes read:
1230  return result;
1231  }

◆ getEventFormatElement()

const xAOD::EventFormatElement * xAOD::Experimental::REvent::getEventFormatElement ( SG::sgkey_t  sgkey) const
protectedinherited

Get the metadata object for a given "SG key".

Definition at line 362 of file REventProxyDict.cxx.

362  {
363 
364  const xAOD::EventFormatElement* efe = 0;
365  static const bool QUIET = true;
366  if( m_outputEventFormat ) {
367  efe = m_outputEventFormat->get( sgkey, QUIET );
368  }
369  if( ! efe ) {
370  efe = m_inputEventFormat.get( sgkey, QUIET );
371  }
372  if ( ! efe ) {
373  static SG::SGKeySet missingSGKeys ATLAS_THREAD_SAFE;
374  static mutex_t mutex;
375  guard_t lock(mutex);
376  if( missingSGKeys.emplace( sgkey ).second ) {
378  ::Warning( "xAOD::REvent::getEventFormatElement",
379  "Can't find EventFormatElement for hashed "
380  "SG key %d", sgkey );
381  }
382  return 0;
383  }
384  }
385  return efe;
386  }

◆ getHash()

SG::sgkey_t xAOD::Experimental::REvent::getHash ( const std::string &  key) const
overridevirtualinherited

Function returning the hash describing an object name.

This helper function is mostly needed by the smart pointers of the xAOD EDM.

Right now it very simply just calculates the hash just based on the key given to the function. But later on it might be good to do some tests here, checking if the event format knows about the specified key or not. This is why it's not made to be a static function

Parameters
keyString key to turn into a hash
Returns
A hash corresponding to the specified string key

Implements xAOD::TVirtualEvent.

Definition at line 1433 of file REvent.cxx.

1433  {
1434 
1435  // For empty keys let's finish quickly:
1436  if( key == "" ) return 0;
1437 
1438  // If the key is used in the input file, let's use the same hash for
1439  // the output file as well:
1440  if( m_inputEventFormat.exists( key ) ) {
1441  return m_inputEventFormat.get( key )->hash();
1442  }
1443 
1444  // If it's a new key, make a new hash for it from scratch:
1445  return Utils::hash( key );
1446  }

◆ getInputObject() [1/2]

const void * xAOD::Experimental::REvent::getInputObject ( const std::string &  key,
const std::type_info &  ti,
::Bool_t  silent = kFALSE,
::Bool_t  metadata = kFALSE 
)
protectedinherited

Function for retrieving an input object in a non-template way.

This is the function doing the heavy lifting to retrieve objects from the input file.

Parameters
keyThe key (branch name) of the object to retrieve
tiThe type as which the object is to be retrieved
silentSet to kTRUE to make the code fail silently in case the object can't be retrieved
metadataFlag deciding whether we're looking for a metadata or event data object
Returns
A pointer to the input object if successful, or a null pointer if not

Definition at line 1982 of file REvent.cxx.

1985  {
1986 
1987  // Check if a name remapping should be applied or not:
1988  std::string keyToUse = key;
1989  auto remap_itr = m_nameRemapping.find( key );
1990  if( ( remap_itr != m_nameRemapping.end() ) &&
1991  ( ! m_inputEventFormat.exists( key ) ) &&
1992  m_inputEventFormat.exists( remap_itr->second ) ) {
1993  keyToUse = remap_itr->second;
1994  }
1995 
1996  // The following catches the cases when we ask for a transient
1997  // ConstDataVector object to be returned as "const DataVector".
1998  TStore* store = TActiveStore::store();
1999  if( store && store->contains( keyToUse, ti ) &&
2000  store->isConst( keyToUse, ti ) ) {
2001  const void* result = store->getConstObject( keyToUse, ti );
2002  return result;
2003  }
2004 
2005  // A sanity check before checking for an object from the input file:
2006  if( ( ( ! m_inNtupleReader ) || ( m_entry < 0 ) ) &&
2007  ( ! metadata ) ) {
2008  return 0;
2009  }
2010  if( ( ! m_inMetaTree ) && metadata ) {
2011  return 0;
2012  }
2013 
2014  // Make sure that the requested branch is connected to:
2015  if( metadata ) {
2016  if( ! connectMetaBranch( keyToUse, silent ).isSuccess() ) {
2017  return 0;
2018  }
2019  } else {
2020  if( ! connectBranch( keyToUse, silent ).isSuccess() ) {
2021  return 0;
2022  }
2023  }
2024 
2025  // Select which object container to use:
2026  Object_t& objects = ( metadata ?
2028 
2029  // Access the object's manager:
2030  Object_t::iterator itr = objects.find( keyToUse );
2031  if( itr == objects.end() ) {
2032  ::Fatal( "xAOD::REvent::getInputObject",
2033  XAOD_MESSAGE( "There is an internal logic error in the "
2034  "code..." ) );
2035  return 0;
2036  }
2037 
2038  // Now we separate into metadata using TTree and event data using RNTuple
2039 
2040  const void* result = 0;
2041 
2042  if( ! metadata ) {
2043 
2044  // Event data
2045 
2046  // This has to be an ObjectManager object:
2047  RObjectManager* mgr =
2048  dynamic_cast< RObjectManager* >( itr->second );
2049  if( ! mgr ) {
2050  if( key == keyToUse ) {
2051  ::Error( "xAOD::REvent::getInputObject",
2052  XAOD_MESSAGE( "Object of wrong type found for key "
2053  "\"%s\"" ),
2054  key.c_str() );
2055  } else {
2056  ::Error( "xAOD::REvent::getInputObject",
2057  XAOD_MESSAGE( "Object of wrong type found for key "
2058  "\"%s\"/\"%s\"" ), key.c_str(),
2059  keyToUse.c_str() );
2060  }
2061  return 0;
2062  }
2063 
2064  // Make sure that the current entry is loaded for event data objects:
2065  if( mgr->getEntry() ) {
2066  // Connect the auxiliary store to objects needing it. This call also
2067  // takes care of updating the dynamic store of auxiliary containers,
2068  // when they are getting accessed directly.
2069  if( ! setAuxStore( *mgr ).isSuccess() ) {
2070  ::Error( "xAOD::REvent::getInputObject",
2071  XAOD_MESSAGE( "Failed to set the auxiliary store for "
2072  "%s/%s" ),
2073  mgr->holder()->getClass()->GetName(),
2074  keyToUse.c_str() );
2075  return 0;
2076  }
2077  }
2078 
2079  // Ask the holder object for the object of this type:
2080  result = mgr->holder()->getAsConst( ti, silent );
2081  if( ! result ) {
2082  if( ! silent ) {
2083  ::Warning( "xAOD::REvent::getInputObject",
2084  "Could not retrieve object with key \"%s\" "
2085  "as \"%s\"", keyToUse.c_str(),
2086  Utils::getTypeName( ti ).c_str() );
2087  }
2088  return 0;
2089  }
2090  }
2091  else {
2092 
2093  // metadata
2094 
2095  // Check if metadata is in RNTuple technology - not yet implemented
2096  if ( !m_inMetaTreeIsTTree ) {
2097  ::Error( "xAOD::REvent::getInputObject",
2098  XAOD_MESSAGE( "Metadata is in RNTuple technology which is not yet implemented. key %s" ), key.c_str() );
2099  return 0;
2100  }
2101 
2102  // This has to be an ObjectManager object:
2103  TObjectManager* mgr =
2104  dynamic_cast< TObjectManager* >( itr->second );
2105  if( ! mgr ) {
2106  if( key == keyToUse ) {
2107  ::Error( "xAOD::REvent::getInputObject",
2108  XAOD_MESSAGE( "Object of wrong type found for key "
2109  "\"%s\"" ),
2110  key.c_str() );
2111  } else {
2112  ::Error( "xAOD::REvent::getInputObject",
2113  XAOD_MESSAGE( "Object of wrong type found for key "
2114  "\"%s\"/\"%s\"" ), key.c_str(),
2115  keyToUse.c_str() );
2116  }
2117  return 0;
2118  }
2119 
2120  // Ask the holder object for the object of this type:
2121  result = mgr->holder()->getAsConst( ti, silent );
2122  if( ! result ) {
2123  if( ! silent ) {
2124  ::Warning( "xAOD::REvent::getInputObject",
2125  "Could not retrieve object with key \"%s\" "
2126  "as \"%s\"", keyToUse.c_str(),
2127  Utils::getTypeName( ti ).c_str() );
2128  }
2129  return 0;
2130  }
2131  }
2132 
2133  // We succeeded:
2134  return result;
2135  }

◆ getInputObject() [2/2]

const void * xAOD::Experimental::REvent::getInputObject ( SG::sgkey_t  key,
const std::type_info &  ti,
bool  silent = false 
)
overrideprotectedvirtualinherited

Function for retrieving an input object in a non-template way.

This function is used by the TVirtualEvent interface to access an input object with a given hashed key.

The function looks up the string key belonging to the hash, and then calls the other GetInputObject(...) function in the class with that parameter.

Parameters
keyThe hashed key of the input object
tiThe type description of the object requested
silentSwitch for being silent about failures or not
Returns
A pointer to the requested object, or a null pointer in case of failure

Implements xAOD::TVirtualEvent.

Definition at line 1731 of file REvent.cxx.

1733  {
1734 
1735  // Get a string name for this key:
1736  const std::string& name = getName( key );
1737  if( ( ! name.length() ) && ( ! silent ) ) {
1738  Warning( "xAOD::REvent::getInputObject",
1739  "Key 0x%08x unknown", key );
1740  return 0;
1741  }
1742 
1743  // Forward the call to the function using an std::string key:
1744  return getInputObject( name, ti, silent );
1745  }

◆ getKey()

SG::sgkey_t xAOD::Experimental::REvent::getKey ( const void *  obj) const
overridevirtualinherited

Function returning the hash describing a known object.

This function is used by the smart pointer code to find the identifier of an object that's already in the event in some way.

Parameters
objPointer to the object that we want to look up
Returns
The hashed identifier of the object, or 0 if the object was not found in the event

Implements xAOD::TVirtualEvent.

Definition at line 1455 of file REvent.cxx.

1455  {
1456 
1457  // Make use of the getName function:
1458  return getHash( getName( obj ) );
1459  }

◆ getName() [1/2]

const std::string & xAOD::Experimental::REvent::getName ( const void *  obj) const
overridevirtualinherited

Function returning the key describing a known object.

This function is used by the smart pointer code to find the identifier of an object that's already in the event in some way.

Parameters
objPointer to the object that we want to look up
Returns
The name of the object, or an empty string if the object was not found in the event

Implements xAOD::TVirtualEvent.

Definition at line 1468 of file REvent.cxx.

1468  {
1469 
1470  // First look among the output objects:
1471  Object_t::const_iterator obj_itr = m_outputObjects.begin();
1472  Object_t::const_iterator obj_end = m_outputObjects.end();
1473  for( ; obj_itr != obj_end; ++obj_itr ) {
1474 
1475  // Check if this is our object:
1476  if( obj_itr->second->object() != obj ) continue;
1477 
1478  // If it is, let's return right away:
1479  return obj_itr->first;
1480  }
1481 
1482  // Now look among the input objects:
1483  obj_itr = m_inputObjects.begin();
1484  obj_end = m_inputObjects.end();
1485  for( ; obj_itr != obj_end; ++obj_itr ) {
1486 
1487  // Check if this is our object:
1488  if( obj_itr->second->object() != obj ) continue;
1489 
1490  // If it is, let's return:
1491  return obj_itr->first;
1492  }
1493 
1494  // If it's not there either, check if it's in an active TStore object:
1495  const TStore* store = TActiveStore::store();
1496  if( store && store->contains( obj ) ) {
1497  // Get the name from the store then:
1498  return store->getName( obj );
1499  }
1500 
1501  // We didn't find the object in the event...
1502  ::Warning( "xAOD::REvent::getName",
1503  "Didn't find object with pointer %p in the event",
1504  obj );
1505  static const std::string dummy;
1506  return dummy;
1507  }

◆ getName() [2/2]

const std::string & xAOD::Experimental::REvent::getName ( SG::sgkey_t  hash) const
overridevirtualinherited

Function returning the key describing a known object.

This function is used primarily when getting the string key of a smart pointer that we read in from a file, or access it in memory.

Parameters
hashThe hashed key for the container/object
Returns
The name of the object, or an empty string if the object was not found in the event

Implements xAOD::TVirtualEvent.

Definition at line 1673 of file REvent.cxx.

1673  {
1674 
1675  // If the branch is known from the input:
1676  if( m_inputEventFormat.exists( hash ) ) {
1677  return m_inputEventFormat.get( hash )->branchName();
1678  }
1679 
1680  // If the branch is known on the output:
1681  if( m_outputEventFormat &&
1683  return m_outputEventFormat->get( hash )->branchName();
1684  }
1685 
1686  // If this is an object in the active store:
1687  const TStore* store = TActiveStore::store();
1688  if( store && store->contains( hash ) ) {
1689  return store->getName( hash );
1690  }
1691 
1692  // If it is unknown:
1693  static const std::string dummy;
1694  return dummy;
1695  }

◆ getNames()

void xAOD::Experimental::REvent::getNames ( const std::string &  targetClassName,
std::vector< std::string > &  vkeys,
bool  metadata = false 
) const
overrideprotectedvirtualinherited

Function determining the list keys associated with a type name.

Implements xAOD::TVirtualEvent.

Definition at line 1509 of file REvent.cxx.

1511  {
1512  // The results go in here
1513  std::set<std::string> keys;
1514 
1515  // Get list of branches from
1516  // the input metadata tree or input tree
1517  std::vector<TObjArray*> fullListOfBranches = {};
1518  if (metadata){
1519  if (m_inMetaTree){
1520  // No friend tree expected for metadata tree
1521  ::Info("xAOD::REvent::getNames", "scanning input objects");
1522  // Only add the list of branches of the metadata tree
1523  fullListOfBranches.push_back(m_inMetaTree->GetListOfBranches());
1524  }
1525  }
1526  else {
1527  ::Error("xAOD::REvent::getNames", "Cannot (yet) get names for event object of typename %s",
1528  targetClassName.c_str());
1529  return;
1530  }
1531 
1532 
1533 
1534  // RDS: assuming meta data is available. Otherwise, we need to find equivalent of all the branch names
1535  // else {
1536  // if (m_inTree){
1537  // ::Info("xAOD::REvent::getNames", "scanning input objects");
1538  // // Add the list of branches of the main tree
1539  // fullListOfBranches.push_back(m_inTree->GetListOfBranches());
1540  // // If input tree has friend trees
1541  // // add as well the list of friend tree branches
1542  // if (m_inTree->GetListOfFriends()){
1543  // // Get the list of friends
1544  // TList *fList = m_inTree->GetListOfFriends();
1545  // // Loop over friend elements
1546  // for (TObject * feObj : *fList){
1547  // if (feObj){
1548  // // Get corresponding friend tree
1549  // TTree *friendTree = dynamic_cast<TFriendElement*>(feObj)->GetTree();
1550  // // Add list of branches of the friend tree
1551  // fullListOfBranches.push_back(friendTree->GetListOfBranches());
1552  // }
1553  // }
1554  // }
1555  // }
1556  // }
1557 
1558  // Loop over all list of branches (if any)
1559  for (const TObjArray * in : fullListOfBranches){
1560  // Loop over all branches inside the current list of branches
1561  for ( Int_t index = 0; index < in->GetEntriesFast(); ++index ) {
1562  const TObject * obj = in->At(index);
1563  if ( ! obj ) continue;
1564  const TBranch * element = dynamic_cast<const TBranch*>(obj);
1565  if (!element) {
1566  ::Error("xAOD::REvent::getNames", "Failure inspecting input objects");
1567  break;
1568  }
1569  std::string objClassName = element->GetClassName();
1570  std::string key = obj->GetName();
1571  ::Info("xAOD::REvent::getNames",
1572  "Inspecting %s / %s",
1573  objClassName.c_str(), key.c_str());
1574  if (objClassName == targetClassName) {
1575  ::Info("xAOD::REvent::getNames",
1576  "Matched %s to key %s",
1577  targetClassName.c_str(), key.c_str());
1578  keys.insert(key);
1579  }
1580  }
1581  }
1582 
1583  const Object_t& inAux = ( metadata ?
1585 
1586  ::Info("xAOD::REvent::getNames",
1587  "scanning input Aux objects for %s", targetClassName.c_str());
1588  for( const auto& object : inAux ) {
1589  // All metadata objects should be held by TObjectManager objects.
1590  // Anything else is an error.
1591  TObjectManager* mgr = dynamic_cast< TObjectManager* >( object.second );
1592  if ( ! mgr ) continue;
1593  const std::string& objClassName = mgr->holder()->getClass()->GetName();
1594  const std::string& key = object.first;
1595  ::Info("xAOD::REvent::getNames",
1596  "Inspecting %s / %s",
1597  objClassName.c_str(), key.c_str());
1598  if (objClassName == targetClassName) {
1599  ::Info("xAOD::REvent::getNames",
1600  "Matched %s to key %s",
1601  targetClassName.c_str(), key.c_str());
1602  keys.insert(key);
1603  }
1604  }
1605 
1606 
1607  // check output objects
1608  TTree *tree = ( metadata ? nullptr : m_outTree );
1609  if (tree) {
1610  const TObjArray * out = tree->GetListOfBranches();
1611  ::Info("xAOD::REvent::getNames", "scanning output objects");
1612 
1613  for ( Int_t index = 0; index < out->GetEntriesFast(); ++index ) {
1614  const TObject * obj = out->At(index);
1615  if ( ! obj ) continue;
1616  const TBranch * element = dynamic_cast<const TBranch*>(obj);
1617  if (!element) {
1618  ::Error("xAOD::REvent::getNames", "Failure inspecting input objects");
1619  break;
1620  }
1621  std::string objClassName = element->GetClassName();
1622  std::string key = obj->GetName();
1623  ::Info("xAOD::REvent::getNames",
1624  "Inspecting %s / %s",
1625  objClassName.c_str(), key.c_str());
1626  if (objClassName == targetClassName) {
1627  ::Info("xAOD::REvent::getNames",
1628  "Matched %s to key %s",
1629  targetClassName.c_str(), key.c_str());
1630  keys.insert(key);
1631  }
1632  }
1633  } else {
1634  ::Info("xAOD::REvent::getNames", "no output tree connected");
1635  }
1636 
1637 
1638  const Object_t& outAux = ( metadata ?
1640 
1641  // Search though EventFormat for entries where class matches the provided
1642  // typeName
1643  ::Info("xAOD::REvent::getNames",
1644  "scanning output Aux objects for %s", targetClassName.c_str());
1645  for( const auto& object : outAux ) {
1646  // All metadata objects should be held by TObjectManager objects.
1647  // Anything else is an error.
1648  TObjectManager* mgr = dynamic_cast< TObjectManager* >( object.second );
1649  if ( ! mgr ) continue;
1650  const std::string& objClassName = mgr->holder()->getClass()->GetName();
1651  const std::string& key = object.first;
1652  ::Info("xAOD::REvent::getNames",
1653  "Inspecting %s / %s",
1654  objClassName.c_str(), key.c_str());
1655  if (objClassName == targetClassName) {
1656  ::Info("xAOD::REvent::getNames",
1657  "Matched %s to key %s",
1658  targetClassName.c_str(), key.c_str());
1659  keys.insert(key);
1660  }
1661  }
1662 
1663  vkeys.insert(vkeys.end(), keys.begin(), keys.end());
1664  }

◆ getOutputObject() [1/2]

void * xAOD::Experimental::REvent::getOutputObject ( const std::string &  key,
const std::type_info &  ti,
::Bool_t  metadata = kFALSE 
) const
protectedinherited

This function does the heavy lifting of retrieving object from the list of output objects.

While it returns a typeless pointer, that pointer can be cast directly to the type described by the second parameter in the caller code.

Parameters
keyThe key (branch name) of the object to retrieve
tiThe type as which the object is to be retrieved
metadataFlag deciding whether we're looking for a metadata or event data object
Returns
A pointer to the output object if successful, or a null pointer if not

Definition at line 1912 of file REvent.cxx.

1914  {
1915 
1916  // Select which object container to use:
1917  const Object_t& objects = ( metadata ?
1919 
1920  // Check if the object can be found:
1921  Object_t::const_iterator itr = objects.find( key );
1922  if( itr == objects.end() ) {
1923  // Do the following only for event data:
1924  if( ! metadata ) {
1925  // It's not in the event. Let's check if we find it in an active
1926  // TStore object...
1927  TStore* store = TActiveStore::store();
1928  if( ( ! store ) || ( ! store->contains( key, ti ) ) ||
1929  store->isConst( key, ti ) ) {
1930  // Nope, not there either...
1931  return 0;
1932  }
1933  // Let's return the object from the TStore:
1934  void* result = store->getObject( key, ti );
1935  return result;
1936  } else {
1937  // For metadata we don't use external resources.
1938  return 0;
1939  }
1940  }
1941 
1942  // If the object is not set in this event yet, we can't continue:
1943  if( ! itr->second->isSet() ) {
1944  return 0;
1945  }
1946 
1947  // If it does exist, check if it's the right kind of object:
1948  TObjectManager* mgr =
1949  dynamic_cast< TObjectManager* >( itr->second );
1950  if( ! mgr ) {
1951  ::Error( "xAOD::REvent::getOutputObject",
1952  XAOD_MESSAGE( "Object of wrong type found for key \"%s\"" ),
1953  key.c_str() );
1954  return 0;
1955  }
1956 
1957  // Ask the holder object for the object of this type:
1958  void* result = mgr->holder()->getAs( ti );
1959  if( ! result ) {
1960  ::Warning( "xAOD::REvent::getOutputObject",
1961  "Couldn't retrieve object as \"%s\"",
1962  Utils::getTypeName( ti ).c_str() );
1963  return 0;
1964  }
1965 
1966  // Return the object:
1967  return result;
1968  }

◆ getOutputObject() [2/2]

void * xAOD::Experimental::REvent::getOutputObject ( SG::sgkey_t  key,
const std::type_info &  ti 
)
overrideprotectedvirtualinherited

This function is used by the TVirtualEvent interface to access an output object with a given hashed key.

The function looks up the string key belonging to the hash, and then calls the other GetOutputObject(...) function in the class with that parameter.

Parameters
keyThe hashed key of the output object
tiThe type description of the object requested
Returns
A pointer to the requested object, or a null pointer in case of failure

Implements xAOD::TVirtualEvent.

Definition at line 1707 of file REvent.cxx.

1708  {
1709 
1710  // Get a string name for this key:
1711  const std::string& name = getName( key );
1712  if( ! name.length() ) {
1713  return 0;
1714  }
1715 
1716  // Forward the call to the function using an std::string key:
1717  return getOutputObject( name, ti );
1718  }

◆ hasAuxStore()

Bool_t xAOD::Experimental::REvent::hasAuxStore ( const THolder holder)
staticprotectedinherited

RDS: for the three following methods, moving to directly take THolder rather than have one for TObjectManager and another for RObjectManager.

Since the code needs to check in a few places whether a given object has an auxiliary store, and as this check may change slightly over time, it seemed to be a good idea to outsource this check into this function.

This can eventually be moved to base class and have TEvent use this one. Function checking if a given object may have an auxiliary store

Parameters
holderThe holder of the object that should be checked
Returns
kTRUE if the object can have an auxiliary store, kFALSE otherwise RDS: keep two versions for the moment for RObjectManager and TObjectManager

Definition at line 3709 of file REvent.cxx.

3709  {
3710 
3711  // The classes whose children can have an auxiliary store attached
3712  // to them:
3713  static const TClass* const dvClass =
3714  ::TClass::GetClass( typeid( SG::AuxVectorBase ) );
3715  static const TClass* const aeClass =
3716  ::TClass::GetClass( typeid( SG::AuxElement ) );
3717 
3718  // Do the check:
3719  return ( holder.getClass()->InheritsFrom( dvClass ) ||
3720  holder.getClass()->InheritsFrom( aeClass ) );
3721  }

◆ initStats()

StatusCode xAOD::Experimental::REvent::initStats ( )
protectedinherited

Function to initialise the statistics for all Tree content.

This function is used internally to initialise the reading of an input file.

It prepares the "monitoring information" in memory that gets filled while the code is running, with information about xAOD I/O.

Returns
StatusCode::SUCCESS if the function is successful, or StatusCode::kFaulure if not

Definition at line 1754 of file REvent.cxx.

1754  {
1755 
1756  // A little sanity check:
1757  if( ! m_inNtupleReader ) {
1758  ::Error( "xAOD::REvent::initStats",
1759  XAOD_MESSAGE( "Function called on an uninitialised "
1760  "object" ) );
1761  return StatusCode::FAILURE;
1762  }
1763 
1764  // Reset the number of input branches information:
1766 
1767  // Loop over the EventFormat information
1770  for( ; itr != end; ++itr ) {
1771 
1772  // Get the name of the branch in question:
1773  const std::string& branchName = itr->second.branchName();
1774 
1775  // If it's an auxiliary container, scan it using RAuxStore:
1776  if( branchName.find( "Aux." ) != std::string::npos ) {
1777 
1778  // But first decide whether it describes a container, or just
1779  // a single object. Since the file may have been written in
1780  // kBranchAccess mode, it's not necessarily a good idea to check
1781  // the type of the auxiliary class. So let's check the interface
1782  // class instead.
1783  //
1784  // Get the name of the interface object/container:
1785  const std::string intName =
1786  branchName.substr( 0, branchName.size() - 4 );
1787 
1788  if( ! m_inputEventFormat.exists( intName ) ) {
1789  // When this happens, it may still be that both the interface and
1790  // the auxiliary container is missing from the file. As we didn't
1791  // check yet whether the auxiliary container is in place or not.
1792  // So, before printing a warning, let's check for this.
1793  // Unfortunately the check is pretty expensive, but this should
1794  // not be performance critical code after all...
1795  ::Bool_t auxFound = kFALSE;
1796  // const std::string dynName = Utils::dynBranchPrefix( branchName );
1797 
1798  // std::vector<TObjArray*> fullListOfBranches = {};
1799  // // Add the list of branches of the main tree
1800  // fullListOfBranches.push_back(m_inTree->GetListOfBranches());
1801  // // If input tree has friend trees
1802  // // add as well the list of friend tree branches
1803  // if (m_inTree->GetListOfFriends()){
1804  // // Get the list of friends
1805  // TList *fList = m_inTree->GetListOfFriends();
1806  // // Loop over friend elements
1807  // for (TObject * feObj : *fList){
1808  // if (feObj){
1809  // // Get corresponding friend tree
1810  // TTree *friendTree = dynamic_cast<TFriendElement*>(feObj)->GetTree();
1811  // // Add list of branches of the friend tree
1812  // fullListOfBranches.push_back(friendTree->GetListOfBranches());
1813  // }
1814  // }
1815  // }
1816 
1817  // for (TObjArray* branches : fullListOfBranches){
1818  // for( Int_t i = 0; i < branches->GetEntriesFast(); ++i ){
1819  // if (!branches->At( i )) continue ;
1820 
1821  // const TString name( branches->At( i )->GetName() );
1822  // if( name.BeginsWith( branchName ) ||
1823  // name.BeginsWith( dynName ) ) {
1824  // auxFound = kTRUE;
1825  // break;
1826  // }
1827  // }
1828  // }
1829  if( auxFound ) {
1830  ::Warning( "xAOD::REvent::initStats",
1831  "Couldn't find interface object/container "
1832  "\"%s\" belonging to branch \"%s\"",
1833  intName.c_str(), branchName.c_str() );
1834  }
1835  continue;
1836  }
1837 
1838  // Get the type of the interface:
1839  const EventFormatElement* el = m_inputEventFormat.get( intName );
1840  ::TClass* cl = ::TClass::GetClass( el->className().c_str() );
1841  if( ( ! cl ) || ( ! cl->IsLoaded() ) ) {
1842  ::Warning( "xAOD::REvent::initStats",
1843  "Couldn't find dictionary for type \"%s\"",
1844  el->className().c_str() );
1845  continue;
1846  }
1847 
1848  // Get the dictionary for the DataVector base class:
1849  static const std::type_info& baseTi = typeid( SG::AuxVectorBase );
1850  static const std::string baseName =
1851  SG::normalizedTypeinfoName( baseTi );
1852  static ::TClass* const baseCl = ::TClass::GetClass( baseName.c_str() );
1853  if( ! baseCl ) {
1854  ::Error( "xAOD::REvent::initStats",
1855  XAOD_MESSAGE( "Couldn't get dictionary for type "
1856  "\"%s\"" ), baseName.c_str() );
1857  return StatusCode::FAILURE;
1858  }
1859 
1860  // The type of the auxiliary store is finally deduced from the
1861  // inheritance of the interface container.
1863  ( cl->InheritsFrom( baseCl ) ? RAuxStore::EStructMode::kContainerStore :
1865 
1866  // Scan the branches using a temporary RAuxStore instance:
1867  static constexpr bool TOP_STORE = true;
1868  RAuxStore temp( branchName, TOP_STORE, mode );
1869  // static constexpr bool PRINT_WARNINGS = false;
1870  RETURN_CHECK( "xAOD::REvent::initStats",
1871  temp.readFrom( *m_inNtupleReader ) );
1872 
1873  // Conveninence variable:
1874  ReadStats& stats = IOStats::instance().stats();
1875 
1876  // Teach the cache about all the branches:
1877  for (SG::auxid_t id : temp.getAuxIDs()) {
1878  stats.branch(branchName, id);
1879  }
1880 
1881  // Increment the number of known branches:
1882  stats.setBranchNum(stats.branchNum() + temp.getAuxIDs().size());
1883  }
1884  // // If it's an interface container:
1885  // else {
1886  // // Try to access the branch:
1887  // const ::TBranch* container =
1888  // m_inTree->GetBranch( branchName.c_str() );
1889  // // If it exists, let's remember it:
1890  // if( container ) {
1891  // IOStats::instance().stats().container( branchName );
1892  // }
1893  // }
1894  }
1895 
1896  // Return gracefully:
1897  return StatusCode::SUCCESS;
1898  }

◆ inputEventFormat()

const EventFormat * xAOD::Experimental::REvent::inputEventFormat ( ) const
inherited

RDS: Only valid for TChains, i.e.

This function makes it possible for the user to investigate the contents of the input file that the object is currently connected to.

RNTuple doesn't (yet) have a way to specify multiple files as TChain does. Get information about the input objects

Notice that this doesn't necessarily mean that all the objects for which metadata is stored, would necessarily be part of the input TTree that this object is connected to.

Returns
The event format object if a file is being read, or a null pointer if no input file is connected at the moment.

Definition at line 1387 of file REvent.cxx.

1387  {
1388 
1389  // If we *are* reading an input file:
1390  if( m_inNtupleReader ) {
1391  return &m_inputEventFormat;
1392  }
1393 
1394  // If not, let's complain:
1395  ::Warning( "xAOD::REvent::inputEventFormat",
1396  "No input file is connected at the moment" );
1397  return 0;
1398  }

◆ isAuxStore()

Bool_t xAOD::Experimental::REvent::isAuxStore ( const THolder holder)
staticprotectedinherited

Function checking if a given object may be an auxiliary store.

This function is used to decide if a given object is an auxiliary store type or not.

Parameters
holderThe holder of the object that should be checked
Returns
kTRUE if the object is an auxiliary store, kFALSE if it is not

Definition at line 3730 of file REvent.cxx.

3730  {
3731 
3732  // The classes whose children are considered auxiliary stores:
3733  static const TClass* const storeClass =
3734  ::TClass::GetClass( typeid( SG::IConstAuxStore ) );
3735  static const TClass* const storeHolderClass =
3736  ::TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
3737 
3738  // Do the check:
3739  return ( holder.getClass()->InheritsFrom( storeClass ) ||
3740  holder.getClass()->InheritsFrom( storeHolderClass ) );
3741  }

◆ isStandalone()

Bool_t xAOD::Experimental::REvent::isStandalone ( const THolder holder)
staticprotectedinherited

Function checking if an object is standalone (not a container)

This function is used to figure out while setting up the reading of the TTree in kBranchAccess mode, what to tell the underlying TAuxStore object, what kind of store it needs to be.

It's done in pretty much the same way in which hasAuxStore(...) decides if the object in question can have an auxiliary store.

Parameters
holderThe holder of the object that should be checked
Returns
kTRUE if the object is a standalone one, kFALSE if it is a container

Definition at line 3753 of file REvent.cxx.

3753  {
3754 
3755  // The classes whose children can have an auxiliary store attached
3756  // to them:
3757  static const TClass* const dvClass =
3758  TClass::GetClass( typeid( SG::AuxVectorBase ) );
3759  static const TClass* const aeClass =
3760  TClass::GetClass( typeid( SG::AuxElement ) );
3761 
3762  // Do the check:
3763  if( holder.getClass()->InheritsFrom( aeClass ) ) {
3764  return kTRUE;
3765  } else if( holder.getClass()->InheritsFrom( dvClass ) ) {
3766  return kFALSE;
3767  }
3768 
3769  // Some logic error happened:
3770  ::Error( "xAOD::REvent::isStandalone",
3771  XAOD_MESSAGE( "Received type (%s) that can't have an "
3772  "auxiliary store" ),
3773  holder.getClass()->GetName() );
3774  return kFALSE;
3775  }

◆ keys()

template<typename T >
void xAOD::TVirtualEvent::keys ( std::vector< std::string > &  vkeys,
bool  metadata = false 
) const
inherited

provide list of all keys associated with provided type.

usage: event->keys( vec_to_fill, metadata )

Parameters
vkeyswill be filled with the list of keys (may be empty)
metadata(default false) look in metadata content if true

◆ keyToString() [1/2]

const std::string * xAOD::Experimental::REvent::keyToString ( SG::sgkey_t  key) const
overrideprotectedinherited

Find the string corresponding to a given key.

Definition at line 441 of file REventProxyDict.cxx.

441  {
442 
443  return &( getName( key ) );
444  }

◆ keyToString() [2/2]

const std::string * xAOD::Experimental::REvent::keyToString ( SG::sgkey_t  key,
CLID clid 
) const
overrideprotectedinherited

Find the string and CLID corresponding to a given key.

Definition at line 446 of file REventProxyDict.cxx.

446  {
447 
448  return &( getName( key ) );
449  }

◆ loadInputObjects()

StatusCode REventClass::loadInputObjects ( )
inline

Function loading all interface objects of the event.

Definition at line 42 of file xAODRNFileReadTest.cxx.

42  {
43  // Get the event format object:
44  const xAOD::EventFormat* ef = this->inputEventFormat();
45  if( ! ef ) {
46  return StatusCode::FAILURE;
47  }
48  // Loop over the objects of the file:
49  for( const auto & ef_itr : *ef ) {
50  // A helper object:
51  const xAOD::EventFormatElement& efe = ef_itr.second;
52  // Skip auxiliary objects:
53  if( efe.branchName().rfind( "Aux." ) ==
54  ( efe.branchName().size() - 4 ) ) {
55  continue;
56  }
57  // And dynamic variables:
58  if( efe.parentName() != "" ) {
59  continue;
60  }
61  // Skip auxiliary stores with non-standard names:
62  ::TClass* cl = ::TClass::GetClass( efe.className().c_str(), kTRUE,
63  kTRUE );
64  if( ! cl ) continue;
65  if( cl->InheritsFrom( "SG::IConstAuxStore" ) ) {
66  continue;
67  }
68  // Get the type of the branch:
69  const std::type_info* ti = cl->GetTypeInfo();
70  if( ! ti ) {
71  ::Warning( "REventClass::loadInputObjects",
72  "Couldn't find std::type_info object for type %s "
73  "(key=%s)", cl->GetName(), efe.branchName().c_str() );
74  continue;
75  }
76  // Check if the branch exists in the file:
77  if( ! this->contains( efe.branchName(), *ti ) ) {
78  continue;
79  }
80  // Try to load the object/container:
81  if( ! this->getInputObject( efe.branchName(), *ti ) ) {
82  Error( "REventClass::loadInputObjects",
83  XAOD_MESSAGE( "Couldn't load object: %s" ),
84  efe.branchName().c_str() );
85  return StatusCode::FAILURE;
86  }
87  }
88  // Return gracefully:
89  return StatusCode::SUCCESS;
90  }

◆ name()

const std::string & xAOD::Experimental::REvent::name ( ) const
overrideprotectedinherited

Get the name of the instance.

Definition at line 463 of file REventProxyDict.cxx.

463  {
464 
465  static const std::string NAME = "xAOD::REvent";
466  return NAME;
467  }

◆ printIOStats()

void xAOD::Experimental::REvent::printIOStats ( ) const
inherited

Function printing the I/O statistics of the current process.

This is a convenience function for printing basic I/O information about the current job.

It can be called at the end of a job to get an overview of what the job did exactly I/O-wise.

Definition at line 278 of file REvent.cxx.

278  {
279 
280  // Simply do this via the xAODCore code:
281  IOStats::instance().stats().Print( "Summary" );
282 
283  return;
284  }

◆ printNameRemap()

void xAOD::Experimental::REvent::printNameRemap ( ) const
inherited

Print the current name re-mapping rules.

This function can be used for debugging, to check what container/object name remapping rules are in place for the current REvent object.

Definition at line 877 of file REvent.cxx.

877  {
878 
879  // Print a header:
880  ::Info( "xAOD::REvent::printNameRemap", "Name remapping rules:" );
881 
882  // In case no remapping rules have been set:
883  if( ! m_nameRemapping.size() ) {
884  ::Info( "xAOD::REvent::printNameRemap", " NONE" );
885  return;
886  }
887 
888  // Otherwise:
889  for( auto itr = m_nameRemapping.begin(); itr != m_nameRemapping.end();
890  ++itr ) {
891  ::Info( "xAOD::REvent::printNameRemap", " \"%s\" -> \"%s\"",
892  itr->second.c_str(), itr->first.c_str() );
893  }
894 
895  // Return gracefully:
896  return;
897  }

◆ proxies()

std::vector< const SG::DataProxy * > xAOD::Experimental::REvent::proxies ( ) const
overrideprotectedinherited

return the list of all current proxies in store

Definition at line 422 of file REventProxyDict.cxx.

422  {
423 
425 
426  std::vector< const SG::DataProxy* > ret;
427  for( const auto& p : m_branches ) {
428  const SG::DataProxy* proxy = p.second.m_proxy.get();
429  if( proxy ) {
430  ret.push_back( proxy );
431  }
432  }
433  return ret;
434  }

◆ proxy() [1/2]

SG::DataProxy * xAOD::Experimental::REvent::proxy ( const CLID id,
const std::string &  key 
) const
overrideprotectedinherited

get proxy with given id and key. Returns 0 to flag failure

Definition at line 236 of file REventProxyDict.cxx.

237  {
238 
239  const SG::sgkey_t sgkey = getHash( key );
240  if( ! sgkey ) {
241  return 0;
242  }
243  // return proxy_exact( sgkey );
244 
245  auto proxy = proxy_exact( sgkey );
246  if ( !proxy ) {
247  ::Warning( "xAOD::REvent::proxy",
248  "Can't find BranchInfo for %s.",
249  key.c_str() );
250 
251  }
252  return proxy;
253  }

◆ proxy() [2/2]

SG::DataProxy * xAOD::Experimental::REvent::proxy ( const void *const  pTransient) const
overrideprotectedinherited

get proxy for a given data object address in memory

Definition at line 208 of file REventProxyDict.cxx.

208  {
209 
210  // Look up the name of this object
211  std::string name = getName( pTransient );
212  if( name.empty() ) {
213  // Apparently the object is not known...
214  return nullptr;
215  }
216 
217  // Get the metadata object for it:
218  const xAOD::EventFormatElement* efe = 0;
219  static const bool QUIET = true;
220  if( m_outputEventFormat ) {
221  efe = m_outputEventFormat->get( name, QUIET );
222  }
223  if( ! efe ) {
224  efe = m_inputEventFormat.get( name, QUIET );
225  }
226  if( ! efe ) {
227  // No metadata found...
228  return nullptr;
229  }
230 
231  // Return the proxy:
232  const BranchInfo* bi = getBranchInfo( efe->hash() );
233  return bi->m_proxy.get();
234  }

◆ proxy_exact()

SG::DataProxy * xAOD::Experimental::REvent::proxy_exact ( SG::sgkey_t  sgkey) const
overrideprotectedinherited

Get proxy given a hashed key+clid.

Definition at line 255 of file REventProxyDict.cxx.

255  {
256 
257  // Get the object describing this branch/object:
258  const BranchInfo* bi = getBranchInfo( sgkey );
259  if( ! bi ) {
260  static SG::SGKeySet missingSGKeys ATLAS_THREAD_SAFE;
261  static mutex_t mutex;
262  guard_t lock(mutex);
263  if( missingSGKeys.emplace( sgkey ).second &&
265  ::Warning( "xAOD::REvent::proxy_exact",
266  "Can't find BranchInfo for %d.",
267  sgkey );
268  }
269  return 0;
270  }
271 
272  // Access its data proxy:
273  SG::DataProxy* proxy = bi->m_proxy.get();
274 
275  // Return the proxy:
276  return proxy;
277  }

◆ readFrom()

StatusCode xAOD::Experimental::REvent::readFrom ( const std::string &  fileName)
inherited

This function takes care of connecting the event object to a new input file.

It reads in the metadata of the input file needed for reading the file.

Parameters
fileNamename of file needed for metadata access

Definition at line 292 of file REvent.cxx.

292  {
293 
294  // If no file was specified, return gracefully:
295  if( fileName.size() == 0 ) return StatusCode::SUCCESS;
296 
297  // For meta data, need to open file as TFile to access the meta data tree
298  std::unique_ptr< TFile > infile( TFile::Open( fileName.c_str(), "READ" ) );
299  if( ! infile.get() ) {
300  ::Error( "xAOD::REvent::readFrom",
301  XAOD_MESSAGE( "Couldn't open file for metadata tree! File name %s"), fileName.c_str());
302  return StatusCode::FAILURE;
303  }
304 
305  // Clear the cached input objects:
306  Object_t::iterator itr = m_inputObjects.begin();
308  for( ; itr != end; ++itr ) {
309  delete itr->second;
310  }
311  m_inputObjects.clear();
312  m_inputMissingObjects.clear();
313  {
315  lock.upgrade();
316  m_branches.clear();
317  }
318 
319  // Clear the cached input meta-objects:
320  itr = m_inputMetaObjects.begin();
321  end = m_inputMetaObjects.end();
322  for( ; itr != end; ++itr ) {
323  delete itr->second;
324  }
325  m_inputMetaObjects.clear();
326 
327  // Reset the internal flags:
328  m_entry = -1;
329 
330  // Make sure we return to the current directory:
331  TDirectoryReset dr;
332 
333  // Look for the metadata tree:
334  m_inMetaTree =
335  dynamic_cast< ::TTree* >( infile->Get( METADATA_TREE_NAME ) );
336  if( ! m_inMetaTree ) {
337  ::Error( "xAOD::REvent::readFrom",
338  XAOD_MESSAGE( "Couldn't find metadata tree on input. Object "
339  "unusable!" ) );
340  return StatusCode::FAILURE;
341  }
342 
343  // Set metadata entry to be read
344  // NB: no reading is done calling LoadTree
345  if ( m_inMetaTree->LoadTree(0) < 0 ){
346  ::Error( "xAOD::REvent::readFrom",
347  XAOD_MESSAGE( "Failed to load entry for metadata tree=%s" ),
348  m_inMetaTree->GetName() );
349  return StatusCode::FAILURE;
350  }
351 
352  // A sanity check:
353  if( m_inMetaTree->GetEntries() != 1 ) {
354  ::Info( "xAOD::REvent::readFrom",
355  "Was expecting a metadata tree with size 1, instead of %i.",
356  static_cast< int >( m_inMetaTree->GetEntries() ) );
357  ::Info( "xAOD::REvent::readFrom",
358  "File most probably produced by hadd..." );
359  }
360 
361  // Make sure that the xAOD::EventFormat dictonary is loaded.
362  // This may not be the case if streamer information reading is turned
363  // off.
364  static const std::string eventFormatTypeName =
365  Utils::getTypeName( typeid( EventFormat ) );
366  ::TClass* cl = ::TClass::GetClass( eventFormatTypeName.c_str() );
367  if( ! cl ) {
368  ::Warning( "xAOD::REvent::readFrom",
369  "Couldn't load the EventFormat dictionary" );
370  }
371 
372  // Check if the EventFormat branch is available:
373  const std::string eventFormatBranchName =
374  Utils::getFirstBranchMatch( m_inMetaTree, "EventFormat");
375  if( ! m_inMetaTree->GetBranch( eventFormatBranchName.c_str() ) ) {
376  // This can happen when the file was produced by an Athena job that
377  // didn't have any input events itself. This means that the file
378  // doesn't actually have any useful metadata.
379  ::Info( "xAOD::REvent::readFrom", "Input file provides no event or "
380  "metadata" );
381  m_inNtupleReader = 0;
382  return StatusCode::SUCCESS;
383  }
384 
385  // Read in the event format object:
386  EventFormat* format = 0; ::TBranch* br = 0;
387  const Int_t status =
388  m_inMetaTree->SetBranchAddress( eventFormatBranchName.c_str(),
389  &format, &br );
390  if( status < 0 ) {
391  ::Error( "xAOD::REvent::readFrom",
392  XAOD_MESSAGE( "Failed to connect to EventFormat object" ) );
393  return StatusCode::FAILURE;
394  }
395 
396  // Read in the object to our private member:
397  br->GetEntry( 0 );
399 
400  // This is a strange place. The object has to be deleted, as it is the
401  // responsibility of the user code to do so. But if I also explicitly
402  // tell the branch to forget about the address of the pointer, then
403  // all hell breaks loose...
404  delete format;
405 
406 
407  // List all the other Metadata trees in the input file
408  // Having several metatrees can happen for augmented files for instance
409  // as one metadata tree per stream is produced
410  std::set<std::string> lOtherMetaTreeNames = {};
411  TList *lKeys = infile->GetListOfKeys();
412 
413  if (lKeys){
414  for (int iKey = 0; iKey < lKeys->GetEntries() ; iKey++){
415  // iterate over keys and add
416  std::string keyName = lKeys->At(iKey)->GetName();
417  // Make sure the key corresponds to a metadata tree but
418  // do not add the current metadata tree in the list of other trees
419  // and do not add the metadata tree handlers to the list
420  if ( (keyName != METADATA_TREE_NAME)
421  && (keyName.find("MetaData") != std::string::npos)
422  && !(keyName.find("MetaDataHdr") != std::string::npos)){
423  // Make sure key corresponds to a tree
424  const char *className = ((::TKey*)lKeys->At(iKey))->GetClassName();
425  static constexpr Bool_t LOAD = kFALSE;
426  static constexpr Bool_t SILENT = kTRUE;
427  ::TClass* cl = ::TClass::GetClass(className, LOAD, SILENT);
428  if ((cl != nullptr) && cl->InheritsFrom(::TTree::Class())){
429  lOtherMetaTreeNames.insert(keyName);
430  }
431  }
432  }
433  }
434  else {
435  ::Info( "xAOD::REvent::readFrom", XAOD_MESSAGE( "no keys found"));
436  }
437 
438  // Loop over the other metadata trees found (if any)
439  for (const std::string & metaTreeName : lOtherMetaTreeNames){
440  TTree *tmpMetaTree = dynamic_cast< ::TTree* >( infile->Get( metaTreeName.c_str() ) );
441 
442  if (!tmpMetaTree){
443  // Skip tree if could not read it
444  ::Warning( "xAOD::REvent::readFrom", "Could not read metadata tree=%s",metaTreeName.c_str());
445  continue;
446  }
447 
448  // Set metadata entry to be read
449  // NB: no reading is done calling LoadTree
450  if ( tmpMetaTree->LoadTree(0) < 0 ){
451  ::Error( "xAOD::REvent::readFrom",
452  XAOD_MESSAGE( "Failed to load entry for metadata tree=%s" ),
453  tmpMetaTree->GetName() );
454  return StatusCode::FAILURE;
455  }
456 
457  // Check if the EventFormat branch is available:
458  const std::string tmpEventFormatBranchName =
459  Utils::getFirstBranchMatch( tmpMetaTree, "EventFormat");
460  if( ! tmpMetaTree->GetBranch( tmpEventFormatBranchName.c_str() ) ) {
461  // skip the additionnal metadata tree
462  ::Warning( "xAOD::REvent::readFrom", "No EventFormat branch found in metadata tree=%s",tmpMetaTree->GetName() );
463  continue ;
464  }
465  // Read in the event format object:
466  EventFormat* tmpFormat = 0; ::TBranch* tmpBr = 0;
467  const Int_t status =
468  tmpMetaTree->SetBranchAddress( tmpEventFormatBranchName.c_str(),
469  &tmpFormat, &tmpBr );
470  if( status < 0 ) {
471  ::Error( "xAOD::REvent::readFrom",
472  XAOD_MESSAGE( "Failed to connect to EventFormat object for metadata tree = %s"), tmpMetaTree->GetName() );
473  return StatusCode::FAILURE;
474  }
475  // Read in the object
476  tmpBr->GetEntry( 0 );
477  // read all objects contained in the event format
478  for (const std::pair<const std::string, xAOD::EventFormatElement> &evtElem : *tmpFormat){
479  // if element is not existing
480  // then add it to the private event format member
481  if (!m_inputEventFormat.exists(evtElem.first)){
482  m_inputEventFormat.add(evtElem.second);
483  }
484  }
485  delete tmpFormat;
486  }
487 
488  // Save RNTuple reader
489 
490  const char* rnTupleName = EVENT_RNTUPLE_NAME;
491  m_inNtupleReader = ROOT::RNTupleReader::Open(rnTupleName, fileName);
492 
493  // m_inNtupleReader = &reader;
494  if ( !m_inNtupleReader ) {
495  ::Error( "xAOD::REvent::readFrom", XAOD_MESSAGE( "inNtupleReader is empty") );
496  return StatusCode::FAILURE;
497  }
498 
499  // m_inNtupleReader->PrintInfo();
500 
501  // Init the statistics collection:
502  RETURN_CHECK( "xAOD::REvent::readFrom", initStats() );
503  // Update the event counter in the statistics object:
505  if( m_inNtupleReader ) {
506  stats.setNEvents( stats.nEvents() + m_inNtupleReader->GetNEntries() );
507  }
508 
509  // Notify the listeners that a new file was opened:
510  const TIncident beginIncident( IncidentType::BeginInputFile );
511  for( TVirtualIncidentListener* listener : m_listeners ) {
512  listener->handle( beginIncident );
513  }
514  // For now implement a very simple scheme in which we claim already
515  // at the start that the entire file was processed. Since we have no way
516  // of ensuring that the user indeed does this. And we can't delay calling
517  // this function, as the user may likely close his/her output file before
518  // closing the last opened input file.
519  const TIncident endIncident( IncidentType::EndInputFile );
520  for( TVirtualIncidentListener* listener : m_listeners ) {
521  listener->handle( endIncident );
522  }
523 
524  // The initialisation was successful:
525  return StatusCode::SUCCESS;
526  }

◆ record()

StatusCode xAOD::Experimental::REvent::record ( void *  obj,
const std::string &  typeName,
const std::string &  key 
)
inherited

Internal function for recording an object into the output.

Definition at line 2139 of file REvent.cxx.

2140  {
2141  // RDS: to be implemented
2142  return StatusCode::SUCCESS;
2143  }

◆ recordMeta() [1/2]

template<typename T >
StatusCode xAOD::Experimental::REvent::recordMeta ( std::unique_ptr< T >  obj,
const std::string &  key,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 1 
)
inherited

Add an object to the output file's metadata, explicitly taking ownership of it.

◆ recordMeta() [2/2]

template<typename T >
StatusCode xAOD::Experimental::REvent::recordMeta ( T *  obj,
const std::string &  key,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 1 
)
inherited

Add an object to the output file's metadata.

◆ recordObject()

SG::DataProxy * xAOD::Experimental::REvent::recordObject ( SG::DataObjectSharedPtr< DataObject >  obj,
const std::string &  key,
bool  allowMods,
bool  returnExisting 
)
overrideprotectedinherited

Record an object in the store.

Definition at line 456 of file REventProxyDict.cxx.

457  {
458 
459  throw std::runtime_error( "xAOD::REvent::recordObject is not "
460  "implemented" );
461  }

◆ registerKey()

void xAOD::Experimental::REvent::registerKey ( SG::sgkey_t  key,
const std::string &  str,
CLID  clid 
)
overrideprotectedinherited

Remember an additional mapping from key to string/CLID.

Definition at line 451 of file REventProxyDict.cxx.

451  {
452 
453  return;
454  }

◆ removeListener()

StatusCode xAOD::Experimental::REvent::removeListener ( TVirtualIncidentListener listener)
inherited

Remove an incident listener object.

This function allows us to remove a listener when for instance a metadata tool is deleted during a job.

Parameters
listenerPointer to the listener that should be removed
Returns
The usual StatusCode types

Definition at line 790 of file REvent.cxx.

790  {
791 
792  // Find the pointer if we can...
794  m_listeners.end(), listener );
795 
796  // If we didn't find it:
797  if( itr == m_listeners.end() ) {
798  ::Error( "xAOD::REvent::removeListener",
799  XAOD_MESSAGE( "Listener %p not known" ),
800  static_cast< void* >( listener ) );
801  return StatusCode::FAILURE;
802  }
803 
804  // Remove it:
805  m_listeners.erase( itr );
806 
807  // Return gracefully:
808  return StatusCode::SUCCESS;
809  }

◆ retrieve() [1/4]

template<typename T >
StatusCode xAOD::Experimental::REvent::retrieve ( const T *&  obj,
const std::string &  key 
)
inherited

Retrieve either an input or an output object from the event.

◆ retrieve() [2/4]

template<typename T >
bool xAOD::TVirtualEvent::retrieve ( const T *&  obj,
const std::string &  key,
bool  silent = false 
)
inherited

Function retrieving an object from the event (constant version)

◆ retrieve() [3/4]

template<typename T >
bool xAOD::TVirtualEvent::retrieve ( const T *&  obj,
sgkey_t  key = DEFAULT_KEY,
bool  silent = false 
)
inherited

Function retrieving an object from the event (constant version)

◆ retrieve() [4/4]

template<typename T >
StatusCode xAOD::Experimental::REvent::retrieve ( T *&  obj,
const std::string &  key 
)
inherited

Retrieve an output object from the event.

◆ retrieveMetaInput()

template<typename T >
StatusCode xAOD::Experimental::REvent::retrieveMetaInput ( const T *&  obj,
const std::string &  key 
)
inherited

Retrieve an input metadata object.

◆ retrieveMetaOutput()

template<typename T >
StatusCode xAOD::Experimental::REvent::retrieveMetaOutput ( const T *&  obj,
const std::string &  key 
)
inherited

Retrieve an output metadata object.

◆ setActive()

void xAOD::Experimental::REvent::setActive ( ) const
inherited

Set this event object as the currently active one.

Setting REvent objects happens automatically when reading a file, but when writing a file from scratch, the code doesn't necessarily know which REvent object a given smart pointer should "belong to".

This function helps the user with setting this up.

Definition at line 704 of file REvent.cxx.

704  {
705 
706  // The active event and current store are thread-local globals:
707  REvent* nc_this ATLAS_THREAD_SAFE = const_cast<REvent*>(this);
708 
709  TActiveEvent::setEvent( static_cast<TVirtualEvent*>( nc_this ) );
710 
711 #ifndef XAOD_STANDALONE
713 #endif // not XAOD_STANDALONE
714 
715  // Return gracefully:
716  return;
717  }

◆ setAuxItemList()

void xAOD::Experimental::REvent::setAuxItemList ( const std::string &  containerKey,
const std::string &  itemList 
)
inherited

Configure which dynamic variables to write out for a given store.

This function receives the rules for selecting which dynamic auxiliary branches should be written for a given container, in the exact same format in which we need to set it in the Athena output ItemList.

Parameters
containerKeyThe name of the auxiliary container in question
itemListThe variable list according to the ... formatting rules

Definition at line 726 of file REvent.cxx.

727  {
728 
729  // Decoded attributes:
730  std::set< std::string > attributes;
731 
732  // Split up the received string using "." as the separator:
733  if( itemList.size() ) {
734  std::stringstream ss( itemList );
735  std::string attr;
736  while( std::getline( ss, attr, '.' ) ) {
737  attributes.insert( attr );
738  }
739  }
740 
741  // Remember the setting:
742  m_auxItemList[ containerKey ] = std::move(attributes);
743 
744  return;
745  }

◆ setAuxStore() [1/2]

StatusCode xAOD::Experimental::REvent::setAuxStore ( RObjectManager mgr,
::Bool_t  metadata = kFALSE 
)
protectedinherited

Function connecting a DV object to its auxiliary store.

Every time a DataVector is read in from the input for a new TTree entry, one needs to re-connect it with its auxiliary store.

This function takes care of this.

Parameters
mgrThe manager object of the DV container
metadataFlag specifying whether we're dealing with a metadata or event data object
Returns
kTRUE if the setup was successful, or kFALSE if it was not

Definition at line 3106 of file REvent.cxx.

3107  {
3108 
3109  // Check if we need to do anything:
3110  if( ( ! hasAuxStore( *mgr.holder() ) ) && ( ! isAuxStore( *mgr.holder() ) ) ) {
3111  return StatusCode::SUCCESS;
3112  }
3113 
3114  // Get the branch name of the object in question:
3115  const std::string key = mgr.fieldName();
3116 
3117  // Select which object container to use:
3118  Object_t& objects = ( metadata ?
3120 
3121 
3122  // Look up the auxiliary object's manager:
3123  TVirtualManager* auxMgr = nullptr;
3124  std::string auxKey;
3125  if( isAuxStore( *mgr.holder() ) ) {
3126  auxMgr = &mgr;
3127  auxKey = key;
3128  } else {
3129  auto itr = objects.find( key + "Aux." );
3130  if( itr == objects.end() ) {
3131  // Apparently there's no auxiliary object for this DV, so let's
3132  // give up:
3133  return StatusCode::SUCCESS;
3134  }
3135  auxMgr = itr->second;
3136  // auxKey = key + "Aux.";
3137  auxKey = key + "Aux:";
3138  }
3139 
3140  if( ! metadata ) {
3141  // Make sure the auxiliary object is up to date:
3142  ::Int_t readBytes = auxMgr->getEntry(m_entry);
3143 
3144  // Check if there is a separate auxiliary object for the dynamic
3145  // variables:
3146  const std::string dynAuxKey = auxKey + "Dynamic";
3147  auto dynAuxMgr = objects.find( dynAuxKey );
3148 
3149  if( ( dynAuxMgr != objects.end() ) &&
3150  ( readBytes || ( m_auxMode == kAthenaAccess ) ||
3151  ( auxMgr == &mgr ) ) ) {
3152 
3153  // Do different things based on the access mode:
3154  if( m_auxMode != kAthenaAccess ) {
3155  // In "normal" access modes just tell the dynamic store object
3156  // to switch to a new event.
3157  dynAuxMgr->second->getEntry();
3158  } else {
3159  // In "Athena mode" this object has already been deleted when
3160  // the main auxiliary store object was switched to the new
3161  // event. So let's re-create it:
3162  if ( metadata ) {
3163  xAOD::TObjectManager& auxMgrRef =
3164  dynamic_cast< xAOD::TObjectManager& >( *auxMgr );
3165  RETURN_CHECK( "xAOD::REvent::setAuxStore", setUpDynamicStore( auxMgrRef, m_inMetaTree ));
3166  }
3167  else {
3168  RObjectManager& auxMgrRef =
3169  dynamic_cast< RObjectManager& >( *auxMgr );
3170  RETURN_CHECK( "xAOD::REvent::setAuxStore", setUpDynamicStore( auxMgrRef, m_inNtupleReader.get() ));
3171  // RETURN_CHECK( "xAOD::REvent::setAuxStore", setUpDynamicStore( auxMgrRef, m_inNtupleReader ));
3172  }
3173  // Now tell the newly created dynamic store object which event
3174  // it should be looking at:
3175  auto dynAuxMgr = objects.find( dynAuxKey );
3176  if( dynAuxMgr == objects.end() ) {
3177  ::Error( "xAOD::REvent::setAuxStore",
3178  XAOD_MESSAGE( "Internal logic error detected" ) );
3179  return StatusCode::FAILURE;
3180  }
3181  dynAuxMgr->second->getEntry();
3182  }
3183  }
3184  }
3185 
3186  // Stop here if we've set up an auxiliary store.
3187  if( auxMgr == &mgr ) {
3188  return StatusCode::SUCCESS;
3189  }
3190 
3191  // Access the auxiliary base class of the object/vector:
3192  SG::AuxVectorBase* vec = 0;
3193  SG::AuxElement* aux = 0;
3194  switch( mgr.holder()->typeKind() ) {
3195  case THolder::DATAVECTOR:
3196  {
3197  void* vvec = mgr.holder()->getAs( typeid( SG::AuxVectorBase ) );
3198  vec = reinterpret_cast< SG::AuxVectorBase* >( vvec );
3199  }
3200  break;
3201  case THolder::AUXELEMENT:
3202  {
3203  void* vaux = mgr.holder()->getAs( typeid( SG::AuxElement ) );
3204  aux = reinterpret_cast< SG::AuxElement* >( vaux );
3205  }
3206  break;
3207  default:
3208  break;
3209  }
3210 
3211  // Check whether index tracking is enabled for the type. If not, then
3212  // we need to fix it...
3213  if( vec && ( ! vec->trackIndices() ) ) {
3214  forceTrackIndices( *vec );
3215  }
3216 
3217  // Check if we were successful:
3218  if( ( ! vec ) && ( ! aux ) ) {
3219  ::Fatal( "xAOD::REvent::setAuxStore",
3220  XAOD_MESSAGE( "Couldn't access class \"%s\" as "
3221  "SG::AuxVectorBase or SG::AuxElement" ),
3222  mgr.holder()->getClass()->GetName() );
3223  }
3224 
3225  // Get the auxiliary store object:
3226  const SG::IConstAuxStore* store = 0;
3227  if( m_auxMode == kBranchAccess ) {
3228  // Get the concrete auxiliary manager:
3229  TAuxManager* amgr = dynamic_cast< TAuxManager* >( auxMgr );
3230  if( ! amgr ) {
3231  ::Fatal( "xAOD::REvent::setAuxStore",
3232  XAOD_MESSAGE( "Auxiliary manager for \"%s\" is not of the "
3233  "right type" ), auxKey.c_str() );
3234  return StatusCode::FAILURE;
3235  }
3236  store = amgr->getConstStore();
3237  // If the store still doesn't know its type, help it now:
3238  if( amgr->getStore()->structMode() == TAuxStore::EStructMode::kUndefinedStore ) {
3239  const TAuxStore::EStructMode mode = ( vec ?
3242  amgr->getStore()->setStructMode( mode );
3243  }
3244  } else if( m_auxMode == kClassAccess || m_auxMode == kAthenaAccess ) {
3245 
3246  // Get the concrete auxiliary manager:
3247  RObjectManager* omgr =
3248  dynamic_cast< RObjectManager* >( auxMgr );
3249  if( ! omgr ) {
3250  ::Fatal( "xAOD::REvent::setAuxStore",
3251  XAOD_MESSAGE( "Auxiliary manager for \"%s\" is not of the "
3252  "right type" ), auxKey.c_str() );
3253  return StatusCode::FAILURE;
3254  }
3255  void* p = omgr->holder()->getAs( typeid( SG::IConstAuxStore ) );
3256  store = reinterpret_cast< const SG::IConstAuxStore* >( p );
3257 
3258  }
3259  if( ! store ) {
3260  ::Fatal( "xAOD::REvent::setAuxStore",
3261  XAOD_MESSAGE( "Logic error detected in the code" ) );
3262  }
3263 
3264  // Connect the two:
3265  if( vec ) {
3266  vec->setStore( store );
3267  } else if( aux ) {
3268  aux->setStore( store );
3269  } else {
3270  ::Fatal( "xAOD::REvent::setAuxStore",
3271  XAOD_MESSAGE( "Logic error detected in the code" ) );
3272  }
3273 
3274  // We succeeded:
3275  return StatusCode::SUCCESS;
3276  }

◆ setAuxStore() [2/2]

StatusCode xAOD::Experimental::REvent::setAuxStore ( TObjectManager mgr)
protectedinherited

Function connecting a DV object to its auxiliary store - using TTree, for metadata only.

For metadata from a file with a TTree implementation, for each new file, one needs to re-connect it with its auxiliary store.

This function takes care of this.

Parameters
mgrThe manager object of the DV container
Returns
kTRUE if the setup was successful, or kFALSE if it was not

Definition at line 3286 of file REvent.cxx.

3286  {
3287 
3288  // Check if we need to do anything:
3289  if( ( ! hasAuxStore( *mgr.holder() ) ) && ( ! isAuxStore( *mgr.holder() ) ) ) {
3290  return StatusCode::SUCCESS;
3291  }
3292 
3293  // Get the branch name of the object in question:
3294  const std::string key = mgr.branch()->GetName();
3295 
3296  // RDS: this should only be called for the metadata store (old: Select which object container to use:)
3298 
3299 
3300  // Look up the auxiliary object's manager:
3301  TVirtualManager* auxMgr = nullptr;
3302  std::string auxKey;
3303  if( isAuxStore( *mgr.holder() ) ) {
3304  auxMgr = &mgr;
3305  auxKey = key;
3306  } else {
3307  auto itr = objects.find( key + "Aux." );
3308  if( itr == objects.end() ) {
3309  // Apparently there's no auxiliary object for this DV, so let's
3310  // give up:
3311  return StatusCode::SUCCESS;
3312  }
3313  auxMgr = itr->second;
3314  auxKey = key + "Aux.";
3315  }
3316 
3317  // if( ! metadata ) {
3318  // // Make sure the auxiliary object is up to date:
3319  // ::Int_t readBytes = auxMgr->getEntry();
3320 
3321  // // Check if there is a separate auxiliary object for the dynamic
3322  // // variables:
3323  // const std::string dynAuxKey = auxKey + "Dynamic";
3324  // auto dynAuxMgr = objects.find( dynAuxKey );
3325 
3326  // if( ( dynAuxMgr != objects.end() ) &&
3327  // ( readBytes || ( m_auxMode == kAthenaAccess ) ||
3328  // ( auxMgr == &mgr ) ) ) {
3329  // // Do different things based on the access mode:
3330  // if( m_auxMode != kAthenaAccess ) {
3331  // // In "normal" access modes just tell the dynamic store object
3332  // // to switch to a new event.
3333  // dynAuxMgr->second->getEntry();
3334  // } else {
3335  // // In "Athena mode" this object has already been deleted when
3336  // // the main auxiliary store object was switched to the new
3337  // // event. So let's re-create it:
3338  // xAOD::TObjectManager& auxMgrRef =
3339  // dynamic_cast< xAOD::TObjectManager& >( *auxMgr );
3340  // RETURN_CHECK( "xAOD::REvent::setAuxStore",
3341  // setUpDynamicStore( auxMgrRef,
3342  // ( metadata ?
3343  // m_inMetaTree :
3344  // m_inTree ) ) );
3345  // // Now tell the newly created dynamic store object which event
3346  // // it should be looking at:
3347  // auto dynAuxMgr = objects.find( dynAuxKey );
3348  // if( dynAuxMgr == objects.end() ) {
3349  // ::Error( "xAOD::REvent::setAuxStore",
3350  // XAOD_MESSAGE( "Internal logic error detected" ) );
3351  // return StatusCode::FAILURE;
3352  // }
3353  // dynAuxMgr->second->getEntry();
3354  // }
3355  // }
3356  // }
3357 
3358  // Stop here if we've set up an auxiliary store.
3359  if( auxMgr == &mgr ) {
3360  return StatusCode::SUCCESS;
3361  }
3362 
3363  // Access the auxiliary base class of the object/vector:
3364  SG::AuxVectorBase* vec = 0;
3365  SG::AuxElement* aux = 0;
3366  switch( mgr.holder()->typeKind() ) {
3367  case THolder::DATAVECTOR:
3368  {
3369  void* vvec = mgr.holder()->getAs( typeid( SG::AuxVectorBase ) );
3370  vec = reinterpret_cast< SG::AuxVectorBase* >( vvec );
3371  }
3372  break;
3373  case THolder::AUXELEMENT:
3374  {
3375  void* vaux = mgr.holder()->getAs( typeid( SG::AuxElement ) );
3376  aux = reinterpret_cast< SG::AuxElement* >( vaux );
3377  }
3378  break;
3379  default:
3380  break;
3381  }
3382 
3383  // Check whether index tracking is enabled for the type. If not, then
3384  // we need to fix it...
3385  if( vec && ( ! vec->trackIndices() ) ) {
3386  forceTrackIndices( *vec );
3387  }
3388 
3389  // Check if we were successful:
3390  if( ( ! vec ) && ( ! aux ) ) {
3391  ::Fatal( "xAOD::REvent::setAuxStore",
3392  XAOD_MESSAGE( "Couldn't access class \"%s\" as "
3393  "SG::AuxVectorBase or SG::AuxElement" ),
3394  mgr.holder()->getClass()->GetName() );
3395  }
3396 
3397  // Get the auxiliary store object:
3398  const SG::IConstAuxStore* store = 0;
3399  if( m_auxMode == kBranchAccess ) {
3400  // Get the concrete auxiliary manager:
3401  TAuxManager* amgr = dynamic_cast< TAuxManager* >( auxMgr );
3402  if( ! amgr ) {
3403  ::Fatal( "xAOD::REvent::setAuxStore",
3404  XAOD_MESSAGE( "Auxiliary manager for \"%s\" is not of the "
3405  "right type" ), auxKey.c_str() );
3406  return StatusCode::FAILURE;
3407  }
3408  store = amgr->getConstStore();
3409  // If the store still doesn't know its type, help it now:
3410  if( amgr->getStore()->structMode() == TAuxStore::EStructMode::kUndefinedStore ) {
3411  const TAuxStore::EStructMode mode = ( vec ?
3414  amgr->getStore()->setStructMode( mode );
3415  }
3416  } else if( m_auxMode == kClassAccess || m_auxMode == kAthenaAccess ) {
3417  // Get the concrete auxiliary manager:
3418  TObjectManager* omgr =
3419  dynamic_cast< TObjectManager* >( auxMgr );
3420  if( ! omgr ) {
3421  ::Fatal( "xAOD::REvent::setAuxStore",
3422  XAOD_MESSAGE( "Auxiliary manager for \"%s\" is not of the "
3423  "right type" ), auxKey.c_str() );
3424  return StatusCode::FAILURE;
3425  }
3426  void* p = omgr->holder()->getAs( typeid( SG::IConstAuxStore ) );
3427  store = reinterpret_cast< const SG::IConstAuxStore* >( p );
3428  }
3429  if( ! store ) {
3430  ::Fatal( "xAOD::REvent::setAuxStore",
3431  XAOD_MESSAGE( "Logic error detected in the code" ) );
3432  }
3433 
3434  // Connect the two:
3435  if( vec ) {
3436  vec->setStore( store );
3437  } else if( aux ) {
3438  aux->setStore( store );
3439  } else {
3440  ::Fatal( "xAOD::REvent::setAuxStore",
3441  XAOD_MESSAGE( "Logic error detected in the code" ) );
3442  }
3443 
3444  // We succeeded:
3445  return StatusCode::SUCCESS;
3446  }

◆ setPrintEventProxyWarnings()

void xAOD::Experimental::REvent::setPrintEventProxyWarnings ( bool  print)
inherited

Function to silence warnings associated with broken element links.

These appear harmless so long as you don't actually try to access the links (which will cause other errors).

Definition at line 3813 of file REvent.cxx.

3813  {
3815  }

◆ setUpDynamicStore() [1/2]

StatusCode xAOD::Experimental::REvent::setUpDynamicStore ( RObjectManager mgr,
ROOT::RNTupleReader *  ntupleReader 
)
protectedinherited

event uses RNTupleReader:

This function is used by connectBranch(...) to set up auxiliary store type objects correctly for accessing dynamic variables from the input file.

Parameters
mgrThe object manager of the auxiliary store object
ntupleReaderThe ntupleReader to read dynamic variables from
Returns
The usual StatusCode types

RDS: for RAuxStore changing ( 0 ) to ( 0, 0 ) - for entry, all. Not sure if this is correct?

Definition at line 2937 of file REvent.cxx.

2937  {
2938 
2939  // Check if we can call setName(...) on the object:
2940  ::TMethodCall setNameCall;
2941  // Don't use this code in Athena access mode. And just accept that access
2942  // monitoring is disabled in this case...
2943  if( m_auxMode != kAthenaAccess ) {
2944  setNameCall.InitWithPrototype( mgr.holder()->getClass(),
2945  "setName", "const char*" );
2946  if( setNameCall.IsValid() ) {
2947  // Yes, there is such a function. Let's call it with the branch
2948  // name:
2949  const ::TString params =
2950  ::TString::Format( "\"%s\"", mgr.fieldName().c_str() );
2951  const char* charParams = params.Data();
2952  setNameCall.Execute( mgr.holder()->get(), charParams );
2953  } else {
2954  // This is weird. What sort of auxiliary container is this? :-/
2955  ::Warning( "xAOD::REvent::setUpDynamicStore",
2956  "Couldn't find setName(...) function for container %s "
2957  " (type: %s)",
2958  mgr.fieldName().c_str(),
2959  mgr.holder()->getClass()->GetName() );
2960  }
2961  }
2962 
2963  // Check if we can switch out the internal store of this object:
2964  static const TClass* const holderClass =
2965  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
2966  if( ! mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
2967  // Nope... So let's just end the journey here.
2968  return StatusCode::SUCCESS;
2969  }
2970 
2971  // Try to get the object as an IAuxStoreHolder:
2972  SG::IAuxStoreHolder* storeHolder =
2973  reinterpret_cast< SG::IAuxStoreHolder* >(
2974  mgr.holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
2975  if( ! storeHolder ) {
2976  ::Fatal( "xAOD::REvent::setUpDynamicStore",
2977  XAOD_MESSAGE( "There's a logic error in the code" ) );
2978  return StatusCode::FAILURE;
2979  }
2980 
2981  // Create a RAuxStore instance that will read the dynamic variables
2982  // of this container. Notice that the RAuxManager doesn't own the
2983  // RAuxStore object. It will be owned by the SG::IAuxStoreHolder
2984  // object.
2985  RAuxStore* store =
2986  new RAuxStore( mgr.fieldName(), kFALSE,
2987  ( storeHolder->getStoreType() ==
2991  // This object is used to read data from the input, it needs to be
2992  // locked:
2993  store->lock();
2994  RAuxManager* amgr = new RAuxManager( store, m_entry, kFALSE );
2995  m_inputObjects[ mgr.fieldName() +
2996  "Dynamic" ] = amgr;
2997  RETURN_CHECK( "xAOD::REvent::setUpDynamicStore", store->readFrom( *ntupleReader ) );
2998  // Tell the auxiliary store which entry to use. This is essential for
2999  // metadata objects, and non-important for event data objects, which will
3000  // get a possibly different entry loaded in setAuxStore(...).
3001 
3003  RETURN_CHECK( "xAOD::REvent::setUpDynamicStore", store->getEntry( 0, 0 ));
3004 
3005  // Give this object to the store holder:
3006  storeHolder->setStore( store );
3007 
3008  // Return gracefully:
3009  return StatusCode::SUCCESS;
3010 
3011  }

◆ setUpDynamicStore() [2/2]

StatusCode xAOD::Experimental::REvent::setUpDynamicStore ( TObjectManager mgr,
::TTree *  tree 
)
protectedinherited

Function adding dynamic variable reading capabilities to an auxiliary store object metadata still uses TTree:

This function is used by connectMetaBranch(...) to set up auxiliary store type objects correctly for accessing dynamic variables from the input file.

Parameters
mgrThe object manager of the auxiliary store object
treeThe tree to read dynamic variables from
Returns
The usual StatusCode types

Definition at line 3022 of file REvent.cxx.

3022  {
3023 
3024  // Check if we can call setName(...) on the object:
3025  ::TMethodCall setNameCall;
3026  // Don't use this code in Athena access mode. And just accept that access
3027  // monitoring is disabled in this case...
3028  if( m_auxMode != kAthenaAccess ) {
3029  setNameCall.InitWithPrototype( mgr.holder()->getClass(),
3030  "setName", "const char*" );
3031  if( setNameCall.IsValid() ) {
3032  // Yes, there is such a function. Let's call it with the branch
3033  // name:
3034  const ::TString params =
3035  ::TString::Format( "\"%s\"", mgr.branch()->GetName() );
3036  const char* charParams = params.Data();
3037  setNameCall.Execute( mgr.holder()->get(), charParams );
3038  } else {
3039  // This is weird. What sort of auxiliary container is this? :-/
3040  ::Warning( "xAOD::REvent::setUpDynamicStore",
3041  "Couldn't find setName(...) function for container %s "
3042  " (type: %s)",
3043  mgr.branch()->GetName(),
3044  mgr.holder()->getClass()->GetName() );
3045  }
3046  }
3047 
3048  // Check if we can switch out the internal store of this object:
3049  static const TClass* const holderClass =
3050  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
3051  if( ! mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
3052  // Nope... So let's just end the journey here.
3053  return StatusCode::SUCCESS;
3054  }
3055 
3056  // Try to get the object as an IAuxStoreHolder:
3057  SG::IAuxStoreHolder* storeHolder =
3058  reinterpret_cast< SG::IAuxStoreHolder* >(
3059  mgr.holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
3060  if( ! storeHolder ) {
3061  ::Fatal( "xAOD::REvent::setUpDynamicStore",
3062  XAOD_MESSAGE( "There's a logic error in the code" ) );
3063  return StatusCode::FAILURE;
3064  }
3065 
3066  // Create a TAuxStore instance that will read the dynamic variables
3067  // of this container. Notice that the TAuxManager doesn't own the
3068  // TAuxStore object. It will be owned by the SG::IAuxStoreHolder
3069  // object.
3070  TAuxStore* store =
3071  new TAuxStore( mgr.branch()->GetName(), kFALSE,
3072  ( storeHolder->getStoreType() ==
3076  // This object is used to read data from the input, it needs to be
3077  // locked:
3078  store->lock();
3079  TAuxManager* amgr = new TAuxManager( store, kFALSE );
3080  m_inputObjects[ std::string( mgr.branch()->GetName() ) +
3081  "Dynamic" ] = amgr;
3082  RETURN_CHECK( "xAOD::REvent::setUpDynamicStore",
3083  store->readFrom( *tree ) );
3084  // Tell the auxiliary store which entry to use. This is essential for
3085  // metadata objects, and non-important for event data objects, which will
3086  // get a possibly different entry loaded in setAuxStore(...).
3087  store->getEntry( 0 );
3088 
3089  // Give this object to the store holder:
3090  storeHolder->setStore( store );
3091 
3092  // Return gracefully:
3093  return StatusCode::SUCCESS;
3094  }

◆ stringToKey()

SG::sgkey_t xAOD::Experimental::REvent::stringToKey ( const std::string &  str,
CLID  clid 
)
overrideprotectedinherited

Find the string corresponding to a given key.

Definition at line 436 of file REventProxyDict.cxx.

436  {
437 
438  return getHash( str );
439  }

◆ transientContains() [1/2]

template<typename T >
::Bool_t xAOD::Experimental::REvent::transientContains ( const std::string &  key) const
inherited

Function checking if an object is already in memory.

◆ transientContains() [2/2]

Bool_t xAOD::Experimental::REvent::transientContains ( const std::string &  key,
const std::type_info &  ti,
::Bool_t  metadata = kFALSE 
) const
protectedinherited

Internal function checking if an object is already in memory.

Internal function checking if an object of a given type, with a given key is held in memory by the event object.

It's this function doing the heavy lifting for the public template function.

Parameters
keyThe key/branch name of the object
tiThe type description of the object
metadataFlag deciding whether we are looking for a metadata object or not
Returns
kTRUE if such a modifiable object is held by the event object at the moment, kFALSE otherwise

Definition at line 3806 of file REvent.cxx.

3808  {
3809 
3810  return getOutputObject( key, ti, metadata );
3811  }

◆ transientContainsMeta()

template<typename T >
::Bool_t xAOD::Experimental::REvent::transientContainsMeta ( const std::string &  key) const
inherited

Function checking if a meta-object is already in memory.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

SG::SGKeyMap< BranchInfo > m_branches xAOD::Experimental::REvent::ATLAS_THREAD_SAFE
mutableprotectedinherited

Map from hashed sgkey to BranchInfo.

Definition at line 535 of file REvent.h.

◆ CACHE_SIZE

const ::Int_t xAOD::Experimental::REvent::CACHE_SIZE = -1
staticprotectedinherited

Size of a possible TTreeCache (30 MB)

Definition at line 463 of file REvent.h.

◆ DEFAULT_KEY

constexpr sgkey_t xAOD::TVirtualEvent::DEFAULT_KEY = ~static_cast<sgkey_t>(0)
staticconstexprinherited

Key for retrieving the "default" object of a given type.

Definition at line 41 of file TVirtualEvent.h.

◆ EVENT_RNTUPLE_NAME

const char *const xAOD::Experimental::REvent::EVENT_RNTUPLE_NAME = "EventData"
staticprotectedinherited

Name of the event tree.

Definition at line 465 of file REvent.h.

◆ KEY_MASK

constexpr sgkey_t xAOD::TVirtualEvent::KEY_MASK = DEFAULT_KEY >> 2
staticconstexprinherited

Mask for the keys, used mostly internally.

Definition at line 43 of file TVirtualEvent.h.

◆ m_auxItemList

std::unordered_map< std::string, std::set< std::string > > xAOD::Experimental::REvent::m_auxItemList
protectedinherited

Rules for selecting which auxiliary branches to write.

Definition at line 507 of file REvent.h.

◆ m_auxMode

EAuxMode xAOD::Experimental::REvent::m_auxMode
protectedinherited

The auxiliary access mode.

Definition at line 470 of file REvent.h.

◆ m_branchesMutex

upgrade_mutex_t xAOD::Experimental::REvent::m_branchesMutex
mutableprotectedinherited

Definition at line 532 of file REvent.h.

◆ m_entry

::Long64_t xAOD::Experimental::REvent::m_entry
protectedinherited

The entry to look at from the input tree.

Definition at line 482 of file REvent.h.

◆ m_inMetaTree

::TTree* xAOD::Experimental::REvent::m_inMetaTree
protectedinherited

Pointer to the metadata tree in the input file.

Definition at line 476 of file REvent.h.

◆ m_inMetaTreeIsTTree

::Bool_t xAOD::Experimental::REvent::m_inMetaTreeIsTTree
protectedinherited

Boolean indicating the technology of the metadata tree, i.e. TTree of RNTuple.

Definition at line 479 of file REvent.h.

◆ m_inNtupleReader

std::unique_ptr<ROOT::RNTupleReader> xAOD::Experimental::REvent::m_inNtupleReader
protectedinherited

The main event reader: RNTupleReader.

Definition at line 473 of file REvent.h.

◆ m_inputEventFormat

EventFormat xAOD::Experimental::REvent::m_inputEventFormat
protectedinherited

Format of the current input file.

Definition at line 502 of file REvent.h.

◆ m_inputMetaObjects

Object_t xAOD::Experimental::REvent::m_inputMetaObjects
protectedinherited

Collection of all the managed input meta-objects.

Definition at line 497 of file REvent.h.

◆ m_inputMissingObjects

std::set< std::string > xAOD::Experimental::REvent::m_inputMissingObjects
protectedinherited

Objects that have been asked for, but were found to be missing in the current input.

Definition at line 492 of file REvent.h.

◆ m_inputObjects

Object_t xAOD::Experimental::REvent::m_inputObjects
protectedinherited

Collection of all the managed input objects.

Definition at line 488 of file REvent.h.

◆ m_listeners

Listener_t xAOD::Experimental::REvent::m_listeners
protectedinherited

Listeners who should be notified when certain incidents happen.

Definition at line 510 of file REvent.h.

◆ m_nameRemapping

std::unordered_map< std::string, std::string > xAOD::Experimental::REvent::m_nameRemapping
protectedinherited

Container name re-mapping rules.

Definition at line 513 of file REvent.h.

◆ m_outputEventFormat

EventFormat* xAOD::Experimental::REvent::m_outputEventFormat
protectedinherited

Format of the current output file.

Definition at line 504 of file REvent.h.

◆ m_outputMetaObjects

Object_t xAOD::Experimental::REvent::m_outputMetaObjects
protectedinherited

Collection of all the managed output meta-objects.

Definition at line 499 of file REvent.h.

◆ m_outputObjects

Object_t xAOD::Experimental::REvent::m_outputObjects
protectedinherited

Collection of all the managed output object.

Definition at line 494 of file REvent.h.

◆ m_outTree

::TTree* xAOD::Experimental::REvent::m_outTree
protectedinherited

The tree that we are writing to.

Definition at line 485 of file REvent.h.

◆ m_printEventProxyWarnings

Bool_t xAOD::Experimental::REvent::m_printEventProxyWarnings = true
protectedinherited

Option to silence common warnings that seem to be harmless.

Definition at line 516 of file REvent.h.

◆ METADATA_TREE_NAME

const char *const xAOD::Experimental::REvent::METADATA_TREE_NAME = "MetaData"
staticprotectedinherited

Name of the metadata tree.

Definition at line 467 of file REvent.h.


The documentation for this class was generated from the following file:
xAOD::Experimental::REvent::m_inputMissingObjects
std::set< std::string > m_inputMissingObjects
Objects that have been asked for, but were found to be missing in the current input.
Definition: REvent.h:492
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::Experimental::REvent::transientContains
::Bool_t transientContains(const std::string &key) const
Function checking if an object is already in memory.
xAOD::EventFormat_v1::end
const_iterator end() const
STL-like function for getting the end of the container.
Definition: EventFormat_v1.cxx:163
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
SGTest::store
TestStore store
Definition: TestStore.cxx:23
xAOD::Experimental::REvent::kBranchAccess
@ kBranchAccess
Access auxiliary data branch-by-branch.
Definition: REvent.h:119
common.sgkey
def sgkey(tool)
Definition: common.py:1027
xAOD::Experimental::REvent::m_outputObjects
Object_t m_outputObjects
Collection of all the managed output object.
Definition: REvent.h:494
xAOD::EventFormat_v1::get
const EventFormatElement * get(const std::string &key, bool quiet=false) const
Get the description of a given branch.
Definition: EventFormat_v1.cxx:91
xAOD::THolder::AUXELEMENT
@ AUXELEMENT
A type inheriting from SG::AuxElement.
Definition: THolder.h:106
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::Experimental::REvent
Tool for accessing xAOD files outside of Athena, version RNTuple.
Definition: REvent.h:105
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::IAuxStoreHolder::getStoreType
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
xAOD::Experimental::REvent::contains
::Bool_t contains(const std::string &key)
Function checking if an object is available from the store.
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
run.infile
string infile
Definition: run.py:13
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:64
vtune_athena.format
format
Definition: vtune_athena.py:14
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
xAOD::Experimental::REvent::m_branchesMutex
upgrade_mutex_t m_branchesMutex
Definition: REvent.h:532
xAOD::IOStats::stats
ReadStats & stats()
Access the object belonging to the current thread.
Definition: IOStats.cxx:17
xAOD::Experimental::REvent::Object_t
std::unordered_map< std::string, TVirtualManager * > Object_t
Definition of the internal data structure type.
Definition: REvent.h:458
L1CaloPhase1Monitoring.standalone
standalone
Definition: L1CaloPhase1Monitoring.py:139
CP::OutOfValidityAction::SILENT
@ SILENT
don't print anything and return success
xAOD::Experimental::REvent::getOutputObject
void * getOutputObject(SG::sgkey_t key, const std::type_info &ti) override
This function is used by the TVirtualEvent interface to access an output object with a given hashed k...
Definition: REvent.cxx:1707
xAOD::TActiveEvent::setEvent
static void setEvent(TVirtualEvent *ptr)
Set the active event pointer.
Definition: TActiveEvent.cxx:21
xAOD::Experimental::REvent::getBranchInfo
const BranchInfo * getBranchInfo(SG::sgkey_t sgkey) const
Get the object describing one object/branch.
Definition: REventProxyDict.cxx:279
SG::normalizedTypeinfoName
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
Definition: normalizedTypeinfoName.cxx:120
index
Definition: index.py:1
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:483
xAOD::THolder::DATAVECTOR
@ DATAVECTOR
A DataVector container.
Definition: THolder.h:105
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:149
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::ReadStats::Print
void Print(::Option_t *option="") const
Print information about the collected statistics.
xAOD::details::AuxStoreBase::EStructMode
EStructMode
"Structural" modes of the object
Definition: AuxStoreBase.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:407
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
SG::TransientAddress
Definition: TransientAddress.h:32
SG::CurrentEventStore::setStore
static IProxyDict * setStore(IProxyDict *store)
Set the current store.
Definition: CurrentEventStore.cxx:36
xAOD::TActiveStore::store
static TStore * store()
Access the currently active TStore object.
Definition: TActiveStore.cxx:16
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:157
xAOD::EventFormatElement::parentName
const std::string & parentName() const
Get the name of the parent auxiliary object.
Definition: EventFormatElement.cxx:42
xAOD::EventFormatElement
Class describing one branch of the ROOT file.
Definition: EventFormatElement.h:39
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:111
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
xAOD::EventFormatElement::branchName
const std::string & branchName() const
Get the branch/key name.
Definition: EventFormatElement.cxx:30
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
xAOD::details::AuxStoreBase::EStructMode::kObjectStore
@ kObjectStore
The object describes a single object.
xAOD::details::AuxStoreBase::EStructMode::kContainerStore
@ kContainerStore
The object describes an entire container.
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
xAOD::EventFormatElement::hash
sgkey_t hash() const
Get the hash belonging to this branch/key.
Definition: EventFormatElement.cxx:48
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
xAOD::ReadStats::nextEvent
void nextEvent()
Function incrementing the processed event counter.
xAOD::Experimental::REvent::METADATA_TREE_NAME
static const char *const METADATA_TREE_NAME
Name of the metadata tree.
Definition: REvent.h:467
xAOD::Experimental::REvent::getEventFormatElement
const xAOD::EventFormatElement * getEventFormatElement(SG::sgkey_t sgkey) const
Get the metadata object for a given "SG key".
Definition: REventProxyDict.cxx:362
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
xAOD::Experimental::REvent::m_nameRemapping
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
Definition: REvent.h:513
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
xAOD::EventFormat_v1::begin
const_iterator begin() const
STL-like function for getting the beginning of the container.
Definition: EventFormat_v1.cxx:158
xAOD::Experimental::REvent::connectMetaBranch
StatusCode connectMetaBranch(const std::string &key, ::Bool_t silent=kFALSE)
Function setting up access to a branch in the metadata tree.
Definition: REvent.cxx:2583
xAOD::Experimental::REvent::getInputObject
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent=false) override
Function for retrieving an input object in a non-template way.
Definition: REvent.cxx:1731
xAOD::Experimental::REvent::hasAuxStore
::Bool_t hasAuxStore(const THolder &holder)
RDS: for the three following methods, moving to directly take THolder rather than have one for TObjec...
Definition: REvent.cxx:3709
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:353
xAOD::Experimental::REvent::kAthenaAccess
@ kAthenaAccess
Access containers/objects like Athena does.
Definition: REvent.h:121
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:241
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:56
vertexingJO_ITK_init.itemList
list itemList
Definition: vertexingJO_ITK_init.py:95
xAOD::Experimental::REvent::m_inputObjects
Object_t m_inputObjects
Collection of all the managed input objects.
Definition: REvent.h:488
xAOD::Experimental::REvent::isStandalone
::Bool_t isStandalone(const THolder &holder)
Function checking if an object is standalone (not a container)
Definition: REvent.cxx:3753
CalibDbCompareRT.dummy
dummy
Definition: CalibDbCompareRT.py:59
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
xAOD::Experimental::REvent::getHash
SG::sgkey_t getHash(const std::string &key) const override
Function returning the hash describing an object name.
Definition: REvent.cxx:1433
xAOD::EventFormatElement::className
const std::string & className() const
Get the class name of this branch/key.
Definition: EventFormatElement.cxx:36
xAOD::ReadStats::setBranchNum
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
Preparation.mode
mode
Definition: Preparation.py:107
xAOD::Experimental::REvent::kUndefinedAccess
@ kUndefinedAccess
Undefined, to be selected by the object.
Definition: REvent.h:122
xAOD::Experimental::REvent::m_outTree
::TTree * m_outTree
The tree that we are writing to.
Definition: REvent.h:485
xAOD::Experimental::REvent::connectBranch
StatusCode connectBranch(const std::string &key, ::Bool_t silent=kFALSE)
Function setting up access to a particular branch.
Definition: REvent.cxx:2417
plotmaker.keyName
keyName
Definition: plotmaker.py:145
xAOD::Experimental::REvent::setAuxStore
StatusCode setAuxStore(RObjectManager &mgr, ::Bool_t metadata=kFALSE)
Function connecting a DV object to its auxiliary store.
Definition: REvent.cxx:3106
xAOD::Experimental::REvent::m_inNtupleReader
std::unique_ptr< ROOT::RNTupleReader > m_inNtupleReader
The main event reader: RNTupleReader.
Definition: REvent.h:473
xAOD::IOStats::instance
static IOStats & instance()
Singleton object accessor.
Definition: IOStats.cxx:11
xAOD::Experimental::REvent::m_inputEventFormat
EventFormat m_inputEventFormat
Format of the current input file.
Definition: REvent.h:502
xAOD::Experimental::REvent::setActive
void setActive() const
Set this event object as the currently active one.
Definition: REvent.cxx:704
xAOD::Experimental::REvent::connectMetaAux
StatusCode connectMetaAux(const std::string &prefix, ::Bool_t standalone)
Function setting up access to a set of auxiliary branches for a metadata object.
Definition: REvent.cxx:2823
xAOD::Experimental::REvent::m_listeners
Listener_t m_listeners
Listeners who should be notified when certain incidents happen.
Definition: REvent.h:510
SG::IAuxStoreHolder::setStore
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
xAOD::TVirtualEvent::keys
void keys(std::vector< std::string > &vkeys, bool metadata=false) const
provide list of all keys associated with provided type.
xAOD::Experimental::REvent::m_auxMode
EAuxMode m_auxMode
The auxiliary access mode.
Definition: REvent.h:470
SG::SGKeySet
std::unordered_set< sgkey_t > SGKeySet
A set of sgkey_t values.
Definition: CxxUtils/CxxUtils/sgkey_t.h:97
xAOD::Experimental::REvent::REvent
REvent(EAuxMode mode=kUndefinedAccess)
Default constructor.
Definition: REvent.cxx:137
xAOD::EventFormat_v1
Event format metadata for xAOD files.
Definition: EventFormat_v1.h:38
xAOD::Experimental::REvent::setUpDynamicStore
StatusCode setUpDynamicStore(TObjectManager &mgr, ::TTree *tree)
Function adding dynamic variable reading capabilities to an auxiliary store object metadata still use...
Definition: REvent.cxx:3022
xAOD::Experimental::REvent::proxy_exact
SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
Definition: REventProxyDict.cxx:255
xAOD::ReadStats::readContainer
void readContainer(const std::string &name)
Function incrementing the read counter on a specific container.
MakeNewFileFromOldAndSubstitution.newName
dictionary newName
Definition: ICHEP2016/MakeNewFileFromOldAndSubstitution.py:95
xAODPrivate::RLoader
Definition: REventProxyDict.cxx:151
xAOD::TObjectManager
Manager for EDM objects created by ROOT.
Definition: TObjectManager.h:29
xAOD::Experimental::REvent::ATLAS_THREAD_SAFE
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
Map from hashed sgkey to BranchInfo.
Definition: REvent.h:535
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
xAOD::Experimental::REvent::m_entry
::Long64_t m_entry
The entry to look at from the input tree.
Definition: REvent.h:482
DeMoScan.index
string index
Definition: DeMoScan.py:362
python.trfDecorators.silent
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
Definition: trfDecorators.py:24
xAOD::Experimental::REvent::m_auxItemList
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
Rules for selecting which auxiliary branches to write.
Definition: REvent.h:507
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
xAOD::Experimental::REvent::m_printEventProxyWarnings
Bool_t m_printEventProxyWarnings
Option to silence common warnings that seem to be harmless.
Definition: REvent.h:516
xAOD::Utils::getFirstBranchMatch
std::string getFirstBranchMatch(TTree *tree, const std::string &pre)
This function is used to search for a branch in a TTree that contains a given substring.
Definition: Control/xAODRootAccess/Root/Utils.cxx:393
xAOD::EventFormat
EventFormat_v1 EventFormat
Definition of the current event format version.
Definition: EventFormat.h:16
SG::TransientAddress::setSGKey
void setSGKey(sgkey_t sgkey)
check if it is a transient ID (primary or symLinked):
Definition: TransientAddress.h:238
xAOD::Experimental::REvent::m_inMetaTreeIsTTree
::Bool_t m_inMetaTreeIsTTree
Boolean indicating the technology of the metadata tree, i.e. TTree of RNTuple.
Definition: REvent.h:479
xAOD::Experimental::REvent::EVENT_RNTUPLE_NAME
static const char *const EVENT_RNTUPLE_NAME
Name of the event tree.
Definition: REvent.h:465
xAOD::Experimental::REvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: REvent.h:120
xAOD::Experimental::REvent::isAuxStore
::Bool_t isAuxStore(const THolder &holder)
Function checking if a given object may be an auxiliary store.
Definition: REvent.cxx:3730
xAOD::details::AuxStoreBase::EStructMode::kUndefinedStore
@ kUndefinedStore
The structure mode is not defined.
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
str
Definition: BTagTrackIpAccessor.cxx:11
merge.status
status
Definition: merge.py:16
xAOD::EventFormat_v1::const_iterator
KeyedData_t::const_iterator const_iterator
Iterator for looping over the elements of the object.
Definition: EventFormat_v1.h:67
xAOD::Experimental::REvent::initStats
StatusCode initStats()
Function to initialise the statistics for all Tree content.
Definition: REvent.cxx:1754
xAOD::Experimental::REvent::inputEventFormat
const EventFormat * inputEventFormat() const
RDS: Only valid for TChains, i.e.
Definition: REvent.cxx:1387
jobOptions.fileName
fileName
Definition: jobOptions.SuperChic_ALP2.py:39
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
xAOD::EventFormat_v1::add
void add(const EventFormatElement &element, bool updatePersistent=true)
Add the description of a new branch.
Definition: EventFormat_v1.cxx:43
xAOD::Experimental::REvent::m_outputEventFormat
EventFormat * m_outputEventFormat
Format of the current output file.
Definition: REvent.h:504
xAOD::Experimental::REvent::m_inputMetaObjects
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
Definition: REvent.h:497
xAOD::Experimental::REvent::upgrading_lock_t
AthContainers_detail::upgrading_lock< upgrade_mutex_t > upgrading_lock_t
Definition: REvent.h:531
xAOD::ReadStats
Class describing the access statistics of a collection of branches.
Definition: ReadStats.h:123
SG::IConstAuxStore
Interface for const operations on an auxiliary store.
Definition: IConstAuxStore.h:64
xAOD::Experimental::REvent::getName
const std::string & getName(const void *obj) const override
Function returning the key describing a known object.
Definition: REvent.cxx:1468
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::DataProxy
Definition: DataProxy.h:45
SG::IAuxStoreHolder::AST_ObjectStore
@ AST_ObjectStore
The store describes a single object.
Definition: IAuxStoreHolder.h:67
SG::IAuxStoreHolder
Interface for objects taking part in direct ROOT I/O.
Definition: IAuxStoreHolder.h:36
xAOD::Utils::hash
SG::sgkey_t hash(const std::string &name)
This function provides a hashed version of the key (branch) names used in the xAOD file,...
Definition: Control/xAODRootAccess/Root/Utils.cxx:125
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:25
xAOD::Experimental::REvent::name
const std::string & name() const override
Get the name of the instance.
Definition: REventProxyDict.cxx:463
LArL1Calo_ComputeHVCorr.className
className
Definition: LArL1Calo_ComputeHVCorr.py:135
python.TransformConfig.attributes
def attributes(self)
Definition: TransformConfig.py:384
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7
xAOD::Experimental::REvent::m_inMetaTree
::TTree * m_inMetaTree
Pointer to the metadata tree in the input file.
Definition: REvent.h:476
xAOD::Experimental::REvent::m_outputMetaObjects
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
Definition: REvent.h:499
xAOD::EventFormat_v1::exists
bool exists(const std::string &key) const
Check if a description exists about a given branch.
Definition: EventFormat_v1.cxx:65
xAOD::Experimental::REvent::proxy
SG::DataProxy * proxy(const void *const pTransient) const override
get proxy for a given data object address in memory
Definition: REventProxyDict.cxx:208
xAOD::Experimental::REvent::connectAux
StatusCode connectAux(const std::string &prefix, ::Bool_t standalone)
Function setting up access to a set of auxiliary branches.
Definition: REvent.cxx:2697
xAODPrivate::RLoader::setProxy
void setProxy(SG::DataProxy &proxy)
Definition: REventProxyDict.cxx:165
PlotCalibFromCool.br
br
Definition: PlotCalibFromCool.py:355
SG::IAuxStoreHolder::AST_ContainerStore
@ AST_ContainerStore
The store describes a container.
Definition: IAuxStoreHolder.h:68
drawFromPickle.view
view
Definition: drawFromPickle.py:294
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
xAOD::Experimental::REvent::stringToKey
SG::sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the string corresponding to a given key.
Definition: REventProxyDict.cxx:436