Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Attributes | List of all members
xAOD::RDataSourceEvent Class Referencefinal

Extension to xAOD::TEvent, used by xAOD::RDataSource. More...

#include <RDataSourceEvent.h>

Inheritance diagram for xAOD::RDataSourceEvent:
Collaboration diagram for xAOD::RDataSourceEvent:

Classes

class  key_hash
 Custom hash functor for use with Key_t. More...
 

Public Types

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

Public Member Functions

 RDataSourceEvent ()
 Default constructor. More...
 
std::vector< std::pair< std::string, std::string > > columnAndTypeNames ()
 Get the available columm and type names from the input. More...
 
void * columnReader (std::string_view columnName, const std::type_info &typeInfo)
 Get a "column reader", a pointer to a pointer to the object. More...
 
void updateObjectsForEntry (Long64_t entry)
 Update all objects in memory for a new 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...
 

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...
 

Private Types

typedef std::pair< std::string, const std::type_info * > Key_t
 Type of the key used in the internal map of object pointers. More...
 

Private Attributes

std::unordered_map< Key_t, const void *, key_hashm_objects
 Objects served to RDataFrame. 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

Extension to xAOD::TEvent, used by xAOD::RDataSource.

In order to get access to the internals of xAOD::TEvent, and provide pointers for ROOT::RDataFrame in a convenient way, this class provides a layer between the two codebases.

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 31 of file RDataSourceEvent.h.

Member Typedef Documentation

◆ Key_t

typedef std::pair< std::string, const std::type_info* > xAOD::RDataSourceEvent::Key_t
private

Type of the key used in the internal map of object pointers.

Definition at line 47 of file RDataSourceEvent.h.

◆ Listener_t

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

Definition of the structure type holding on to listeners.

Definition at line 410 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 408 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ sgkey_t

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

99  {
100  kBranchAccess = 0,
101  kClassAccess = 1,
102  kAthenaAccess = 2,
103  kUndefinedAccess = 3
104  };

Constructor & Destructor Documentation

◆ RDataSourceEvent()

xAOD::RDataSourceEvent::RDataSourceEvent ( )

Default constructor.

Definition at line 24 of file RDataSourceEvent.cxx.

26 
27  }

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

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

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

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

◆ addToStore()

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

Add a new proxy to the store.

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

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

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

Definition at line 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 280 of file Control/xAODRootAccess/Root/TEvent.cxx.

280  {
281 
282  return m_auxMode;
283  }

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

972  {
973 
974  m_listeners.clear();
975  return;
976  }

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

1026  {
1027 
1028  m_nameRemapping.clear();
1029  return;
1030  }

◆ columnAndTypeNames()

std::vector< std::pair< std::string, std::string > > xAOD::RDataSourceEvent::columnAndTypeNames ( )

Get the available columm and type names from the input.

Definition at line 30 of file RDataSourceEvent.cxx.

30  {
31 
32  // This makes sure that the input is connected to.
33  if( ( ! m_inTree ) && ( getEntry( 0 ) < 0 ) ) {
34  ::Error( "xAOD::RDataSourceEvent::columnAndTypeNames",
35  XAOD_MESSAGE( "No input file opened yet" ) );
36  throw std::runtime_error( "No input file opened yet" );
37  }
38 
39  // A sanity check.
40  if( ! inputEventFormat() ) {
41  ::Error( "xAOD::RDataSourceEvent::columnAndTypeNames",
42  XAOD_MESSAGE( "No xAOD::EventFormat object available" ) );
43  throw std::runtime_error( "No xAOD::EventFormat object available" );
44  }
45 
46  // The result object.
47  std::vector< std::pair< std::string, std::string > > result;
48 
49  // Loop over the known objects.
52  for( ; ef_itr != ef_end; ++ef_itr ) {
53 
54  // A convenient reference.
55  const xAOD::EventFormatElement& efe = ef_itr->second;
56 
57  // Skip auxiliary containers.
58  if( efe.branchName().rfind( "Aux." ) ==
59  ( efe.branchName().size() - 4 ) ) {
60  continue;
61  }
62  // Skip dynamic branches.
63  if( efe.parentName() != "" ) {
64  continue;
65  }
66  // Skip unavailable branches.
67  if( ! m_inTree->GetBranch( efe.branchName().c_str() ) ) {
68  continue;
69  }
70  // Skip unknown types.
71  ::TClass* cl = ::TClass::GetClass( efe.className().c_str() );
72  if( ! cl ) {
73  continue;
74  }
75  // Skip auxiliary containers that are mislabeled.
76  if( cl->InheritsFrom( "SG::IConstAuxStore" ) ) {
77  continue;
78  }
79 
80  // Make sure that we have a functional dictionary for the type.
81  const std::type_info* ti = cl->GetTypeInfo();
82  if( ! ti ) {
83  ::Warning( "xAOD::RDataSourceEvent::columnAndTypeNames",
84  "No std::type_info available for type %s (key=%s)",
85  cl->GetName(), efe.branchName().c_str() );
86  continue;
87  }
88 
89  // And do one final check that we can really read this type.
90  if( ! contains( efe.branchName(), *ti ) ) {
91  continue;
92  }
93 
94  // Remember this objects.
95  result.emplace_back( efe.branchName(), efe.className() );
96  }
97 
98  // Return the collected results.
99  return result;
100  }

◆ columnReader()

void * xAOD::RDataSourceEvent::columnReader ( std::string_view  columnName,
const std::type_info &  typeInfo 
)

Get a "column reader", a pointer to a pointer to the object.

Definition at line 102 of file RDataSourceEvent.cxx.

103  {
104 
105  // Make sure that this is the active event in the current thread.
106  setActive();
107 
108  // Create/access the pointer for this object.
109  return &( m_objects[ std::make_pair( std::string( columnName ),
110  &typeInfo ) ] );
111  }

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

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

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

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

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

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

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

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

◆ contains() [1/2]

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/2]

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

3691  {
3692 
3693  return ( getOutputObject( key, ti, metadata ) ||
3694  getInputObject( key, ti, kTRUE, metadata ) );
3695  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2131  {
2132 
2133  // Select which object container to use:
2134  const Object_t& objects = ( metadata ?
2136 
2137  // Check if the object can be found:
2138  Object_t::const_iterator itr = objects.find( key );
2139  if( itr == objects.end() ) {
2140  // Do the following only for event data:
2141  if( ! metadata ) {
2142  // It's not in the event. Let's check if we find it in an active
2143  // TStore object...
2144  TStore* store = TActiveStore::store();
2145  if( ( ! store ) || ( ! store->contains( key, ti ) ) ||
2146  store->isConst( key, ti ) ) {
2147  // Nope, not there either...
2148  return 0;
2149  }
2150  // Let's return the object from the TStore:
2151  void* result = store->getObject( key, ti );
2152  return result;
2153  } else {
2154  // For metadata we don't use external resources.
2155  return 0;
2156  }
2157  }
2158 
2159  // If the object is not set in this event yet, we can't continue:
2160  if( ! itr->second->isSet() ) {
2161  return 0;
2162  }
2163 
2164  // If it does exist, check if it's the right kind of object:
2165  TObjectManager* mgr =
2166  dynamic_cast< TObjectManager* >( itr->second );
2167  if( ! mgr ) {
2168  ::Error( "xAOD::TEvent::getOutputObject",
2169  XAOD_MESSAGE( "Object of wrong type found for key \"%s\"" ),
2170  key.c_str() );
2171  return 0;
2172  }
2173 
2174  // Ask the holder object for the object of this type:
2175  void* result = mgr->holder()->getAs( ti );
2176  if( ! result ) {
2177  ::Warning( "xAOD::TEvent::getOutputObject",
2178  "Couldn't retrieve object as \"%s\"",
2179  Utils::getTypeName( ti ).c_str() );
2180  return 0;
2181  }
2182 
2183  // Return the object:
2184  return result;
2185  }

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

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

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

3611  {
3612 
3613  // The classes whose children can have an auxiliary store attached
3614  // to them:
3615  static const TClass* const dvClass =
3616  ::TClass::GetClass( typeid( SG::AuxVectorBase ) );
3617  static const TClass* const aeClass =
3618  ::TClass::GetClass( typeid( SG::AuxElement ) );
3619 
3620  // Do the check:
3621  return ( mgr.holder()->getClass()->InheritsFrom( dvClass ) ||
3622  mgr.holder()->getClass()->InheritsFrom( aeClass ) );
3623  }

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

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

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

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

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

3632  {
3633 
3634  // The classes whose children are considered auxiliary stores:
3635  static const TClass* const storeClass =
3636  ::TClass::GetClass( typeid( SG::IConstAuxStore ) );
3637  static const TClass* const storeHolderClass =
3638  ::TClass::GetClass( typeid( SG::IAuxStoreHolder ) );
3639 
3640  // Do the check:
3641  return ( mgr.holder()->getClass()->InheritsFrom( storeClass ) ||
3642  mgr.holder()->getClass()->InheritsFrom( storeHolderClass ) );
3643  }

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

3655  {
3656 
3657  // The classes whose children can have an auxiliary store attached
3658  // to them:
3659  static const TClass* const dvClass =
3660  TClass::GetClass( typeid( SG::AuxVectorBase ) );
3661  static const TClass* const aeClass =
3662  TClass::GetClass( typeid( SG::AuxElement ) );
3663 
3664  // Do the check:
3665  if( mgr.holder()->getClass()->InheritsFrom( aeClass ) ) {
3666  return kTRUE;
3667  } else if( mgr.holder()->getClass()->InheritsFrom( dvClass ) ) {
3668  return kFALSE;
3669  }
3670 
3671  // Some logic error happened:
3672  ::Error( "xAOD::TEvent::isStandalone",
3673  XAOD_MESSAGE( "Received type (%s) that can't have an "
3674  "auxiliary store" ),
3675  mgr.holder()->getClass()->GetName() );
3676  return kFALSE;
3677  }

◆ 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
overrideprotectedinherited

Find the string corresponding to a given key.

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
overrideprotectedinherited

Find the string and CLID corresponding to a given key.

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 452 of file TEventProxyDict.cxx.

452  {
453 
454  static const std::string NAME = "xAOD::TEvent";
455  return NAME;
456  }

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

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

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

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

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

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

◆ proxies()

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

return the list of all current proxies in store

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
overrideprotectedinherited

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

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
overrideprotectedinherited

get proxy for a given data object address in memory

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
overrideprotectedinherited

Get proxy given a hashed key+clid.

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

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

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

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

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

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

◆ record() [1/4]

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() [2/4]

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() [3/4]

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

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

◆ record() [4/4]

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

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

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

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

◆ 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 
)
overrideprotectedinherited

Record an object in the store.

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 
)
overrideprotectedinherited

Remember an additional mapping from key to string/CLID.

Definition at line 440 of file TEventProxyDict.cxx.

440  {
441 
442  return;
443  }

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

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

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

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

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

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

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

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

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

3715  {
3717  }

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

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

◆ stringToKey()

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

Find the string corresponding to a given key.

Definition at line 425 of file TEventProxyDict.cxx.

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

◆ transientContains() [1/2]

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/2]

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

3710  {
3711 
3712  return getOutputObject( key, ti, metadata );
3713  }

◆ 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.

◆ updateObjectsForEntry()

void xAOD::RDataSourceEvent::updateObjectsForEntry ( Long64_t  entry)

Update all objects in memory for a new event.

Definition at line 113 of file RDataSourceEvent.cxx.

113  {
114 
115  // Make sure that this is the active event in the current thread.
116  setActive();
117 
118  // Switch to the new entry.
119  if( getEntry( entry ) < 0 ) {
120  ::Error( "xAOD::RDataSourceEvent::updateObjectsForEntry",
121  XAOD_MESSAGE( "Failed to get entry %lld" ), entry );
122  throw std::runtime_error( "Failed to get entry" );
123  }
124 
125  // Loop over all "registered" objects.
126  for( auto& obj : m_objects ) {
127  // (Re-)Access this object.
128  obj.second = getInputObject( obj.first.first, *( obj.first.second ) );
129  }
130 
131  // Return gracefully.
132  return;
133  }

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

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

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 488 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 413 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 415 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 460 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_auxMode

EAuxMode xAOD::TEvent::m_auxMode
protectedinherited

The auxiliary access mode.

Definition at line 420 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 436 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inChain

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

The (optional) chain provided as input.

Definition at line 428 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 430 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 434 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_inputEventFormat

EventFormat xAOD::TEvent::m_inputEventFormat
protectedinherited

Format of the current input file.

Definition at line 455 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 450 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 445 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 442 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 423 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 426 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 432 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 463 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 466 of file Control/xAODRootAccess/xAODRootAccess/TEvent.h.

◆ m_objects

std::unordered_map< Key_t, const void*, key_hash > xAOD::RDataSourceEvent::m_objects
private

Objects served to RDataFrame.

Definition at line 57 of file RDataSourceEvent.h.

◆ m_outputEventFormat

EventFormat* xAOD::TEvent::m_outputEventFormat
protectedinherited

Format of the current output file.

Definition at line 457 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 452 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 447 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 439 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 469 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 417 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:432
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:466
xAOD::EventFormat_v1::end
const_iterator end() const
STL-like function for getting the end of the container.
Definition: EventFormat_v1.cxx:163
SGTest::store
TestStore store
Definition: TestStore.cxx:23
beamspotman.r
def r
Definition: beamspotman.py:676
common.sgkey
def sgkey(tool)
Definition: common.py:1028
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
xAOD::TEvent::name
const std::string & name() const override
Get the name of the instance.
Definition: TEventProxyDict.cxx:452
xAOD::TEvent::m_auxMode
EAuxMode m_auxMode
The auxiliary access mode.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:420
xAOD::TEvent::kUndefinedAccess
@ kUndefinedAccess
Undefined, to be selected by the object.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:103
checkxAOD.brName
brName
Definition: Tools/PyUtils/bin/checkxAOD.py:125
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::IAuxStoreHolder::getStoreType
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:64
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:1942
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
L1CaloPhase1Monitoring.standalone
standalone
Definition: L1CaloPhase1Monitoring.py:136
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
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:483
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:1918
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:102
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:149
xAOD::TEvent::m_outTree
::TTree * m_outTree
The tree that we are writing to.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:439
xAOD::TEvent::m_inChain
::TChain * m_inChain
The (optional) chain provided as input.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:428
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:3368
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::ReadStats::Print
void Print(::Option_t *option="") const
Print information about the collected statistics.
xAOD::details::AuxStoreBase::EStructMode
EStructMode
"Structural" modes of the object
Definition: AuxStoreBase.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:407
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:134
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
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:442
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
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
xAOD::ReadStats::container
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
xAOD::EventFormatElement::parentName
const std::string & parentName() const
Get the name of the parent auxiliary object.
Definition: EventFormatElement.cxx:42
xAOD::EventFormatElement
Class describing one branch of the ROOT file.
Definition: EventFormatElement.h:39
xAOD::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:1145
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
xAOD::EventFormatElement::branchName
const std::string & branchName() const
Get the branch/key name.
Definition: EventFormatElement.cxx:30
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:101
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
xAOD::details::AuxStoreBase::EStructMode::kObjectStore
@ kObjectStore
The object describes a single object.
xAOD::details::AuxStoreBase::EStructMode::kContainerStore
@ kContainerStore
The object describes an entire container.
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::TEvent::m_inMetaTree
::TTree * m_inMetaTree
Pointer to the metadata tree in the input file.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:434
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
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
xAOD::ReadStats::nextEvent
void nextEvent()
Function incrementing the processed event counter.
xAOD::RDataSourceEvent::m_objects
std::unordered_map< Key_t, const void *, key_hash > m_objects
Objects served to RDataFrame.
Definition: RDataSourceEvent.h:57
covarianceTool.filter
filter
Definition: covarianceTool.py:514
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:61
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
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:469
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
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
xAOD::TEvent::m_inTree
::TTree * m_inTree
The main tree that we are reading from.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:423
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:352
lumiFormat.i
int i
Definition: lumiFormat.py:85
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:241
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:1295
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:460
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:1326
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:3655
sel
sel
Definition: SUSYToolsTester.cxx:97
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
vertexingJO_ITK_init.itemList
list itemList
Definition: vertexingJO_ITK_init.py:95
generateReferenceFile.files
files
Definition: generateReferenceFile.py:12
CalibDbCompareRT.dummy
dummy
Definition: CalibDbCompareRT.py:60
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
xAOD::EventFormatElement::className
const std::string & className() const
Get the class name of this branch/key.
Definition: EventFormatElement.cxx:36
Preparation.mode
mode
Definition: Preparation.py:107
xAOD::ReadStats::setBranchNum
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
xAOD::TEvent::m_inputEventFormat
EventFormat m_inputEventFormat
Format of the current input file.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:455
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:463
xAOD::TEvent::CACHE_SIZE
static const ::Int_t CACHE_SIZE
Size of a possible TTreeCache (30 MB)
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:413
xAOD::TEvent::m_outputMetaObjects
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:452
xAOD::TEvent::m_outputObjects
Object_t m_outputObjects
Collection of all the managed output object.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:447
xAOD::TEvent::m_inputMetaObjects
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:450
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
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
xAOD::TVirtualEvent::keys
void keys(std::vector< std::string > &vkeys, bool metadata=false) const
provide list of all keys associated with provided type.
xAOD::TEvent::m_branchesMutex
upgrade_mutex_t m_branchesMutex
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:485
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:417
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:484
xAOD::TEvent::TEvent
TEvent(EAuxMode mode=kUndefinedAccess)
Default constructor.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:133
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:426
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:1965
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.
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:3632
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:2875
xAOD::TEvent::m_outputEventFormat
EventFormat * m_outputEventFormat
Format of the current output file.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:457
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:3107
DeMoScan.index
string index
Definition: DeMoScan.py:364
xAOD::TEvent::getFiles
::Long64_t getFiles() const
Get how many files are available on the currently defined input.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1454
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:488
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:3611
xAOD::Utils::getFirstBranchMatch
std::string getFirstBranchMatch(TTree *tree, const std::string &pre)
This function is used to search for a branch in a TTree that contains a given substring.
Definition: Control/xAODRootAccess/Root/Utils.cxx:392
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:2577
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:1651
xAOD::EventFormat
EventFormat_v1 EventFormat
Definition of the current event format version.
Definition: EventFormat.h:16
SG::TransientAddress::setSGKey
void setSGKey(sgkey_t sgkey)
check if it is a transient ID (primary or symLinked):
Definition: TransientAddress.h:238
xAOD::TEvent::m_entry
::Long64_t m_entry
The entry to look at from the input tree.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:436
xAOD::TEvent::inputEventFormat
const EventFormat * inputEventFormat() const
Get information about the input objects.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:1605
xAOD::TEvent::m_inChainTracker
TChainStateTracker * m_inChainTracker
Optional object for tracking the state changes of an input TChain.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:430
xAOD::details::AuxStoreBase::EStructMode::kUndefinedStore
@ kUndefinedStore
The structure mode is not defined.
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:366
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:408
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:100
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:1686
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:132
xAOD::TEvent::setActive
void setActive() const
Set this event object as the currently active one.
Definition: Control/xAODRootAccess/Root/TEvent.cxx:862
SG::DataProxy
Definition: DataProxy.h:45
SG::IAuxStoreHolder::AST_ObjectStore
@ AST_ObjectStore
The store describes a single object.
Definition: IAuxStoreHolder.h:67
SG::IAuxStoreHolder
Interface for objects taking part in direct ROOT I/O.
Definition: IAuxStoreHolder.h:36
xAOD::Utils::hash
SG::sgkey_t hash(const std::string &name)
This function provides a hashed version of the key (branch) names used in the xAOD file,...
Definition: Control/xAODRootAccess/Root/Utils.cxx:125
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:2761
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
LArL1Calo_ComputeHVCorr.className
className
Definition: LArL1Calo_ComputeHVCorr.py:135
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:293
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:445
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:2994
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:3191