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
xAOD::TPyEvent Class Reference

Python interface to xAOD::TEvent. More...

#include <TPyEvent.h>

Inheritance diagram for xAOD::TPyEvent:
Collaboration diagram for xAOD::TPyEvent:

Public Types

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

Public Member Functions

 TPyEvent (EAuxMode mode=kUndefinedAccess)
 Constructor with an access mode - only that one is used from the python TPyEvent. More...
 
::Bool_t contains (const std::string &key, const std::string &type)
 Function checking if an object is available from the store. More...
 
::Bool_t transientContains (const std::string &key, const std::string &type) const
 Function checking if an object is already in memory. More...
 
StatusCode record (int dummy, void *obj, const std::string &key, const std::string &type, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
 Add an output object to 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...
 
 DeclareInterfaceID (IProxyDict, 2, 0)
 
 DeclareInterfaceID (INamedInterface, 2, 0)
 
virtual void boundHandle (IResetable *handle)
 Tell the store that a handle has been bound to a proxy. More...
 
virtual void unboundHandle (IResetable *handle)
 Tell the store that a handle has been unbound from a proxy. More...
 
virtual bool tryELRemap (sgkey_t sgkey_in, size_t index_in, sgkey_t &sgkey_out, size_t &index_out)
 Test to see if the target of an ElementLink has moved. More...
 
virtual StatusCode createObj (IConverter *cvt, IOpaqueAddress *addr, DataObject *&refpObject)
 Call converter to create an object, possibly with locking. More...
 
virtual IProxyDicthiveProxyDict () override
 Return the current event-slot-specific store. More...
 
virtual SG::SourceID sourceID (const std::string &key="EventSelector") const
 Return the metadata source ID for the current event slot. 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...
 
StatusCode record (TAuxStore *store, const std::string &key, ::Int_t basketSize, ::Int_t splitLevel, ::Bool_t ownsStore=kFALSE)
 Internal function for adding an auxiliary store object to the output. More...
 
void * getOutputObject (const std::string &key, const std::type_info &ti, ::Bool_t metadata=kFALSE) const
 Function for retrieving an output object in a non-template way. 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. More...
 
StatusCode setAuxStore (TObjectManager &mgr, ::Bool_t metadata=kFALSE)
 Function connecting a DV object to its auxiliary store. More...
 
StatusCode putAux (::TTree &outTree, TVirtualManager &mgr, ::Int_t basketSize=32000, ::Int_t splitLevel=0, ::Bool_t metadata=kFALSE)
 Function saving the dynamically created auxiliary properties. More...
 

Static Protected Member Functions

::Bool_t hasAuxStore (const TObjectManager &mgr)
 Function checking if a given object may have an auxiliary store. More...
 
::Bool_t isAuxStore (const TObjectManager &mgr)
 Function checking if a given object may be an auxiliary store. More...
 
::Bool_t isStandalone (const TObjectManager &mgr)
 Function checking if an object is standalone (not a container) More...
 

Protected Attributes

EAuxMode m_auxMode
 The auxiliary access mode. More...
 
::TTree * m_inTree
 The main tree that we are reading from. More...
 
::Bool_t m_inTreeMissing
 Internal status flag showing that an input file is open, but it doesn't contain an event tree. More...
 
::TChain * m_inChain
 The (optional) chain provided as input. More...
 
TChainStateTrackerm_inChainTracker
 Optional object for tracking the state changes of an input TChain. More...
 
::Int_t m_inTreeNumber
 The number of the currently open tree in the input chain. More...
 
::TTree * m_inMetaTree
 Pointer to the metadata tree in the input file. 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...
 
EventFormatm_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_TREE_NAME = "CollectionTree"
 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

StatusCode record (void *obj, const std::string &typeName, const std::string &key, ::Int_t basketSize, ::Int_t splitLevel, ::Bool_t overwrite=kFALSE, ::Bool_t metadata=kFALSE, ::Bool_t isOwner=kTRUE)
 Internal function for recording an object into the output. More...
 
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...
 
void * getOutputObject (SG::sgkey_t key, const std::type_info &ti) override
 Function for retrieving an output object in a non-template way. 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

Python interface to xAOD::TEvent.

In order to make it possible to record objects that are created in Python, into an xAOD::TEvent object (in order to record selected objects into an output file for instance), this class extends the xAOD::TEvent object with some non-template functions. Functions that are inconvenient to use from C++, but which allow for much more flexibility in PyROOT.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 29 of file TPyEvent.h.

Member Typedef Documentation

◆ Listener_t

typedef std::vector< TVirtualIncidentListener* > xAOD::TEvent::Listener_t
protectedinherited

Definition of the structure type holding on to listeners.

Definition at line 416 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ Object_t

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

Definition of the internal data structure type.

Definition at line 414 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ sgkey_t [1/2]

typedef SG::sgkey_t IStringPool::sgkey_t
inherited

Type of the keys.

Definition at line 34 of file IStringPool.h.

◆ sgkey_t [2/2]

Definition at line 35 of file TVirtualEvent.h.

◆ upgrade_mutex_t

typedef AthContainers_detail::upgrade_mutex xAOD::TEvent::upgrade_mutex_t
protectedinherited

Mutex and lock for multithread synchronization.

Definition at line 489 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ upgrading_lock_t

Member Enumeration Documentation

◆ EAuxMode

enum xAOD::TEvent::EAuxMode
inherited

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 95 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

95  {
96  kBranchAccess = 0,
97  kClassAccess = 1,
98  kAthenaAccess = 2,
99  kUndefinedAccess = 3
100  };

Constructor & Destructor Documentation

◆ TPyEvent()

xAOD::TPyEvent::TPyEvent ( EAuxMode  mode = kUndefinedAccess)
inline

Constructor with an access mode - only that one is used from the python TPyEvent.

Definition at line 33 of file TPyEvent.h.

33 : TEvent(mode) {}

Member Function Documentation

◆ addListener()

StatusCode xAOD::TEvent::addListener ( TVirtualIncidentListener listener)
inherited

Register an incident listener object.

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

It tells the TEvent 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 910 of file Control/xAODRootAccess/Root/TEvent.cxx.

910  {
911 
912  // Check that we received a valid pointer:
913  if( ! listener ) {
914  ::Error( "xAOD::TEvent::addListener",
915  XAOD_MESSAGE( "Received a null pointer for the listener" ) );
916  return StatusCode::FAILURE;
917  }
918 
919  // Check if this listener is already in our list:
920  bool listenerKnown = false;
921  for( TVirtualIncidentListener* l : m_listeners ) {
922  if( l == listener ) {
923  ::Warning( "xAOD::TEvent::addListener",
924  "Listener %p was added previously already",
925  static_cast< void* >( listener ) );
926  listenerKnown = true;
927  break;
928  }
929  }
930 
931  // If we don't know it yet, let's add it now:
932  if( ! listenerKnown ) {
933  m_listeners.push_back( listener );
934  }
935 
936  // Return gracefully:
937  return StatusCode::SUCCESS;
938  }

◆ addNameRemap()

StatusCode xAOD::TEvent::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 990 of file Control/xAODRootAccess/Root/TEvent.cxx.

991  {
992 
993  // Check if this name is known on the input or output already. As that's
994  // not good.
996  ::Error( "xAOD::TEvent::addNameRemap",
997  XAOD_MESSAGE( "Can't use \"%s\" as the target name in the"
998  "\"%s\" -> \"%s\" remapping" ),
999  newName.c_str(), onfile.c_str(), newName.c_str() );
1000  return StatusCode::FAILURE;
1001  }
1002 
1003  // Check if this name was remapped to something already:
1004  auto itr = m_nameRemapping.find( newName );
1005  if( itr != m_nameRemapping.end() ) {
1006  ::Warning( "xAOD::TEvent::addNameRemap",
1007  "Overriding existing name remapping \"%s\" -> \"%s\"",
1008  itr->second.c_str(), itr->first.c_str() );
1009  ::Warning( "xAOD::TEvent::addNameRemap", " with: \"%s\" -> \"%s\"",
1010  onfile.c_str(), newName.c_str() );
1011  }
1012 
1014  m_nameRemapping[ newName ] = onfile;
1015 
1016  // Return gracefully:
1017  return StatusCode::SUCCESS;
1018  }

◆ addRef()

unsigned long xAOD::TEvent::addRef ( )
overrideprotectedinherited

Increment the reference count of Interface instance.

Definition at line 452 of file TEventProxyDict.cxx.

452  {
453 
454  return 0;
455  }

◆ addToStore()

StatusCode xAOD::TEvent::addToStore ( CLID  clid,
SG::DataProxy proxy 
)
overrideprotectedvirtualinherited

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.

Implements IProxyDict.

Definition at line 385 of file TEventProxyDict.cxx.

385  {
386 
388 
389  // Warn the user that the function got called:
390  static std::atomic_flag warningPrinted ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT;
391  if ( ! warningPrinted.test_and_set() && m_printEventProxyWarnings) {
392  ::Warning( "xAOD::TEvent::addToStore",
393  "Function should only be called through an invalid "
394  "ElementLink" );
395  }
396 
397  // Hold on to the proxy with some non-existent, hopefully unique key:
398  const ::TString uniqueKey = ::TString::Format( "NonExistentKey_%lu",
399  m_branches.size() );
400  BranchInfo bi;
401  bi.m_proxy.reset( proxy );
402  lock.upgrade();
403  m_branches.insert( std::make_pair( stringToKey( uniqueKey.Data(),
404  clid ),
405  std::move( bi ) ) );
406 
407  // Return gracefully:
408  return StatusCode::SUCCESS;
409  }

◆ auxMode()

TEvent::EAuxMode xAOD::TEvent::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 278 of file Control/xAODRootAccess/Root/TEvent.cxx.

278  {
279 
280  return m_auxMode;
281  }

◆ boundHandle()

void IProxyDict::boundHandle ( IResetable handle)
virtualinherited

Tell the store that a handle has been bound to a proxy.

Parameters
handleThe handle that was bound. The default implementation does nothing.

Reimplemented in SGImplSvc, SGTest::TestStore, SimpleView, and SG::View.

Definition at line 23 of file IProxyDict.cxx.

24 {
25 }

◆ clearListeners()

void xAOD::TEvent::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 970 of file Control/xAODRootAccess/Root/TEvent.cxx.

970  {
971 
972  m_listeners.clear();
973  return;
974  }

◆ clearNameRemap()

void xAOD::TEvent::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 1024 of file Control/xAODRootAccess/Root/TEvent.cxx.

1024  {
1025 
1026  m_nameRemapping.clear();
1027  return;
1028  }

◆ connectAux()

StatusCode xAOD::TEvent::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 2856 of file Control/xAODRootAccess/Root/TEvent.cxx.

2857  {
2858 
2859  // A simple test...
2860  if( ! m_inTree ) {
2861  ::Error( "xAOD::TEvent::connectAux",
2862  XAOD_MESSAGE( "No input tree is available" ) );
2863  return StatusCode::FAILURE;
2864  }
2865 
2866  // Check if we know anything about this auxiliary object:
2867  if( ( ! m_inTree->GetBranch( prefix.c_str() ) ) &&
2869  // If not, then let's just return right away. Not having
2870  // an auxiliary object with this name is not an error per se.
2871  return StatusCode::SUCCESS;
2872  }
2873 
2874  // Check if the branch is already connected:
2875  if( m_inputObjects.find( prefix ) != m_inputObjects.end() ) {
2876  return StatusCode::SUCCESS;
2877  }
2878 
2879  // Do different things based on the "auxiliary mode" we are in:
2881 
2882  // In "class access mode" let's first connect the concrete auxiliary
2883  // object to the input:
2884  RETURN_CHECK( "xAOD::TEvent::connectAux", connectBranch( prefix ) );
2885 
2886  // Access the object's manager:
2887  Object_t::const_iterator mgr_itr = m_inputObjects.find( prefix );
2888  if( mgr_itr == m_inputObjects.end() ) {
2889  ::Fatal( "xAOD::TEvent::connectAux",
2890  XAOD_MESSAGE( "There's a logic error in the code" ) );
2891  }
2892  const TObjectManager* omgr =
2893  dynamic_cast< const TObjectManager* >( mgr_itr->second );
2894  if( ! omgr ) {
2895  ::Fatal( "xAOD::TEvent::connectAux",
2896  XAOD_MESSAGE( "There's a logic error in the code" ) );
2897  return StatusCode::FAILURE;
2898  }
2899 
2900  // Check if we can switch out the internal store of this object:
2901  static const TClass* const holderClass =
2902  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
2903  if( ! omgr->holder()->getClass()->InheritsFrom( holderClass ) ) {
2904  // Nope... So let's just end the journey here.
2905  return StatusCode::SUCCESS;
2906  }
2907 
2908  // Try to get the object as an IAuxStoreHolder:
2909  SG::IAuxStoreHolder* storeHolder =
2910  reinterpret_cast< SG::IAuxStoreHolder* >(
2911  omgr->holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
2912  if( ! storeHolder ) {
2913  ::Fatal( "xAOD::TEvent::connectAux",
2914  XAOD_MESSAGE( "There's a logic error in the code" ) );
2915  }
2916 
2917  // A sanity check to see whether the store's type is in sync with the
2918  // object's type that it will be connected to:
2919  if( ( standalone && ( storeHolder->getStoreType() !=
2921  ( ( ! standalone ) &&
2922  ( storeHolder->getStoreType() !=
2924  ::Error( "xAOD::TEvent::connectAux",
2925  XAOD_MESSAGE( "Requested store types inconsistent "
2926  "for: %s" ), prefix.c_str() );
2927  ::Error( "xAOD::TEvent::connectAux",
2928  XAOD_MESSAGE( "standalone = %s, getStoreType() = %i" ),
2929  ( standalone ? "kTRUE" : "kFALSE" ),
2930  static_cast< int >( storeHolder->getStoreType() ) );
2931  return StatusCode::FAILURE;
2932  }
2933 
2934  // Return gracefully:
2935  return StatusCode::SUCCESS;
2936 
2937  } else if( m_auxMode == kBranchAccess ) {
2938 
2939  // In "branch access mode" let's create a TAuxStore object, and let
2940  // that take care of the auxiliary store access:
2941  TAuxStore* store =
2942  new TAuxStore( prefix.c_str(), kTRUE,
2943  ( standalone ? TAuxStore::kObjectStore :
2945  // We're using this object to read from the input, it needs to be
2946  // locked:
2947  store->lock();
2948  TAuxManager* mgr = new TAuxManager( store );
2949  m_inputObjects[ prefix ] = mgr;
2950 
2951  // Now connect the object to the input tree:
2952  RETURN_CHECK( "xAOD::TEvent::connectAux",
2953  store->readFrom( m_inTree ) );
2954 
2955  // Return gracefully:
2956  return StatusCode::SUCCESS;
2957  }
2958 
2959  // There was some problem:
2960  ::Error( "xAOD::TEvent::connectAux",
2961  XAOD_MESSAGE( "Unknown auxiliary access mode set (%i)" ),
2962  static_cast< int >( m_auxMode ) );
2963  return StatusCode::FAILURE;
2964  }

◆ connectBranch()

StatusCode xAOD::TEvent::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 2558 of file Control/xAODRootAccess/Root/TEvent.cxx.

2559  {
2560 
2561  // A little sanity check:
2562  if( ! m_inTree ) {
2563  ::Error( "xAOD::TEvent::connectBranch",
2564  XAOD_MESSAGE( "Function called on un-initialised object" ) );
2565  return StatusCode::FAILURE;
2566  }
2567 
2568  // Increment the access counter on this container:
2570 
2571  // Check if the branch is already connected:
2572  if( m_inputObjects.find( key ) != m_inputObjects.end() ) {
2573  return StatusCode::SUCCESS;
2574  }
2575  // Check if it was already found to be missing.
2576  if( m_inputMissingObjects.find( key ) != m_inputMissingObjects.end() ) {
2577  if( ! silent ) {
2578  ::Warning( "xAOD::TEvent::connectBranch",
2579  "Branch \"%s\" not available on input",
2580  key.c_str() );
2581  }
2582  return StatusCode::RECOVERABLE;
2583  }
2584 
2585  // Check if we have metadata about this branch:
2586  const xAOD::EventFormatElement* ef = 0;
2587  if( ! m_inputEventFormat.exists( key ) ) {
2588  if( ! silent ) {
2589  ::Warning( "xAOD::TEvent::connectBranch",
2590  "No metadata available for branch: %s",
2591  key.c_str() );
2592  }
2593  } else {
2595  }
2596 
2597  // Check if the branch exists in our input tree:
2598  ::TBranch* br =
2599  m_inTree->GetBranch( key.c_str() );
2600  if( ! br ) {
2601  if( ! silent ) {
2602  ::Warning( "xAOD::TEvent::connectBranch",
2603  "Branch \"%s\" not available on input",
2604  key.c_str() );
2605  }
2606  m_inputMissingObjects.insert( key );
2607  return StatusCode::RECOVERABLE;
2608  }
2609 
2610  // Make sure that it's not in "MakeClass mode":
2611  br->SetMakeClass( 0 );
2612 
2613  // Decide about the type that we need to use for the reading of this
2614  // branch:
2615  std::string className = br->GetClassName();
2616  if( className == "" ) {
2617  if( ef ) {
2618  // This is a fairly weird situation, but let's fall back to taking
2619  // the class name from the metadata object in this case.
2620  className = ef->className();
2621  } else {
2622  ::Error( "xAOD::TEvent::connectBranch",
2623  XAOD_MESSAGE( "Couldn't find an appropriate type with a "
2624  "dictionary for branch \"%s\"" ),
2625  key.c_str() );
2626  return StatusCode::FAILURE;
2627  }
2628  }
2629  ::TClass* realClass = ::TClass::GetClass( className.c_str() );
2630  if( ( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) && ef ) {
2631  // We may need to do an actual schema evolution here, in which
2632  // case let's fall back on the class name coming from the metadata
2633  // object.
2634  className = ef->className();
2635  realClass = ::TClass::GetClass( className.c_str() );
2636  }
2637  if( ( ! realClass ) || ( ! realClass->IsLoaded() ) ) {
2638  // Now we're in trouble...
2639  ::Error( "xAOD::TEvent::connectBranch",
2640  XAOD_MESSAGE( "Couldn't find an appropriate type with a "
2641  "dictionary for branch \"%s\"" ),
2642  key.c_str() );
2643  return StatusCode::FAILURE;
2644  }
2645 
2646  // Make sure that the current object is the "active event":
2647  setActive();
2648 
2649  // The data type is always "other" for us:
2650  static const ::EDataType dataType = kOther_t;
2651 
2652  // Check if the output already has this object. If it does, let's
2653  // assume that we have been copying the object to the output. Which
2654  // means that we need to resume filling the same memory address that
2655  // the output holder points to.
2656  void* ptr = 0;
2657  Object_t::const_iterator out_itr = m_outputObjects.find( key );
2658  if( out_itr != m_outputObjects.end() ) {
2659  // It needs to be an object manager...
2660  TObjectManager* mgr =
2661  dynamic_cast< TObjectManager* >( out_itr->second );
2662  if( ! mgr ) {
2663  ::Error( "xAOD::TEvent::connectBranch",
2664  XAOD_MESSAGE( "Couldn't access output manager for: %s" ),
2665  key.c_str() );
2666  return StatusCode::FAILURE;
2667  }
2668  // Get the pointer out of it:
2669  ptr = mgr->holder()->get();
2670  }
2671 
2672  // If there is no output object, then let's create one ourselves.
2673  // This is the only way in which we can have the memory management of
2674  // THolder do the right thing with this object.
2675  if( ! ptr ) {
2676  ptr = realClass->New();
2677  }
2678 
2679  // Create the new manager object that will hold this EDM object:
2680  THolder* hldr = new THolder( ptr, realClass );
2681  TObjectManager* mgr =
2682  new TObjectManager( 0, hldr, ( m_auxMode == kAthenaAccess ) );
2683  m_inputObjects[ key ] = mgr;
2684 
2685  // One final check. If it's not an auxiliary store, then it must have
2686  // a split level of 0. Otherwise read rules may not work on it. Causing
2687  // *very* serious silent corruption in the data read, if we don't use
2688  // the "Athena read mode".
2689  if( ( m_auxMode != kAthenaAccess ) && ( br->GetSplitLevel() != 0 ) &&
2690  ( ! isAuxStore( *mgr ) ) ) {
2691  ::Error( "xAOD::TEvent::connectBranch",
2692  XAOD_MESSAGE( "Split level for branch \"%s\" is %i. "
2693  "This can only be read in kAthenaAccess mode." ),
2694  key.c_str(), br->GetSplitLevel() );
2695  // Clean up:
2696  *( hldr->getPtr() ) = 0;
2697  delete mgr;
2698  m_inputObjects.erase( key );
2699  return StatusCode::FAILURE;
2700  }
2701 
2702  // Now try to connect to the branch:
2703  const ::Int_t status = m_inTree->SetBranchAddress( key.c_str(),
2704  hldr->getPtr(),
2705  mgr->branchPtr(),
2706  realClass, dataType,
2707  kTRUE );
2708  if( status < 0 ) {
2709  ::Error( "xAOD::TEvent::connectBranch",
2710  XAOD_MESSAGE( "Couldn't connect variable of type \"%s\" to "
2711  "input branch \"%s\". Return code: %i" ),
2712  className.c_str(), key.c_str(), status );
2713  // Clean up:
2714  *( hldr->getPtr() ) = 0;
2715  delete mgr;
2716  m_inputObjects.erase( key );
2717  return StatusCode::FAILURE;
2718  }
2719 
2720  // If it's an auxiliary store object, set it up correctly:
2721  if( isAuxStore( *mgr ) ) {
2722  RETURN_CHECK( "xAOD::TEvent::connectBranch",
2724  }
2725 
2726  // Return here if the object can't have an auxiliary store:
2727  if( ! hasAuxStore( *mgr ) ) return StatusCode::SUCCESS;
2728 
2729  // If there may be an auxiliary object connected to this one,
2730  // connect that as well:
2731  return connectAux( key + "Aux.", isStandalone( *mgr ) );
2732  }

◆ connectMetaAux()

StatusCode xAOD::TEvent::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 2975 of file Control/xAODRootAccess/Root/TEvent.cxx.

2976  {
2977 
2978  // Check if the branch is already connected:
2979  if( m_inputMetaObjects.find( prefix ) != m_inputMetaObjects.end() ) {
2980  return StatusCode::SUCCESS;
2981  }
2982 
2983  // A sanity check:
2984  if( ! m_inMetaTree ) {
2985  ::Fatal( "xAOD::TEvent::connectMetaAux",
2986  XAOD_MESSAGE( "Internal logic error detected" ) );
2987  return StatusCode::FAILURE;
2988  }
2989 
2990  // Do different things based on the "auxiliary mode" we are in:
2992 
2993  // In "class access mode" let's first connect the concrete auxiliary
2994  // object to the input:
2995  RETURN_CHECK( "xAOD::TEvent::connectMetaAux",
2997 
2998  // Access the object's manager:
2999  Object_t::const_iterator mgr_itr = m_inputMetaObjects.find( prefix );
3000  if( mgr_itr == m_inputMetaObjects.end() ) {
3001  ::Fatal( "xAOD::TEvent::connectMetaAux",
3002  XAOD_MESSAGE( "There's a logic error in the code" ) );
3003  }
3004  const TObjectManager* omgr =
3005  dynamic_cast< const TObjectManager* >( mgr_itr->second );
3006  if( ! omgr ) {
3007  ::Fatal( "xAOD::TEvent::connectMetaAux",
3008  XAOD_MESSAGE( "There's a logic error in the code" ) );
3009  return StatusCode::FAILURE;
3010  }
3011 
3012  // Check if we can switch out the internal store of this object:
3013  static const TClass* const holderClass =
3014  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
3015  if( ! omgr->holder()->getClass()->InheritsFrom( holderClass ) ) {
3016  // Nope... So let's just end the journey here.
3017  return StatusCode::SUCCESS;
3018  }
3019 
3020  // Try to get the object as an IAuxStoreHolder:
3021  SG::IAuxStoreHolder* storeHolder =
3022  reinterpret_cast< SG::IAuxStoreHolder* >(
3023  omgr->holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
3024  if( ! storeHolder ) {
3025  ::Fatal( "xAOD::TEvent::connectMetaAux",
3026  XAOD_MESSAGE( "There's a logic error in the code" ) );
3027  }
3028 
3029  // A sanity check to see whether the store's type is in sync with the
3030  // object's type that it will be connected to:
3031  if( ( standalone && ( storeHolder->getStoreType() !=
3033  ( ( ! standalone ) &&
3034  ( storeHolder->getStoreType() !=
3036  ::Error( "xAOD::TEvent::connectMetaAux",
3037  XAOD_MESSAGE( "Requested store types inconsistent" ) );
3038  ::Error( "xAOD::TEvent::connectMetaAux",
3039  XAOD_MESSAGE( "standalone = %s, getStoreType() = %i" ),
3040  ( standalone ? "kTRUE" : "kFALSE" ),
3041  static_cast< int >( storeHolder->getStoreType() ) );
3042  return StatusCode::FAILURE;
3043  }
3044 
3045  // Return gracefully:
3046  return StatusCode::SUCCESS;
3047 
3048  } else if( m_auxMode == kBranchAccess ) {
3049 
3050  // In "branch access mode" let's create a TAuxStore object, and let
3051  // that take care of the auxiliary store access:
3052  TAuxStore* store =
3053  new TAuxStore( prefix.c_str(), kTRUE,
3054  ( standalone ? TAuxStore::kObjectStore :
3056  // We use this object to read data from the input, it needs to be
3057  // locked:
3058  store->lock();
3059  TAuxManager* mgr = new TAuxManager( store );
3061 
3062  // Now connect the object to the input tree:
3063  RETURN_CHECK( "xAOD::TEvent::connectMetaAux",
3064  store->readFrom( m_inMetaTree ) );
3065 
3066  // Tell the auxiliary store which entry to use:
3067  store->getEntry( 0 );
3068 
3069  // Return gracefully:
3070  return StatusCode::SUCCESS;
3071  }
3072 
3073  // There was some problem:
3074  ::Error( "xAOD::TEvent::connectMetaAux",
3075  XAOD_MESSAGE( "Unknown auxiliary access mode set (%i)" ),
3076  static_cast< int >( m_auxMode ) );
3077  return StatusCode::FAILURE;
3078  }

◆ connectMetaBranch()

StatusCode xAOD::TEvent::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 2742 of file Control/xAODRootAccess/Root/TEvent.cxx.

2743  {
2744 
2745  // A little sanity check:
2746  if( ! m_inMetaTree ) {
2747  ::Error( "xAOD::TEvent::connectMetaBranch",
2748  XAOD_MESSAGE( "Function called on un-initialised object" ) );
2749  return StatusCode::FAILURE;
2750  }
2751 
2752  // Check if the branch is already connected:
2753  if( m_inputMetaObjects.find( key ) != m_inputMetaObjects.end() ) {
2754  return StatusCode::SUCCESS;
2755  }
2756 
2757  // Check if the branch exists in our metadata tree:
2758  ::TBranch* br = m_inMetaTree->GetBranch( key.c_str() );
2759  if( ! br ) {
2760  if( ! silent ) {
2761  ::Warning( "xAOD::TEvent::connectMetaBranch",
2762  "Branch \"%s\" not available on input",
2763  key.c_str() );
2764  }
2765  return StatusCode::RECOVERABLE;
2766  }
2767 
2768  // Check that we have an entry in the branch:
2769  if( ! br->GetEntries() ) {
2770  if( ! silent ) {
2771  ::Warning( "xAOD::TEvent::connectMetaBranch",
2772  "Branch \"%s\" doesn't hold any data",
2773  key.c_str() );
2774  }
2775  return StatusCode::RECOVERABLE;
2776  }
2777 
2778  // Make sure that it's not in "MakeClass mode":
2779  br->SetMakeClass( 0 );
2780 
2781  // Extract the type of the branch:
2782  ::TClass* cl = 0;
2783  ::EDataType dt = kOther_t;
2784  if( br->GetExpectedType( cl, dt ) || ( ! cl ) ) {
2785  ::Error( "xAOD::TEvent::connectMetaBranch",
2786  XAOD_MESSAGE( "Couldn't get the type for metadata "
2787  "branch %s" ), key.c_str() );
2788  return StatusCode::FAILURE;
2789  }
2790 
2791  // Create the object, and all of the managers around it:
2792  void* ptr = cl->New();
2793  THolder* hldr = new THolder( ptr, cl );
2794  TObjectManager* mgr =
2795  new TObjectManager( 0, hldr, m_auxMode == kAthenaAccess );
2796  m_inputMetaObjects[ key ] = mgr;
2797 
2798  // Now try to connect to the branch:
2799  const ::Int_t status = m_inMetaTree->SetBranchAddress( key.c_str(),
2800  hldr->getPtr(),
2801  mgr->branchPtr(),
2802  cl, dt,
2803  kTRUE );
2804  if( status < 0 ) {
2805  ::Error( "xAOD::TEvent::connectMetaBranch",
2806  XAOD_MESSAGE( "Couldn't connect variable of type \"%s\" to "
2807  "input branch \"%s\". Return code: %i" ),
2808  cl->GetName(), key.c_str(), status );
2809  // Clean up:
2810  *( hldr->getPtr() ) = 0;
2811  delete mgr;
2812  m_inputMetaObjects.erase( key );
2813  return StatusCode::FAILURE;
2814  }
2815 
2816  // Read in the object:
2817  if( mgr->getEntry() < 0 ) {
2818  ::Error( "xAOD::TEvent::connectMetaBranch",
2819  XAOD_MESSAGE( "Couldn't read in metadata object with key "
2820  "\"%s\"" ), key.c_str() );
2821  return StatusCode::FAILURE;
2822  }
2823 
2824  // If it's an auxiliary store object, set it up correctly:
2825  if( isAuxStore( *mgr ) ) {
2826  RETURN_CHECK( "xAOD::TEvent::connectBranch",
2828  }
2829 
2830  // Return here if the object can't have an auxiliary store:
2831  if( ! hasAuxStore( *mgr ) ) return StatusCode::SUCCESS;
2832 
2833  // If there may be an auxiliary object connected to this one,
2834  // connect that as well:
2835  RETURN_CHECK( "xAOD::TEvent::connectMetaBranch",
2836  connectMetaAux( key + "Aux.", isStandalone( *mgr ) ) );
2837 
2838  // And now connect the first object to its auxiliary store:
2839  RETURN_CHECK( "xAOD::TEvent::connectMetaBranch",
2840  setAuxStore( *mgr, kTRUE ) );
2841 
2842  // We succeeded:
2843  return StatusCode::SUCCESS;
2844  }

◆ contains() [1/3]

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

Function checking if an object is available from the store.

◆ contains() [2/3]

Bool_t xAOD::TPyEvent::contains ( const std::string &  key,
const std::string &  type 
)

Function checking if an object is available from the store.

Definition at line 13 of file TPyEvent.cxx.

14  {
15 
16  // Try to access the dictionary of this type:
17  ::TClass* cl = ::TClass::GetClass( type.c_str() );
18  if( ! cl ) {
19  ::Warning( "xAOD::TPyEvent::contains",
20  "Type name \"%s\" not known", type.c_str() );
21  return kFALSE;
22  }
23 
24  // Check if the dictionary can return a type_info:
25  const std::type_info* ti = cl->GetTypeInfo();
26  if( ! ti ) {
27  ::Warning( "xAOD::TPyEvent::contains",
28  "Type \"%s\" doesn't have a proper dictionary",
29  type.c_str() );
30  return kFALSE;
31  }
32 
33  // Let the base class do the work:
34  return TEvent::contains( key, *ti, kFALSE );
35  }

◆ contains() [3/3]

Bool_t xAOD::TEvent::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 3671 of file Control/xAODRootAccess/Root/TEvent.cxx.

3673  {
3674 
3675  return ( getOutputObject( key, ti, metadata ) ||
3676  getInputObject( key, ti, kTRUE, metadata ) );
3677  }

◆ containsMeta()

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

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

◆ copy() [1/2]

StatusCode xAOD::TEvent::copy ( ::Int_t  basketSize = 32000,
::Int_t  splitLevel = 0 
)
inherited

Copy all (ROOT readable) objects directly from the input to the output.

This function is here to make it easy to write code that skims an input file into an output file without applying any modification to the events.

Parameters
basketSizeOptional size for the basket associated with the output branch
splitLevelOptional split level of the output branch
Returns
StatusCode::SUCCESS if the copy was successful, or StatusCode::FAILURE if not

Definition at line 1246 of file Control/xAODRootAccess/Root/TEvent.cxx.

1246  {
1247 
1248  // Make sure that an input TTree is available:
1249  if( ! m_inTree ) {
1250  ::Error( "xAOD::TEvent::copy",
1251  XAOD_MESSAGE( "No input TTree is open" ) );
1252  return StatusCode::FAILURE;
1253  }
1254 
1255  // Loop over the known input containers:
1258  for( ; itr != end; ++itr ) {
1259 
1260  // Convenience reference:
1261  const EventFormatElement& efe = itr->second;
1262 
1263  // Ignore objects that don't exist on the input:
1264  if( ! m_inTree->GetBranch( efe.branchName().c_str() ) ) {
1265  continue;
1266  }
1267  // Skip all branches ending in "Aux.":
1268  if( efe.branchName().find( "Aux." ) ==
1269  ( efe.branchName().size() - 4 ) ) {
1270  continue;
1271  }
1272  // Also skip dynamic branches:
1273  if( efe.parentName() != "" ) {
1274  continue;
1275  }
1276  // Check if the class in question is known:
1277  ::TClass* cl = ::TClass::GetClass( efe.className().c_str() );
1278  if( ( ! cl ) || ( ! cl->IsLoaded() ) ) {
1279  continue;
1280  }
1281 
1282  // Make the copy then...
1283  RETURN_CHECK( "xAOD::TEvent::copy",
1284  this->copy( efe.branchName(), basketSize, splitLevel ) );
1285  }
1286 
1287  // Return gracefully:
1288  return StatusCode::SUCCESS;
1289  }

◆ copy() [2/2]

StatusCode xAOD::TEvent::copy ( const std::string &  key,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 0 
)
inherited

Copy an object directly from the input to the output.

This function can be used to easily copy a given object/container to the output, without modifying the contents of it.

It only needs to be called on the interface object/container, the copying of the auxiliary data is done automatically, and is steered by the SetAuxItemList function.

Parameters
keyThe key (branch name) of the object/container to copy
basketSizeOptional size for the basket associated with the output branch
splitLevelOptional split level of the output branch

Definition at line 1143 of file Control/xAODRootAccess/Root/TEvent.cxx.

1144  {
1145 
1146  // Check if a name re-mapping should be applied or not:
1147  std::string keyToUse = key;
1148  auto remap_itr = m_nameRemapping.find( key );
1149  if( ( remap_itr != m_nameRemapping.end() ) &&
1150  ( ! m_inputEventFormat.exists( key ) ) &&
1151  m_inputEventFormat.exists( remap_itr->second ) ) {
1152  keyToUse = remap_itr->second;
1153  }
1154 
1155  // Make sure that the branch got connected to:
1156  RETURN_CHECK( "xAOD::TEvent::copy", connectBranch( keyToUse ) );
1157 
1158  // Make sure that the input object is properly updated:
1159  Object_t::const_iterator vobjMgr = m_inputObjects.find( keyToUse );
1160  if( vobjMgr == m_inputObjects.end() ) {
1161  ::Error( "xAOD::TEvent::copy",
1162  XAOD_MESSAGE( "Internal logic error detected" ) );
1163  return StatusCode::FAILURE;
1164  }
1165  TObjectManager* objMgr =
1166  dynamic_cast< TObjectManager* >( vobjMgr->second );
1167  if( ! objMgr ) {
1168  ::Error( "xAOD::TEvent::copy",
1169  XAOD_MESSAGE( "Internal logic error detected" ) );
1170  return StatusCode::FAILURE;
1171  }
1172  if( ! getInputObject( key,
1173  *( objMgr->holder()->getClass()->GetTypeInfo() ) ) ) {
1174  ::Error( "xAOD::TEvent::copy",
1175  XAOD_MESSAGE( "Internal logic error detected" ) );
1176  return StatusCode::FAILURE;
1177  }
1178 
1179  // Put the interface object into the output:
1180  RETURN_CHECK( "xAOD::TEvent::copy",
1181  record( objMgr->object(),
1182  objMgr->holder()->getClass()->GetName(),
1183  key, basketSize, splitLevel, kTRUE ) );
1184 
1185  // Check if we have a filtering rule for the store:
1186  const std::set< std::string >* filter = 0;
1187  auto fitr = m_auxItemList.find( key + "Aux." );
1188  if( fitr != m_auxItemList.end() ) {
1189  filter = &( fitr->second );
1190  }
1191 
1192  // Put the auxiliary store object into the output:
1193  Object_t::const_iterator vauxMgr = m_inputObjects.find( keyToUse +
1194  "Aux." );
1195  if( vauxMgr == m_inputObjects.end() ) {
1196  // If there is no auxiliary store for this object/container, we're
1197  // done already:
1198  return StatusCode::SUCCESS;
1199  }
1200  // Check what type of auxiliary store this is:
1202  TObjectManager* auxMgr =
1203  dynamic_cast< TObjectManager* >( vauxMgr->second );
1204  if( ! auxMgr ) {
1205  ::Error( "xAOD::TEvent::copy",
1206  XAOD_MESSAGE( "Internal logic error detected" ) );
1207  return StatusCode::FAILURE;
1208  }
1209  RETURN_CHECK( "xAOD::TEvent::copy",
1210  record( auxMgr->object(),
1211  auxMgr->holder()->getClass()->GetName(),
1212  key + "Aux.", basketSize, splitLevel, kTRUE ) );
1213  } else if( m_auxMode == kBranchAccess ) {
1214  TAuxManager* auxMgr =
1215  dynamic_cast< TAuxManager* >( vauxMgr->second );
1216  if( ! auxMgr ) {
1217  ::Error( "xAOD::TEvent::copy",
1218  XAOD_MESSAGE( "Internal logic error detected" ) );
1219  return StatusCode::FAILURE;
1220  }
1221  // Set up the filtering:
1222  if( filter ) {
1223  auxMgr->getStore()->selectAux( *filter );
1224  }
1225  RETURN_CHECK( "xAOD::TEvent::copy",
1226  record( auxMgr->getStore(),
1227  key + "Aux.", basketSize, splitLevel ) );
1228  } else {
1229  ::Fatal( "xAOD::TEvent::copy",
1230  XAOD_MESSAGE( "Internal logic error detected" ) );
1231  }
1232 
1233  // Return gracefully:
1234  return StatusCode::SUCCESS;
1235  }

◆ createObj()

StatusCode IProxyDict::createObj ( IConverter *  cvt,
IOpaqueAddress *  addr,
DataObject *&  refpObject 
)
virtualinherited

Call converter to create an object, possibly with locking.

Parameters
cvtThe converter to call.
addrOpaque address information for the object to create.
refpObjectReference to location of the pointer of the created object.

This calls the createObj method on cvt to create the referenced transient object.

This will also lock the store, if that is required.

The default implementation just forwards the method call, with no locking.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 70 of file IProxyDict.cxx.

73 {
74  return cvt->createObj (addr, refpObject);
75 }

◆ DeclareInterfaceID() [1/2]

IHiveStore::DeclareInterfaceID ( INamedInterface  ,
,
 
)
inherited

◆ DeclareInterfaceID() [2/2]

IProxyDict::DeclareInterfaceID ( IProxyDict  ,
,
 
)
inherited

◆ dump()

std::string xAOD::TEvent::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 292 of file Control/xAODRootAccess/Root/TEvent.cxx.

292  {
293 
294  // The internal stream object:
295  std::ostringstream ost;
296  ost << "<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
297 
298  // Loop over the EventFormat object:
301  for( ; ef_itr != ef_end; ++ef_itr ) {
302 
303  // Construct the type name:
304  std::string typeName = ef_itr->second.className();
305  removeVersionNames( typeName );
306 
307  // Get the type:
308  ::TClass* cl =
309  ::TClass::GetClass( ef_itr->second.className().c_str() );
310  const std::type_info* ti = ( cl ? cl->GetTypeInfo() : nullptr );
311  if( ( ! cl ) || ( ! cl->IsLoaded() ) || ( ! ti ) ) {
312  Warning( "xAOD::TEvent::dump",
313  "Unknown type (%s) found in the event format",
314  ef_itr->second.className().c_str() );
315  continue;
316  }
317 
318  // Skip containers that are not available anyway:
319  if( ! contains( ef_itr->second.branchName(), *ti ) ) {
320  continue;
321  }
322 
323  // Do the printout:
324  ost << " Hash: 0x" << std::setw( 8 ) << std::setfill( '0' )
325  << std::hex << ef_itr->second.hash()
326  << " Key: \"" << ef_itr->second.branchName() << "\"\n";
327 
328  ost << " type: " << typeName << "\n";
329  const bool isNonConst = transientContains( ef_itr->second.branchName(),
330  *ti );
331  ost << " isConst: " << ( isNonConst ? "No" : "Yes" ) << "\n";
332  ost << " Data: "
333  << ( isNonConst ? getOutputObject( ef_itr->second.branchName(),
334  *ti ) :
335  getInputObject( ef_itr->second.branchName(), *ti ) ) << "\n";
336  }
337 
338  // Finish with the construction:
339  ost << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
340  return ost.str();
341  }

◆ fill()

Int_t xAOD::TEvent::fill ( )
inherited

Function filling one event into the output tree.

This function needs to be called by the user at the end of processing each event that is meant to be written out.

Returns
The number of bytes written if successful, a negative number if not

Definition at line 1508 of file Control/xAODRootAccess/Root/TEvent.cxx.

1508  {
1509 
1510  // A little sanity check:
1511  if( ! m_outTree ) {
1512  ::Error( "xAOD::TEvent::fill",
1513  XAOD_MESSAGE( "Object not connected to an output file!" ) );
1514  return 0;
1515  }
1516 
1517  // Make sure that all objects have been read in. The 99 as the value
1518  // has a special meaning for TAuxStore. With this value it doesn't
1519  // delete its transient (decoration) variables. Otherwise it does.
1520  // (As it's supposed to, when moving to a new event.)
1521  if( m_inChain ) {
1522  if (getEntry( m_inChain->GetReadEntry(), 99 ) < 0) {
1523  ::Error( "xAOD::TEvent::fill",
1524  XAOD_MESSAGE( "getEntry failed!" ) );
1525  return 0;
1526  }
1527  } else if( m_inTree ) {
1528  if (getEntry( m_entry, 99 ) < 0) {
1529  ::Error( "xAOD::TEvent::fill",
1530  XAOD_MESSAGE( "getEntry failed!" ) );
1531  return 0;
1532  }
1533  }
1534 
1535  // Prepare the objects for writing. Note that we need to iterate over a
1536  // copy of the m_outputObjects container. Since the putAux(...) function
1537  // called inside the loop may itself add elements to the m_outputObject
1538  // container.
1539  std::string unsetObjects;
1540  Object_t outputObjectsCopy = m_outputObjects;
1541  for( auto& itr : outputObjectsCopy ) {
1542  // Check that a new object was provided in the event:
1543  if( ! itr.second->create() ) {
1544  // We are now going to fail. But let's collect the names of
1545  // all the unset objects:
1546  if( unsetObjects.size() ) {
1547  unsetObjects.append( ", \"" + itr.first + "\"" );
1548  } else {
1549  unsetObjects.append( "\"" + itr.first + "\"" );
1550  }
1551  continue;
1552  }
1553  // Make sure that any dynamic auxiliary variables that
1554  // were added to the object after it was put into the event,
1555  // get added to the output:
1556  if( ! putAux( *m_outTree, *( itr.second ) ) ) {
1557  ::Error( "xAOD::TEvent::fill",
1558  XAOD_MESSAGE( "Failed to put dynamic auxiliary variables "
1559  "in the output for object \"%s\"" ),
1560  itr.first.c_str() );
1561  return 0;
1562  }
1563  }
1564 
1565  // Check if there were any unset objects:
1566  if( unsetObjects.size() ) {
1567  ::Error( "xAOD::TEvent::fill",
1568  XAOD_MESSAGE( "The following objects were not set in the "
1569  "current event: %s" ), unsetObjects.c_str() );
1570  return 0;
1571  }
1572 
1573  // Write the entry, and check the return value:
1574  const ::Int_t ret = m_outTree->Fill();
1575  if( ret <= 0 ) {
1576  ::Error( "xAOD::TEvent::fill",
1577  XAOD_MESSAGE( "Output tree filling failed with return "
1578  "value: %i" ), ret );
1579  }
1580 
1581  // Reset the object managers:
1582  Object_t::iterator ncitr = m_outputObjects.begin();
1583  Object_t::iterator ncend = m_outputObjects.end();
1584  for( ; ncitr != ncend; ++ncitr ) {
1585  ncitr->second->reset();
1586  }
1587 
1588  // Return the value:
1589  return ret;
1590  }

◆ finishWritingTo()

StatusCode xAOD::TEvent::finishWritingTo ( ::TFile *  file)
inherited

Finish writing to an output file.

This function needs to be called when the user is done writing events to a file, before (s)he would close the file itself.

Parameters
fileThe file that the event data is written to
Returns
kTRUE if successful, kFALSE otherwise

Definition at line 734 of file Control/xAODRootAccess/Root/TEvent.cxx.

734  {
735 
736  // A small sanity check:
737  if( ! m_outTree ) {
738  ::Error( "xAOD::TEvent::finishWritingTo",
739  XAOD_MESSAGE( "The object doesn't seem to be connected to an "
740  "output file!" ) );
741  return StatusCode::FAILURE;
742  }
743 
744  // Make sure we return to the current directory:
745  TDirectoryReset dr;
746 
747  // Notify the listeners that they should write out their metadata, if they
748  // have any.
749  const TIncident incident( IncidentType::MetaDataStop );
750  Listener_t::iterator l_itr = m_listeners.begin();
751  Listener_t::iterator l_end = m_listeners.end();
752  for( ; l_itr != l_end; ++l_itr ) {
753  ( *l_itr )->handle( incident );
754  }
755 
756  // Write out the event tree, and delete it:
757  m_outTree->AutoSave( "FlushBaskets" );
758  m_outTree->SetDirectory( 0 );
759  delete m_outTree;
760  m_outTree = 0;
761 
762  // Now go to the output file:
763  file->cd();
764 
765  // Check if there's already a metadata tree in the output:
766  if( file->Get( METADATA_TREE_NAME ) ) {
767  // Let's assume that the metadata is complete in the file already.
768  return StatusCode::SUCCESS;
769  }
770 
771  // Create the metadata tree:
772  ::TTree* metatree =
773  new ::TTree( METADATA_TREE_NAME, "xAOD metadata tree" );
774  metatree->SetAutoSave( 10000 );
775  metatree->SetAutoFlush( -30000000 );
776  metatree->SetDirectory( file );
777 
778  // Create the only branch in it:
779  metatree->Branch( "EventFormat",
780  SG::normalizedTypeinfoName( typeid( xAOD::EventFormat ) ).c_str(),
782 
783  // Create a copy of the m_outputMetaObjects variable. This is necessary
784  // because the putAux(...) function will modify this variable while we
785  // loop over it.
786  Object_t outputMetaObjects = m_outputMetaObjects;
787 
788  // Now loop over all the metadata objects that need to be put into the
789  // output file:
790  for( auto& object : outputMetaObjects ) {
791  // All metadata objects should be held by TObjectManager objects.
792  // Anything else is an error.
793  TObjectManager* mgr = dynamic_cast< TObjectManager* >( object.second );
794  if( ! mgr ) {
795  ::Error( "xAOD::TEvent::finishWritingTo",
796  XAOD_MESSAGE( "Internal logic error detected" ) );
797  return StatusCode::FAILURE;
798  }
799  // Select a split level depending on whether this is an interface or an
800  // auxiliary object:
801  const ::Int_t splitLevel = ( object.first.find( "Aux." ) ==
802  ( object.first.size() - 4 ) ? 1 : 0 );
803  // Create the new branch:
804  *( mgr->branchPtr() ) =
805  metatree->Branch( object.first.c_str(),
806  mgr->holder()->getClass()->GetName(),
807  mgr->holder()->getPtr(), 32000, splitLevel );
808  if( ! mgr->branch() ) {
809  ::Error( "xAOD::TEvent::finishWritingTo",
810  XAOD_MESSAGE( "Failed to create metadata branch "
811  "\"%s/%s\"" ),
812  mgr->holder()->getClass()->GetName(),
813  object.first.c_str() );
814  return StatusCode::FAILURE;
815  }
816  // Set up the saving of all the dynamic auxiliary properties
817  // of the object if it has any:
818  RETURN_CHECK( "xAOD::TEvent::finishWritingTo",
819  putAux( *metatree, *( object.second ), 32000, 0,
820  kTRUE ) );
821  }
822 
823  // Write the metadata objects:
824  if( metatree->Fill() <= 0 ) {
825  ::Error( "xAOD::TEvent::finishWritingTo",
826  XAOD_MESSAGE( "Failed to write event format metadata into "
827  "the output" ) );
828  metatree->SetDirectory( 0 );
829  delete metatree;
830  return StatusCode::FAILURE;
831  }
832 
833  // Now clean up:
834  metatree->Write();
835  metatree->SetDirectory( 0 );
836  delete metatree;
838  Object_t::iterator obj_itr = m_outputObjects.begin();
839  Object_t::iterator obj_end = m_outputObjects.end();
840  for( ; obj_itr != obj_end; ++obj_itr ) {
841  delete obj_itr->second;
842  }
843  m_outputObjects.clear();
844  obj_itr = m_outputMetaObjects.begin();
845  obj_end = m_outputMetaObjects.end();
846  for( ; obj_itr != obj_end; ++obj_itr ) {
847  delete obj_itr->second;
848  }
849  m_outputMetaObjects.clear();
850 
851  // Return gracefully:
852  return StatusCode::SUCCESS;
853  }

◆ getBranchInfo()

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

Get the object describing one object/branch.

Definition at line 268 of file TEventProxyDict.cxx.

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

◆ getEntries()

Long64_t xAOD::TEvent::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 1293 of file Control/xAODRootAccess/Root/TEvent.cxx.

1293  {
1294 
1295  if( m_inChain ) {
1296  return m_inChain->GetEntries();
1297  } else if( m_inTree ) {
1298  return m_inTree->GetEntries();
1299  } else if( m_inTreeMissing ) {
1300  // The input file is empty:
1301  return 0;
1302  } else {
1303  ::Error( "xAOD::TEvent::getEntries",
1304  XAOD_MESSAGE( "Function called on an uninitialised "
1305  "object" ) );
1306  return 0;
1307  }
1308  }

◆ getEntry()

Int_t xAOD::TEvent::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 1324 of file Control/xAODRootAccess/Root/TEvent.cxx.

1324  {
1325 
1326  // A little sanity check:
1327  if( ( ! m_inTree ) && ( ! m_inChain ) ) {
1328  ::Error( "xAOD::TEvent::getEntry",
1329  XAOD_MESSAGE( "Function called on an uninitialised "
1330  "object" ) );
1331  return -1;
1332  }
1333 
1334  // If we have a chain as input:
1335  if( m_inChain ) {
1336  // Make sure that the correct tree is loaded:
1337  const ::Long64_t fileEntry = m_inChain->LoadTree( entry );
1338  if( fileEntry < 0 ) {
1339  ::Error( "xAOD::TEvent::getEntry",
1340  XAOD_MESSAGE( "Failure in loading entry %i from the "
1341  "input chain" ),
1342  static_cast< int >( entry ) );
1343  return -1;
1344  }
1345  // Check if a new file was loaded:
1346  if( ( m_inTreeNumber != m_inChain->GetTreeNumber() ) ||
1348  // Reset the tracker:
1350  // Connect to this new file:
1351  m_inTreeNumber = m_inChain->GetTreeNumber();
1352  ::TFile* file = m_inChain->GetFile();
1353  // The useTreeCache parameter is set to false, since the cache
1354  // is anyway set up through the TChain. It shouldn't be modified
1355  // on the file level.
1356  if( ! readFrom( file, kFALSE, m_inChain->GetName() ) ) {
1357  ::Error( "xAOD::TEvent::getEntry",
1358  XAOD_MESSAGE( "Couldn't connect to input file #%i "
1359  "of the input chain" ), m_inTreeNumber );
1360  return -1;
1361  }
1362  }
1363  // Restore the previously received entry number.
1364  m_entry = fileEntry;
1365  }
1366  // If we have a regular file/tree as input:
1367  else {
1368  m_entry = entry;
1369  }
1370 
1371  // In order to make the reading of branches+tree cache work
1372  // NB: TTree::LoadTree() only set the entry that should be read for each branch
1373  // but no reading of the branch content is performed when calling that function.
1374  // The entry set that can be retrieved with
1375  // branch->GetTree()->GetReadEntry()
1376  // For friend trees, if an index was built, then the entry which is set for the related branches
1377  // is found by the LoadTree function by matching
1378  // the the major and minor values of the main tree and friend tree
1379  if( m_inTree && m_inTree->LoadTree( m_entry ) < 0 ) {
1380  ::Error( "xAOD::TEvent::getEntry",
1381  XAOD_MESSAGE( "Failure in loading entry %i from the input "
1382  "file" ), static_cast< int >( m_entry ) );
1383  return -1;
1384  }
1385 
1386  // Stats counter needs to know it's the next event:
1388 
1389  // If force-reading is not requested, we're done:
1390  if( ! getall ) {
1391 
1392  // Notify the listeners that a new event was loaded:
1393  const TIncident incident( IncidentType::BeginEvent );
1394  Listener_t::iterator l_itr = m_listeners.begin();
1395  Listener_t::iterator l_end = m_listeners.end();
1396  for( ; l_itr != l_end; ++l_itr ) {
1397  ( *l_itr )->handle( incident );
1398  }
1399 
1400  // No real reading was done:
1401  return 0;
1402  }
1403 
1404  // Loop over all input object managers, and force them to load their
1405  // content:
1406  ::Int_t result = 0;
1407  if( m_auxMode == kAthenaAccess ) {
1408  // In kAthenaAccess mode we need to use getInputObject(...) to load
1409  // all the input objects correctly.
1410  for( auto& inObj : m_inputObjects ) {
1411  static const std::string dynStorePostfix = "Aux.Dynamic";
1412  if( inObj.first.find( dynStorePostfix ) ==
1413  ( inObj.first.size() - dynStorePostfix.size() ) ) {
1414  // Ignore the dynamic store objects. They get loaded through
1415  // their parents.
1416  } else {
1417  // Load the objects and their auxiliary stores through the
1418  // getInputObject(...) function, which takes care of correctly
1419  // setting them up. The type is irrelevant here. We don't
1420  // really care about the exact type of the objects.
1421  getInputObject( inObj.first, typeid( int ), kTRUE, kFALSE );
1422  }
1423  }
1424  } else {
1425  // In a "reasonable" access mode, we do something very simple:
1426  for( auto& inObj : m_inputObjects ) {
1427  result += inObj.second->getEntry( getall );
1428  }
1429  }
1430 
1431  // Notify the listeners that a new event was loaded:
1432  const TIncident incident( IncidentType::BeginEvent );
1433  Listener_t::iterator l_itr = m_listeners.begin();
1434  Listener_t::iterator l_end = m_listeners.end();
1435  for( ; l_itr != l_end; ++l_itr ) {
1436  ( *l_itr )->handle( incident );
1437  }
1438 
1439  // Return the number of bytes read:
1440  return result;
1441  }

◆ getEventFormatElement()

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

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

Definition at line 351 of file TEventProxyDict.cxx.

351  {
352 
353  const xAOD::EventFormatElement* efe = 0;
354  static const bool QUIET = true;
355  if( m_outputEventFormat ) {
356  efe = m_outputEventFormat->get( sgkey, QUIET );
357  }
358  if( ! efe ) {
359  efe = m_inputEventFormat.get( sgkey, QUIET );
360  }
361  if ( ! efe ) {
362  static SG::SGKeySet missingSGKeys ATLAS_THREAD_SAFE;
363  static mutex_t mutex;
364  guard_t lock(mutex);
365  if( missingSGKeys.emplace( sgkey ).second ) {
367  ::Warning( "xAOD::TEvent::getEventFormatElement",
368  "Can't find EventFormatElement for hashed "
369  "SG key %d", sgkey );
370  }
371  return 0;
372  }
373  }
374  return efe;
375  }

◆ getFile()

Int_t xAOD::TEvent::getFile ( ::Long64_t  file,
::Int_t  getall = 0 
)
inherited

Load the first event for a given file from the input TChain.

This function can be used to iterate over the input files specified for the object.

It should be most useful for collecting metadata about a set of input files, if there's no regular event loop done to process them.

Parameters
fileThe file number to load
getallIf set to 1, all connected branches are loaded
Returns
The number of read bytes on success, or a negative number on failure

Definition at line 1472 of file Control/xAODRootAccess/Root/TEvent.cxx.

1472  {
1473 
1474  // Check if the file number is valid:
1475  if( ( file < 0 ) || ( file >= getFiles() ) ) {
1476  ::Error( "xAOD::TEvent::getFile",
1477  XAOD_MESSAGE( "Function called with invalid file number "
1478  "(%i)" ), static_cast< int >( file ) );
1479  return -1;
1480  }
1481 
1482  // If we are not reading a TChain, return at this point. As the one and
1483  // only file is open already...
1484  if( ! m_inChain ) {
1485  return 0;
1486  }
1487 
1488  // Trigger the "scanning" of the input files, so the TChain would know
1489  // how many entries are in the various files.
1490  getEntries();
1491 
1492  // Calculate which entry/event we need to load:
1493  ::Long64_t entry = 0;
1494  for( ::Long64_t i = 0; i < file; ++i ) {
1495  entry += m_inChain->GetTreeOffset()[ i ];
1496  }
1497 
1498  // Load this entry using the regular event opening function:
1499  return getEntry( entry, getall );
1500  }

◆ getFiles()

Long64_t xAOD::TEvent::getFiles ( ) const
inherited

Get how many files are available on the currently defined input.

This function can be used to get the number of input files that the object currently knows about.

This is meant to be used to collect the metadata from each of the input files, or to access the metadata using a transient tree. (xAOD::TMetaTree)

Returns
The number of input files when reading from a TChain, 1 when reading from a TFile, and 0 if the object is not connected to any input

Definition at line 1452 of file Control/xAODRootAccess/Root/TEvent.cxx.

1452  {
1453 
1454  if( m_inChain ) {
1455  return m_inChain->GetListOfFiles()->GetEntries();
1456  } else if( m_inTree || m_inTreeMissing ) {
1457  return 1;
1458  } else {
1459  return 0;
1460  }
1461  }

◆ getHash()

SG::sgkey_t xAOD::TEvent::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 1649 of file Control/xAODRootAccess/Root/TEvent.cxx.

1649  {
1650 
1651  // For empty keys let's finish quickly:
1652  if( key == "" ) return 0;
1653 
1654  // If the key is used in the input file, let's use the same hash for
1655  // the output file as well:
1656  if( m_inputEventFormat.exists( key ) ) {
1657  return m_inputEventFormat.get( key )->hash();
1658  }
1659 
1660  // If it's a new key, make a new hash for it from scratch:
1661  return Utils::hash( key );
1662  }

◆ getInputObject() [1/2]

const void * xAOD::TEvent::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 2180 of file Control/xAODRootAccess/Root/TEvent.cxx.

2183  {
2184 
2185  // Check if a name remapping should be applied or not:
2186  std::string keyToUse = key;
2187  auto remap_itr = m_nameRemapping.find( key );
2188  if( ( remap_itr != m_nameRemapping.end() ) &&
2189  ( ! m_inputEventFormat.exists( key ) ) &&
2190  m_inputEventFormat.exists( remap_itr->second ) ) {
2191  keyToUse = remap_itr->second;
2192  }
2193 
2194  // The following catches the cases when we ask for a transient
2195  // ConstDataVector object to be returned as "const DataVector".
2196  TStore* store = TActiveStore::store();
2197  if( store && store->contains( keyToUse, ti ) &&
2198  store->isConst( keyToUse, ti ) ) {
2199  const void* result = store->getConstObject( keyToUse, ti );
2200  return result;
2201  }
2202 
2203  // A sanity check before checking for an object from the input file:
2204  if( ( ( ! m_inTree ) || ( m_entry < 0 ) ) &&
2205  ( ! metadata ) ) {
2206  return 0;
2207  }
2208  if( ( ! m_inMetaTree ) && metadata ) {
2209  return 0;
2210  }
2211 
2212  // Make sure that the requested branch is connected to:
2213  if( metadata ) {
2214  if( ! connectMetaBranch( keyToUse, silent ).isSuccess() ) {
2215  return 0;
2216  }
2217  } else {
2218  if( ! connectBranch( keyToUse, silent ).isSuccess() ) {
2219  return 0;
2220  }
2221  }
2222 
2223  // Select which object container to use:
2224  Object_t& objects = ( metadata ?
2226 
2227  // Access the object's manager:
2228  Object_t::iterator itr = objects.find( keyToUse );
2229  if( itr == objects.end() ) {
2230  ::Fatal( "xAOD::TEvent::getInputObject",
2231  XAOD_MESSAGE( "There is an internal logic error in the "
2232  "code..." ) );
2233  return 0;
2234  }
2235 
2236  // This has to be an ObjectManager object:
2237  TObjectManager* mgr =
2238  dynamic_cast< TObjectManager* >( itr->second );
2239  if( ! mgr ) {
2240  if( key == keyToUse ) {
2241  ::Error( "xAOD::TEvent::getInputObject",
2242  XAOD_MESSAGE( "Object of wrong type found for key "
2243  "\"%s\"" ),
2244  key.c_str() );
2245  } else {
2246  ::Error( "xAOD::TEvent::getInputObject",
2247  XAOD_MESSAGE( "Object of wrong type found for key "
2248  "\"%s\"/\"%s\"" ), key.c_str(),
2249  keyToUse.c_str() );
2250  }
2251  return 0;
2252  }
2253 
2254  // Make sure that the current entry is loaded for event data objects:
2255  if( ! metadata ) {
2256  if( mgr->getEntry() ) {
2257  // Connect the auxiliary store to objects needing it. This call also
2258  // takes care of updating the dynamic store of auxiliary containers,
2259  // when they are getting accessed directly.
2260  if( ! setAuxStore( *mgr ).isSuccess() ) {
2261  ::Error( "xAOD::TEvent::getInputObject",
2262  XAOD_MESSAGE( "Failed to set the auxiliary store for "
2263  "%s/%s" ),
2264  mgr->holder()->getClass()->GetName(),
2265  keyToUse.c_str() );
2266  return 0;
2267  }
2268  }
2269  }
2270 
2271  // Ask the holder object for the object of this type:
2272  const void* result = mgr->holder()->getAsConst( ti, silent );
2273  if( ! result ) {
2274  if( ! silent ) {
2275  ::Warning( "xAOD::TEvent::getInputObject",
2276  "Could not retrieve object with key \"%s\" "
2277  "as \"%s\"", keyToUse.c_str(),
2278  Utils::getTypeName( ti ).c_str() );
2279  }
2280  return 0;
2281  }
2282 
2283  // We succeeded:
2284  return result;
2285  }

◆ getInputObject() [2/2]

const void * xAOD::TEvent::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 1938 of file Control/xAODRootAccess/Root/TEvent.cxx.

1940  {
1941 
1942  // Get a string name for this key:
1943  const std::string& name = getName( key );
1944  if( ( ! name.length() ) && ( ! silent ) ) {
1945  Warning( "xAOD::TEvent::getInputObject",
1946  "Key 0x%08x unknown", key );
1947  return 0;
1948  }
1949 
1950  // Forward the call to the function using an std::string key:
1951  return getInputObject( name, ti, silent );
1952  }

◆ getKey()

SG::sgkey_t xAOD::TEvent::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 1671 of file Control/xAODRootAccess/Root/TEvent.cxx.

1671  {
1672 
1673  // Make use of the getName function:
1674  return getHash( getName( obj ) );
1675  }

◆ getName() [1/2]

const std::string & xAOD::TEvent::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 1684 of file Control/xAODRootAccess/Root/TEvent.cxx.

1684  {
1685 
1686  // First look among the output objects:
1687  Object_t::const_iterator obj_itr = m_outputObjects.begin();
1688  Object_t::const_iterator obj_end = m_outputObjects.end();
1689  for( ; obj_itr != obj_end; ++obj_itr ) {
1690 
1691  // Check if this is our object:
1692  if( obj_itr->second->object() != obj ) continue;
1693 
1694  // If it is, let's return right away:
1695  return obj_itr->first;
1696  }
1697 
1698  // Now look among the input objects:
1699  obj_itr = m_inputObjects.begin();
1700  obj_end = m_inputObjects.end();
1701  for( ; obj_itr != obj_end; ++obj_itr ) {
1702 
1703  // Check if this is our object:
1704  if( obj_itr->second->object() != obj ) continue;
1705 
1706  // If it is, let's return:
1707  return obj_itr->first;
1708  }
1709 
1710  // If it's not there either, check if it's in an active TStore object:
1711  const TStore* store = TActiveStore::store();
1712  if( store && store->contains( obj ) ) {
1713  // Get the name from the store then:
1714  return store->getName( obj );
1715  }
1716 
1717  // We didn't find the object in the event...
1718  ::Warning( "xAOD::TEvent::getName",
1719  "Didn't find object with pointer %p in the event",
1720  obj );
1721  static const std::string dummy;
1722  return dummy;
1723  }

◆ getName() [2/2]

const std::string & xAOD::TEvent::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 1880 of file Control/xAODRootAccess/Root/TEvent.cxx.

1880  {
1881 
1882  // If the branch is known from the input:
1883  if( m_inputEventFormat.exists( hash ) ) {
1884  return m_inputEventFormat.get( hash )->branchName();
1885  }
1886 
1887  // If the branch is known on the output:
1888  if( m_outputEventFormat &&
1890  return m_outputEventFormat->get( hash )->branchName();
1891  }
1892 
1893  // If this is an object in the active store:
1894  const TStore* store = TActiveStore::store();
1895  if( store && store->contains( hash ) ) {
1896  return store->getName( hash );
1897  }
1898 
1899  // If it is unknown:
1900  static const std::string dummy;
1901  return dummy;
1902  }

◆ getNames()

void xAOD::TEvent::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 1725 of file Control/xAODRootAccess/Root/TEvent.cxx.

1727  {
1728  // The results go in here
1729  std::set<std::string> keys;
1730 
1731  // Get list of branches from
1732  // the input metadata tree or input tree
1733  std::vector<TObjArray*> fullListOfBranches = {};
1734  if (metadata){
1735  if (m_inMetaTree){
1736  // No friend tree expected for metadata tree
1737  // Only add the list of branches of the metadata tree
1738  ::Info("xAOD::TEvent::getNames", "scanning input objects");
1739  fullListOfBranches.push_back(m_inMetaTree->GetListOfBranches());
1740  }
1741  }
1742  else {
1743  if (m_inTree){
1744  ::Info("xAOD::TEvent::getNames", "scanning input objects");
1745  // Add the list of branches of the main tree
1746  fullListOfBranches.push_back(m_inTree->GetListOfBranches());
1747  // If input tree has friend trees
1748  // add as well the list of friend tree branches
1749  if (m_inTree->GetListOfFriends()){
1750  // Get the list of friends
1751  TList *fList = m_inTree->GetListOfFriends();
1752  // Loop over friend elements
1753  for (TObject * feObj : *fList){
1754  if (feObj){
1755  // Get corresponding friend tree
1756  TTree *friendTree = dynamic_cast<TFriendElement*>(feObj)->GetTree();
1757  // Add list of branches of the friend tree
1758  fullListOfBranches.push_back(friendTree->GetListOfBranches());
1759  }
1760  }
1761  }
1762  }
1763  }
1764 
1765  // Loop over all list of branches (if any)
1766  for (const TObjArray * in : fullListOfBranches){
1767  // Loop over all branches inside the current list of branches
1768  for ( Int_t index = 0; index < in->GetEntriesFast(); ++index ) {
1769  const TObject * obj = in->At(index);
1770  if ( ! obj ) continue;
1771  const TBranch * element = dynamic_cast<const TBranch*>(obj);
1772  if (!element) {
1773  ::Error("xAOD::TEvent::getNames", "Failure inspecting input objects");
1774  break;
1775  }
1776  std::string objClassName = element->GetClassName();
1777  std::string key = obj->GetName();
1778  ::Info("xAOD::TEvent::getNames",
1779  "Inspecting %s / %s",
1780  objClassName.c_str(), key.c_str());
1781  if (objClassName == targetClassName) {
1782  ::Info("xAOD::TEvent::getNames",
1783  "Matched %s to key %s",
1784  targetClassName.c_str(), key.c_str());
1785  keys.insert(key);
1786  }
1787  }
1788  }
1789 
1790  const Object_t& inAux = ( metadata ?
1792 
1793  ::Info("xAOD::TEvent::getNames",
1794  "scanning input Aux objects for %s", targetClassName.c_str());
1795  for( const auto& object : inAux ) {
1796  // All metadata objects should be held by TObjectManager objects.
1797  // Anything else is an error.
1798  TObjectManager* mgr = dynamic_cast< TObjectManager* >( object.second );
1799  if ( ! mgr ) continue;
1800  const std::string& objClassName = mgr->holder()->getClass()->GetName();
1801  const std::string& key = object.first;
1802  ::Info("xAOD::TEvent::getNames",
1803  "Inspecting %s / %s",
1804  objClassName.c_str(), key.c_str());
1805  if (objClassName == targetClassName) {
1806  ::Info("xAOD::TEvent::getNames",
1807  "Matched %s to key %s",
1808  targetClassName.c_str(), key.c_str());
1809  keys.insert(key);
1810  }
1811  }
1812 
1813 
1814  // check output objects
1815  TTree *tree = ( metadata ? nullptr : m_outTree );
1816  if (tree) {
1817  const TObjArray * out = tree->GetListOfBranches();
1818  ::Info("xAOD::TEvent::getNames", "scanning output objects");
1819 
1820  for ( Int_t index = 0; index < out->GetEntriesFast(); ++index ) {
1821  const TObject * obj = out->At(index);
1822  if ( ! obj ) continue;
1823  const TBranch * element = dynamic_cast<const TBranch*>(obj);
1824  if (!element) {
1825  ::Error("xAOD::TEvent::getNames", "Failure inspecting input objects");
1826  break;
1827  }
1828  std::string objClassName = element->GetClassName();
1829  std::string key = obj->GetName();
1830  ::Info("xAOD::TEvent::getNames",
1831  "Inspecting %s / %s",
1832  objClassName.c_str(), key.c_str());
1833  if (objClassName == targetClassName) {
1834  ::Info("xAOD::TEvent::getNames",
1835  "Matched %s to key %s",
1836  targetClassName.c_str(), key.c_str());
1837  keys.insert(key);
1838  }
1839  }
1840  } else {
1841  ::Info("xAOD::TEvent::getNames", "no output tree connected");
1842  }
1843 
1844 
1845  const Object_t& outAux = ( metadata ?
1847 
1848  // Search though EventFormat for entries where class matches the provided
1849  // typeName
1850  ::Info("xAOD::TEvent::getNames",
1851  "scanning output Aux objects for %s", targetClassName.c_str());
1852  for( const auto& object : outAux ) {
1853  // All metadata objects should be held by TObjectManager objects.
1854  // Anything else is an error.
1855  TObjectManager* mgr = dynamic_cast< TObjectManager* >( object.second );
1856  if ( ! mgr ) continue;
1857  const std::string& objClassName = mgr->holder()->getClass()->GetName();
1858  const std::string& key = object.first;
1859  ::Info("xAOD::TEvent::getNames",
1860  "Inspecting %s / %s",
1861  objClassName.c_str(), key.c_str());
1862  if (objClassName == targetClassName) {
1863  ::Info("xAOD::TEvent::getNames",
1864  "Matched %s to key %s",
1865  targetClassName.c_str(), key.c_str());
1866  keys.insert(key);
1867  }
1868  }
1869 
1870  vkeys.insert(vkeys.end(), keys.begin(), keys.end());
1871  }

◆ getOutputObject() [1/2]

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

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

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 2110 of file Control/xAODRootAccess/Root/TEvent.cxx.

2112  {
2113 
2114  // Select which object container to use:
2115  const Object_t& objects = ( metadata ?
2117 
2118  // Check if the object can be found:
2119  Object_t::const_iterator itr = objects.find( key );
2120  if( itr == objects.end() ) {
2121  // Do the following only for event data:
2122  if( ! metadata ) {
2123  // It's not in the event. Let's check if we find it in an active
2124  // TStore object...
2125  TStore* store = TActiveStore::store();
2126  if( ( ! store ) || ( ! store->contains( key, ti ) ) ||
2127  store->isConst( key, ti ) ) {
2128  // Nope, not there either...
2129  return 0;
2130  }
2131  // Let's return the object from the TStore:
2132  void* result = store->getObject( key, ti );
2133  return result;
2134  } else {
2135  // For metadata we don't use external resources.
2136  return 0;
2137  }
2138  }
2139 
2140  // If the object is not set in this event yet, we can't continue:
2141  if( ! itr->second->isSet() ) {
2142  return 0;
2143  }
2144 
2145  // If it does exist, check if it's the right kind of object:
2146  TObjectManager* mgr =
2147  dynamic_cast< TObjectManager* >( itr->second );
2148  if( ! mgr ) {
2149  ::Error( "xAOD::TEvent::getOutputObject",
2150  XAOD_MESSAGE( "Object of wrong type found for key \"%s\"" ),
2151  key.c_str() );
2152  return 0;
2153  }
2154 
2155  // Ask the holder object for the object of this type:
2156  void* result = mgr->holder()->getAs( ti );
2157  if( ! result ) {
2158  ::Warning( "xAOD::TEvent::getOutputObject",
2159  "Couldn't retrieve object as \"%s\"",
2160  Utils::getTypeName( ti ).c_str() );
2161  return 0;
2162  }
2163 
2164  // Return the object:
2165  return result;
2166  }

◆ getOutputObject() [2/2]

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

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

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 1914 of file Control/xAODRootAccess/Root/TEvent.cxx.

1915  {
1916 
1917  // Get a string name for this key:
1918  const std::string& name = getName( key );
1919  if( ! name.length() ) {
1920  return 0;
1921  }
1922 
1923  // Forward the call to the function using an std::string key:
1924  return getOutputObject( name, ti );
1925  }

◆ hasAuxStore()

Bool_t xAOD::TEvent::hasAuxStore ( const TObjectManager mgr)
staticprotectedinherited

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

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.

Parameters
mgrThe manager of the object that should be checked
Returns
kTRUE if the object can have an auxiliary store, kFALSE otherwise

Definition at line 3593 of file Control/xAODRootAccess/Root/TEvent.cxx.

3593  {
3594 
3595  // The classes whose children can have an auxiliary store attached
3596  // to them:
3597  static const TClass* const dvClass =
3598  ::TClass::GetClass( typeid( SG::AuxVectorBase ) );
3599  static const TClass* const aeClass =
3600  ::TClass::GetClass( typeid( SG::AuxElement ) );
3601 
3602  // Do the check:
3603  return ( mgr.holder()->getClass()->InheritsFrom( dvClass ) ||
3604  mgr.holder()->getClass()->InheritsFrom( aeClass ) );
3605  }

◆ hiveProxyDict()

IProxyDict * IProxyDict::hiveProxyDict ( )
overridevirtualinherited

Return the current event-slot-specific store.

The default version just returns this.

Implements IHiveStore.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 83 of file IProxyDict.cxx.

84 {
85  return this;
86 }

◆ initStats()

StatusCode xAOD::TEvent::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 1961 of file Control/xAODRootAccess/Root/TEvent.cxx.

1961  {
1962 
1963  // If we're dealing with an empty input file, stop here:
1964  if( m_inTreeMissing ) {
1965  return StatusCode::SUCCESS;
1966  }
1967 
1968  // A little sanity check:
1969  if( ! m_inTree ) {
1970  ::Error( "xAOD::TEvent::initStats",
1971  XAOD_MESSAGE( "Function called on an uninitialised "
1972  "object" ) );
1973  return StatusCode::FAILURE;
1974  }
1975 
1976  // Reset the number of input branches information:
1978 
1979  // Loop over the EventFormat information
1982  for( ; itr != end; ++itr ) {
1983 
1984  // Get the name of the branch in question:
1985  const std::string& branchName = itr->second.branchName();
1986 
1987  // If it's an auxiliary container, scan it using TAuxStore:
1988  if( branchName.find( "Aux." ) != std::string::npos ) {
1989 
1990  // But first decide whether it describes a container, or just
1991  // a single object. Since the file may have been written in
1992  // kBranchAccess mode, it's not necessarily a good idea to check
1993  // the type of the auxiliary class. So let's check the interface
1994  // class instead.
1995  //
1996  // Get the name of the interface object/container:
1997  const std::string intName =
1998  branchName.substr( 0, branchName.size() - 4 );
1999  if( ! m_inputEventFormat.exists( intName ) ) {
2000  // When this happens, it may still be that both the interface and
2001  // the auxiliary container is missing from the file. As we didn't
2002  // check yet whether the auxiliary container is in place or not.
2003  // So, before printing a warning, let's check for this.
2004  // Unfortunately the check is pretty expensive, but this should
2005  // not be performance critical code after all...
2006  ::Bool_t auxFound = kFALSE;
2007  const std::string dynName = Utils::dynBranchPrefix( branchName );
2008 
2009  std::vector<TObjArray*> fullListOfBranches = {};
2010  // Add the list of branches of the main tree
2011  fullListOfBranches.push_back(m_inTree->GetListOfBranches());
2012  // If input tree has friend trees
2013  // add as well the list of friend tree branches
2014  if (m_inTree->GetListOfFriends()){
2015  // Get the list of friends
2016  TList *fList = m_inTree->GetListOfFriends();
2017  // Loop over friend elements
2018  for (TObject * feObj : *fList){
2019  if (feObj){
2020  // Get corresponding friend tree
2021  TTree *friendTree = dynamic_cast<TFriendElement*>(feObj)->GetTree();
2022  // Add list of branches of the friend tree
2023  fullListOfBranches.push_back(friendTree->GetListOfBranches());
2024  }
2025  }
2026  }
2027 
2028  for (TObjArray* branches : fullListOfBranches){
2029  for( Int_t i = 0; i < branches->GetEntriesFast(); ++i ){
2030  if (!branches->At( i )) continue ;
2031 
2032  const TString name( branches->At( i )->GetName() );
2033  if( name.BeginsWith( branchName ) ||
2034  name.BeginsWith( dynName ) ) {
2035  auxFound = kTRUE;
2036  break;
2037  }
2038  }
2039  }
2040  if( auxFound ) {
2041  ::Warning( "xAOD::TEvent::initStats",
2042  "Couldn't find interface object/container "
2043  "\"%s\" belonging to branch \"%s\"",
2044  intName.c_str(), branchName.c_str() );
2045  }
2046  continue;
2047  }
2048 
2049  // Get the type of the interface:
2050  const EventFormatElement* el = m_inputEventFormat.get( intName );
2051  ::TClass* cl = ::TClass::GetClass( el->className().c_str() );
2052  if( ( ! cl ) || ( ! cl->IsLoaded() ) ) {
2053  ::Warning( "xAOD::TEvent::initStats",
2054  "Couldn't find dictionary for type \"%s\"",
2055  el->className().c_str() );
2056  continue;
2057  }
2058 
2059  // Get the dictionary for the DataVector base class:
2060  static const std::type_info& baseTi = typeid( SG::AuxVectorBase );
2061  static const std::string baseName =
2062  SG::normalizedTypeinfoName( baseTi );
2063  static ::TClass* const baseCl = ::TClass::GetClass( baseName.c_str() );
2064  if( ! baseCl ) {
2065  ::Error( "xAOD::TEvent::initStats",
2066  XAOD_MESSAGE( "Couldn't get dictionary for type "
2067  "\"%s\"" ), baseName.c_str() );
2068  return StatusCode::FAILURE;
2069  }
2070 
2071  // The type of the auxiliary store is finally deduced from the
2072  // inheritance of the interface container.
2074  ( cl->InheritsFrom( baseCl ) ? TAuxStore::kContainerStore :
2076 
2077  // Scan the branches using a temporary TAuxStore instance:
2078  TAuxStore temp( branchName.c_str(), kTRUE, mode );
2079  RETURN_CHECK( "xAOD::TEvent::initStats",
2080  temp.initStats( m_inTree ) );
2081  }
2082  // If it's an interface container:
2083  else {
2084  // Try to access the branch:
2085  const ::TBranch* container =
2086  m_inTree->GetBranch( branchName.c_str() );
2087  // If it exists, let's remember it:
2088  if( container ) {
2089  IOStats::instance().stats().container( branchName );
2090  }
2091  }
2092  }
2093 
2094  // Return gracefully:
2095  return StatusCode::SUCCESS;
2096  }

◆ inputEventFormat()

const EventFormat * xAOD::TEvent::inputEventFormat ( ) const
inherited

Get information about the input objects.

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

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 1603 of file Control/xAODRootAccess/Root/TEvent.cxx.

1603  {
1604 
1605  // If we *are* reading an input file:
1606  if( m_inTree || m_inTreeMissing ) {
1607  return &m_inputEventFormat;
1608  }
1609 
1610  // If not, let's complain:
1611  ::Warning( "xAOD::TEvent::inputEventFormat",
1612  "No input file is connected at the moment" );
1613  return 0;
1614  }

◆ isAuxStore()

Bool_t xAOD::TEvent::isAuxStore ( const TObjectManager mgr)
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
mgrThe manager of the object that should be checked
Returns
kTRUE if the object is an auxiliary store, kFALSE if it is not

Definition at line 3614 of file Control/xAODRootAccess/Root/TEvent.cxx.

3614  {
3615 
3616  // The classes whose children are considered auxiliary stores:
3617  static const TClass* const storeClass =
3618  ::TClass::GetClass( typeid( SG::IConstAuxStore ) );
3619  static const TClass* const storeHolderClass =
3620  ::TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
3621 
3622  // Do the check:
3623  return ( mgr.holder()->getClass()->InheritsFrom( storeClass ) ||
3624  mgr.holder()->getClass()->InheritsFrom( storeHolderClass ) );
3625  }

◆ isStandalone()

Bool_t xAOD::TEvent::isStandalone ( const TObjectManager mgr)
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
mgrThe manager 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 3637 of file Control/xAODRootAccess/Root/TEvent.cxx.

3637  {
3638 
3639  // The classes whose children can have an auxiliary store attached
3640  // to them:
3641  static const TClass* const dvClass =
3642  TClass::GetClass( typeid( SG::AuxVectorBase ) );
3643  static const TClass* const aeClass =
3644  TClass::GetClass( typeid( SG::AuxElement ) );
3645 
3646  // Do the check:
3647  if( mgr.holder()->getClass()->InheritsFrom( aeClass ) ) {
3648  return kTRUE;
3649  } else if( mgr.holder()->getClass()->InheritsFrom( dvClass ) ) {
3650  return kFALSE;
3651  }
3652 
3653  // Some logic error happened:
3654  ::Error( "xAOD::TEvent::isStandalone",
3655  XAOD_MESSAGE( "Received type (%s) that can't have an "
3656  "auxiliary store" ),
3657  mgr.holder()->getClass()->GetName() );
3658  return kFALSE;
3659  }

◆ 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::TEvent::keyToString ( SG::sgkey_t  key) const
overrideprotectedvirtualinherited

Find the string corresponding to a given key.

Implements IStringPool.

Definition at line 430 of file TEventProxyDict.cxx.

430  {
431 
432  return &( getName( key ) );
433  }

◆ keyToString() [2/2]

const std::string * xAOD::TEvent::keyToString ( SG::sgkey_t  key,
CLID clid 
) const
overrideprotectedvirtualinherited

Find the string and CLID corresponding to a given key.

Implements IStringPool.

Definition at line 435 of file TEventProxyDict.cxx.

435  {
436 
437  return &( getName( key ) );
438  }

◆ name()

const std::string & xAOD::TEvent::name ( ) const
overrideprotectedinherited

Get the name of the instance.

Definition at line 462 of file TEventProxyDict.cxx.

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

◆ outputEventFormat()

const EventFormat * xAOD::TEvent::outputEventFormat ( ) const
inherited

Get information about the output objects.

This function makes it possible for the user to investigate the content that is being written to the output file.

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

Returns
The event format object if a file is being written, or a null pointer if not.

Definition at line 1626 of file Control/xAODRootAccess/Root/TEvent.cxx.

1626  {
1627 
1628  // If we *are* reading an input file:
1629  if( m_outTree ) {
1630  return m_outputEventFormat;
1631  }
1632 
1633  // If not, let's complain:
1634  ::Warning( "xAOD::TEvent::outputEventFormat",
1635  "No output file is connected at the moment" );
1636  return 0;
1637  }

◆ printIOStats()

void xAOD::TEvent::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 347 of file Control/xAODRootAccess/Root/TEvent.cxx.

347  {
348 
349  // Simply do this via the xAODCore code:
350  IOStats::instance().stats().Print( "Summary" );
351 
352  return;
353  }

◆ printNameRemap()

void xAOD::TEvent::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 TEvent object.

Definition at line 1033 of file Control/xAODRootAccess/Root/TEvent.cxx.

1033  {
1034 
1035  // Print a header:
1036  ::Info( "xAOD::TEvent::printNameRemap", "Name remapping rules:" );
1037 
1038  // In case no remapping rules have been set:
1039  if( ! m_nameRemapping.size() ) {
1040  ::Info( "xAOD::TEvent::printNameRemap", " NONE" );
1041  return;
1042  }
1043 
1044  // Otherwise:
1045  for( auto itr = m_nameRemapping.begin(); itr != m_nameRemapping.end();
1046  ++itr ) {
1047  ::Info( "xAOD::TEvent::printNameRemap", " \"%s\" -> \"%s\"",
1048  itr->second.c_str(), itr->first.c_str() );
1049  }
1050 
1051  // Return gracefully:
1052  return;
1053  }

◆ proxies()

std::vector< const SG::DataProxy * > xAOD::TEvent::proxies ( ) const
overrideprotectedvirtualinherited

return the list of all current proxies in store

Implements IProxyDict.

Definition at line 411 of file TEventProxyDict.cxx.

411  {
412 
414 
415  std::vector< const SG::DataProxy* > ret;
416  for( const auto& p : m_branches ) {
417  const SG::DataProxy* proxy = p.second.m_proxy.get();
418  if( proxy ) {
419  ret.push_back( proxy );
420  }
421  }
422  return ret;
423  }

◆ proxy() [1/2]

SG::DataProxy * xAOD::TEvent::proxy ( const CLID id,
const std::string &  key 
) const
overrideprotectedvirtualinherited

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

Implements IProxyDict.

Definition at line 234 of file TEventProxyDict.cxx.

235  {
236 
237  const SG::sgkey_t sgkey = getHash( key );
238  if( ! sgkey ) {
239  return 0;
240  }
241  return proxy_exact( sgkey );
242  }

◆ proxy() [2/2]

SG::DataProxy * xAOD::TEvent::proxy ( const void *const  pTransient) const
overrideprotectedvirtualinherited

get proxy for a given data object address in memory

Implements IProxyDict.

Definition at line 206 of file TEventProxyDict.cxx.

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

◆ proxy_exact()

SG::DataProxy * xAOD::TEvent::proxy_exact ( SG::sgkey_t  sgkey) const
overrideprotectedvirtualinherited

Get proxy given a hashed key+clid.

Implements IProxyDict.

Definition at line 244 of file TEventProxyDict.cxx.

244  {
245 
246  // Get the object describing this branch/object:
247  const BranchInfo* bi = getBranchInfo( sgkey );
248  if( ! bi ) {
249  static SG::SGKeySet missingSGKeys ATLAS_THREAD_SAFE;
250  static mutex_t mutex;
251  guard_t lock(mutex);
252  if( missingSGKeys.emplace( sgkey ).second &&
254  ::Warning( "xAOD::TEvent::proxy_exact",
255  "Can't find BranchInfo for %d.",
256  sgkey );
257  }
258  return 0;
259  }
260 
261  // Access its data proxy:
262  SG::DataProxy* proxy = bi->m_proxy.get();
263 
264  // Return the proxy:
265  return proxy;
266  }

◆ putAux()

StatusCode xAOD::TEvent::putAux ( ::TTree &  outTree,
TVirtualManager vmgr,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 0,
::Bool_t  metadata = kFALSE 
)
protectedinherited

Function saving the dynamically created auxiliary properties.

This function is used internally to set up the writing of the auxiliary store variables that were dynamically created on an object.

(And not statically defined to be part of that object.)

Parameters
outTreeThe TTree to put the auxiliary branches into
mgrThe object manager of the output object
basketSizeSize of the buffer associated with the branches
splitLevelThe split level to use for the created branches
metadataFlag specifying whether the info written is metadata or not
Returns
kTRUE if the setup was successful, or kFALSE if it was not

Definition at line 3350 of file Control/xAODRootAccess/Root/TEvent.cxx.

3352  {
3353 
3354  // A little sanity check:
3355  assert( m_outputEventFormat != 0 );
3356 
3357  // Do the conversion:
3358  TObjectManager* mgr = dynamic_cast< TObjectManager* >( &vmgr );
3359  if( ! mgr ) {
3360  // It's not an error any more when we don't get a TObjectManager.
3361  return StatusCode::SUCCESS;
3362  }
3363 
3364  // Check if we need to do anything here:
3365  if( ! mgr->holder()->getClass()->InheritsFrom( "SG::IAuxStoreIO" ) ) {
3366  return StatusCode::SUCCESS;
3367  }
3368 
3369  // Get a pointer to the auxiliary store I/O interface:
3370  SG::IAuxStoreIO* aux =
3371  reinterpret_cast< SG::IAuxStoreIO* >(
3372  mgr->holder()->getAs( typeid( SG::IAuxStoreIO ) ) );
3373  if( ! aux ) {
3374  ::Fatal( "xAOD::TEvent::putAux",
3375  XAOD_MESSAGE( "There is a logic error in the code!" ) );
3376  }
3377 
3378  // Check if we have rules defined for which auxiliary properties
3379  // to write out:
3381  if( ! metadata ) {
3382  auto item_itr = m_auxItemList.find( mgr->branch()->GetName() );
3383  if( item_itr != m_auxItemList.end() ) {
3384  sel.selectAux( item_itr->second );
3385  }
3386  }
3387 
3388  // Get the dynamic auxiliary variables held by this object, which
3389  // were selected to be written:
3390  const SG::auxid_set_t auxids = sel.getSelectedAuxIDs (aux->getSelectedAuxIDs());
3391 
3392  // If there are no dynamic auxiliary variables in the object, return
3393  // right away:
3394  if( auxids.empty() ) {
3395  return StatusCode::SUCCESS;
3396  }
3397 
3398  // Decide what should be the prefix of all the dynamic branches:
3399  const std::string dynNamePrefix =
3400  Utils::dynBranchPrefix( mgr->branch()->GetName() );
3401 
3402  // Select which container to add the variables to:
3404 
3405  // This iteration will determine the ordering of branches within
3406  // the tree, so sort auxids by name.
3408  typedef std::pair< std::string, SG::auxid_t > AuxVarSort_t;
3409  std::vector< AuxVarSort_t > varsort;
3410  varsort.reserve( auxids.size() );
3411  for( SG::auxid_t id : auxids ) {
3412  varsort.emplace_back( r.getName( id ), id );
3413  }
3414  std::sort( varsort.begin(), varsort.end() );
3415 
3416  // Extract all the dynamic variables from the object:
3417  for( const auto& p : varsort ) {
3418 
3419  // The auxiliary ID:
3420  const SG::auxid_t id = p.second;
3421 
3422  // Construct a name for the branch that we will write:
3423  const std::string brName = dynNamePrefix + p.first;
3424 
3425  // Try to find the branch:
3426  Object_t::iterator bmgr = objects.find( brName );
3427 
3428  // Check if we already know about this variable:
3429  if( bmgr == objects.end() ) {
3430 
3431  // Construct the full type name of the variable:
3432  const std::type_info* brType = aux->getIOType( id );
3433  if( ! brType ) {
3434  ::Error( "xAOD::TEvent::putAux",
3435  XAOD_MESSAGE( "No I/O type found for variable %s" ),
3436  brName.c_str() );
3437  return StatusCode::FAILURE;
3438  }
3439  const std::string brTypeName =
3440  Utils::getTypeName( *brType );
3441  std::string brProperTypeName = "<unknown>";
3442 
3443  // The branch that will hopefully be created:
3444  ::TBranch* br = 0;
3445 
3446  // Check if it's a primitive type or not:
3447  if( strlen( brType->name() ) == 1 ) {
3448 
3449  // Making the "proper" type name is simple in this case:
3450  brProperTypeName = brTypeName;
3451 
3452  // Get the character describing this type for ROOT:
3453  const char rootType = Utils::rootType( brType->name()[ 0 ] );
3454  if( rootType == '\0' ) {
3455  ::Error( "xAOD::TEvent::putAux",
3456  XAOD_MESSAGE( "Type not known for variable \"%s\" "
3457  "of type \"%s\"" ),
3458  brName.c_str(), brTypeName.c_str() );
3459  return StatusCode::FAILURE;
3460  }
3461 
3462  // Create the full description of the variable for ROOT:
3463  std::ostringstream leaflist;
3464  leaflist << brName << "/" << rootType;
3465 
3466  // Let's create a holder for this property:
3467  THolder* hldr = new THolder( aux->getIOData( id ),
3468  0, kFALSE );
3469  TPrimitiveAuxBranchManager* auxmgr =
3470  new TPrimitiveAuxBranchManager( id, 0, hldr );
3471  objects[ brName ] = auxmgr;
3472 
3473  // ... and let's add it to the output TTree:
3474  *( auxmgr->branchPtr() ) =
3475  outTree.Branch( brName.c_str(), hldr->get(),
3476  leaflist.str().c_str(),
3477  basketSize );
3478  if( ! auxmgr->branch() ) {
3479  ::Error( "xAOD::TEvent::putAux",
3480  XAOD_MESSAGE( "Failed to create branch \"%s\" out "
3481  "of type \"%s\"" ),
3482  brName.c_str(), brProperTypeName.c_str() );
3483  // Clean up:
3484  *( auxmgr->holder()->getPtr() ) = 0;
3485  delete auxmgr;
3486  objects.erase( brName );
3487  return StatusCode::FAILURE;
3488  }
3489  br = auxmgr->branch();
3490 
3491  } else {
3492 
3493  // Check if we have a dictionary for this type:
3494  TClass* cl = TClass::GetClass( *brType, kTRUE, kTRUE );
3495  if( ! cl ) {
3496  // The dictionary needs to be loaded now. This could be an
3497  // issue. But let's hope for the best...
3498  cl = TClass::GetClass( brTypeName.c_str() );
3499  // If still not found...
3500  if( ! cl ) {
3501  ::Error( "xAOD::TEvent::putAux",
3502  XAOD_MESSAGE( "Dictionary not available for "
3503  "variable \"%s\" of type \"%s\"" ),
3504  brName.c_str(), brTypeName.c_str() );
3505  return StatusCode::FAILURE;
3506  }
3507  }
3508 
3509  // The proper type name comes from the dictionary in this case:
3510  brProperTypeName = cl->GetName();
3511 
3512  // Let's create a holder for this property:
3513  THolder* hldr = new THolder( aux->getIOData( id ),
3514  cl, kFALSE );
3515  TAuxBranchManager* auxmgr =
3516  new TAuxBranchManager( id, 0, hldr );
3517  objects[ brName ] = auxmgr;
3518 
3519  if (!cl->CanSplit() && strncmp (cl->GetName(), "SG::PackedContainer<", 20) == 0)
3520  splitLevel = 0;
3521 
3522  // ... and let's add it to the output TTree:
3523  *( auxmgr->branchPtr() ) =
3524  outTree.Branch( brName.c_str(),
3525  cl->GetName(),
3526  hldr->getPtr(), basketSize, splitLevel );
3527  if( ! auxmgr->branch() ) {
3528  ::Error( "xAOD::TEvent::putAux",
3529  XAOD_MESSAGE( "Failed to create branch \"%s\" out "
3530  "of type \"%s\"" ),
3531  brName.c_str(), brProperTypeName.c_str() );
3532  // Clean up:
3533  *( auxmgr->holder()->getPtr() ) = 0;
3534  delete auxmgr;
3535  objects.erase( brName );
3536  return StatusCode::FAILURE;
3537  }
3538  br = auxmgr->branch();
3539 
3540  }
3541 
3542  // If this is not the first event, fill up the already filled
3543  // events with (empty) content:
3544  if( outTree.GetEntries() ) {
3545  void* ptr = br->GetAddress();
3546  br->SetAddress( 0 );
3547  for( ::Long64_t i = 0; i < outTree.GetEntries(); ++i ) {
3548  br->Fill();
3549  }
3550  br->SetAddress( ptr );
3551  }
3552 
3553  // If all went fine, let's add this branch to the event format
3554  // metadata:
3555  if( ! m_outputEventFormat->exists( brName ) ) {
3557  EventFormatElement( brName,
3558  brProperTypeName,
3559  mgr->branch()->GetName(),
3560  getHash( brName ) ) );
3561  }
3562 
3563  // We don't need to do the rest:
3564  continue;
3565  }
3566 
3567  // Access the object manager:
3568  bmgr = objects.find( brName );
3569  if( bmgr == objects.end() ) {
3570  ::Fatal( "xAOD::TEvent::putAux",
3571  XAOD_MESSAGE( "There is an internal logic error in the "
3572  "code..." ) );
3573  }
3574 
3575  // Replace the managed object:
3576  void* nc_data ATLAS_THREAD_SAFE = // we hold non-const pointers but check on retrieve
3577  const_cast< void* >( static_cast< const void* >( aux->getIOData( id ) ) );
3578  bmgr->second->setObject( nc_data );
3579  }
3580 
3581  // Return gracefully:
3582  return StatusCode::SUCCESS;
3583  }

◆ queryInterface()

StatusCode xAOD::TEvent::queryInterface ( const InterfaceID &  ,
void **   
)
overrideprotectedinherited

Set the void** to the pointer to the requested interface of the instance.

Definition at line 468 of file TEventProxyDict.cxx.

468  {
469 
470  // Return without doing anything:
471  return StatusCode::SUCCESS;
472  }

◆ readFrom() [1/2]

StatusCode xAOD::TEvent::readFrom ( ::TFile *  file,
Bool_t  useTreeCache = kTRUE,
const char treeName = EVENT_TREE_NAME 
)
inherited

Connect the object to a new input file.

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
filePointer to the file being read
useTreeCacheFlag for turning on/off the usage of TTreeCache
treeNameName of the input tree
Returns
kTRUE if successful, kFALSE otherwise

Definition at line 364 of file Control/xAODRootAccess/Root/TEvent.cxx.

365  {
366 
367  // If no file was specified, return gracefully:
368  if( ! file ) return StatusCode::SUCCESS;
369 
370  // Clear the cached input objects:
371  Object_t::iterator itr = m_inputObjects.begin();
373  for( ; itr != end; ++itr ) {
374  delete itr->second;
375  }
376  m_inputObjects.clear();
377  m_inputMissingObjects.clear();
378  {
380  lock.upgrade();
381  m_branches.clear();
382  }
383 
384  // Clear the cached input meta-objects:
385  itr = m_inputMetaObjects.begin();
386  end = m_inputMetaObjects.end();
387  for( ; itr != end; ++itr ) {
388  delete itr->second;
389  }
390  m_inputMetaObjects.clear();
391 
392  // Reset the internal flags:
393  m_inTreeMissing = kFALSE;
394  m_entry = -1;
395 
396  // Make sure we return to the current directory:
397  TDirectoryReset dr;
398 
399  // Set up the file access tracer:
400  static TFileAccessTracer tracer ATLAS_THREAD_SAFE;
401  tracer.add( *file );
402 
403  // Look for the metadata tree:
404  m_inMetaTree =
405  dynamic_cast< ::TTree* >( file->Get( METADATA_TREE_NAME ) );
406  if( ! m_inMetaTree ) {
407  ::Error( "xAOD::TEvent::readFrom",
408  XAOD_MESSAGE( "Couldn't find metadata tree on input. Object "
409  "unusable!" ) );
410  return StatusCode::FAILURE;
411  }
412 
413  // Set metadata entry to be read
414  // NB: no reading is done calling LoadTree
415  if ( m_inMetaTree->LoadTree(0) < 0 ){
416  ::Error( "xAOD::TEvent::readFrom",
417  XAOD_MESSAGE( "Failed to load entry for metadata tree=%s" ),
418  m_inMetaTree->GetName() );
419  return StatusCode::FAILURE;
420  }
421 
422  // A sanity check:
423  if( m_inMetaTree->GetEntries() != 1 ) {
424  ::Info( "xAOD::TEvent::readFrom",
425  "Was expecting a metadata tree with size 1, instead of %i.",
426  static_cast< int >( m_inMetaTree->GetEntries() ) );
427  ::Info( "xAOD::TEvent::readFrom",
428  "File most probably produced by hadd..." );
429  }
430 
431  // Make sure that the xAOD::EventFormat dictonary is loaded.
432  // This may not be the case if streamer information reading is turned
433  // off.
434  static const std::string eventFormatTypeName =
435  Utils::getTypeName( typeid( EventFormat ) );
436  ::TClass* cl = ::TClass::GetClass( eventFormatTypeName.c_str() );
437  if( ! cl ) {
438  ::Warning( "xAOD::TEvent::readFrom",
439  "Couldn't load the EventFormat dictionary" );
440  }
441 
442  // Check if the EventFormat branch is available:
443  const std::string eventFormatBranchName =
444  Utils::getFirstBranchMatch( m_inMetaTree, "EventFormat");
445  if( ! m_inMetaTree->GetBranch( eventFormatBranchName.c_str() ) ) {
446  // This can happen when the file was produced by an Athena job that
447  // didn't have any input events itself. This means that the file
448  // doesn't actually have any useful metadata.
449  ::Info( "xAOD::TEvent::readFrom", "Input file provides no event or "
450  "metadata" );
451  m_inTree = 0;
452  m_inTreeMissing = kTRUE;
453  return StatusCode::SUCCESS;
454  }
455 
456  // Read in the event format object:
457  EventFormat* format = 0; ::TBranch* br = 0;
458  const Int_t status =
459  m_inMetaTree->SetBranchAddress( eventFormatBranchName.c_str(),
460  &format, &br );
461  if( status < 0 ) {
462  ::Error( "xAOD::TEvent::readFrom",
463  XAOD_MESSAGE( "Failed to connect to EventFormat object" ) );
464  return StatusCode::FAILURE;
465  }
466 
467  // Read in the object to our private member:
468  br->GetEntry( 0 );
470 
471  // This is a strange place. The object has to be deleted, as it is the
472  // responsibility of the user code to do so. But if I also explicitly
473  // tell the branch to forget about the address of the pointer, then
474  // all hell breaks loose...
475  delete format;
476 
477 
478  // List all the other Metadata trees in the input file
479  // Having several metatrees can happen for augmented files for instance
480  // as one metadata tree per stream is produced
481  std::set<std::string> lOtherMetaTreeNames = {};
482  TList *lKeys = file->GetListOfKeys();
483 
484  if (lKeys){
485  for (int iKey = 0; iKey < lKeys->GetEntries() ; iKey++){
486  // iterate over keys and add
487  std::string keyName = lKeys->At(iKey)->GetName();
488  // Make sure the key corresponds to a metadata tree but
489  // do not add the current metadata tree in the list of other trees
490  // and do not add the metadata tree handlers to the list
491  if ( (keyName != METADATA_TREE_NAME)
492  && (keyName.find("MetaData") != std::string::npos)
493  && !(keyName.find("MetaDataHdr") != std::string::npos)){
494  // Make sure key corresponds to a tree
495  const char *className = ((::TKey*)lKeys->At(iKey))->GetClassName();
496  static constexpr Bool_t LOAD = kFALSE;
497  static constexpr Bool_t SILENT = kTRUE;
498  ::TClass* cl = ::TClass::GetClass(className, LOAD, SILENT);
499  if ((cl != nullptr) && cl->InheritsFrom(::TTree::Class())){
500  // key is corresponding to a metadata tree
501  lOtherMetaTreeNames.insert(keyName);
502  }
503  }
504  }
505  }
506 
507  // Loop over the other metadata trees found (if any)
508  for (const std::string & metaTreeName : lOtherMetaTreeNames){
509  TTree *tmpMetaTree = dynamic_cast< ::TTree* >( file->Get( metaTreeName.c_str() ) );
510 
511  if (!tmpMetaTree){
512  // Skip tree if could not read it
513  ::Warning( "xAOD::TEvent::readFrom", "Could not read metadata tree=%s",metaTreeName.c_str());
514  continue;
515  }
516 
517  // Set metadata entry to be read
518  // NB: no reading is done calling LoadTree
519  if ( tmpMetaTree->LoadTree(0) < 0 ){
520  ::Error( "xAOD::TEvent::readFrom",
521  XAOD_MESSAGE( "Failed to load entry for metadata tree=%s" ),
522  tmpMetaTree->GetName() );
523  return StatusCode::FAILURE;
524  }
525 
526  // Check if the EventFormat branch is available:
527  const std::string tmpEventFormatBranchName =
528  Utils::getFirstBranchMatch( tmpMetaTree, "EventFormat");
529  if( ! tmpMetaTree->GetBranch( tmpEventFormatBranchName.c_str() ) ) {
530  // skip the additionnal metadata tree
531  ::Warning( "xAOD::TEvent::readFrom", "No EventFormat branch found in metadata tree=%s",tmpMetaTree->GetName() );
532  continue ;
533  }
534  // Read in the event format object:
535  EventFormat* tmpFormat = 0; ::TBranch* tmpBr = 0;
536  const Int_t status =
537  tmpMetaTree->SetBranchAddress( tmpEventFormatBranchName.c_str(),
538  &tmpFormat, &tmpBr );
539  if( status < 0 ) {
540  ::Error( "xAOD::TEvent::readFrom",
541  XAOD_MESSAGE( "Failed to connect to EventFormat object for metadata tree = %s"), tmpMetaTree->GetName() );
542  return StatusCode::FAILURE;
543  }
544  // Read in the object
545  tmpBr->GetEntry( 0 );
546  // read all objects contained in the event format
547  for (const std::pair<const std::string, xAOD::EventFormatElement> &evtElem : *tmpFormat){
548  // if element is not existing
549  // then add it to the private event format member
550  if (!m_inputEventFormat.exists(evtElem.first)){
551  m_inputEventFormat.add(evtElem.second);
552  }
553  }
554  delete tmpFormat;
555  }
556 
557  // Look for the event tree in the input file:
558  m_inTree = dynamic_cast< ::TTree* >( file->Get( treeName ) );
559  if( ! m_inTree ) {
560  // This is no longer an error condition. As it can happen for DxAODs
561  // that don't have any events in them. But they still have metadata
562  // that needs to be collected.
563  m_inTreeMissing = kTRUE;
564  }
565 
566  // Turn on the cache if requested:
567  if( m_inTree && useTreeCache && ( ! m_inTree->GetCacheSize() ) ) {
568  m_inTree->SetCacheSize( CACHE_SIZE );
569  m_inTree->SetCacheLearnEntries( 10 );
570  }
571 
572  // Init the statistics collection:
573  RETURN_CHECK( "xAOD::TEvent::readFrom", initStats() );
574  // Update the event counter in the statistics object:
576  if( m_inTree ) {
577  stats.setNEvents( stats.nEvents() + m_inTree->GetEntries() );
578  }
579 
580  // Notify the listeners that a new file was opened:
581  const TIncident beginIncident( IncidentType::BeginInputFile );
582  for( TVirtualIncidentListener* listener : m_listeners ) {
583  listener->handle( beginIncident );
584  }
585  // For now implement a very simple scheme in which we claim already
586  // at the start that the entire file was processed. Since we have no way
587  // of ensuring that the user indeed does this. And we can't delay calling
588  // this function, as the user may likely close his/her output file before
589  // closing the last opened input file.
590  const TIncident endIncident( IncidentType::EndInputFile );
591  for( TVirtualIncidentListener* listener : m_listeners ) {
592  listener->handle( endIncident );
593  }
594 
595  // The initialisation was successful:
596  return StatusCode::SUCCESS;
597  }

◆ readFrom() [2/2]

StatusCode xAOD::TEvent::readFrom ( ::TTree *  tree,
Bool_t  useTreeCache = kTRUE 
)
inherited

Connect the object to a new input tree/chain.

This version of the function sets up the object to read information from a tree/chain.

Using it with a TTree pointer makes not much sense, but using it with a TChain pointer could be a very valid usage mode.

Parameters
treeThe pointer to a TTree or a TChain
useTreeCacheFlag for switching TTreeCache usage on/off
Returns
kTRUE if successful, kFALSE when not

Definition at line 607 of file Control/xAODRootAccess/Root/TEvent.cxx.

607  {
608 
609  // Remember the info:
610  m_inTree = 0;
611  m_inTreeMissing = kFALSE;
612  m_inChain = dynamic_cast< ::TChain* >( tree );
613  m_inMetaTree = 0;
614 
615  if( m_inChain ) {
616 
617  // Set up the caching on the chain level. The individual trees of the
618  // input files will get a cache set up automatically after this.
619  if( useTreeCache && ( ! m_inChain->GetCacheSize() ) ) {
620  m_inChain->SetCacheSize( CACHE_SIZE );
621  m_inChain->SetCacheLearnEntries( 10 );
622  }
623 
624  // Explicitly open the first file of the chain. To correctly auto-load
625  // the dictionaries necessary. This doesn't happen automatically with
626  // some ROOT versions...
627  const TObjArray* files = m_inChain->GetListOfFiles();
628  if( ! files ) {
629  ::Error( "xAOD::TEvent::readFrom",
630  XAOD_MESSAGE( "Couldn't get the list of files from the "
631  "input TChain" ) );
632  return StatusCode::FAILURE;
633  }
634  if( ! files->GetEntries() ) {
635  ::Error( "xAOD::TEvent::readFrom",
636  XAOD_MESSAGE( "No files are present in the received "
637  "TChain" ) );
638  return StatusCode::FAILURE;
639  }
640  const ::TChainElement* chEl =
641  dynamic_cast< const ::TChainElement* >( files->At( 0 ) );
642  if( ! chEl ) {
643  ::Error( "xAOD::TEvent::readFrom",
644  XAOD_MESSAGE( "Couldn't cast object to TChainElement" ) );
645  return StatusCode::FAILURE;
646  }
647  ::TFile* dummyFile = ::TFile::Open( chEl->GetTitle() );
648  if( ! dummyFile ) {
649  ::Error( "xAOD::TEvent::readFrom",
650  XAOD_MESSAGE( "Couldn't open file %s" ),
651  chEl->GetTitle() );
652  return StatusCode::FAILURE;
653  }
654  delete dummyFile;
655 
656  // Set up a tracker for the chain:
657  if( ! m_inChainTracker ) {
658  m_inChainTracker = new TChainStateTracker();
659  }
661  tree->SetNotify( m_inChainTracker );
662 
663  // Stop at this point. The first file will be opened when the user
664  // asks for the first event. Otherwise we open the first file of the
665  // chain multiple times.
666  m_inTreeNumber = -1;
667  return StatusCode::SUCCESS;
668 
669  } else {
670 
671  // If it's a simple TTree, then let's fully initialise the object
672  // using its file:
673  m_inTreeNumber = -1;
674  if( m_inChainTracker ) {
675  delete m_inChainTracker;
676  m_inChainTracker = 0;
677  }
678  ::TFile* file = tree->GetCurrentFile();
679  return readFrom( file, useTreeCache, tree->GetName() );
680 
681  }
682  }

◆ record() [1/5]

StatusCode xAOD::TPyEvent::record ( int  dummy,
void *  obj,
const std::string &  key,
const std::string &  type,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 0 
)

Add an output object to the event.

This function is designed to be callable from PyROOT in order to record hand-made containers into an output file.

Notice that unline TEvent::record(...), this function doesn't take ownership of the object that's given to it. That's because all objects created by the Python interpreter are garbage collected by the Python interpreter. And we don't want to run into double-deletes.

Parameters
dummyNecessary to make sure that this function's signature is distinct from xAOD::TEvent::record. So that PyROOT would not mistake them for each other.
objTypeless pointer to the object that is to be recorded
keyThe key with which the object is to be recorded
typeThe type name of the object being recorded
basketSizeThe size of the baskets used to write the payload
splitLevelThe split level of the branch created
Returns
The usual StatusCode types

Definition at line 79 of file TPyEvent.cxx.

82  {
83 
84  // Simply forward the call to the base class:
85  RETURN_CHECK( "xAOD::TPyEvent::record",
86  TEvent::record( obj, type, key, basketSize, splitLevel,
87  kFALSE, kFALSE, kFALSE ) );
88  // Return gracefully:
89  return StatusCode::SUCCESS;
90  }

◆ record() [2/5]

template<typename T >
StatusCode xAOD::TEvent::record ( std::unique_ptr< T >  obj,
const std::string &  key,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 0 
)
inherited

Add an output object to the event, explicitly taking ownership of it.

◆ record() [3/5]

template<typename T >
StatusCode xAOD::TEvent::record ( T *  obj,
const std::string &  key,
::Int_t  basketSize = 32000,
::Int_t  splitLevel = 0 
)
inherited

Add an output object to the event.

◆ record() [4/5]

StatusCode xAOD::TEvent::record ( TAuxStore store,
const std::string &  key,
::Int_t  basketSize,
::Int_t  splitLevel,
::Bool_t  ownsStore = kFALSE 
)
protectedinherited

Internal function for adding an auxiliary store object to the output.

This function is used internally when copying an object with its auxiliary store from the input file, and branch access mode is activated for the event object.

The assumption is that the store object already knows what prefix it should be using. The key parameter only specifies under what ID the object should be handled in the output object list.

Parameters
storeThe store object to connect to the output
keyThe "key" with which to record the object
basketSizeThe basket size of the output branches
splitLevelThe split level of the output branches
Returns
kTRUE if the operation was successful, or kFALSE if it was not

Definition at line 2468 of file Control/xAODRootAccess/Root/TEvent.cxx.

2470  {
2471 
2472  // Check if we have an output tree:
2473  if( ! m_outTree ) {
2474  ::Error( "xAOD::TEvent::record",
2475  XAOD_MESSAGE( "No output tree defined. Did you forget to "
2476  "call writeTo(...)?" ) );
2477  return StatusCode::FAILURE;
2478  }
2479 
2480  // Check if we have a filtering rule for this key:
2481  const std::set< std::string >* filter = 0;
2482  auto filter_itr = m_auxItemList.find( key );
2483  if( filter_itr != m_auxItemList.end() ) {
2484  filter = &( filter_itr->second );
2485  }
2486 
2487  // Check if we need to add it to the event record:
2488  Object_t::iterator vitr = m_outputObjects.find( key );
2489  if( vitr == m_outputObjects.end() ) {
2490 
2491  // Configure the object for variable filtering:
2492  if( filter ) {
2493  store->selectAux( *filter );
2494  }
2495  // Tell the object where to write its contents:
2496  RETURN_CHECK( "xAOD::TEvent::record", store->writeTo( m_outTree ) );
2497  // Record it to the output list:
2498  TAuxManager* mgr = new TAuxManager( store, ownsStore );
2499  m_outputObjects[ key ] = mgr;
2500 
2501  // We're done:
2502  return StatusCode::SUCCESS;
2503  }
2504 
2505  // Check if the output has the right store:
2506  if( vitr->second->object() == store ) {
2507  // We're done already:
2508  return StatusCode::SUCCESS;
2509  }
2510 
2511  // If not, update the output manager. This can happen when we copy
2512  // objects from the input to the output files, and we process
2513  // multiple input files.
2514 
2515  // Check if the output manager is of the right type:
2516  TAuxManager* mgr = dynamic_cast< TAuxManager* >( vitr->second );
2517  if( ! mgr ) {
2518  ::Error( "xAOD::TEvent::record",
2519  XAOD_MESSAGE( "Output object with key %s already exists, "
2520  "and is not of type TAuxStore" ),
2521  key.c_str() );
2522  return StatusCode::FAILURE;
2523  }
2524 
2525  // Configure the object for variable filtering:
2526  if( filter ) {
2527  store->selectAux( *filter );
2528  }
2529 
2530  // Connect the auxiliary store to the output tree:
2531  RETURN_CHECK( "xAOD::TEvent::record", store->writeTo( m_outTree ) );
2532 
2533  // Update the manager:
2534  mgr->setObject( store );
2535 
2536  // Return gracefully:
2537  return StatusCode::SUCCESS;
2538  }

◆ record() [5/5]

StatusCode xAOD::TEvent::record ( void *  obj,
const std::string &  typeName,
const std::string &  key,
::Int_t  basketSize,
::Int_t  splitLevel,
::Bool_t  overwrite = kFALSE,
::Bool_t  metadata = kFALSE,
::Bool_t  isOwner = kTRUE 
)
inherited

Internal function for recording an object into the output.

This is the function doing the heavy lifting when recording a new object into the output tree/file.

It makes sure that the object is saved together with all of its dynamic auxiliary data if it has any.

Parameters
objA typeless pointer to the object that we want to record
typeNameThe type name of the output object
keyThe key (branch name) of the object to record
basketSizeThe basket size of the output branch
splitLevelThe split level of the output branch
overwriteFlag selecting if it is allowed to overwrite an already existing object (used internally)
metadataFlag selecting if we are writing an event or a metadata object
isOwnerFlag selecting if we should take ownership of the object or not
Returns
kTRUE if the operation was successful, or kFALSE if it was not

Definition at line 2305 of file Control/xAODRootAccess/Root/TEvent.cxx.

2309  {
2310 
2311  // Check if we have an output tree:
2312  if( ! m_outTree ) {
2313  ::Error( "xAOD::TEvent::record",
2314  XAOD_MESSAGE( "No output tree defined. Did you forget to "
2315  "call writeTo(...)?" ) );
2316  return StatusCode::FAILURE;
2317  }
2318  assert( m_outputEventFormat != 0 );
2319 
2320  // If this is metadata, just take ownership of it. The object will only
2321  // be recorded into the output file when calling finishWritingTo(...).
2322  if( metadata ) {
2323  // Check whether we already have such an object:
2324  if( ( ! overwrite ) &&
2325  ( m_outputMetaObjects.find( key ) !=
2326  m_outputMetaObjects.end() ) ) {
2327  ::Error( "xAOD::TEvent::record",
2328  XAOD_MESSAGE( "Meta-object %s/%s already recorded" ),
2329  typeName.c_str(), key.c_str() );
2330  return StatusCode::FAILURE;
2331  }
2332  // Check if we have a dictionary for this object:
2333  TClass* cl = TClass::GetClass( typeName.c_str() );
2334  if( ! cl ) {
2335  ::Error( "xAOD::TEvent::record",
2336  XAOD_MESSAGE( "Didn't find dictionary for type: %s" ),
2337  typeName.c_str() );
2338  return StatusCode::FAILURE;
2339  }
2340  // Let's create a holder for the object:
2341  THolder* hldr = new THolder( obj, cl, isOwner );
2342  TObjectManager* mgr =
2343  new TObjectManager( 0, hldr, m_auxMode == kAthenaAccess );
2345  // We're done. The rest will be done later on.
2346  return StatusCode::SUCCESS;
2347  }
2348 
2349  // Check if we accessed this object on the input. If yes, then this
2350  // key may not be used for recording.
2351  if( ( ! overwrite ) &&
2352  ( m_inputObjects.find( key ) != m_inputObjects.end() ) ) {
2353  ::Error( "xAOD::TEvent::record",
2354  XAOD_MESSAGE( "Object %s/%s already accessed from the input, "
2355  "can't be overwritten in memory" ),
2356  typeName.c_str(), key.c_str() );
2357  return StatusCode::FAILURE;
2358  }
2359 
2360  // Override the default 0 split level with a split level of 1 for
2361  // auxiliary container objects.
2362  if( ( splitLevel == 0 ) &&
2363  ( key.find( "Aux." ) == ( key.size() - 4 ) ) ) {
2364  splitLevel = 1;
2365  }
2366 
2367  // Check if we need to add it to the event record:
2368  Object_t::iterator vitr = m_outputObjects.find( key );
2369  if( vitr == m_outputObjects.end() ) {
2370 
2371  // Check if we have a dictionary for this object:
2372  TClass* cl = TClass::GetClass( typeName.c_str() );
2373  if( ! cl ) {
2374  ::Error( "xAOD::TEvent::record",
2375  XAOD_MESSAGE( "Didn't find dictionary for type: %s" ),
2376  typeName.c_str() );
2377  return StatusCode::FAILURE;
2378  }
2379 
2380  // Check if this is a new object "type" or not:
2381  if( ! m_outputEventFormat->exists( key ) ) {
2382  m_outputEventFormat->add( EventFormatElement( key, cl->GetName(),
2383  "", getHash( key ) ) );
2384  }
2385 
2386  // Let's create a holder for the object:
2387  THolder* hldr = new THolder( obj, cl, isOwner );
2388  TObjectManager* mgr =
2389  new TObjectManager( 0, hldr, m_auxMode == kAthenaAccess );
2390  m_outputObjects[ key ] = mgr;
2391 
2392  // ... and let's add it to the output TTree:
2393  *( mgr->branchPtr() ) =
2394  m_outTree->Branch( key.c_str(), cl->GetName(),
2395  hldr->getPtr(), basketSize, splitLevel );
2396  if( ! mgr->branch() ) {
2397  ::Error( "xAOD::TEvent::record",
2398  XAOD_MESSAGE( "Failed to create branch \"%s\" out of "
2399  "type \"%s\"" ),
2400  key.c_str(), cl->GetName() );
2401  // Clean up:
2402  hldr->setOwner( kFALSE );
2403  delete mgr;
2404  return StatusCode::FAILURE;
2405  }
2406 
2407  // Set up the saving of all the dynamic auxiliary properties
2408  // of the object if it has any:
2409  RETURN_CHECK( "xAOD::TEvent::record",
2410  putAux( *m_outTree, *mgr, basketSize, splitLevel,
2411  kFALSE ) );
2412 
2413  // Return at this point, as we don't want to run the rest of
2414  // the function's code:
2415  return StatusCode::SUCCESS;
2416  }
2417 
2418  // Access the object manager:
2419  TObjectManager* omgr = dynamic_cast< TObjectManager* >( vitr->second );
2420  if( ! omgr ) {
2421  ::Error( "xAOD::TEvent::record",
2422  XAOD_MESSAGE( "Manager object of the wrong type "
2423  "encountered" ) );
2424  return StatusCode::FAILURE;
2425  }
2426 
2427  // Check that the type of the object matches that of the previous
2428  // object:
2429  if( typeName != omgr->holder()->getClass()->GetName() ) {
2430  // This may still be, when the ROOT dictionary name differs from the
2431  // "simple type name" known to C++. So let's get the ROOT name of the
2432  // new type:
2433  TClass* cl = TClass::GetClass( typeName.c_str() );
2434  if( ( ! cl ) || ::strcmp( cl->GetName(),
2435  omgr->holder()->getClass()->GetName() ) ) {
2436  ::Error( "xAOD::TEvent::record",
2437  XAOD_MESSAGE( "For output key \"%s\" the previous type "
2438  "was \"%s\", the newly requested type is "
2439  "\"%s\"" ),
2440  key.c_str(), omgr->holder()->getClass()->GetName(),
2441  typeName.c_str() );
2442  return StatusCode::FAILURE;
2443  }
2444  }
2445 
2446  // Replace the managed object:
2447  omgr->setObject( obj );
2448 
2449  // Replace the auxiliary objects:
2450  return putAux( *m_outTree, *omgr, basketSize, splitLevel, kFALSE );
2451  }

◆ recordAux()

SG::IAuxStore * xAOD::TEvent::recordAux ( const std::string &  key,
SG::IAuxStoreHolder::AuxStoreType  type = SG::IAuxStoreHolder::AST_ContainerStore,
Int_t  basketSize = 32000,
Int_t  splitLevel = 0 
)
inherited

Add an auxiliary store object to the output.

This function can be used to create/retrieve a ROOT-specific auxiliary object container that can be used to write information in the output file.

Any auxiliary information written this way will however only be readable in ROOT, using the kBranchAccess option.

Parameters
keyThe name/prefix of the auxiliary store object/branches
typeThe type of the auxiliary store (object/container)
basketSizeSize of the baskets created by the store object
splitLevelThe split level of the branches created by the store
Returns
An auxiliary store object that will write to the output

Definition at line 1066 of file Control/xAODRootAccess/Root/TEvent.cxx.

1068  {
1069 
1070  // A sanity check:
1071  if( ! m_outTree ) {
1072  ::Error( "xAOD::TEvent::recordAux",
1073  XAOD_MESSAGE( "No output tree given to the object" ) );
1074  return 0;
1075  }
1076 
1077  // Check for an object with this name in the output list:
1078  Object_t::iterator itr = m_outputObjects.find( key );
1079  if( itr == m_outputObjects.end() ) {
1080  // Create one if if it doesn't exist yet...
1081  // Translate the store type:
1083  switch( type ) {
1086  break;
1089  break;
1090  default:
1091  ::Error( "xAOD::TEvent::recordAux",
1092  XAOD_MESSAGE( "Unknown store type (%i) requested" ),
1093  static_cast< int >( type ) );
1094  return 0;
1095  }
1096  // Create and record the object:
1097  TAuxStore* store = new TAuxStore( key.c_str(), kTRUE, mode,
1098  basketSize, splitLevel );
1099  if( record( store, key, basketSize, splitLevel, kTRUE ).isFailure() ) {
1100  ::Error( "xAOD::TEvent::recordAux",
1101  XAOD_MESSAGE( "Couldn't connect TAuxStore object to the "
1102  "output" ) );
1103  delete store;
1104  return 0;
1105  }
1106  // Update the iterator:
1107  itr = m_outputObjects.find( key );
1108  }
1109 
1110  // A security check:
1111  if( itr == m_outputObjects.end() ) {
1112  ::Error( "xAOD::TEvent::recordAux",
1113  XAOD_MESSAGE( "Internal logic error detected" ) );
1114  return 0;
1115  }
1116 
1117  // Check that it is of the right type:
1118  TAuxManager* mgr = dynamic_cast< TAuxManager* >( itr->second );
1119  if( ! mgr ) {
1120  ::Error( "xAOD::TEvent::recordAux",
1121  XAOD_MESSAGE( "Object of non-TAuxStore type registered "
1122  "with key \"%s\"" ), key.c_str() );
1123  return 0;
1124  }
1125 
1126  // Extract the pointer out of it:
1127  TAuxStore* store = mgr->getStore();
1128 
1129  // Give it to the user:
1130  return store;
1131  }

◆ recordMeta() [1/2]

template<typename T >
StatusCode xAOD::TEvent::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::TEvent::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::TEvent::recordObject ( SG::DataObjectSharedPtr< DataObject >  obj,
const std::string &  key,
bool  allowMods,
bool  returnExisting 
)
overrideprotectedvirtualinherited

Record an object in the store.

Implements IProxyDict.

Definition at line 445 of file TEventProxyDict.cxx.

446  {
447 
448  throw std::runtime_error( "xAOD::TEvent::recordObject is not "
449  "implemented" );
450  }

◆ registerKey()

void xAOD::TEvent::registerKey ( SG::sgkey_t  key,
const std::string &  str,
CLID  clid 
)
overrideprotectedvirtualinherited

Remember an additional mapping from key to string/CLID.

Implements IStringPool.

Definition at line 440 of file TEventProxyDict.cxx.

440  {
441 
442  return;
443  }

◆ release()

long unsigned int xAOD::TEvent::release ( )
overrideprotectedinherited

Release Interface instance.

Definition at line 457 of file TEventProxyDict.cxx.

457  {
458 
459  return 0;
460  }

◆ removeListener()

StatusCode xAOD::TEvent::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 946 of file Control/xAODRootAccess/Root/TEvent.cxx.

946  {
947 
948  // Find the pointer if we can...
950  m_listeners.end(), listener );
951 
952  // If we didn't find it:
953  if( itr == m_listeners.end() ) {
954  ::Error( "xAOD::TEvent::removeListener",
955  XAOD_MESSAGE( "Listener %p not known" ),
956  static_cast< void* >( listener ) );
957  return StatusCode::FAILURE;
958  }
959 
960  // Remove it:
961  m_listeners.erase( itr );
962 
963  // Return gracefully:
964  return StatusCode::SUCCESS;
965  }

◆ retrieve() [1/4]

template<typename T >
StatusCode xAOD::TEvent::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::TEvent::retrieve ( T *&  obj,
const std::string &  key 
)
inherited

Retrieve an output object from the event.

◆ retrieveMetaInput()

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

Retrieve an input metadata object.

◆ retrieveMetaOutput() [1/2]

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

Retrieve an output metadata object.

◆ retrieveMetaOutput() [2/2]

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

Retrieve an output metadata object.

◆ setActive()

void xAOD::TEvent::setActive ( ) const
inherited

Set this event object as the currently active one.

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

This function helps the user with setting this up.

Definition at line 860 of file Control/xAODRootAccess/Root/TEvent.cxx.

860  {
861 
862  // The active event and current store are thread-local globals:
863  TEvent* nc_this ATLAS_THREAD_SAFE = const_cast<TEvent*>(this);
864 
865  TActiveEvent::setEvent( static_cast<TVirtualEvent*>( nc_this ) );
866 
867 #ifndef XAOD_STANDALONE
869 #endif // not XAOD_STANDALONE
870 
871  // Return gracefully:
872  return;
873  }

◆ setAuxItemList()

void xAOD::TEvent::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 882 of file Control/xAODRootAccess/Root/TEvent.cxx.

883  {
884 
885  // Decoded attributes:
886  std::set< std::string > attributes;
887 
888  // Split up the received string using "." as the separator:
889  if( itemList.size() ) {
890  std::stringstream ss( itemList );
891  std::string attr;
892  while( std::getline( ss, attr, '.' ) ) {
893  attributes.insert( attr );
894  }
895  }
896 
897  // Remember the setting:
898  m_auxItemList[ containerKey ] = attributes;
899 
900  return;
901  }

◆ setAuxStore()

StatusCode xAOD::TEvent::setAuxStore ( TObjectManager 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 3172 of file Control/xAODRootAccess/Root/TEvent.cxx.

3173  {
3174 
3175  // Check if we need to do anything:
3176  if( ( ! hasAuxStore( mgr ) ) && ( ! isAuxStore( mgr ) ) ) {
3177  return StatusCode::SUCCESS;
3178  }
3179 
3180  // Get the branch name of the object in question:
3181  const std::string key = mgr.branch()->GetName();
3182 
3183  // Select which object container to use:
3184  Object_t& objects = ( metadata ?
3186 
3187 
3188  // Look up the auxiliary object's manager:
3189  TVirtualManager* auxMgr = nullptr;
3190  std::string auxKey;
3191  if( isAuxStore( mgr ) ) {
3192  auxMgr = &mgr;
3193  auxKey = key;
3194  } else {
3195  auto itr = objects.find( key + "Aux." );
3196  if( itr == objects.end() ) {
3197  // Apparently there's no auxiliary object for this DV, so let's
3198  // give up:
3199  return StatusCode::SUCCESS;
3200  }
3201  auxMgr = itr->second;
3202  auxKey = key + "Aux.";
3203  }
3204 
3205  if( ! metadata ) {
3206  // Make sure the auxiliary object is up to date:
3207  ::Int_t readBytes = auxMgr->getEntry();
3208 
3209  // Check if there is a separate auxiliary object for the dynamic
3210  // variables:
3211  const std::string dynAuxKey = auxKey + "Dynamic";
3212  auto dynAuxMgr = objects.find( dynAuxKey );
3213 
3214  if( ( dynAuxMgr != objects.end() ) &&
3215  ( readBytes || ( m_auxMode == kAthenaAccess ) ||
3216  ( auxMgr == &mgr ) ) ) {
3217  // Do different things based on the access mode:
3218  if( m_auxMode != kAthenaAccess ) {
3219  // In "normal" access modes just tell the dynamic store object
3220  // to switch to a new event.
3221  dynAuxMgr->second->getEntry();
3222  } else {
3223  // In "Athena mode" this object has already been deleted when
3224  // the main auxiliary store object was switched to the new
3225  // event. So let's re-create it:
3226  xAOD::TObjectManager& auxMgrRef =
3227  dynamic_cast< xAOD::TObjectManager& >( *auxMgr );
3228  RETURN_CHECK( "xAOD::TEvent::setAuxStore",
3229  setUpDynamicStore( auxMgrRef,
3230  ( metadata ?
3231  m_inMetaTree :
3232  m_inTree ) ) );
3233  // Now tell the newly created dynamic store object which event
3234  // it should be looking at:
3235  auto dynAuxMgr = objects.find( dynAuxKey );
3236  if( dynAuxMgr == objects.end() ) {
3237  ::Error( "xAOD::TEvent::setAuxStore",
3238  XAOD_MESSAGE( "Internal logic error detected" ) );
3239  return StatusCode::FAILURE;
3240  }
3241  dynAuxMgr->second->getEntry();
3242  }
3243  }
3244  }
3245 
3246  // Stop here if we've set up an auxiliary store.
3247  if( auxMgr == &mgr ) {
3248  return StatusCode::SUCCESS;
3249  }
3250 
3251  // Access the auxiliary base class of the object/vector:
3252  SG::AuxVectorBase* vec = 0;
3253  SG::AuxElement* aux = 0;
3254  switch( mgr.holder()->typeKind() ) {
3255  case THolder::DATAVECTOR:
3256  {
3257  void* vvec = mgr.holder()->getAs( typeid( SG::AuxVectorBase ) );
3258  vec = reinterpret_cast< SG::AuxVectorBase* >( vvec );
3259  }
3260  break;
3261  case THolder::AUXELEMENT:
3262  {
3263  void* vaux = mgr.holder()->getAs( typeid( SG::AuxElement ) );
3264  aux = reinterpret_cast< SG::AuxElement* >( vaux );
3265  }
3266  break;
3267  default:
3268  break;
3269  }
3270 
3271  // Check whether index tracking is enabled for the type. If not, then
3272  // we need to fix it...
3273  if( vec && ( ! vec->trackIndices() ) ) {
3274  forceTrackIndices( *vec );
3275  }
3276 
3277  // Check if we were successful:
3278  if( ( ! vec ) && ( ! aux ) ) {
3279  ::Fatal( "xAOD::TEvent::setAuxStore",
3280  XAOD_MESSAGE( "Couldn't access class \"%s\" as "
3281  "SG::AuxVectorBase or SG::AuxElement" ),
3282  mgr.holder()->getClass()->GetName() );
3283  }
3284 
3285  // Get the auxiliary store object:
3286  const SG::IConstAuxStore* store = 0;
3287  if( m_auxMode == kBranchAccess ) {
3288  // Get the concrete auxiliary manager:
3289  TAuxManager* amgr = dynamic_cast< TAuxManager* >( auxMgr );
3290  if( ! amgr ) {
3291  ::Fatal( "xAOD::TEvent::setAuxStore",
3292  XAOD_MESSAGE( "Auxiliary manager for \"%s\" is not of the "
3293  "right type" ), auxKey.c_str() );
3294  return StatusCode::FAILURE;
3295  }
3296  store = amgr->getConstStore();
3297  // If the store still doesn't know its type, help it now:
3298  if( amgr->getStore()->structMode() == TAuxStore::kUndefinedStore ) {
3299  const TAuxStore::EStructMode mode = ( vec ?
3302  RETURN_CHECK( "xAOD::TEvent::setAuxStore",
3303  amgr->getStore()->setStructMode( mode ) );
3304  }
3305  } else if( m_auxMode == kClassAccess || m_auxMode == kAthenaAccess ) {
3306  // Get the concrete auxiliary manager:
3307  TObjectManager* omgr =
3308  dynamic_cast< TObjectManager* >( auxMgr );
3309  if( ! omgr ) {
3310  ::Fatal( "xAOD::TEvent::setAuxStore",
3311  XAOD_MESSAGE( "Auxiliary manager for \"%s\" is not of the "
3312  "right type" ), auxKey.c_str() );
3313  return StatusCode::FAILURE;
3314  }
3315  void* p = omgr->holder()->getAs( typeid( SG::IConstAuxStore ) );
3316  store = reinterpret_cast< const SG::IConstAuxStore* >( p );
3317  }
3318  if( ! store ) {
3319  ::Fatal( "xAOD::TEvent::setAuxStore",
3320  XAOD_MESSAGE( "Logic error detected in the code" ) );
3321  }
3322 
3323  // Connect the two:
3324  if( vec ) {
3325  vec->setStore( store );
3326  } else if( aux ) {
3327  aux->setStore( store );
3328  } else {
3329  ::Fatal( "xAOD::TEvent::setAuxStore",
3330  XAOD_MESSAGE( "Logic error detected in the code" ) );
3331  }
3332 
3333  // We succeeded:
3334  return StatusCode::SUCCESS;
3335  }

◆ setPrintEventProxyWarnings()

void xAOD::TEvent::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 3697 of file Control/xAODRootAccess/Root/TEvent.cxx.

3697  {
3699  }

◆ setUpDynamicStore()

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

Function adding dynamic variable reading capabilities to an auxiliary store object.

This function is used by connectBranch(...) and 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 3088 of file Control/xAODRootAccess/Root/TEvent.cxx.

3088  {
3089 
3090  // Check if we can call setName(...) on the object:
3091  ::TMethodCall setNameCall;
3092  // Don't use this code in Athena access mode. And just accept that access
3093  // monitoring is disabled in this case...
3094  if( m_auxMode != kAthenaAccess ) {
3095  setNameCall.InitWithPrototype( mgr.holder()->getClass(),
3096  "setName", "const char*" );
3097  if( setNameCall.IsValid() ) {
3098  // Yes, there is such a function. Let's call it with the branch
3099  // name:
3100  const ::TString params =
3101  ::TString::Format( "\"%s\"", mgr.branch()->GetName() );
3102  const char* charParams = params.Data();
3103  setNameCall.Execute( mgr.holder()->get(), charParams );
3104  } else {
3105  // This is weird. What sort of auxiliary container is this? :-/
3106  ::Warning( "xAOD::TEvent::setUpDynamicStore",
3107  "Couldn't find setName(...) function for container %s "
3108  " (type: %s)",
3109  mgr.branch()->GetName(),
3110  mgr.holder()->getClass()->GetName() );
3111  }
3112  }
3113 
3114  // Check if we can switch out the internal store of this object:
3115  static const TClass* const holderClass =
3116  TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
3117  if( ! mgr.holder()->getClass()->InheritsFrom( holderClass ) ) {
3118  // Nope... So let's just end the journey here.
3119  return StatusCode::SUCCESS;
3120  }
3121 
3122  // Try to get the object as an IAuxStoreHolder:
3123  SG::IAuxStoreHolder* storeHolder =
3124  reinterpret_cast< SG::IAuxStoreHolder* >(
3125  mgr.holder()->getAs( typeid( SG::IAuxStoreHolder ) ) );
3126  if( ! storeHolder ) {
3127  ::Fatal( "xAOD::TEvent::setUpDynamicStore",
3128  XAOD_MESSAGE( "There's a logic error in the code" ) );
3129  return StatusCode::FAILURE;
3130  }
3131 
3132  // Create a TAuxStore instance that will read the dynamic variables
3133  // of this container. Notice that the TAuxManager doesn't own the
3134  // TAuxStore object. It will be owned by the SG::IAuxStoreHolder
3135  // object.
3136  TAuxStore* store =
3137  new TAuxStore( mgr.branch()->GetName(), kFALSE,
3138  ( storeHolder->getStoreType() ==
3142  // This object is used to read data from the input, it needs to be
3143  // locked:
3144  store->lock();
3145  TAuxManager* amgr = new TAuxManager( store, kFALSE );
3146  m_inputObjects[ std::string( mgr.branch()->GetName() ) +
3147  "Dynamic" ] = amgr;
3148  RETURN_CHECK( "xAOD::TEvent::setUpDynamicStore",
3149  store->readFrom( tree ) );
3150  // Tell the auxiliary store which entry to use. This is essential for
3151  // metadata objects, and non-important for event data objects, which will
3152  // get a possibly different entry loaded in setAuxStore(...).
3153  store->getEntry( 0 );
3154 
3155  // Give this object to the store holder:
3156  storeHolder->setStore( store );
3157 
3158  // Return gracefully:
3159  return StatusCode::SUCCESS;
3160  }

◆ sourceID()

SG::SourceID IProxyDict::sourceID ( const std::string &  key = "EventSelector") const
virtualinherited

Return the metadata source ID for the current event slot.

Parameters
keySG key of the DataHeader to query. Returns an empty string if no source has been set.

The default version always returns an empty string.

Reimplemented in StoreGateSvc, and SGImplSvc.

Definition at line 97 of file IProxyDict.cxx.

98 {
99  return SG::SourceID();
100 }

◆ stringToKey()

SG::sgkey_t xAOD::TEvent::stringToKey ( const std::string &  str,
CLID  clid 
)
overrideprotectedvirtualinherited

Find the string corresponding to a given key.

Implements IStringPool.

Definition at line 425 of file TEventProxyDict.cxx.

425  {
426 
427  return getHash( str );
428  }

◆ transientContains() [1/3]

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

Function checking if an object is already in memory.

◆ transientContains() [2/3]

Bool_t xAOD::TPyEvent::transientContains ( const std::string &  key,
const std::string &  type 
) const

Function checking if an object is already in memory.

Definition at line 37 of file TPyEvent.cxx.

38  {
39 
40  // Try to access the dictionary of this type:
41  ::TClass* cl = ::TClass::GetClass( type.c_str() );
42  if( ! cl ) {
43  ::Warning( "xAOD::TPyEvent::transientContains",
44  "Type name \"%s\" not known", type.c_str() );
45  return kFALSE;
46  }
47 
48  // Check if the dictionary can return a type_info:
49  const std::type_info* ti = cl->GetTypeInfo();
50  if( ! ti ) {
51  ::Warning( "xAOD::TPyEvent::transientContains",
52  "Type \"%s\" doesn't have a proper dictionary",
53  type.c_str() );
54  return kFALSE;
55  }
56 
57  // Let the base class do the work:
58  return TEvent::transientContains( key, *ti, kFALSE );
59  }

◆ transientContains() [3/3]

Bool_t xAOD::TEvent::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 3690 of file Control/xAODRootAccess/Root/TEvent.cxx.

3692  {
3693 
3694  return getOutputObject( key, ti, metadata );
3695  }

◆ transientContainsMeta()

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

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

◆ tryELRemap()

bool IProxyDict::tryELRemap ( sgkey_t  sgkey_in,
size_t  index_in,
sgkey_t sgkey_out,
size_t &  index_out 
)
virtualinherited

Test to see if the target of an ElementLink has moved.

Parameters
sgkey_inOriginal hashed key of the EL.
index_inOriginal index of the EL.
sgkey_out[out]New hashed key for the EL.
index_out[out]New index for the EL.
Returns
True if there is a remapping; false otherwise.

The default implementation here always returns false.

Reimplemented in StoreGateSvc, SGImplSvc, SGTest::TestStore, SimpleView, and SG::View.

Definition at line 48 of file IProxyDict.cxx.

50 {
51  return false;
52 }

◆ unboundHandle()

void IProxyDict::unboundHandle ( IResetable handle)
virtualinherited

Tell the store that a handle has been unbound from a proxy.

Parameters
handleThe handle that was unbound. The default implementation does nothing.

Reimplemented in SGImplSvc, SGTest::TestStore, SimpleView, and SG::View.

Definition at line 33 of file IProxyDict.cxx.

34 {
35 }

◆ writeTo()

StatusCode xAOD::TEvent::writeTo ( ::TFile *  file,
Int_t  autoFlush = 200,
const char treeName = EVENT_TREE_NAME 
)
inherited

Connect the object to an output file.

This function should be called on a file opened be the user, before any event processing would occur.

It sets up the output event tree.

Parameters
fileThe file that the event data should be written to
autoFlushThe auto-flush setting to use on the output TTree
treeNameName of the output event tree
Returns
kTRUE if successful, kFALSE otherwise

Definition at line 692 of file Control/xAODRootAccess/Root/TEvent.cxx.

693  {
694 
695  // Just a simple security check:
696  if( ! file ) {
697  ::Error( "xAOD::TEvent::writeTo",
698  XAOD_MESSAGE( "Null pointer given to the function!" ) );
699  return StatusCode::FAILURE;
700  }
701 
702  // Check that the object is in the "right state":
703  if( m_outTree ) {
704  ::Error( "xAOD::TEvent::writeTo",
705  XAOD_MESSAGE( "Object already writing to a file. Close that "
706  "file first!" ) );
707  return StatusCode::FAILURE;
708  }
709 
710  // Make sure we return to the current directory:
711  TDirectoryReset dr;
712 
713  // Create the output TTree:
714  file->cd();
715  m_outTree = new ::TTree( treeName, "xAOD event tree" );
716  m_outTree->SetDirectory( file );
717  m_outTree->SetAutoSave( 1000000 );
718  m_outTree->SetAutoFlush( autoFlush );
719 
720  // Access the EventFormat object associated with this file:
723 
724  // Return gracefully:
725  return StatusCode::SUCCESS;
726  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

SG::SGKeyMap< BranchInfo > m_branches xAOD::TEvent::ATLAS_THREAD_SAFE
mutableprotectedinherited

Map from hashed sgkey to BranchInfo.

Definition at line 494 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ CACHE_SIZE

const ::Int_t xAOD::TEvent::CACHE_SIZE = -1
staticprotectedinherited

Size of a possible TTreeCache (30 MB)

Definition at line 419 of file Control/xAODRootAccess/xAODRootAccess/TEvent.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_TREE_NAME

const char *const xAOD::TEvent::EVENT_TREE_NAME = "CollectionTree"
staticprotectedinherited

Name of the event tree.

Definition at line 421 of file Control/xAODRootAccess/xAODRootAccess/TEvent.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::TEvent::m_auxItemList
protectedinherited

Rules for selecting which auxiliary branches to write.

Definition at line 466 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_auxMode

EAuxMode xAOD::TEvent::m_auxMode
protectedinherited

The auxiliary access mode.

Definition at line 426 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_branchesMutex

upgrade_mutex_t xAOD::TEvent::m_branchesMutex
mutableprotectedinherited

◆ m_entry

::Long64_t xAOD::TEvent::m_entry
protectedinherited

The entry to look at from the input tree.

Definition at line 442 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inChain

::TChain* xAOD::TEvent::m_inChain
protectedinherited

The (optional) chain provided as input.

Definition at line 434 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inChainTracker

TChainStateTracker* xAOD::TEvent::m_inChainTracker
protectedinherited

Optional object for tracking the state changes of an input TChain.

Definition at line 436 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inMetaTree

::TTree* xAOD::TEvent::m_inMetaTree
protectedinherited

Pointer to the metadata tree in the input file.

Definition at line 440 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inputEventFormat

EventFormat xAOD::TEvent::m_inputEventFormat
protectedinherited

Format of the current input file.

Definition at line 461 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inputMetaObjects

Object_t xAOD::TEvent::m_inputMetaObjects
protectedinherited

Collection of all the managed input meta-objects.

Definition at line 456 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inputMissingObjects

std::set< std::string > xAOD::TEvent::m_inputMissingObjects
protectedinherited

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

Definition at line 451 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inputObjects

Object_t xAOD::TEvent::m_inputObjects
protectedinherited

Collection of all the managed input objects.

Definition at line 448 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inTree

::TTree* xAOD::TEvent::m_inTree
protectedinherited

The main tree that we are reading from.

Definition at line 429 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inTreeMissing

::Bool_t xAOD::TEvent::m_inTreeMissing
protectedinherited

Internal status flag showing that an input file is open, but it doesn't contain an event tree.

Definition at line 432 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inTreeNumber

::Int_t xAOD::TEvent::m_inTreeNumber
protectedinherited

The number of the currently open tree in the input chain.

Definition at line 438 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_listeners

Listener_t xAOD::TEvent::m_listeners
protectedinherited

Listeners who should be notified when certain incidents happen.

Definition at line 469 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_nameRemapping

std::unordered_map< std::string, std::string > xAOD::TEvent::m_nameRemapping
protectedinherited

Container name re-mapping rules.

Definition at line 472 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_outputEventFormat

EventFormat* xAOD::TEvent::m_outputEventFormat
protectedinherited

Format of the current output file.

Definition at line 463 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_outputMetaObjects

Object_t xAOD::TEvent::m_outputMetaObjects
protectedinherited

Collection of all the managed output meta-objects.

Definition at line 458 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_outputObjects

Object_t xAOD::TEvent::m_outputObjects
protectedinherited

Collection of all the managed output object.

Definition at line 453 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_outTree

::TTree* xAOD::TEvent::m_outTree
protectedinherited

The tree that we are writing to.

Definition at line 445 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_printEventProxyWarnings

Bool_t xAOD::TEvent::m_printEventProxyWarnings = true
protectedinherited

Option to silence common warnings that seem to be harmless.

Definition at line 475 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ METADATA_TREE_NAME

const char *const xAOD::TEvent::METADATA_TREE_NAME = "MetaData"
staticprotectedinherited

Name of the metadata tree.

Definition at line 423 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.


The documentation for this class was generated from the following files:
xAOD::TEvent::m_inTreeNumber
::Int_t m_inTreeNumber
The number of the currently open tree in the input chain.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:438
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::TEvent::m_nameRemapping
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:472
xAOD::EventFormat_v1::end
const_iterator end() const
STL-like function for getting the end of the container.
Definition: EventFormat_v1.cxx:163
beamspotman.r
def r
Definition: beamspotman.py:676
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
common.sgkey
def sgkey(tool)
Definition: common.py:1028
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
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
xAOD::TEvent::proxy_exact
SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
Definition: TEventProxyDict.cxx:244
RETURN_CHECK
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Definition: ReturnCheck.h:26
StoreGateSvc::contains
bool contains(const TKEY &key) const
Look up a keyed object in TDS (compare also tryRetrieve) returns false if object not available in TDS...
xAOD::TEvent::name
const std::string & name() const override
Get the name of the instance.
Definition: TEventProxyDict.cxx:462
xAOD::TEvent::m_auxMode
EAuxMode m_auxMode
The auxiliary access mode.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:426
xAOD::TEvent::kUndefinedAccess
@ kUndefinedAccess
Undefined, to be selected by the object.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:99
checkxAOD.brName
brName
Definition: Tools/PyUtils/bin/checkxAOD.py:113
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
get_generator_info.result
result
Definition: get_generator_info.py:21
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::IAuxStoreHolder::getStoreType
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:56
vtune_athena.format
format
Definition: vtune_athena.py:14
xAOD::TEvent::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: Control/xAODRootAccess/Root/TEvent.cxx:1938
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
xAOD::IOStats::stats
ReadStats & stats()
Access the object belonging to the current thread.
Definition: IOStats.cxx:17
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:49
CP::OutOfValidityAction::SILENT
@ SILENT
don't print anything and return success
xAOD::TActiveEvent::setEvent
static void setEvent(TVirtualEvent *ptr)
Set the active event pointer.
Definition: TActiveEvent.cxx:21
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:446
xAOD::TEvent::getOutputObject
void * getOutputObject(SG::sgkey_t key, const std::type_info &ti) override
Function for retrieving an output object in a non-template way.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1914
xAOD::THolder::DATAVECTOR
@ DATAVECTOR
A DataVector container.
Definition: THolder.h:105
xAOD::TEvent::kAthenaAccess
@ kAthenaAccess
Access containers/objects like Athena does.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:98
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
xAOD::TEvent::m_outTree
::TTree * m_outTree
The tree that we are writing to.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:445
xAOD::TEvent::m_inChain
::TChain * m_inChain
The (optional) chain provided as input.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:434
xAOD::TEvent::putAux
StatusCode putAux(::TTree &outTree, TVirtualManager &mgr, ::Int_t basketSize=32000, ::Int_t splitLevel=0, ::Bool_t metadata=kFALSE)
Function saving the dynamically created auxiliary properties.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:3350
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::ReadStats::Print
void Print(::Option_t *option="") const
Print information about the collected statistics.
skel.it
it
Definition: skel.GENtoEVGEN.py:424
SG::TransientAddress
Definition: TransientAddress.h:32
xAOD::TEvent::m_inputObjects
Object_t m_inputObjects
Collection of all the managed input objects.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:448
SG::CurrentEventStore::setStore
static IProxyDict * setStore(IProxyDict *store)
Set the current store.
Definition: CurrentEventStore.cxx:36
downloadSingle.dataType
string dataType
Definition: downloadSingle.py:18
xAOD::TActiveStore::store
static TStore * store()
Access the currently active TStore object.
Definition: TActiveStore.cxx:16
xAOD::ReadStats::container
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
xAOD::EventFormatElement
Class describing one branch of the ROOT file.
Definition: EventFormatElement.h:39
xAOD::TEvent::copy
StatusCode copy(const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
Copy an object directly from the input to the output.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1143
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:12
atn_test_sgProducerConsumerDataPool_jobOptions.end
end
Definition: atn_test_sgProducerConsumerDataPool_jobOptions.py:25
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
xAOD::TAuxStore::EStructMode
EStructMode
"Structural" modes of the object
Definition: TAuxStore.h:53
xAOD::EventFormatElement::branchName
const std::string & branchName() const
Get the branch/key name.
Definition: EventFormatElement.cxx:30
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:97
xAOD::TEvent::stringToKey
SG::sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the string corresponding to a given key.
Definition: TEventProxyDict.cxx:425
SG::IAuxStoreIO::getIOType
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
xAOD::TEvent::m_inMetaTree
::TTree * m_inMetaTree
Pointer to the metadata tree in the input file.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:440
xAOD::EventFormatElement::hash
sgkey_t hash() const
Get the hash belonging to this branch/key.
Definition: EventFormatElement.cxx:48
SG::IAuxStoreIO
Interface providing I/O for a generic auxiliary store.
Definition: IAuxStoreIO.h:44
xAOD::Utils::dynBranchPrefix
std::string dynBranchPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary branches coming from a container c...
Definition: Control/xAODRootAccess/Root/Utils.cxx:144
xAOD::ReadStats::nextEvent
void nextEvent()
Function incrementing the processed event counter.
covarianceTool.filter
filter
Definition: covarianceTool.py:514
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:62
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:174
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
runLayerRecalibration.branches
list branches
Definition: runLayerRecalibration.py:98
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
xAOD::TEvent::m_printEventProxyWarnings
Bool_t m_printEventProxyWarnings
Option to silence common warnings that seem to be harmless.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:475
CxxUtils::ConcurrentBitset::size
bit_t size() const
Count the number of 1 bits in the set.
xAOD::EventFormat_v1::begin
const_iterator begin() const
STL-like function for getting the beginning of the container.
Definition: EventFormat_v1.cxx:158
xAOD::TEvent::getBranchInfo
const BranchInfo * getBranchInfo(SG::sgkey_t sgkey) const
Get the object describing one object/branch.
Definition: TEventProxyDict.cxx:268
python.LArHVDB.className
className
Definition: LArHVDB.py:7
xAOD::TEvent::m_inTree
::TTree * m_inTree
The main tree that we are reading from.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:429
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:285
lumiFormat.i
int i
Definition: lumiFormat.py:92
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:221
ret
T ret(T t)
Definition: rootspy.cxx:260
xAOD::TEvent::getEntries
::Long64_t getEntries() const
Get how many entries are available from the current input file(s)
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1293
xAOD::TEvent::m_auxItemList
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
Rules for selecting which auxiliary branches to write.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:466
xAOD::TEvent::getEntry
::Int_t getEntry(::Long64_t entry, ::Int_t getall=0)
Function loading a given entry of the input TTree.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1324
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
xAOD::TEvent::isStandalone
::Bool_t isStandalone(const TObjectManager &mgr)
Function checking if an object is standalone (not a container)
Definition: Control/xAODRootAccess/Root/TEvent.cxx:3637
sel
sel
Definition: SUSYToolsTester.cxx:92
xAOD::TAuxStore::kObjectStore
@ kObjectStore
The object describes a single object.
Definition: TAuxStore.h:56
SG::IAuxStoreIO::getSelectedAuxIDs
virtual SG::auxid_set_t getSelectedAuxIDs() const
Get a list of dynamic variables that need to be written out.
Definition: IAuxStoreIO.h:86
xAOD::TChainStateTracker::reset
void reset()
Reset the object.
Definition: TChainStateTracker.cxx:31
generateReferenceFile.files
files
Definition: generateReferenceFile.py:12
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
file
TFile * file
Definition: tile_monitor.h:29
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
python.xAODType.dummy
dummy
Definition: xAODType.py:4
xAOD::ReadStats::setBranchNum
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
Preparation.mode
mode
Definition: Preparation.py:96
xAOD::TEvent::m_inputEventFormat
EventFormat m_inputEventFormat
Format of the current input file.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:461
CxxUtils::ConcurrentBitset::empty
bool empty() const
Return true if there are no 1 bits in the set.
xAOD::TEvent::proxy
SG::DataProxy * proxy(const void *const pTransient) const override
get proxy for a given data object address in memory
Definition: TEventProxyDict.cxx:206
xAOD::TEventFormatRegistry::instance
static const TEventFormatRegistry & instance()
Access the only instance of the object in memory.
Definition: TEventFormatRegistry.cxx:14
xAOD::TEvent::contains
::Bool_t contains(const std::string &key)
Function checking if an object is available from the store.
plotmaker.keyName
keyName
Definition: plotmaker.py:145
xAOD::TEvent::getEventFormatElement
const xAOD::EventFormatElement * getEventFormatElement(SG::sgkey_t sgkey) const
Get the metadata object for a given "SG key".
Definition: TEventProxyDict.cxx:351
xAOD::IOStats::instance
static IOStats & instance()
Singleton object accessor.
Definition: IOStats.cxx:11
xAOD::TEvent::m_listeners
Listener_t m_listeners
Listeners who should be notified when certain incidents happen.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:469
xAOD::TEvent::CACHE_SIZE
static const ::Int_t CACHE_SIZE
Size of a possible TTreeCache (30 MB)
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:419
xAOD::TEvent::m_outputMetaObjects
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:458
xAOD::TEvent::m_outputObjects
Object_t m_outputObjects
Collection of all the managed output object.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:453
xAOD::TAuxStore::kContainerStore
@ kContainerStore
The object describes an entire container.
Definition: TAuxStore.h:55
xAOD::TEvent::m_inputMetaObjects
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:456
SG::IAuxStoreHolder::setStore
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.
xAODPrivate::TLoader::setProxy
void setProxy(SG::DataProxy &proxy)
Definition: TEventProxyDict.cxx:165
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::TEvent::m_branchesMutex
upgrade_mutex_t m_branchesMutex
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:491
xAOD::AuxSelection
Class helping in dealing with dynamic branch selection.
Definition: AuxSelection.h:31
xAOD::TEvent::METADATA_TREE_NAME
static const char *const METADATA_TREE_NAME
Name of the metadata tree.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:423
xAOD::TChainStateTracker::internalStateChanged
::Bool_t internalStateChanged() const
Check whether there was an internal state change without us knowing.
Definition: TChainStateTracker.cxx:26
SG::SGKeySet
std::unordered_set< sgkey_t > SGKeySet
A set of sgkey_t values.
Definition: CxxUtils/CxxUtils/sgkey_t.h:97
xAOD::EventFormat_v1
Event format metadata for xAOD files.
Definition: EventFormat_v1.h:38
xAOD::TEvent::record
StatusCode record(T *obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
Add an output object to the event.
xAOD::TEvent::upgrading_lock_t
AthContainers_detail::upgrading_lock< upgrade_mutex_t > upgrading_lock_t
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:490
xAOD::TEvent::TEvent
TEvent(EAuxMode mode=kUndefinedAccess)
Default constructor.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:131
xAOD::TEvent::m_inTreeMissing
::Bool_t m_inTreeMissing
Internal status flag showing that an input file is open, but it doesn't contain an event tree.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:432
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
xAOD::TEvent::initStats
StatusCode initStats()
Function to initialise the statistics for all Tree content.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1961
xAOD::TObjectManager
Manager for EDM objects created by ROOT.
Definition: TObjectManager.h:29
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
SG::IAuxStoreIO::getIOData
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
test_pythinning.out
out
Definition: test_pythinning.py:94
xAOD::TEventFormatRegistry::getEventFormat
EventFormat & getEventFormat(const TFile *file) const
Access the managed EventFormat object.
Definition: TEventFormatRegistry.cxx:20
xAOD::TEvent::transientContains
::Bool_t transientContains(const std::string &key) const
Function checking if an object is already in memory.
xAOD::TEvent::isAuxStore
::Bool_t isAuxStore(const TObjectManager &mgr)
Function checking if a given object may be an auxiliary store.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:3614
xAOD::TEvent::connectAux
StatusCode connectAux(const std::string &prefix, ::Bool_t standalone)
Function setting up access to a set of auxiliary branches.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:2856
beamspotCoolDiff.l
l
Definition: beamspotCoolDiff.py:354
xAOD::TEvent::m_outputEventFormat
EventFormat * m_outputEventFormat
Format of the current output file.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:463
xAOD::TAuxStore::kUndefinedStore
@ kUndefinedStore
The structure mode is not defined.
Definition: TAuxStore.h:54
xAOD::TEvent::setUpDynamicStore
StatusCode setUpDynamicStore(TObjectManager &mgr, ::TTree *tree)
Function adding dynamic variable reading capabilities to an auxiliary store object.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:3088
DeMoScan.index
string index
Definition: DeMoScan.py:362
xAOD::TEvent::getFiles
::Long64_t getFiles() const
Get how many files are available on the currently defined input.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1452
python.trfDecorators.silent
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
Definition: trfDecorators.py:24
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
xAOD::TEvent::ATLAS_THREAD_SAFE
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
Map from hashed sgkey to BranchInfo.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:494
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
xAOD::TEvent::hasAuxStore
::Bool_t hasAuxStore(const TObjectManager &mgr)
Function checking if a given object may have an auxiliary store.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:3593
xAOD::Utils::getFirstBranchMatch
std::string getFirstBranchMatch(TTree *tree, const std::string &pre)
Search for branches, returns search term on no result.
Definition: Control/xAODRootAccess/Root/Utils.cxx:318
xAOD::TEvent::connectBranch
StatusCode connectBranch(const std::string &key, ::Bool_t silent=kFALSE)
Function setting up access to a particular branch.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:2558
xAOD::TEvent::getHash
SG::sgkey_t getHash(const std::string &key) const override
Function returning the hash describing an object name.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1649
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:23
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:229
xAOD::TEvent::m_entry
::Long64_t m_entry
The entry to look at from the input tree.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:442
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
xAOD::TEvent::m_inChainTracker
TChainStateTracker * m_inChainTracker
Optional object for tracking the state changes of an input TChain.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:436
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
collListGuids.attributes
attributes
Definition: collListGuids.py:46
xAOD::TEvent::readFrom
StatusCode readFrom(::TFile *file, Bool_t useTreeCache=kTRUE, const char *treeName=EVENT_TREE_NAME)
Connect the object to a new input file.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:364
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
xAOD::TEvent::Object_t
std::unordered_map< std::string, TVirtualManager * > Object_t
Definition of the internal data structure type.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:414
str
Definition: BTagTrackIpAccessor.cxx:11
merge.status
status
Definition: merge.py:17
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::TEvent::kBranchAccess
@ kBranchAccess
Access auxiliary data branch-by-branch.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:96
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::TEvent::getName
const std::string & getName(const void *obj) const override
Function returning the key describing a known object.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1684
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
python.PyAthena.obj
obj
Definition: PyAthena.py:135
xAOD::TEvent::setActive
void setActive() const
Set this event object as the currently active one.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:860
SG::DataProxy
Definition: DataProxy.h:44
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
xAOD::TEvent::connectMetaBranch
StatusCode connectMetaBranch(const std::string &key, ::Bool_t silent=kFALSE)
Function setting up access to a branch in the metadata tree.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:2742
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
xAOD::Utils::rootType
char rootType(char typeidType)
This function is used internally in the code when creating primitive dynamic auxiliary branches.
Definition: Control/xAODRootAccess/Root/Utils.cxx:226
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7
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::TEvent::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: Control/xAODRootAccess/xAODRootAccess/TEvent.h:451
xAODPrivate::TLoader
Definition: TEventProxyDict.cxx:151
PlotCalibFromCool.br
br
Definition: PlotCalibFromCool.py:355
SG::IAuxStoreHolder::AST_ContainerStore
@ AST_ContainerStore
The store describes a container.
Definition: IAuxStoreHolder.h:68
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
xAOD::TEvent::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: Control/xAODRootAccess/Root/TEvent.cxx:2975
xAOD::TEvent::setAuxStore
StatusCode setAuxStore(TObjectManager &mgr, ::Bool_t metadata=kFALSE)
Function connecting a DV object to its auxiliary store.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:3172