ATLAS Offline Software
Loading...
Searching...
No Matches
REventClass Class Reference

Class used for the test. More...

Inheritance diagram for REventClass:
Collaboration diagram for REventClass:

Public Types

using sgkey_t = SG::sgkey_t

Public Member Functions

StatusCode loadInputObjects ()
 Function loading all interface objects of the event.
 REvent ()
 Default constructor.
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).
template<typename T>
bool retrieve (const T *&obj, const std::string &key, bool silent=false)
 Function retrieving an object from the event (constant version).
void setLevel (MSG::Level lvl)
 Change the current logging level.
Setup functions
StatusCode readFrom (TFile &inFile) override
 Set up the reading of an input file from TFile This method implements the interface from Event.
StatusCode readFrom (std::string_view fileName)
 Set up the reading of an input file via a file name.
StatusCode writeTo (TFile &file) override
 Connect the object to an output file.
StatusCode finishWritingTo (TFile &file) override
 Finish writing to an output file.
Persistent data accessor/modifier functions
::Long64_t getEntries () const override
 Get how many entries are available from the current input file(s).
::Int_t getEntry (::Long64_t entry, ::Int_t getall=0) override
 Function loading a given entry of the input RNTuple.
::Int_t fill () override
 Method filling one event into the output.
template<typename T>
StatusCode record (T *obj, const std::string &key)
 Add an output object to the event.
template<typename T>
StatusCode record (std::unique_ptr< T > obj, const std::string &key)
 Add an output object to the event, explicitly taking ownership of it.
Persistent data accessor/modifier functions
const EventFormat * inputEventFormat () const
 Get information about the input objects.
const EventFormat * outputEventFormat () const
 Get information about the output objects.
Event data accessor/modifier functions
std::string dump ()
 Function creating a user-readable dump of the current input.
void printIOStats () const
 Function printing the I/O statistics of the current process.
template<typename T>
bool contains (const std::string &key)
 Function checking if an object is available from the store.
template<typename T>
bool transientContains (const std::string &key) const
 Function checking if an object is already in memory.
template<typename T>
StatusCode keys (std::vector< std::string > &vkeys, bool metadata) const
 Provide a list of all data object keys associated with a specific type.
template<typename T>
StatusCode retrieve (const T *&obj, const std::string &key)
 Retrieve either an input or an output object from the event.
template<typename T>
StatusCode retrieve (T *&obj, const std::string &key)
 Retrieve an output object from the event.
StatusCode copy (const std::string &pattern=".*")
 Copy an object directly from the input to the output.
Metadata accessor/modifier functions
template<typename T>
bool containsMeta (const std::string &key)
 Function checking if a meta-object is available from the store.
template<typename T>
bool transientContainsMeta (const std::string &key) const
 Function checking if a meta-object is already in memory.
template<typename T>
StatusCode metaKeys (std::vector< std::string > &vkeys) const
 Provide a list of all metadata object keys associated with a specific type.
template<typename T>
StatusCode retrieveMetaInput (const T *&obj, const std::string &key)
 Retrieve an input metadata object.
template<typename T>
StatusCode retrieveMetaOutput (const T *&obj, const std::string &key)
 Retrieve an output metadata object.
template<typename T>
StatusCode retrieveMetaOutput (T *&obj, const std::string &key)
 Retrieve an output metadata object.
template<typename T>
StatusCode recordMeta (T *obj, const std::string &key)
 Add an object to the output file's metadata.
template<typename T>
StatusCode recordMeta (std::unique_ptr< T > obj, const std::string &key)
 Add an object to the output file's metadata, explicitly taking ownership of it.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Static Public Attributes

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

Protected Types

using Object_t
 Definition of the internal data structure type.

Protected Member Functions

bool contains (const std::string &key, const std::type_info &ti, bool metadata)
 Internal function checking if an object is in the input.
bool transientContains (const std::string &key, const std::type_info &ti, bool metadata) const
 Internal function checking if an object is already in memory.
void * getOutputObject (const std::string &key, const std::type_info &ti, bool metadata) const
 Function for retrieving an output object in a non-template way.
const void * getInputObject (const std::string &key, const std::type_info &ti, bool silent, bool metadata)
 Function for retrieving an input object in a non-template way.
StatusCode recordTypeless (void *obj, const std::string &typeName, const std::string &key, bool overwrite=false, bool metadata=true, bool isOwner=true)
 Internal function for recording an object into the output.
const EventContext & currentContext () const
 Return the event context corresponding to this event.
Functions implementing the IProxyDict interface
SG::DataProxyproxy (const void *const pTransient) const override
 get proxy for a given data object address in memory
SG::DataProxyproxy (const CLID &id, const std::string &key) const override
 get proxy with given id and key. Returns 0 to flag failure
SG::DataProxyproxy_exact (SG::sgkey_t sgkey) const override
 Get proxy given a hashed key+clid.
StatusCode addToStore (CLID id, SG::DataProxy *proxy) override
 Add a new proxy to the store.
std::vector< const SG::DataProxy * > proxies () const override
 return the list of all current proxies in store
SG::sgkey_t stringToKey (const std::string &str, CLID clid) override
 Find the string corresponding to a given key.
const std::string * keyToString (SG::sgkey_t key) const override
 Find the string corresponding to a given key.
const std::string * keyToString (SG::sgkey_t key, CLID &clid) const override
 Find the string and CLID corresponding to a given key.
void registerKey (SG::sgkey_t key, const std::string &str, CLID clid) override
 Remember an additional mapping from key to string/CLID.
SG::DataProxyrecordObject (SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override
 Record an object in the store.
const std::string & name () const override
 Get the name of the instance.

Protected Attributes

Object_t m_inputObjects
 Collection of all the managed input objects.
std::set< std::string > m_inputMissingObjects
 Objects that have been asked for, but were found to be missing in the current input.
Object_t m_outputObjects
 Collection of all the managed output object.
Object_t m_inputMetaObjects
 Collection of all the managed input meta-objects.
Object_t m_outputMetaObjects
 Collection of all the managed output meta-objects.
EventFormat m_inputEventFormat
 Format of the current input file.
EventFormat * m_outputEventFormat = nullptr
 Format of the current output file.
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
 Rules for selecting which auxiliary branches to write.
std::vector< TVirtualIncidentListener * > m_listeners
 Listeners who should be notified when certain incidents happen.
std::unordered_map< std::string, std::string > m_nameRemapping
 Container name re-mapping rules.
bool m_printEventProxyWarnings = false
 Option to silence common warnings that seem to be harmless.

Private Member Functions

StatusCode initStats ()
 Function to initialise the statistics for all RNTuple content.
StatusCode setUpDynamicStore (RObjectManager &mgr, ROOT::RNTupleReader &ntupleReader)
 event uses RNTupleReader:
void initMessaging () const
 Initialize our message level and MessageSvc.
Functions implemented from @c xAOD::Event
bool hasInput () const override
 Check if an input file is connected to the object.
bool hasOutput () const override
 Check if an output file is connected to the object.
StatusCode getNames (const std::string &targetClassName, std::vector< std::string > &vkeys, bool metadata) const override
 Function determining the list keys associated with a type name.
StatusCode connectObject (const std::string &key, bool silent) override
 Function setting up access to a particular object.
StatusCode connectMetaObject (const std::string &key, bool silent) override
 Function setting up access to a particular metadata object.
StatusCode connectAux (const std::string &prefix, bool standalone) override
 Function setting up access to a set of auxiliary branches.
StatusCode connectMetaAux (const std::string &prefix, bool standalone) override
 Function setting up access to a set of auxiliary branches for a metadata object.
StatusCode setAuxStore (const std::string &key, Details::IObjectManager &mgr, bool metadata) override
 Function connecting a DV object to its auxiliary store.
StatusCode record (void *obj, const std::string &typeName, const std::string &key, bool overwrite, bool metadata, bool isOwner) override
 Record an object into a connected output file.
StatusCode recordAux (TVirtualManager &mgr, const std::string &key, bool metadata) override
 Record an auxiliary store into a connected output file.
StatusCode putAux (TVirtualManager &mgr, ::Bool_t metadata=kFALSE)
 Method saving the dynamically created auxiliary properties.
StatusCode addField (const std::string &key, const TVirtualManager &mgr)
 Add field to RNTuple model given the StoreGate key and output object manager.

Private Attributes

std::unique_ptr< ROOT::RNTupleReader > m_eventReader
 The main event data reader.
bool m_inputNTupleIsMissing = false
 Whether the input has an event RNTuple or not.
std::unique_ptr< ROOT::RNTupleReader > m_metaReader
 The metadata reader.
::Long64_t m_entry {}
 The entry to look at from the input.
std::unique_ptr< ROOT::RNTupleModel > m_model
 The RNTuple model used for event fields.
std::unique_ptr< ROOT::RNTupleWriter > m_eventWriter
 The main event writer: RNTupleWeader.
::TFile * m_outputFile {nullptr}
 The output file for writing.
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.

Setup functions

void setActive () const
 Set this event object as the currently active one.
void setAuxItemList (const std::string &containerKey, const std::string &itemList)
 Configure which dynamic variables to write out for a given store.
StatusCode addListener (TVirtualIncidentListener *listener)
 Register an incident listener object.
StatusCode removeListener (TVirtualIncidentListener *listener)
 Remove an incident listener object.
void clearListeners ()
 Remove all listeners from the object.
StatusCode addNameRemap (const std::string &onfile, const std::string &newName)
 Add a name re-mapping rule.
void clearNameRemap ()
 Clear the current name re-mapping.
void printNameRemap () const
 Print the current name re-mapping rules.
void printProxyWarnings (bool value=true)
 Enable warnings associated with broken element links.
static const char *const EVENT_TREE_NAME = "CollectionTree"
 Default name of the event TTree.
static const char *const EVENT_RNTUPLE_NAME = "EventData"
 Name of the event RNTuple.
static const char *const METADATA_OBJECT_NAME = "MetaData"
 Name of the metadata tree or RNTuple.
static std::unique_ptr< EventcreateAndReadFrom (TFile &file)
 static method to create an Event object and readFrom a file, given by a TFile.

Functions implementing the @c xAOD::TVirtualEvent interface

SG::sgkey_t getHash (const std::string &key) const override
 Function returning the hash describing an object name.
SG::sgkey_t getKey (const void *obj) const override
 Function returning the hash describing a known object.
const std::string & getName (const void *obj) const override
 Function returning the key describing a known object.
const std::string & getName (SG::sgkey_t hash) const override
 Function returning the key describing a known object.
void * getOutputObject (SG::sgkey_t key, const std::type_info &ti) override
 Function for retrieving an output object in a non-template way.
const void * getInputObject (SG::sgkey_t key, const std::type_info &ti, bool silent) override
 Function for retrieving an input object in a non-template way.

Variable(s) used in the @c IProxyDict implementation

using upgrade_mutex_t = AthContainers_detail::upgrade_mutex
 Mutex type for multithread synchronization.
using upgrading_lock_t
 Lock type for multithread synchronization.
upgrade_mutex_t m_branchesMutex
 Mutex for multithread synchronization.
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
 Map from hashed sgkey to BranchInfo.

Helper functions for the IProxyDict interface

EventContext m_ctx
 The event context associated with this event.
const xAOD::EventFormatElementgetEventFormatElement (SG::sgkey_t sgkey) const
 Get the metadata object for a given "SG key".
const BranchInfogetBranchInfo (SG::sgkey_t sgkey) const
 Get the object describing one object/branch.

Detailed Description

Class used for the test.

Definition at line 36 of file xAODRNFileReadTest.cxx.

Member Typedef Documentation

◆ Object_t

using xAOD::Event::Object_t
protectedinherited
Initial value:
std::unordered_map<std::string, std::unique_ptr<TVirtualManager>>

Definition of the internal data structure type.

Definition at line 338 of file Event.h.

◆ sgkey_t

Definition at line 29 of file TVirtualEvent.h.

◆ upgrade_mutex_t

using xAOD::Event::upgrade_mutex_t = AthContainers_detail::upgrade_mutex
protectedinherited

Mutex type for multithread synchronization.

Definition at line 383 of file Event.h.

◆ upgrading_lock_t

using xAOD::Event::upgrading_lock_t
protectedinherited
Initial value:

Lock type for multithread synchronization.

Definition at line 385 of file Event.h.

Member Function Documentation

◆ addField()

StatusCode xAOD::Experimental::REvent::addField ( const std::string & key,
const TVirtualManager & mgr )
privateinherited

Add field to RNTuple model given the StoreGate key and output object manager.

Definition at line 1686 of file REvent.cxx.

1686 {
1687
1688 // Add to the RNTuple model -
1689 // This is done by either adding the field to the initial model before the first event is written, or
1690 // after the first event has been written a new field is added via an extension of the output RNTuple model.
1691 // This can occurs when an AuxStore is empty for the initial events
1692
1693 // Get field name and class name to create a RFieldBase
1694 std::string fieldName;
1695 std::string className;
1696 if (getInfoForFieldCreation( key, mgr, fieldName, className ).isFailure()) return StatusCode::FAILURE;
1697 // should have found class name
1698 if ( className.empty() ) {
1699 ATH_MSG_ERROR( "could not find className!" );
1700 return StatusCode::FAILURE;
1701 }
1702
1703 if (m_model) {
1704 // Continue to add to the initial RNTuple model
1705 m_model->AddField( ROOT::RFieldBase::Create( fieldName, className ).Unwrap());
1706 }
1707 else {
1708 if (m_eventWriter.get() == nullptr) {
1709 ATH_MSG_ERROR("Internal logic error detected - no output found");
1710 return StatusCode::FAILURE;
1711 }
1712 // After the first event, one needs to extend the output RNTuple model
1713 auto field = ROOT::RFieldBase::Create(fieldName, className).Unwrap();
1714 auto updater = m_eventWriter->CreateModelUpdater();
1715 updater->BeginUpdate();
1716 updater->AddField(std::move(field));
1717 updater->CommitUpdate();
1718 }
1719
1720 // Return gracefully:
1721 return StatusCode::SUCCESS;
1722
1723}
#define ATH_MSG_ERROR(x)
std::unique_ptr< ROOT::RNTupleWriter > m_eventWriter
The main event writer: RNTupleWeader.
Definition REvent.h:144
std::unique_ptr< ROOT::RNTupleModel > m_model
The RNTuple model used for event fields.
Definition REvent.h:141
Updater_t & updater()
Access the Updater instance.

◆ addListener()

StatusCode Event::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 104 of file EventCore.cxx.

104 {
105
106 // Check that we received a valid pointer:
107 if (listener == nullptr) {
108 ATH_MSG_ERROR("Received a null pointer for the listener");
109 return StatusCode::FAILURE;
110 }
111
112 // Check whether we already have this listener.
113 auto itr = std::find(m_listeners.begin(), m_listeners.end(), listener);
114 if (itr != m_listeners.end()) {
115 ATH_MSG_WARNING("Listener " << static_cast<void*>(listener)
116 << " is already registered");
117 return StatusCode::SUCCESS;
118 }
119
120 // Add the listener.
121 m_listeners.push_back(listener);
122
123 // Return gracefully:
124 return StatusCode::SUCCESS;
125}
#define ATH_MSG_WARNING(x)
std::vector< TVirtualIncidentListener * > m_listeners
Listeners who should be notified when certain incidents happen.
Definition Event.h:363

◆ addNameRemap()

StatusCode Event::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 169 of file EventCore.cxx.

170 {
171
172 // Check if this name is known on the input or output already. As that's
173 // not good.
174 if (m_inputEventFormat.exists(newName)) {
175 ATH_MSG_ERROR("Can't use \"" << newName << "\" as the target name in the \""
176 << onfile << "\" -> \"" << newName
177 << "\" remapping");
178 return StatusCode::FAILURE;
179 }
180
181 // Check if this name was remapped to something already.
182 auto itr = m_nameRemapping.find(newName);
183 if (itr != m_nameRemapping.end()) {
184 ATH_MSG_WARNING("Overriding existing name remapping \""
185 << itr->second << "\" -> \"" << itr->first << "\" with: \""
186 << onfile << "\" -> \"" << newName << "\"");
187 }
188
190 m_nameRemapping[newName] = onfile;
191
192 // Return gracefully:
193 return StatusCode::SUCCESS;
194}
EventFormat m_inputEventFormat
Format of the current input file.
Definition Event.h:355
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
Definition Event.h:366

◆ addToStore()

StatusCode Event::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 251 of file EventIProxyDict.cxx.

251 {
252
254
255 // Warn the user that the function got called:
256 static std::atomic_flag warningPrinted ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT;
257 if (!warningPrinted.test_and_set() && m_printEventProxyWarnings) {
259 "Function should only be called through an invalid ElementLink");
260 }
261
262 // Hold on to the proxy with some non-existent, hopefully unique key:
263 const ::TString uniqueKey =
264 ::TString::Format("NonExistentKey_%lu", m_branches.size());
265 BranchInfo bi;
266 bi.m_proxy.reset(proxy);
267 lock.upgrade();
268 m_branches.insert(
269 std::make_pair(stringToKey(uniqueKey.Data(), clid), std::move(bi)));
270
271 // Return gracefully:
272 return StatusCode::SUCCESS;
273}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
SG::sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the string corresponding to a given key.
upgrade_mutex_t m_branchesMutex
Mutex for multithread synchronization.
Definition Event.h:388
bool m_printEventProxyWarnings
Option to silence common warnings that seem to be harmless.
Definition Event.h:369
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
Map from hashed sgkey to BranchInfo.
Definition Event.h:392
AthContainers_detail::upgrading_lock< upgrade_mutex_t > upgrading_lock_t
Lock type for multithread synchronization.
Definition Event.h:385
SG::DataProxy * proxy(const void *const pTransient) const override
get proxy for a given data object address in memory
Helper struct used by the IProxyDict code.
Definition Event.h:375
std::unique_ptr< SG::DataProxy > m_proxy
Data proxy describing this branch/object.
Definition Event.h:377

◆ clearListeners()

void Event::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 150 of file EventCore.cxx.

150 {
151
152 m_listeners.clear();
153}

◆ clearNameRemap()

void Event::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 200 of file EventCore.cxx.

200 {
201
202 m_nameRemapping.clear();
203}

◆ connectAux()

StatusCode xAOD::Experimental::REvent::connectAux ( const std::string & prefix,
bool standalone )
overrideprivatevirtualinherited

Function setting up access to a set of auxiliary branches.

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

This uses 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

Implements xAOD::Event.

Definition at line 1077 of file REvent.cxx.

1077 {
1078
1079 // A little sanity check.
1080 if (!m_eventReader) {
1081 ATH_MSG_ERROR("Function called on un-initialised object");
1082 return StatusCode::FAILURE;
1083 }
1084
1085 // Check if the field is already connected.
1086 if (m_inputObjects.contains(prefix)) {
1087 return StatusCode::SUCCESS;
1088 }
1089
1090 // Connect to the field as we would for any other.
1091 static constexpr bool SILENT = false;
1092 ATH_CHECK(connectObject(prefix, SILENT));
1093
1094 // Access the object's manager.
1095 Object_t::const_iterator mgr_itr = m_inputObjects.find(prefix);
1096 if (mgr_itr == m_inputObjects.end()) {
1097 ATH_MSG_FATAL("There's a logic error in the code");
1098 return StatusCode::FAILURE;
1099 }
1100 const Details::IObjectManager* omgr =
1101 dynamic_cast<const RObjectManager*>(mgr_itr->second.get());
1102 if (omgr == nullptr) {
1103 ATH_MSG_FATAL("There's a logic error in the code");
1104 return StatusCode::FAILURE;
1105 }
1106
1107 // Check if we can switch out the internal store of this object.
1108 static const TClass* const holderClass = TClass::GetClass(typeid(SG::IAuxStoreHolder));
1109 if (omgr->holder()->getClass()->InheritsFrom(holderClass) == false) {
1110 // Nope... So let's just end the journey here.
1111 return StatusCode::SUCCESS;
1112 }
1113
1114 // Try to get the object as an IAuxStoreHolder.
1115 SG::IAuxStoreHolder* storeHolder = reinterpret_cast<SG::IAuxStoreHolder*>(
1116 omgr->holder()->getAs(typeid(SG::IAuxStoreHolder)));
1117 if (!storeHolder) {
1118 ATH_MSG_FATAL("There's a logic error in the code");
1119 return StatusCode::FAILURE;
1120 }
1121
1122 // A sanity check to see whether the store's type is in sync with the
1123 // object's type that it will be connected to:
1124 if ((standalone &&
1126 ((!standalone) && (storeHolder->getStoreType() !=
1128 ATH_MSG_ERROR("Requested store types inconsistent for: " << prefix);
1129 ATH_MSG_ERROR("standalone = "
1130 << standalone << ", getStoreType() = "
1131 << static_cast<int>(storeHolder->getStoreType()));
1132 return StatusCode::FAILURE;
1133 }
1134
1135 // Return gracefully.
1136 return StatusCode::SUCCESS;
1137}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
@ AST_ContainerStore
The store describes a container.
@ AST_ObjectStore
The store describes a single object.
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
Object_t m_inputObjects
Collection of all the managed input objects.
Definition Event.h:342
std::unique_ptr< ROOT::RNTupleReader > m_eventReader
The main event data reader.
Definition REvent.h:131
StatusCode connectObject(const std::string &key, bool silent) override
Function setting up access to a particular object.
Definition REvent.cxx:839
@ SILENT
don't print anything and return success

◆ connectMetaAux()

StatusCode xAOD::Experimental::REvent::connectMetaAux ( const std::string & prefix,
bool standalone )
overrideprivatevirtualinherited

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.

This uses 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

Implements xAOD::Event.

Definition at line 1147 of file REvent.cxx.

1148 {
1149
1150 // A little sanity check.
1151 if (!m_metaReader) {
1152 ATH_MSG_ERROR("Function called on un-initialised object");
1153 return StatusCode::FAILURE;
1154 }
1155
1156 // Check if the field is already connected.
1157 if (m_inputMetaObjects.contains(prefix)) {
1158 return StatusCode::SUCCESS;
1159 }
1160
1161 // Connect to the field as we would for any other.
1162 static constexpr bool SILENT = false;
1163 ATH_CHECK(connectMetaObject(prefix, SILENT));
1164
1165 // Access the object's manager.
1166 Object_t::const_iterator mgr_itr = m_inputMetaObjects.find(prefix);
1167 if (mgr_itr == m_inputMetaObjects.end()) {
1168 ATH_MSG_FATAL("There's a logic error in the code");
1169 return StatusCode::FAILURE;
1170 }
1171 const Details::IObjectManager* omgr =
1172 dynamic_cast<const RObjectManager*>(mgr_itr->second.get());
1173 if (omgr == nullptr) {
1174 ATH_MSG_FATAL("There's a logic error in the code");
1175 return StatusCode::FAILURE;
1176 }
1177
1178 // Check if we can switch out the internal store of this object.
1179 static const TClass* const holderClass =
1180 TClass::GetClass(typeid(SG::IAuxStoreHolder));
1181 if (omgr->holder()->getClass()->InheritsFrom(holderClass) == false) {
1182 // Nope... So let's just end the journey here.
1183 return StatusCode::SUCCESS;
1184 }
1185
1186 // Try to get the object as an IAuxStoreHolder.
1187 SG::IAuxStoreHolder* storeHolder = reinterpret_cast<SG::IAuxStoreHolder*>(
1188 omgr->holder()->getAs(typeid(SG::IAuxStoreHolder)));
1189 if (!storeHolder) {
1190 ATH_MSG_FATAL("There's a logic error in the code");
1191 return StatusCode::FAILURE;
1192 }
1193
1194 // A sanity check to see whether the store's type is in sync with the
1195 // object's type that it will be connected to:
1196 if ((standalone &&
1198 ((!standalone) && (storeHolder->getStoreType() !=
1200 ATH_MSG_ERROR("Requested store types inconsistent for: " << prefix);
1201 ATH_MSG_ERROR("standalone = "
1202 << standalone << ", getStoreType() = "
1203 << static_cast<int>(storeHolder->getStoreType()));
1204 return StatusCode::FAILURE;
1205 }
1206
1207 // Return gracefully.
1208 return StatusCode::SUCCESS;
1209}
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
Definition Event.h:350
std::unique_ptr< ROOT::RNTupleReader > m_metaReader
The metadata reader.
Definition REvent.h:135
StatusCode connectMetaObject(const std::string &key, bool silent) override
Function setting up access to a particular metadata object.
Definition REvent.cxx:988

◆ connectMetaObject()

StatusCode xAOD::Experimental::REvent::connectMetaObject ( const std::string & key,
bool silent )
overrideprivatevirtualinherited

Function setting up access to a particular metadata object.

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

Implements xAOD::Event.

Definition at line 988 of file REvent.cxx.

988 {
989
990 // A little sanity check.
991 if (!m_metaReader) {
992 ATH_MSG_ERROR("Function called on un-initialised object");
993 return StatusCode::FAILURE;
994 }
995
996 // Check if the branch is already connected.
997 if (m_inputMetaObjects.contains(key)) {
998 return StatusCode::SUCCESS;
999 }
1000
1001 // RNTuples store fields with an "Aux:" postfix instead of "Aux.".
1002 std::string fieldName = key;
1003 if (key.ends_with("Aux.")) {
1004 fieldName.replace(fieldName.size() - 1, 1, ":");
1005 }
1006
1007 // Check if the field exists in our input RNTuple.
1008 if (m_metaReader->GetDescriptor().FindFieldId(fieldName.c_str()) ==
1009 ROOT::kInvalidDescriptorId) {
1010 // Field doesn't exist
1011 if (!silent) {
1012 ATH_MSG_WARNING("Field \"" << fieldName << "\" not available on input");
1013 }
1014 return StatusCode::RECOVERABLE;
1015 }
1016
1017 // RDS: may need some logic here to get type from inputEventFormat rather than
1018 // the view to read in with automatic schema evolution
1019
1020 // Get class name from the field
1021 ROOT::RNTupleView<void> view =
1022 m_metaReader->GetView<void>(fieldName.c_str(), nullptr);
1023 std::string className = view.GetField().GetTypeName();
1024 if (className == "") {
1026 "Couldn't find an appropriate type with a dictionary for field \""
1027 << fieldName << "\"");
1028 return StatusCode::FAILURE;
1029 }
1030 ::TClass* realClass = ::TClass::GetClass(className.c_str());
1031 if ((!realClass) || (!realClass->IsLoaded())) {
1032 // Now we're in trouble...
1034 "Couldn't find an appropriate type with a dictionary for field \""
1035 << fieldName << "\"");
1036 return StatusCode::FAILURE;
1037 }
1038
1039 // Create the object and the manager(s) around it.
1040 void* ptr = realClass->New();
1041 static const ::Long64_t FIRST_ENTRY = 0;
1042 auto mgr = std::make_unique<RObjectManager>(
1043 m_metaReader->GetView(fieldName, ptr, className), FIRST_ENTRY,
1044 std::make_unique<THolder>(ptr, realClass));
1045 // For metadata, we must read in the first entry - entry number already set by FIRST_ENTRY in constructor
1046 mgr->getEntry();
1047 RObjectManager* mgrPtr = mgr.get();
1048 m_inputMetaObjects[key] = std::move(mgr);
1049
1050 // If it's an auxiliary store object, set it up correctly.
1051 if (Details::isAuxStore(*(mgrPtr->holder()->getClass()))) {
1052 // For reading in of the dynamic variables for metadata
1054 }
1055
1056 // If it (probably) has an associated auxiliary store, set it up as well.
1057 if (Details::hasAuxStore(*(mgrPtr->holder()->getClass()))) {
1059 key + "Aux.", Details::isStandalone(*(mgrPtr->holder()->getClass()))));
1060 static constexpr bool METADATA = true;
1061 ATH_CHECK(setAuxStore(key, *mgrPtr, METADATA));
1062 }
1063
1064 // Return gracefully.
1065 return StatusCode::SUCCESS;
1066} // connectMetaObject
StatusCode setUpDynamicStore(RObjectManager &mgr, ROOT::RNTupleReader &ntupleReader)
event uses RNTupleReader:
Definition REvent.cxx:1825
StatusCode connectMetaAux(const std::string &prefix, bool standalone) override
Function setting up access to a set of auxiliary branches for a metadata object.
Definition REvent.cxx:1147
StatusCode setAuxStore(const std::string &key, Details::IObjectManager &mgr, bool metadata) override
Function connecting a DV object to its auxiliary store.
Definition REvent.cxx:1222
void * ptr(T *p)
Definition SGImplSvc.cxx:74
bool hasAuxStore(const TClass &cl)
Helper function deciding if a given type "has an auxiliary store".
Definition IOUtils.cxx:40
bool isAuxStore(const TClass &cl)
Helper function deciding if a given type "is an auxiliary store".
Definition IOUtils.cxx:53
bool isStandalone(const TClass &cl)
Helper function deciding if a given type "is a standalone object".
Definition IOUtils.cxx:65

◆ connectObject()

StatusCode xAOD::Experimental::REvent::connectObject ( const std::string & key,
bool silent )
overrideprivatevirtualinherited

Function setting up access to a particular object.

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

It connects the event object to a given field of the input RNTuple.

The type that is read in to memory is not actually determined by the type written to the ntuple itself, but from the xAOD::EventFormat object. Which is there to make it possible to possibly use ROOT read rules 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 true to make the code fail silently in case the field can't be connected to
Returns
The usual StatusCode values

Implements xAOD::Event.

Definition at line 839 of file REvent.cxx.

839 {
840
841 // A little sanity check.
842 if (!m_eventReader) {
843 ATH_MSG_ERROR("Function called on un-initialised object");
844 return StatusCode::FAILURE;
845 }
846
847 // Increment the access counter on this container.
849
850 // Check if the branch is already connected.
851 if (m_inputObjects.contains(key)) {
852 return StatusCode::SUCCESS;
853 }
854 // Check if it was already found to be missing.
855 if (m_inputMissingObjects.contains(key)) {
856 if (!silent) {
857 ATH_MSG_WARNING("Field \"" << key << "\" not available on input");
858 }
859 return StatusCode::RECOVERABLE;
860 }
861
862 // Tell the user what's happening.
863 ATH_MSG_DEBUG("Connecting to field \"" << key << "\"");
864
865 // Check if we have metadata about this branch.
866 const xAOD::EventFormatElement* ef = nullptr;
867
868 // RNTuples store fields with an "Aux:" postfix instead of "Aux.".
869 std::string fieldName = key;
870 if (key.ends_with("Aux.")) {
871 fieldName.replace(fieldName.size() - 1, 1, ":");
872 }
873
874 if (m_inputEventFormat.exists(key) == false) {
875 if (!silent) {
876 ATH_MSG_WARNING("No metadata available for object: " << key);
877 }
878 } else {
879 ef = m_inputEventFormat.get(key);
880 }
881
882 // Check if the field exists in our input RNTuple.
883 if (m_eventReader->GetDescriptor().FindFieldId(fieldName.c_str()) ==
884 ROOT::kInvalidDescriptorId) {
885 // Field doesn't exist
886 if (!silent) {
887 ATH_MSG_WARNING("Field \"" << fieldName << "\" not available on input");
888 }
889 m_inputMissingObjects.insert(key);
890 return StatusCode::RECOVERABLE;
891 }
892
893 // RDS: may need some logic here to get type from inputEventFormat rather than
894 // the view to read in with automatic schema evolution
895
896 // Get class name from the field
897 ROOT::RNTupleView<void> view =
898 m_eventReader->GetView<void>(fieldName.c_str(), nullptr);
899 std::string className = view.GetField().GetTypeName();
900 if (className == "") {
901 if (ef) {
902 // This is a fairly weird situation, but let's fall back to taking
903 // the class name from the metadata object in this case.
904 className = ef->className();
905 } else {
907 "Couldn't find an appropriate type with a dictionary for field \""
908 << fieldName << "\"");
909 return StatusCode::FAILURE;
910 }
911 }
912 ::TClass* realClass = ::TClass::GetClass(className.c_str());
913 if (((!realClass) || (!realClass->IsLoaded())) && ef) {
914 // We may need to do an actual schema evolution here, in which
915 // case let's fall back on the class name coming from the metadata
916 // object.
917 className = ef->className();
918 realClass = ::TClass::GetClass(className.c_str());
919 }
920 if ((!realClass) || (!realClass->IsLoaded())) {
921 // Now we're in trouble...
923 "Couldn't find an appropriate type with a dictionary for field \""
924 << fieldName << "\"");
925 return StatusCode::FAILURE;
926 }
927
928 // Make sure that the current object is the "active event":
929 setActive();
930
931 // Check if the output already has this object. If it does, let's
932 // assume that we have been copying the object to the output. Which
933 // means that we need to resume filling the same memory address that
934 // the output holder points to.
935 void* ptr = nullptr;
936
937 // Handle the case where an output object with this key already exists.
938 Object_t::const_iterator out_itr = m_outputObjects.find( key );
939 if( out_itr != m_outputObjects.end() ) {
940 // It needs to be an object manager...
941 RObjectManager* mgr =
942 dynamic_cast< RObjectManager* >( out_itr->second.get() );
943 if( ! mgr ) {
944 ATH_MSG_ERROR("Couldn't access output manager for: " << key );
945 return StatusCode::FAILURE;
946 }
947 // Get the pointer out of it:
948 ptr = mgr->holder()->get();
949 }
950
951 // If there is no output object, then let's create one ourselves.
952 // This is the only way in which we can have the memory management of
953 // THolder do the right thing with this object.
954 if (ptr == nullptr) {
955 ptr = realClass->New();
956 }
957
958 // Create the new manager object that will hold this EDM object.
959 auto mgr = std::make_unique<RObjectManager>(
960 m_eventReader->GetView(fieldName, ptr, className), m_entry,
961 std::make_unique<THolder>(ptr, realClass));
962 RObjectManager* mgrPtr = mgr.get();
963 m_inputObjects[key] = std::move(mgr);
964
965 // If it's an auxiliary store object, set it up correctly.
966 if (Details::isAuxStore(*(mgrPtr->holder()->getClass()))) {
968 }
969
970 // If it (probably) has an associated auxiliary store, set it up as well.
971 if (Details::hasAuxStore(*(mgrPtr->holder()->getClass()))) {
973 key + "Aux.", Details::isStandalone(*(mgrPtr->holder()->getClass()))));
974 }
975
976 // Return gracefully.
977 return StatusCode::SUCCESS;
978} // connectObject
#define ATH_MSG_DEBUG(x)
std::set< std::string > m_inputMissingObjects
Objects that have been asked for, but were found to be missing in the current input.
Definition Event.h:345
void setActive() const
Set this event object as the currently active one.
Definition EventCore.cxx:61
Object_t m_outputObjects
Collection of all the managed output object.
Definition Event.h:347
::Long64_t m_entry
The entry to look at from the input.
Definition REvent.h:138
StatusCode connectAux(const std::string &prefix, bool standalone) override
Function setting up access to a set of auxiliary branches.
Definition REvent.cxx:1077
ReadStats & stats()
Access the object belonging to the current thread.
Definition IOStats.cxx:17
static IOStats & instance()
Singleton object accessor.
Definition IOStats.cxx:11
void readContainer(const std::string &name)
Function incrementing the read counter on a specific container.

◆ contains() [1/2]

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

Function checking if an object is available from the store.

◆ contains() [2/2]

bool xAOD::Event::contains ( const std::string & key,
const std::type_info & ti,
bool metadata )
protectedinherited

Internal function checking if an object is in the input.

◆ containsMeta()

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

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

◆ copy()

StatusCode Event::copy ( const std::string & pattern = ".*")
inherited

Copy an object directly from the input to the output.

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

It only needs to be called on the interface object/container(s), the copying of the auxiliary data is done automatically, and is steered by the xAOD::Event::setAuxItemList function.

Parameters
patternRegular expression for the key(s)/name(s) of the object(s)/container(s) to copy

Definition at line 95 of file EventIO.cxx.

95 {
96
97 // Tell the user what's happening.
98 ATH_MSG_DEBUG("Copying objects matching pattern \"" << pattern
99 << "\" to the output");
100
101 // Collect a list of keys to copy.
102 std::set<std::string> keys;
103
104 // The regular expression to use.
105 std::regex re{pattern};
106
107 // Loop over the known input containers.
108 for (const auto& [key, efe] : m_inputEventFormat) {
109
110 // Tell the user what's happening.
111 ATH_MSG_VERBOSE("Considering input object with key \"" << key << "\"");
112
113 // Check if the class in question matches the requested pattern.
114 if (std::regex_match(key, re) == false) {
115 continue;
116 }
117 // Skip all branches ending in "Aux.":
118 if (key.ends_with("Aux.")) {
119 continue;
120 }
121 // Also skip dynamic branches:
122 if (efe.parentName() != "") {
123 continue;
124 }
125 // Ignore objects that don't exist on the input.
126 static const bool SILENT = true;
127 if (connectObject(key, SILENT).isSuccess() == false) {
128 continue;
129 }
130 // Add the key to the list.
131 ATH_MSG_VERBOSE("Matched key \"" << key << "\"");
132 keys.insert(key);
133 }
134
135 // Check if the pattern matches any of the name remapping rules.
136 for (const auto& [newname, onfile] : m_nameRemapping) {
137
138 // Tell the user what's happening.
139 ATH_MSG_VERBOSE("Considering remapped key \"" << newname << "\"");
140
141 // Check if the remapped name matches the pattern.
142 if (std::regex_match(newname, re) == false) {
143 continue;
144 }
145 // Ignore objects that don't exist on the input.
146 static const bool SILENT = true;
147 if (connectObject(onfile, SILENT).isSuccess() == false) {
148 continue;
149 }
150 // Add the remapped name to the list.
151 ATH_MSG_VERBOSE("Matched remapped key \"" << newname << "\"");
152 keys.insert(newname);
153 }
154
155 // Now loop over all of the found keys.
156 for (const std::string& key : keys) {
157
158 // Check if a name re-mapping should be applied or not.
159 std::string keyToUse = key;
160 auto remap_itr = m_nameRemapping.find(key);
161 if ((remap_itr != m_nameRemapping.end()) &&
162 (!m_inputEventFormat.exists(key)) &&
163 m_inputEventFormat.exists(remap_itr->second)) {
164 keyToUse = remap_itr->second;
165 }
166
167 // Make sure that the input object got connected to.
168 static const bool SILENT = false;
169 ATH_CHECK(connectObject(keyToUse, SILENT));
170
171 // Make sure that the input object is properly updated.
172 Object_t::const_iterator vobjMgr = m_inputObjects.find(keyToUse);
173 if (vobjMgr == m_inputObjects.end()) {
174 ATH_MSG_FATAL("Internal logic error detected");
175 return StatusCode::FAILURE;
176 }
177 Details::IObjectManager* objMgr =
178 dynamic_cast<Details::IObjectManager*>(vobjMgr->second.get());
179 if (objMgr == nullptr) {
180 ATH_MSG_FATAL("Internal logic error detected");
181 return StatusCode::FAILURE;
182 }
183 static const bool METADATA = false;
184 if (getInputObject(keyToUse, *(objMgr->holder()->getClass()->GetTypeInfo()),
185 SILENT, METADATA) == nullptr) {
186 ATH_MSG_FATAL("Internal logic error detected");
187 return StatusCode::FAILURE;
188 }
189
190 // Put the interface object into the output.
191 static const bool OVERWRITE = true;
192 static const bool IS_OWNER = true;
193 ATH_CHECK(record(objMgr->object(), objMgr->holder()->getClass()->GetName(),
194 key, OVERWRITE, METADATA, IS_OWNER));
195
196 // If there is also an auxiliary store for this object/container, copy that
197 // as well.
198 const std::string auxKey = keyToUse + "Aux.";
199 if (m_inputObjects.contains(auxKey)) {
200 ATH_CHECK(
201 recordAux(*(m_inputObjects.at(auxKey)), key + "Aux.", METADATA));
202 }
203 }
204
205 // Return gracefully:
206 return StatusCode::SUCCESS;
207}
const std::regex re(r_e)
#define ATH_MSG_VERBOSE(x)
virtual StatusCode recordAux(TVirtualManager &mgr, const std::string &key, bool metadata)=0
Record an auxiliary store into a connected output file.
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent) override
Function for retrieving an input object in a non-template way.
virtual StatusCode connectObject(const std::string &key, bool silent)=0
Function setting up access to a particular object.
StatusCode record(T *obj, const std::string &key)
Add an output object to the event.
StatusCode keys(std::vector< std::string > &vkeys, bool metadata) const
Provide a list of all data object keys associated with a specific type.
@ OVERWRITE
create the directory as is, removing existing directories if needed

◆ createAndReadFrom()

std::unique_ptr< Event > Event::createAndReadFrom ( TFile & inFile)
staticinherited

static method to create an Event object and readFrom a file, given by a TFile.

static method to get Event object for reading either TTree (TEvent) or RNTuple (REvent).

The the reader technology, TTree read by TEvent or RNTuple read by REvent, is determined by the looking into the file, given as a TFile object.

Here we access by TFile object

Definition at line 43 of file EventIO.cxx.

43 {
44
45 // Make use of the messaging function(s) from the xAODEvent namespace.
46 using xAODEvent::msg;
47
48 if (inFile.FindKey(EVENT_RNTUPLE_NAME) != nullptr) {
49 // Create and set up an REvent object
50 auto event = std::make_unique<Experimental::REvent>();
51 if (event->readFrom(inFile).isFailure()) {
52 ANA_MSG_ERROR("Could not read RNTuple from: " << inFile.GetName());
53 return {};
54 }
55 return event;
56 } else if (inFile.FindKey(EVENT_TREE_NAME) != nullptr) {
57 // Create and set up a TEvent object
58 // Check if file is AOD, in which case kAthenaAccess must be used
59 auto eauxMode = TEvent::kClassAccess;
60 std::string sauxMode = "kClassAccess";
61 auto metaData = dynamic_cast<TTree*>(inFile.Get("MetaData"));
62 if (metaData) {
63 auto rc = metaData->LoadTree(0);
64 if (rc < 0)[[unlikely]]{
65 ANA_MSG_ERROR("Error from LoadTree: "<< rc);
66 return {};
67 }
68 if (metaData->GetBranch("StreamAOD")) {
69 eauxMode = TEvent::kAthenaAccess;
70 sauxMode = "kAthenaAccess";
71 }
72 }
73 ANA_MSG_INFO("Using aux mode " << sauxMode << " for file " << inFile.GetName());
74 auto event = std::make_unique<TEvent>(eauxMode);
75 if (event->readFrom(inFile).isFailure()) {
76 ANA_MSG_ERROR("Could not read TTree from: " << inFile.GetName());
77 return {};
78 }
79 return event;
80 } else {
81 ANA_MSG_ERROR("Could not recognize file: " << inFile.GetName());
82 return {};
83 }
84}
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
static Double_t rc
static const char *const EVENT_TREE_NAME
Default name of the event TTree.
Definition Event.h:77
static const char *const EVENT_RNTUPLE_NAME
Name of the event RNTuple.
Definition Event.h:78
@ kAthenaAccess
Access containers/objects like Athena does.
@ kClassAccess
Access auxiliary data using the aux containers.
str inFile
Definition makeTOC.py:5
#define unlikely(x)

◆ currentContext()

const EventContext & Event::currentContext ( ) const
protectedinherited

Return the event context corresponding to this event.

(Returns a dummy in standalone builds.)

Definition at line 311 of file EventCore.cxx.

311 {
312#ifdef XAOD_STANDALONE
313 return Gaudi::Hive::currentContext();
314#else
315 return m_ctx;
316#endif
317}
EventContext m_ctx
The event context associated with this event.
Definition Event.h:408

◆ dump()

std::string Event::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 257 of file EventCore.cxx.

257 {
258
259 // The internal stream object.
260 std::ostringstream ost;
261 ost << "<<<<<<<<<<<<<<<<<<<< xAOD::TEvent Dump >>>>>>>>>>>>>>>>>>>>\n";
262
263 // Loop over the input EventFormat object.
264 for (const auto& [key, element] : m_inputEventFormat) {
265
266 // Get the type.
267 ::TClass* cl = ::TClass::GetClass(element.className().c_str());
268 const std::type_info* ti = (cl ? cl->GetTypeInfo() : nullptr);
269 if ((cl == nullptr) || (cl->IsLoaded() == false) || (ti == nullptr)) {
270 ATH_MSG_WARNING("Unknown type (" << element.className()
271 << ") found in the event format");
272 continue;
273 }
274
275 // Skip containers that are not available anyway.
276 static const bool METADATA = false;
277 if (!contains(element.branchName(), *ti, METADATA)) {
278 continue;
279 }
280
281 // Do the printout.
282 ost << " Hash: 0x" << std::setw(8) << std::setfill('0') << std::hex
283 << element.hash() << " Key: \"" << element.branchName() << "\"\n";
284
285 ost << " type: " << element.className() << "\n";
286 const bool isNonConst =
287 transientContains(element.branchName(), *ti, METADATA);
288 ost << " isConst: " << (isNonConst ? "No" : "Yes") << "\n";
289 static const bool SILENT = false;
290 ost << " Data: "
291 << (isNonConst
292 ? getOutputObject(element.branchName(), *ti, METADATA)
293 : getInputObject(element.branchName(), *ti, SILENT, METADATA))
294 << "\n";
295 }
296
297 // Finish with the construction:
298 ost << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
299 return ost.str();
300}
bool transientContains(const std::string &key) const
Function checking if an object is already in memory.
bool contains(const std::string &key)
Function checking if an object is available from the store.
void * getOutputObject(SG::sgkey_t key, const std::type_info &ti) override
Function for retrieving an output object in a non-template way.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]

◆ fill()

Int_t xAOD::Experimental::REvent::fill ( )
overridevirtualinherited

Method filling one event into the output.

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

Implements xAOD::Event.

Definition at line 612 of file REvent.cxx.

612 {
613
614 // Make sure that all objects have been read in. The 99 as the value
615 // has a special meaning for RAuxStore. With this value it doesn't
616 // delete its transient (decoration) variables. Otherwise it does.
617 // (As it's supposed to, when moving to a new event.)
618 if( m_eventReader ) {
619 if (getEntry( m_entry, 99 ) < 0) {
620 ATH_MSG_ERROR( "getEntry failed!" );
621 return 0;
622 }
623 }
624
625 // Prepare the objects for writing. Note that we need to iterate over a
626 // copy of the m_outputObjects container. Since the putAux(...) function
627 // called inside the loop may itself add elements to the m_outputObject
628 // container.
629 std::string unsetObjects;
630 std::vector<std::pair<std::string, TVirtualManager*>> outputObjectsCopy;
631 outputObjectsCopy.reserve(m_outputObjects.size());
632 for (const auto& [key, mgr] : m_outputObjects) {
633 TVirtualManager* objMgr = dynamic_cast<TVirtualManager*>(mgr.get());
634 if (objMgr == nullptr) {
635 ATH_MSG_ERROR("Internal logic error detected");
636 return 0;
637 }
638 outputObjectsCopy.emplace_back(key, objMgr);
639 }
640 for (auto &[key, mgr] : outputObjectsCopy) {
641
642 ATH_MSG_DEBUG("REvent::fill - checking and adding aux for " << key << ", " << mgr << " isSet " << mgr->isSet());
643
644 // Check that a new object was provided in the event - skip dynamic variables:
645 if ((key.find("AuxDyn") == std::string::npos) && !mgr->isSet()) {
646
647 ATH_MSG_DEBUG("REvent::fill - not set " << key);
648
649 // We are now going to fail. But let's collect the names of
650 // all the unset objects:
651 if (unsetObjects.size()) {
652 unsetObjects += ", ";
653 }
654 unsetObjects.append("\"" + key + "\"");
655 continue;
656 }
657
658 // Make sure that any dynamic auxiliary variables that
659 // were added to the object after it was put into the event
660 // are also added to the output.
661 if( putAux( *mgr ).isFailure() ) {
662 ATH_MSG_ERROR( "Failed to put dynamic auxiliary variables in the output for object \"" << key << "\"" );
663 return 0;
664 }
665 }
666
667 // Check if there were any unset objects:
668 if (unsetObjects.size()) {
669 ATH_MSG_ERROR("The following objects were not set in the current event: "
670 << unsetObjects);
671 return 0;
672 }
673
674 // For the first call to fill, we create an RNTupleWriter with the RNTuple model already accumulated
675 // - there may be extensions for Aux containers which are empty for the first few events
676 ATH_MSG_DEBUG( "REvent::fill - has event writer " << (m_eventWriter.get() != nullptr) );
677
678 if( m_eventWriter.get() == nullptr ) {
679
680 // Set output RNTuple name as model description
681 const char* rnTupleName = EVENT_RNTUPLE_NAME;
682
683 // Create RNTuple write with model
684 m_eventWriter = ROOT::RNTupleWriter::Append(std::move(m_model), rnTupleName, *m_outputFile);
685
686 // Reset the RNTupleModel so that subsequent additions of new fields will be done with model extensions
687 m_model.reset();
688
689 ATH_MSG_DEBUG( "REvent::fill - created writer and reset model " );
690
691 }
692
693 // Get entry for writing
694 auto rnEntry = m_eventWriter->GetModel().CreateBareEntry();
695
696 // Now loop over all object managers and bind the output object pointers
697 // to the those in the output RNTuple
698 ::Int_t nbytes = 0;
699 for (auto &[key, mgr] : m_outputObjects) {
700
701 // Get field name from the key
702 auto fieldName = getFieldNameFromKey(key);
703
704 // Check if this is a container, top-level or aux, rather than a aux variable (AuxDyn):
705 ROutObjManager* omgr = dynamic_cast< ROutObjManager* >( mgr.get() );
706 bool isContainer = (omgr != nullptr);
707
708 ATH_MSG_DEBUG("REvent::fill - bind ptr " << key << " mgr " << mgr << " is set " << mgr->isSet()
709 << ", is container " << isContainer);
710
711 // Save value, if an object has been set, otherwise save default value
712 // Dynamic attributes don't exist for empty containers, e.g. no electrons in an event
713 if (mgr->isSet()) {
714 rnEntry->BindRawPtr(fieldName, mgr->object());
715 } else {
716
717 ATH_MSG_DEBUG("REvent::fill - bind unSet ptr " << key << " mgr " << mgr << " is set " << mgr->isSet()
718 << ", is container " << isContainer);
719
720 rnEntry->EmplaceNewValue(fieldName);
721 }
722 }
723
724 ATH_MSG_DEBUG("REvent::fill - writer fill ");
725
726 // Write the entry, and check the return value:
727 const ::Int_t ret = m_eventWriter->Fill(*rnEntry);
728 if( ret <= 0 ) {
729 ATH_MSG_ERROR( "Output RNTuple filling failed with return value: " << ret );
730 }
731 nbytes += ret;
732
733 ATH_MSG_DEBUG("REvent::fill - writer filled ");
734
735 // Reset the object managers:
736 for (auto &[key, mgr] : m_outputObjects) {
737 mgr->reset();
738
739 ATH_MSG_DEBUG("REvent::fill - after reset " << key << " is set " << mgr->isSet());
740
741 }
742
743 // Return the number of bytes written:
744 return nbytes;
745}
StatusCode putAux(TVirtualManager &mgr, ::Bool_t metadata=kFALSE)
Method saving the dynamically created auxiliary properties.
Definition REvent.cxx:1506
::Int_t getEntry(::Long64_t entry, ::Int_t getall=0) override
Function loading a given entry of the input RNTuple.
Definition REvent.cxx:558
::TFile * m_outputFile
The output file for writing.
Definition REvent.h:147

◆ finishWritingTo()

StatusCode xAOD::Experimental::REvent::finishWritingTo ( TFile & file)
overridevirtualinherited

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

reset writer (metaDataWriter will be reset when going out of scope)

Implements xAOD::Event.

Definition at line 377 of file REvent.cxx.

377 {
378
379 // A small sanity check for meta data writing - need output file as long as MetaData is in a rntuple:
380 if( m_outputFile != &file ) {
381 ATH_MSG_FATAL("File given to finishWritingTo does not match the file given in writeTo file!");
382 return StatusCode::FAILURE;
383 }
384
385 // Notify the listeners that they should write out their metadata, if they
386 // have any.
387 const TIncident incident( IncidentType::MetaDataStop );
388 for (auto& listener : m_listeners) {
389 listener->handle(incident);
390 }
391
392 // Now go to the output file:
393 m_outputFile->cd();
394
395 const char* outRNTupleName = METADATA_OBJECT_NAME;
396
397 // Check if there's already a metadata tree in the output, if so we can return:
398 if( m_outputFile->Get( outRNTupleName ) ) {
399
400 // Let's assume that the metadata is complete in the file already.
401 ATH_MSG_INFO( "Metadata tree already exists, returning" );
402
403 return StatusCode::SUCCESS;
404 }
405
406 // Write out meta data
407
408 // Create new model for this file
409 auto model = ROOT::RNTupleModel::Create();
410
411 // Set output RNTuple name as model description
412 model->SetDescription(outRNTupleName);
413
414
415 // Create field explicitly for EventFormat
416
417 // Check if we have a dictionary: for this object:
418 std::string typeName = SG::normalizedTypeinfoName( typeid( xAOD::EventFormat ) );
419 TClass* cl = TClass::GetClass( typeName.c_str() );
420 if( ! cl ) {
421 ATH_MSG_ERROR( "Didn't find dictionary for type: " << typeName );
422 return StatusCode::FAILURE;
423 }
424 std::string efName = cl->GetName();
425
426 ATH_MSG_DEBUG("finishWriting");
427
428 model->AddField( ROOT::RFieldBase::Create( "EventFormat", efName ).Unwrap());
429
430 // Loop over output meta data object managers and create the corresponding fields for the output model
431
432 // Make sure that any dynamic auxiliary variables that
433 // were added to the object after it was put into the event,
434 // get added to the output
435
436 // Must copy m_outputMetaObjects because it may be augmented in putAux
437 std::vector<std::pair<std::string, TVirtualManager*>> outputMetaObjects;
438 outputMetaObjects.reserve(m_outputMetaObjects.size());
439 for (const auto& [key, mgr] : m_outputMetaObjects) {
440 TVirtualManager* objMgr = dynamic_cast<TVirtualManager*>(mgr.get());
441 if (objMgr == nullptr) {
442 ATH_MSG_FATAL("Internal logic error detected");
443 return StatusCode::FAILURE;
444 }
445
446 ATH_MSG_DEBUG("finishWriting: save metadata key " << key);
447
448 outputMetaObjects.emplace_back(key, objMgr);
449 }
450
451 // Set up the saving of all the dynamic auxiliary properties
452 // of the object if it has any:
453 for( auto& itr : outputMetaObjects ) {
454 static constexpr bool IS_METADATA = true;
455 ATH_CHECK( putAux( *(itr.second), IS_METADATA ) );
456 }
457
458 // Now create fields for each output metadata object
459 for (auto &[key, mgr] : m_outputMetaObjects) {
460
461 // Get field name and class name to create a RFieldBase
462 std::string fieldName;
463 std::string className;
464 if (getInfoForFieldCreation( key, *mgr, fieldName, className ).isFailure()) return StatusCode::FAILURE;
465
466 // should have found class name
467 if ( className.empty() ) {
468 ATH_MSG_ERROR( "could not find className!" );
469 return StatusCode::FAILURE;
470 }
471
472 // Add RFieldBase to model
473 model->AddField( ROOT::RFieldBase::Create( fieldName, className ).Unwrap());
474
475 }
476
477 // Create RNTuple write for meta data with model
478 auto metaDataWriter = ROOT::RNTupleWriter::Append(std::move(model), outRNTupleName, *m_outputFile);
479
480
481 // Get entry for writing
482 auto rnEntry = metaDataWriter->GetModel().CreateBareEntry();
483
484 // Now loop over all object managers and bind the output object pointers
485 // to the those in the output metadata RNTuple
486 for (auto &[key, mgr] : m_outputMetaObjects) {
487
488 // Get field name from the key
489 auto fieldName = getFieldNameFromKey(key);
490
491 // Save value, if exist, otherwise save default value
492 if (mgr.get()) {
493 rnEntry->BindRawPtr(fieldName, mgr->object());
494 } else {
495 rnEntry->EmplaceNewValue(fieldName);
496 }
497 }
498
499 // Add EventFormat to the RNEntry
500 rnEntry->BindRawPtr( "EventFormat", m_outputEventFormat );
501
502 // Write the entry, and check the return value:
503 const ::Int_t ret = metaDataWriter->Fill(*rnEntry);
504 if( ret <= 0 ) {
505 ATH_MSG_FATAL( "Output rntuple filling failed with return value: " << ret );
506 }
507 else {
508 ATH_MSG_INFO( "Output meta data rntuple filled. nbytes = " << ret );
509 }
510
511 // Now clean up:
512
513 // reset output EventFormat
515 m_outputObjects.clear();
516 m_outputMetaObjects.clear();
517
518 rnEntry.reset();
519
521 m_eventWriter.reset();
522
523 metaDataWriter.reset();
524
525 // Return gracefully:
526 return StatusCode::SUCCESS;
527} // finishWriting
#define ATH_MSG_INFO(x)
static const char *const METADATA_OBJECT_NAME
Name of the metadata tree or RNTuple.
Definition Event.h:79
EventFormat * m_outputEventFormat
Format of the current output file.
Definition Event.h:357
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
Definition Event.h:352
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...
static const ::Int_t MetaDataStop
The metadata for the output file should be written out.
Definition TIncident.h:31
EventFormat_v1 EventFormat
Definition of the current event format version.
Definition EventFormat.h:16
TFile * file

◆ getBranchInfo()

const Event::BranchInfo * Event::getBranchInfo ( SG::sgkey_t sgkey) const
protectedinherited

Get the object describing one object/branch.

Definition at line 347 of file EventIProxyDict.cxx.

347 {
348
349 {
350 // We can only hold the lock (even though it's a shared lock) for
351 // this limited scope because the call to getInputObject below
352 // leads to a recursion and dead-lock if not released immediately.
354
355 // If the object already exists, return it:
356 auto it = m_branches.find(sgkey);
357 if (it != m_branches.end()) {
358 return &(it->second);
359 }
360 }
361
362 // If not, construct it now:
363 BranchInfo bi;
364 const xAOD::EventFormatElement* efe = getEventFormatElement(sgkey);
365 if (!efe) {
366 // Apparently this key is not known:
367 return nullptr;
368 }
369
370 // Helper variable(s).
371 static const bool SILENT = true;
372 static const bool METADATA = false;
373
374 // The name of the requested object.
375 const std::string& name = getName(sgkey);
376 // This is a bit perverse... In order to let the "base class" figure
377 // out the exact type of this object, we ask for it with an "Event
378 // pointer". I use that type because I need something that has a
379 // dictionary, and which should always be available when this code
380 // runs. In the end it doesn't matter that the object can't be
381 // retrieved as that type (of course...), it only matters that it gets
382 // "set up" following these calls.
383 Event* nc_this = const_cast<Event*>(this);
384 static const std::type_info& dummy = typeid(Event);
385 nc_this->getInputObject(name, dummy, SILENT, METADATA);
386 auto itr = m_outputObjects.find(name);
387 if (itr == m_outputObjects.end()) {
388 itr = m_inputObjects.find(name);
389 if (itr == m_inputObjects.end()) {
390 // We didn't find this object in the store...
391 return nullptr;
392 }
393 }
394 const Details::IObjectManager* mgr =
395 dynamic_cast<const Details::IObjectManager*>(itr->second.get());
396 if (!mgr) {
397 ATH_MSG_ERROR("Internal logic error found");
398 return nullptr;
399 }
400 bi.m_class = mgr->holder()->getClass();
401 // There's no need to check whether this is a "proper" dictionary
402 // at this point, since if TEvent is holding on to it, the type
403 // must have a proper compiled dictionary.
404
405#ifndef XAOD_STANDALONE
406 // Create a proper proxy for the input branch:
407 auto taddr = std::make_unique<SG::TransientAddress>(
408 CLID_NULL, efe->branchName(), new GenericAddress());
409 taddr->setSGKey(sgkey);
411 *nc_this, getName(sgkey), *bi.m_class->GetTypeInfo());
412 bi.m_proxy = std::make_unique<SG::DataProxy>(std::move(taddr), loader);
413 loader->setProxy(*bi.m_proxy.get());
414#endif // not XAOD_STANDALONE
415
416 // Add the branch info to our list:
418 lock.upgrade();
419 auto ret = m_branches.insert(std::make_pair(sgkey, std::move(bi)));
420
421 // Return a pointer to the branch info:
422 return &(ret.first->second);
423}
void setProxy(SG::DataProxy &proxy)
const std::string & branchName() const
Get the branch/key name.
const std::string & name() const override
Get the name of the instance.
const std::string & getName(const void *obj) const override
Function returning the key describing a known object.
friend class xAODPrivate::Loader
Definition Event.h:65
Event(std::string_view name)
Constructor with a name.
Definition EventCore.cxx:29
const xAOD::EventFormatElement * getEventFormatElement(SG::sgkey_t sgkey) const
Get the metadata object for a given "SG key".

◆ getEntries()

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

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

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

Implements xAOD::Event.

Definition at line 532 of file REvent.cxx.

532 {
533
534 if (m_eventReader) {
535 return m_eventReader->GetNEntries();
536 } else if (m_inputNTupleIsMissing) {
537 return 0u;
538 } else {
539 ATH_MSG_ERROR("Function called on an uninitialised object");
540 return 0u;
541 }
542}
bool m_inputNTupleIsMissing
Whether the input has an event RNTuple or not.
Definition REvent.h:133
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ getEntry()

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

Function loading a given entry of the input RNTuple.

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

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

Implements xAOD::Event.

Definition at line 558 of file REvent.cxx.

558 {
559
560 // A little sanity check:
561 if (!m_eventReader) {
562 ATH_MSG_ERROR("Function called on an uninitialised object");
563 return -1;
564 }
565
566 // Check if anything needs to be done.
567 if (entry == m_entry) {
568 ATH_MSG_DEBUG("Entry " << entry << " is already the active one");
569 return 0;
570 }
571
572 // Set entry value
573 m_entry = entry;
574
575 // Stats counter needs to know it's the next event.
577
578 // Loop over all input object managers, and force them to load their
579 // content. But only if getall was used.
580 ::Int_t result = 0;
581 if (getall) {
582 for (auto& [key, inObj] : m_inputObjects) {
583 result += inObj->getEntry(getall);
584 }
585 }
586
587 // Notify the listeners that a new event was loaded.
588 const TIncident incident(IncidentType::BeginEvent);
589 for (TVirtualIncidentListener* listener : m_listeners) {
590 listener->handle(incident);
591 }
592
593 // Return the number of bytes read.
594 return result;
595}
void nextEvent()
Function incrementing the processed event counter.
static const ::Int_t BeginEvent
A new event was just loaded.
Definition TIncident.h:29

◆ getEventFormatElement()

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

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

Definition at line 321 of file EventIProxyDict.cxx.

322 {
323
324 const xAOD::EventFormatElement* efe = nullptr;
325 static const bool QUIET = true;
327 efe = m_outputEventFormat->get(sgkey, QUIET);
328 }
329 if (!efe) {
330 efe = m_inputEventFormat.get(sgkey, QUIET);
331 }
332 if (!efe) {
333 static SG::SGKeySet missingSGKeys ATLAS_THREAD_SAFE;
334 static mutex_t mutex;
335 guard_t lock(mutex);
336 if (missingSGKeys.emplace(sgkey).second) {
339 "Can't find EventFormatElement for hashed SG key: " << sgkey);
340 }
341 return 0;
342 }
343 }
344 return efe;
345}
AthContainers_detail::lock_guard< mutex_t > guard_t
Guard type for multithreaded synchronisation.
std::unordered_set< sgkey_t > SGKeySet
A set of sgkey_t values.
Definition sgkey_t.h:97
AthContainers_detail::mutex mutex_t
Mutex used to synchronize modifications to the cache vector.

◆ getHash()

SG::sgkey_t Event::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 27 of file EventTVirtualEvent.cxx.

27 {
28
29 // For empty keys let's finish quickly.
30 if (key == "") {
31 return 0;
32 }
33
34 // If the key is used in the input file, let's use the same hash for
35 // the output file as well.
36 if (m_inputEventFormat.exists(key)) {
37 return m_inputEventFormat.get(key)->hash();
38 }
39
40 // If it's a new key, make a new hash for it from scratch:
41 return Utils::hash(key);
42}
SG::sgkey_t hash(const std::string &name)
This function provides a hashed version of the key (branch) names used in the xAOD file,...

◆ getInputObject() [1/2]

const void * Event::getInputObject ( const std::string & key,
const std::type_info & ti,
bool silent,
bool metadata )
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 285 of file EventIO.cxx.

287 {
288
289 // Check if a name remapping should be applied or not:
290 std::string keyToUse = key;
291 auto remap_itr = m_nameRemapping.find(key);
292 if ((remap_itr != m_nameRemapping.end()) &&
293 (!m_inputEventFormat.exists(key)) &&
294 m_inputEventFormat.exists(remap_itr->second)) {
295 keyToUse = remap_itr->second;
296 }
297
298 // The following catches the cases when we ask for a transient
299 // ConstDataVector object to be returned as "const DataVector".
300 TStore* store = TActiveStore::store();
301 if (store && store->contains(keyToUse, ti) && store->isConst(keyToUse, ti)) {
302 const void* result = store->getConstObject(keyToUse, ti);
303 return result;
304 }
305
306 // A sanity check before checking for an object from the input file.
307 if (hasInput() == false) {
308 if (silent == false) {
309 ATH_MSG_WARNING("No input file connected to the Event object");
310 }
311 return nullptr;
312 }
313
314 // Make sure that the requested input is connected to.
315 const StatusCode sc = (metadata ? connectMetaObject(keyToUse, silent)
316 : connectObject(keyToUse, silent));
317 if (sc.isSuccess() == false) {
318 return nullptr;
319 }
320
321 // Select which object container to use:
322 Object_t& objects = (metadata ? m_inputMetaObjects : m_inputObjects);
323
324 // Access the object's manager:
325 auto itr = objects.find(keyToUse);
326 if (itr == objects.end()) {
327 ATH_MSG_FATAL("There is an internal logic error in the code...");
328 return nullptr;
329 }
330
331 // This has to be an ObjectManager object:
332 Details::IObjectManager* mgr =
333 dynamic_cast<Details::IObjectManager*>(itr->second.get());
334 if (mgr == nullptr) {
335 if (key == keyToUse) {
336 ATH_MSG_ERROR("Object of wrong type found for key \"" << key << "\"");
337 } else {
338 ATH_MSG_ERROR("Object of wrong type found for key \""
339 << key << "\"/\"" << keyToUse << "\"");
340 }
341 return nullptr;
342 }
343
344 // Make sure that the current entry is loaded for event data objects.
345 if (metadata == false) {
346 const Int_t readBytes = mgr->getEntry();
347 if (readBytes > 0) {
348 // Connect the auxiliary store to objects needing it. This call also
349 // takes care of updating the dynamic store of auxiliary containers,
350 // when they are getting accessed directly.
351 static const bool IS_METADATA = false;
352 if (setAuxStore(key, *mgr, IS_METADATA).isSuccess() == false) {
353 ATH_MSG_ERROR("Failed to set the auxiliary store for "
354 << mgr->holder()->getClass()->GetName() << "/"
355 << keyToUse);
356 return nullptr;
357 }
358 } else if (readBytes < 0) {
359 ATH_MSG_ERROR("Failed to load current entry for object "
360 << mgr->holder()->getClass()->GetName() << "/" << keyToUse);
361 return nullptr;
362 }
363 }
364
365 // Ask the holder object for the object of this type:
366 const void* result = mgr->holder()->getAsConst(ti, silent);
367 if (result == nullptr) {
368 if (!silent) {
369 ATH_MSG_WARNING("Could not retrieve object with key \""
370 << keyToUse << "\" as \""
371 << SG::normalizedTypeinfoName(ti) << "\"");
372 }
373 return nullptr;
374 }
375
376 // We succeeded:
377 return result;
378}
static Double_t sc
if(pathvar)
virtual bool hasInput() const =0
Check if an input file is connected to the object.
std::unordered_map< std::string, std::unique_ptr< TVirtualManager > > Object_t
Definition of the internal data structure type.
Definition Event.h:338
virtual StatusCode connectMetaObject(const std::string &key, bool silent)=0
Function setting up access to a particular metadata object.
virtual StatusCode setAuxStore(const std::string &key, Details::IObjectManager &mgr, bool metadata)=0
Function connecting a DV object to its auxiliary store.
static TStore * store()
Access the currently active TStore object.
::StatusCode StatusCode
StatusCode definition for legacy code.
TestStore store
Definition TestStore.cxx:23
silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity... N....

◆ getInputObject() [2/2]

const void * Event::getInputObject ( SG::sgkey_t key,
const std::type_info & ti,
bool silent )
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 162 of file EventTVirtualEvent.cxx.

163 {
164
165 // Get a string name for this key:
166 const std::string& name = getName(key);
167 if (name.empty() && (silent == false)) {
168 ATH_MSG_WARNING("Key 0x" << std::hex << key << " unknown");
169 return nullptr;
170 }
171
172 // Forward the call to the function using an std::string key:
173 static const bool METADATA = false;
174 return getInputObject(name, ti, silent, METADATA);
175}

◆ getKey()

SG::sgkey_t Event::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 51 of file EventTVirtualEvent.cxx.

51 {
52
53 // Make use of the getName function.
54 return getHash(getName(obj));
55}
SG::sgkey_t getHash(const std::string &key) const override
Function returning the hash describing an object name.

◆ getName() [1/2]

const std::string & Event::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 64 of file EventTVirtualEvent.cxx.

64 {
65
66 // First look among the output objects.
67 for (const auto& [key, manager] : m_outputObjects) {
68 // Check if this is our object.
69 if (manager->object() == obj) {
70 // If it is, let's return right away.
71 return key;
72 }
73 }
74
75 // Now look among the input objects.
76 for (const auto& [key, manager] : m_inputObjects) {
77 // Check if this is our object.
78 if (manager->object() == obj) {
79 // If it is, let's return.
80 return key;
81 }
82 }
83
84 // If it's not there either, check if it's in an active TStore object:
85 const TStore* store = TActiveStore::store();
86 if (store && store->contains(obj)) {
87 // Get the name from the store then:
88 return store->getName(obj);
89 }
90
91 // We didn't find the object in the event...
92 ATH_MSG_WARNING("Didn't find object with pointer \"" << obj
93 << "\" in the event");
94 static const std::string dummy;
95 return dummy;
96}

◆ getName() [2/2]

const std::string & Event::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 105 of file EventTVirtualEvent.cxx.

105 {
106
107 // If the branch is known from the input:
108 if (m_inputEventFormat.exists(hash)) {
109 return m_inputEventFormat.get(hash)->branchName();
110 }
111
112 // If the branch is known on the output:
113 if (m_outputEventFormat && m_outputEventFormat->exists(hash)) {
114 return m_outputEventFormat->get(hash)->branchName();
115 }
116
117 // If this is an object in the active store:
118 const TStore* store = TActiveStore::store();
119 if (store && store->contains(hash)) {
120 return store->getName(hash);
121 }
122
123 // If it is unknown:
124 static const std::string dummy;
125 return dummy;
126}

◆ getNames()

StatusCode xAOD::Experimental::REvent::getNames ( const std::string & targetClassName,
std::vector< std::string > & vkeys,
bool metadata ) const
overrideprivatevirtualinherited

Function determining the list keys associated with a type name.

Implements xAOD::Event.

Definition at line 748 of file REvent.cxx.

750 {
751
752 // The results go in here
753 std::set<std::string> keys;
754
755 // Get list of fields from
756 // the input metadata tree or input tree
757
758 ROOT::RNTupleReader* reader = (metadata) ? m_metaReader.get() : m_eventReader.get();
759 if (reader == nullptr) {
760 ATH_MSG_ERROR("No input file is connected");
761 return StatusCode::FAILURE;
762 }
763 if (metadata) ATH_MSG_DEBUG("scanning input objects for metadata for type name " << targetClassName);
764 else ATH_MSG_DEBUG("scanning input objects for event data for type name " << targetClassName);
765
766 // add in names for all top level fields
767 for (const auto &topLevelField : reader->GetDescriptor().GetTopLevelFields()) {
768 std::string objClassName = topLevelField.GetTypeName();
769 std::string key = topLevelField.GetFieldName();
770 if (objClassName == targetClassName) {
771 ATH_MSG_VERBOSE("Matched " << targetClassName << " to key " << key);
772 keys.insert(std::move(key));
773 }
774 }
775
776 // check output objects
777 if (m_eventWriter && !metadata){
778 ATH_MSG_DEBUG("scanning output objects for type name " << targetClassName);
779 // add in names for all top level fields
780 for (const auto& topLevelFieldName : m_eventWriter->GetModel().GetRegisteredSubfieldNames()) {
781 auto& topLevelField = m_eventWriter->GetModel().GetConstField(topLevelFieldName);
782 std::string objClassName = topLevelField.GetTypeName();
783 std::string key = topLevelField.GetFieldName();
784 ATH_MSG_VERBOSE("Inspecting " << objClassName << "/" << key);
785 if (objClassName == targetClassName) {
786 ATH_MSG_VERBOSE("Matched " << targetClassName << " to key " << key);
787 keys.insert(std::move(key));
788 }
789 }
790 }
791
792 const Object_t& outAux = ( metadata ?
794
795 // Search though EventFormat for entries where class matches the provided
796 // typeName
797
798 ATH_MSG_DEBUG("scanning output Aux objects for type name " << targetClassName);
799
800 for( const auto& object : outAux ) {
801 // All metadata objects should be held by ROutObjManager objects.
802 // Anything else is an error.
803 std::string objClassName;
804 if ( metadata ) {
805 ROutObjManager* mgr = dynamic_cast< ROutObjManager* >( object.second.get() );
806 if ( ! mgr ) continue;
807 objClassName = mgr->holder()->getClass()->GetName();
808 }
809 const std::string& key = object.first;
810 ATH_MSG_VERBOSE("Inspecting " << objClassName << "/" << key);
811 if (objClassName == targetClassName) {
812 ATH_MSG_VERBOSE("Matched " << targetClassName << " to key " << key);
813 keys.insert(std::move(key));
814 }
815 }
816
817 vkeys.insert(vkeys.end(), keys.begin(), keys.end());
818
819 return StatusCode::SUCCESS;
820}
reader
read the goodrunslist xml file(s)
Definition collisions.py:22

◆ getOutputObject() [1/2]

void * Event::getOutputObject ( const std::string & key,
const std::type_info & ti,
bool metadata ) 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 221 of file EventIO.cxx.

222 {
223
224 // Select which object container to use:
226
227 // Check if the object can be found:
228 auto itr = objects.find(key);
229 if (itr == objects.end()) {
230 // Do the following only for event data:
231 if (!metadata) {
232 // It's not in the event. Let's check if we find it in an active
233 // TStore object...
234 TStore* store = TActiveStore::store();
235 if ((!store) || (!store->contains(key, ti)) || store->isConst(key, ti)) {
236 // Nope, not there either...
237 return nullptr;
238 }
239 // Let's return the object from the TStore:
240 void* result = store->getObject(key, ti);
241 return result;
242 } else {
243 // For metadata we don't use external resources.
244 return nullptr;
245 }
246 }
247
248 // If the object is not set in this event yet, we can't continue:
249 if (itr->second->isSet() == false) {
250 return nullptr;
251 }
252
253 // If it does exist, check if it's the right kind of object:
254 Details::IObjectManager* mgr =
255 dynamic_cast<Details::IObjectManager*>(itr->second.get());
256 if (mgr == nullptr) {
257 ATH_MSG_ERROR("Object of wrong type found for key \"" << key << "\"");
258 return nullptr;
259 }
260
261 // Ask the holder object for the object of this type:
262 void* result = mgr->holder()->getAs(ti);
263 if (result == nullptr) {
264 ATH_MSG_WARNING("Couldn't retrieve object as \""
265 << SG::normalizedTypeinfoName(ti) << "\"");
266 return nullptr;
267 }
268
269 // Return the object:
270 return result;
271}

◆ getOutputObject() [2/2]

void * Event::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 138 of file EventTVirtualEvent.cxx.

138 {
139
140 // Get a string name for this key.
141 const std::string& name = getName(key);
142 if (name.empty()) {
143 return nullptr;
144 }
145
146 // Forward the call to the function using an std::string key.
147 static const bool METADATA = false;
148 return getOutputObject(name, ti, METADATA);
149}

◆ hasInput()

bool xAOD::Experimental::REvent::hasInput ( ) const
overrideprivatevirtualinherited

Check if an input file is connected to the object.

Implements xAOD::Event.

Definition at line 597 of file REvent.cxx.

597 {
598
600}

◆ hasOutput()

bool xAOD::Experimental::REvent::hasOutput ( ) const
overrideprivatevirtualinherited

Check if an output file is connected to the object.

Implements xAOD::Event.

Definition at line 602 of file REvent.cxx.

602 {
603 return (m_outputFile != nullptr);
604}

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ initStats()

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

Function to initialise the statistics for all RNTuple 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
The usual StatusCode values

Definition at line 1732 of file REvent.cxx.

1732 {
1733
1734 // A little sanity check.
1735 if (!m_eventReader) {
1736 ATH_MSG_ERROR("Function called on an uninitialised object");
1737 return StatusCode::FAILURE;
1738 }
1739
1740 // Reset the number of input branches information.
1742
1743 // Loop over the EventFormat information.
1744 for (const auto& [key, format] : m_inputEventFormat) {
1745
1746 ATH_MSG_DEBUG("Investigating object \"" << key << "\" of class \""
1747 << format.className() << "\"");
1748
1749 // If it's an auxiliary container, scan it using RAuxStore.
1750 if (key.ends_with("Aux.")) {
1751
1752 // But first decide whether it describes a container, or just
1753 // a single object. For that, first get the class that it was
1754 // written with.
1755 TClass* cl = TClass::GetClass(format.className().c_str());
1756 if ((cl == nullptr) || (cl->IsLoaded() == false)) {
1758 "Couldn't find the dictionary for type: " << format.className());
1759 continue;
1760 }
1761
1762 // And then check if it inherits from xAOD::AuxContainerBase or from
1763 // xAOD::AuxInfoBase.
1764 static TClass* const auxContCl = TClass::GetClass(
1765 SG::normalizedTypeinfoName(typeid(xAOD::AuxContainerBase)).c_str());
1766 static TClass* const auxInfoCl = TClass::GetClass(
1767 SG::normalizedTypeinfoName(typeid(xAOD::AuxInfoBase)).c_str());
1768 if ((auxContCl == nullptr) || (auxInfoCl == nullptr)) {
1770 "Couldn't get dictionary for xAOD::AuxContainerBase or "
1771 "xAOD::AuxInfoBase");
1772 return StatusCode::FAILURE;
1773 }
1774 const bool isContainer = cl->InheritsFrom(auxContCl);
1775 const bool isInfo = cl->InheritsFrom(auxInfoCl);
1776 if ((isContainer == false) && (isInfo == false)) {
1777 ATH_MSG_WARNING("Auxiliary store \""
1778 << key
1779 << "\" is of an unknown type: " << format.className());
1780 continue;
1781 }
1782 ATH_MSG_VERBOSE("isContainer = " << isContainer
1783 << ", isInfo = " << isInfo);
1784
1785 // Scan the branches using a temporary RAuxStore instance.
1786 const std::string fieldName = key.substr(0, key.size() - 1) + ":";
1790 static constexpr bool TOP_STORE = true;
1791 RAuxStore temp(this->currentContext(), fieldName, TOP_STORE, mode);
1792 ATH_CHECK(temp.readFrom(*m_eventReader));
1793
1794 // Add all the auxids to the statistics object:
1795 ReadStats& stats = IOStats::instance().stats();
1796 for (SG::auxid_t id : temp.getAuxIDs()) {
1797 stats.branch(fieldName, id);
1798 }
1799
1800 // Increment the number of known branches.
1801 stats.setBranchNum(stats.branchNum() + temp.getAuxIDs().size());
1802 }
1803 // If it's an interface container.
1804 else {
1805 // Check if it's part of the input ntuple.
1806 if (m_eventReader->GetDescriptor().FindFieldId(key) !=
1807 ROOT::kInvalidDescriptorId) {
1809 }
1810 }
1811 }
1812
1813 // Return gracefully:
1814 return StatusCode::SUCCESS;
1815}
const EventContext & currentContext() const
Return the event context corresponding to this event.
BranchStats * container(const std::string &name)
Access the description of a container. Creating it if necessary.
void setBranchNum(::Int_t num)
Set the total number of branches on the input.
EStructMode
"Structural" modes of the object
@ kObjectStore
The object describes a single object.
@ kContainerStore
The object describes an entire container.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

◆ inputEventFormat()

const EventFormat * Event::inputEventFormat ( ) const
inherited

Get information about the input objects.

Definition at line 235 of file EventCore.cxx.

235 {
236
237 if (hasInput()) {
238 return &m_inputEventFormat;
239 }
240 return nullptr;
241}

◆ keys()

template<typename T>
StatusCode xAOD::Event::keys ( std::vector< std::string > & vkeys,
bool metadata ) const
inherited

Provide a list of all data object keys associated with a specific type.

◆ keyToString() [1/2]

const std::string * Event::keyToString ( SG::sgkey_t key) const
overrideprotectedinherited

Find the string corresponding to a given key.

Definition at line 294 of file EventIProxyDict.cxx.

294 {
295
296 return &(getName(key));
297}

◆ keyToString() [2/2]

const std::string * Event::keyToString ( SG::sgkey_t key,
CLID & clid ) const
overrideprotectedinherited

Find the string and CLID corresponding to a given key.

Definition at line 299 of file EventIProxyDict.cxx.

299 {
300
301 return &(getName(key));
302}

◆ loadInputObjects()

StatusCode REventClass::loadInputObjects ( )
inline

Function loading all interface objects of the event.

Definition at line 42 of file xAODRNFileReadTest.cxx.

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

◆ metaKeys()

template<typename T>
StatusCode xAOD::Event::metaKeys ( std::vector< std::string > & vkeys) const
inherited

Provide a list of all metadata object keys associated with a specific type.

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ name()

const std::string & Event::name ( ) const
overrideprotectedinherited

Get the name of the instance.

Definition at line 315 of file EventIProxyDict.cxx.

315 {
316
317 static const std::string result{"xAOD::Event"};
318 return result;
319}

◆ outputEventFormat()

const EventFormat * Event::outputEventFormat ( ) const
inherited

Get information about the output objects.

Definition at line 243 of file EventCore.cxx.

243 {
244
245 return m_outputEventFormat;
246}

◆ printIOStats()

void Event::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 305 of file EventCore.cxx.

305 {
306
307 // Simply do this via the xAODCore code:
308 IOStats::instance().stats().Print("Summary");
309}
void Print(::Option_t *option="") const
Print information about the collected statistics.

◆ printNameRemap()

void Event::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 208 of file EventCore.cxx.

208 {
209
210 // Print a header.
211 ATH_MSG_INFO("Name remapping rules:");
212
213 // In case no remapping rules have been set.
214 if (m_nameRemapping.empty()) {
215 ATH_MSG_INFO(" NONE");
216 return;
217 }
218
219 // Otherwise.
220 for (const auto& [newName, onfile] : m_nameRemapping) {
221 ATH_MSG_INFO(" \"" << newName << "\" -> \"" << onfile << "\"");
222 }
223}

◆ printProxyWarnings()

void Event::printProxyWarnings ( bool value = true)
inherited

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

Parameters
valueThe new value for the option

Definition at line 230 of file EventCore.cxx.

230 {
231
233}

◆ proxies()

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

return the list of all current proxies in store

Definition at line 275 of file EventIProxyDict.cxx.

275 {
276
278
279 std::vector<const SG::DataProxy*> ret;
280 for (const auto& p : m_branches) {
281 const SG::DataProxy* proxy = p.second.m_proxy.get();
282 if (proxy) {
283 ret.push_back(proxy);
284 }
285 }
286 return ret;
287}

◆ proxy() [1/2]

SG::DataProxy * Event::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 213 of file EventIProxyDict.cxx.

213 {
214
215 const SG::sgkey_t sgkey = getHash(key);
216 if (!sgkey) {
217 return 0;
218 }
219 return proxy_exact(sgkey);
220}
SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32
sgkey(tool)
Definition common.py:1027

◆ proxy() [2/2]

SG::DataProxy * Event::proxy ( const void *const pTransient) const
overrideprotectedinherited

get proxy for a given data object address in memory

Definition at line 185 of file EventIProxyDict.cxx.

185 {
186
187 // Look up the name of this object
188 std::string name = getName(pTransient);
189 if (name.empty()) {
190 // Apparently the object is not known...
191 return nullptr;
192 }
193
194 // Get the metadata object for it:
195 const xAOD::EventFormatElement* efe = 0;
196 static const bool QUIET = true;
198 efe = m_outputEventFormat->get(name, QUIET);
199 }
200 if (!efe) {
201 efe = m_inputEventFormat.get(name, QUIET);
202 }
203 if (!efe) {
204 // No metadata found...
205 return nullptr;
206 }
207
208 // Return the proxy:
209 const BranchInfo* bi = getBranchInfo(efe->hash());
210 return bi->m_proxy.get();
211}
sgkey_t hash() const
Get the hash belonging to this branch/key.
const BranchInfo * getBranchInfo(SG::sgkey_t sgkey) const
Get the object describing one object/branch.

◆ proxy_exact()

SG::DataProxy * Event::proxy_exact ( SG::sgkey_t sgkey) const
overrideprotectedinherited

Get proxy given a hashed key+clid.

Definition at line 222 of file EventIProxyDict.cxx.

222 {
223
224 // Get the object describing this branch/object:
225 const BranchInfo* bi = getBranchInfo(sgkey);
226 if (!bi) {
227 static SG::SGKeySet missingSGKeys ATLAS_THREAD_SAFE;
228 static mutex_t mutex;
229 guard_t lock(mutex);
230 if (missingSGKeys.emplace(sgkey).second && m_printEventProxyWarnings) {
231 ATH_MSG_WARNING("Can't find BranchInfo for: " << sgkey);
232 }
233 return 0;
234 }
235
236 // Access its data proxy:
237 SG::DataProxy* proxy = bi->m_proxy.get();
238
239 // Return the proxy:
240 return proxy;
241}

◆ putAux()

StatusCode xAOD::Experimental::REvent::putAux ( TVirtualManager & vmgr,
::Bool_t metadata = kFALSE )
privateinherited

Method 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.) The first time an aux store variable is encountered, an RAuxFieldManager is created to manage it. And for each call, the manager holder is set to point to the aux variable. Note: this may be called when recording an aux container, but new aux variables may be created up to a call to fill One also needs to keep track of empty aux containers on the first event to allow to add in the aux fields to the RNTuple model for the next event which has a non-empty container

Parameters
mgrThe object manager of the output object
metadataFlag specifying whether the info written is metadata or not
Returns
kTRUE if the setup was successful, or kFALSE if it was not

Add field to RNTuple model

Definition at line 1506 of file REvent.cxx.

1506 {
1507
1508 // A little sanity check:
1509 assert( m_outputEventFormat != 0 );
1510
1511 // Do the conversion:
1512 ROutObjManager* mgr = dynamic_cast< ROutObjManager* >( &vmgr );
1513
1514 ATH_MSG_DEBUG("REvent::putAux - vmgr " << mgr);
1515
1516 if( ! mgr ) {
1517 // It's not an error any more when we don't get a ROutObjManager.
1518 return StatusCode::SUCCESS;
1519 }
1520
1521 // Check if this class has an auxiliary store, if not nothing needs to be done:
1522 if( ! mgr->holder()->getClass()->InheritsFrom( "SG::IAuxStoreIO" ) ) {
1523
1524 ATH_MSG_DEBUG("REvent::putAux - no Aux store ");
1525
1526 return StatusCode::SUCCESS;
1527 }
1528
1529 // Get a pointer to the auxiliary store I/O interface:
1530 SG::IAuxStoreIO* aux = reinterpret_cast< SG::IAuxStoreIO* >(mgr->holder()->getAs( typeid( SG::IAuxStoreIO ) ) );
1531 if( ! aux ) {
1532 ATH_MSG_FATAL( "There is a logic error in the code!" );
1533 }
1534
1535 // Check if we have rules defined for which auxiliary properties
1536 // to write out:
1537 xAOD::AuxSelection sel;
1538 if( ! metadata ) {
1539 auto item_itr = m_auxItemList.find( mgr->key() );
1540 if( item_itr != m_auxItemList.end() ) {
1541 sel.selectAux( item_itr->second );
1542 }
1543 }
1544
1545 // Get the dynamic auxiliary variables held by this object, which
1546 // were selected to be written:
1547 const SG::auxid_set_t auxids = sel.getSelectedAuxIDs (aux->getSelectedAuxIDs());
1548
1549 // Decide what should be the prefix of all the dynamic branches:
1550 const std::string dynNamePrefix = Utils::dynBranchPrefix( mgr->key() );
1551
1552 ATH_MSG_DEBUG("REvent::putAux - dynNamePrefix " << dynNamePrefix);
1553
1554
1555 // Select which container to add the variables to:
1557
1558 // RDS: is the following needed in an RNTuple?
1559 // This iteration will determine the ordering of branches within
1560 // the tree, so sort auxids by name.
1561 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
1562 typedef std::pair< std::string, SG::auxid_t > AuxVarSort_t;
1563 std::vector< AuxVarSort_t > varsort;
1564 varsort.reserve( auxids.size() );
1565 for( SG::auxid_t id : auxids ) {
1566 varsort.emplace_back( r.getName( id ), id );
1567 }
1568 std::sort( varsort.begin(), varsort.end() );
1569
1570 // Extract all the dynamic variables from the object:
1571 for( const auto& p : varsort ) {
1572
1573 // The auxiliary ID:
1574 const SG::auxid_t id = p.second;
1575
1576 // Construct a dynamic key name for the field that we will write:
1577 const std::string dynKey = dynNamePrefix + p.first;
1578
1579 ATH_MSG_DEBUG("REvent::putAux - id, dynKey " << id << ", " << dynKey);
1580
1581
1582 // Try to find the object manager:
1583 Object_t::iterator bmgr = objects.find( dynKey );
1584
1585 // Check if we already know about this variable:
1586 if( bmgr == objects.end() ) {
1587 // Construct the full type name of the variable:
1588 const std::type_info* brType = aux->getIOType( id );
1589 if( ! brType ) {
1590 ATH_MSG_FATAL( "No I/O type found for variable " << dynKey );
1591 return StatusCode::FAILURE;
1592 }
1593 const std::string brTypeName = Utils::getTypeName( *brType );
1594 std::string brProperTypeName = "<unknown>";
1595
1596 // Check if it's a primitive type or not:
1597 bool isPrimitive = false;
1598 TVirtualManager* outmgrPtr = nullptr;
1599
1600 if( strlen( brType->name() ) == 1 ) {
1601 isPrimitive = true;
1602
1603 ATH_MSG_DEBUG("REvent::putAux - primitive " << id << ", " << brTypeName << " brType name " << brType->name());
1604
1605
1606 // Making the "proper" type name is simple in this case:
1607 brProperTypeName = std::move(brTypeName);
1608
1609 // Let's create an RAuxFieldManager for this property:
1610 static constexpr bool IS_OWNER = false;
1611 auto auxmgr = std::make_unique<RAuxFieldManager>(
1612 std::make_unique<THolder>(aux->getIOData( id ), *brType, IS_OWNER), isPrimitive );
1613 outmgrPtr = auxmgr.get();
1614
1615 objects[ dynKey ] = std::move(auxmgr);
1616
1617 } else {
1618
1619 ATH_MSG_DEBUG("REvent::putAux - not primitive " << id << ", " << brTypeName);
1620
1621 // Check if we have a dictionary for this type:
1622 TClass* cl = TClass::GetClass( *brType, kTRUE, kTRUE );
1623 if( ! cl ) {
1624 // The dictionary needs to be loaded now. This could be an
1625 // issue. But let's hope for the best...
1626 cl = TClass::GetClass( brTypeName.c_str() );
1627 // If still not found...
1628 if( ! cl ) {
1629 ATH_MSG_FATAL( "Dictionary not available for variable \"" << dynKey
1630 << "\" of type \"" << brTypeName << "\"" );
1631 return StatusCode::FAILURE;
1632 }
1633 }
1634
1635 // The proper type name comes from the dictionary in this case:
1636 brProperTypeName = cl->GetName();
1637
1638 // Let's create an RAuxFieldManager for this property - not a primitive:
1639 static constexpr bool IS_OWNER = false;
1640 auto auxmgr = std::make_unique<RAuxFieldManager>(
1641 std::make_unique<THolder>(aux->getIOData( id ), cl, IS_OWNER), isPrimitive );
1642 outmgrPtr = auxmgr.get();
1643 objects[ dynKey ] = std::move(auxmgr);
1644 }
1645
1646 // For event data, add in the the new fields to the RNTuple model and event format metadata
1647 if (!metadata) {
1648
1650 ATH_CHECK( addField(dynKey, *outmgrPtr) );
1651
1652 // If all went fine, let's add this branch to the event format
1653 // metadata (but not for regular metadata):
1654 if( ! m_outputEventFormat->exists( dynKey ) ) {
1656 EventFormatElement( dynKey,
1657 brProperTypeName,
1658 mgr->key(),
1659 getHash( dynKey ) ) );
1660 }
1661 }
1662
1663 // We don't need to do the rest:
1664 continue;
1665 }
1666
1667 ATH_MSG_DEBUG("REvent::putAux - setObj " << dynKey);
1668
1669 // Access the object manager:
1670 bmgr = objects.find( dynKey );
1671 if( bmgr == objects.end() ) {
1672 ATH_MSG_FATAL( "There is an internal logic error in the code..." );
1673 }
1674 // Replace the managed object:
1675 void* nc_data ATLAS_THREAD_SAFE = // we hold non-const pointers but check on retrieve
1676 const_cast< void* >( static_cast< const void* >( aux->getIOData( id ) ) );
1677 bmgr->second->setObject( nc_data );
1678 }
1679
1680 // Return gracefully:
1681 return StatusCode::SUCCESS;
1682}
std::atomic_flag m_initialized ATLAS_THREAD_SAFE
Messaging initialized (initMessaging).
static AuxTypeRegistry & instance()
Return the singleton registry instance.
virtual SG::auxid_set_t getSelectedAuxIDs() const
Get a list of dynamic variables that need to be written out.
Definition IAuxStoreIO.h:86
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.
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
Rules for selecting which auxiliary branches to write.
Definition Event.h:360
StatusCode addField(const std::string &key, const TVirtualManager &mgr)
Add field to RNTuple model given the StoreGate key and output object manager.
Definition REvent.cxx:1686
int r
Definition globals.cxx:22
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
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...
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.

◆ readFrom() [1/2]

StatusCode xAOD::Experimental::REvent::readFrom ( std::string_view fileName)
inherited

Set up the reading of an input file via a file name.

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

This can be considered the 'native' interface as an RNTupleReader opens a file with a name

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

Parameters
fileNamename of file needed for metadata access

Definition at line 167 of file REvent.cxx.

167 {
168
169 ATH_MSG_INFO("REvent::readFrom: fileName " << fileName);
170
171 // Set up the file access tracer.
173
174 // Clear the cached input objects.
175 m_inputObjects.clear();
176 m_inputMissingObjects.clear();
177 m_inputMetaObjects.clear();
178 {
180 lock.upgrade();
181 m_branches.clear();
182 }
183 m_eventReader.reset();
184
185 // Reset the internal flags.
186 m_entry = -1;
188
189 // Clear out the current object.
191
192
193 ATH_MSG_DEBUG("Create RNTupleReader for \"" << METADATA_OBJECT_NAME
194 << "\" in file: " << fileName);
195
196 // Set up a reader for the metadata ntuple.
197 // Since some types are non-xAOD types and so not 'visible' when running in AnalysisBase
198 // we need to protect for unknown types with SetEmulateUnknownTypes(true)
199 ROOT::RNTupleDescriptor::RCreateModelOptions opts;
200 opts.SetEmulateUnknownTypes(true);
201 m_metaReader = ROOT::RNTupleReader::Open(opts, METADATA_OBJECT_NAME, fileName);
202 if (!m_metaReader) {
203 ATH_MSG_ERROR("Couldn't find \"" << METADATA_OBJECT_NAME
204 << "\" tree in input file: " << fileName);
205 return StatusCode::FAILURE;
206 }
207 ATH_MSG_DEBUG("Created RNTupleReader for \"" << METADATA_OBJECT_NAME
208 << "\" in file: " << fileName);
209
210 // Make sure that the xAOD::EventFormat dictonary is loaded.
211 // This may not be the case if streamer information reading is turned
212 // off.
213 static const std::string eventFormatTypeName =
215 if (::TClass::GetClass(eventFormatTypeName.c_str()) == nullptr) {
216 ATH_MSG_WARNING("Couldn't load the EventFormat dictionary");
217 }
218 ATH_MSG_VERBOSE("Loaded the xAOD::EventFormat dictionary");
219
220 // Helper lambda for collecting the event format metadata from an RNTuple
221 // with a given name.
222 auto readEventFormatMetadata = [&](std::string_view tupleName) -> StatusCode {
223 // Set up a reader. This may technically be the same as m_metaReader, but
224 // it's easier to write the code this way.
225 auto metaReader = ROOT::RNTupleReader::Open(tupleName, fileName);
226 if (!metaReader) {
227 ATH_MSG_ERROR("Couldn't find \""
228 << tupleName << "\" ntuple in input file: " << fileName);
229 return StatusCode::FAILURE;
230 }
231 ATH_MSG_VERBOSE("Created temporary RNTupleReader for \""
232 << tupleName << "\" in file: " << fileName);
233
234 // Try to read in the event format metadata.
235 const std::string eventFormatFieldName =
236 getFirstFieldMatch(*m_metaReader, "EventFormat");
237 try {
238 // Add its elements to m_inputEventFormat.
239 auto ef = m_metaReader->GetView<xAOD::EventFormat>(eventFormatFieldName);
240 for (const auto& [key, element] : ef(0u)) {
241 m_inputEventFormat.add(element);
242 }
243 } catch (const ROOT::RException&) {
244 ATH_MSG_WARNING("Input file provides no event or metadata");
245 return StatusCode::RECOVERABLE;
246 }
247 ATH_MSG_VERBOSE("Merged event format metadata from \"" << tupleName
248 << "\" ntuple");
249
250 // Return gracefully.
251 return StatusCode::SUCCESS;
252 };
253
254 // Read in the metadata from the "main" metadata ntuple.
255 const StatusCode sc = readEventFormatMetadata(METADATA_OBJECT_NAME);
256 if (sc.isRecoverable()) {
258 return StatusCode::SUCCESS;
259 }
260 ATH_CHECK(sc);
261
262 // List all the other Metadata RNTuples in the input file.
263 // Having several metadata tuples can happen for augmented files
264 // as one metadata tree per stream is produced.
265 std::set<std::string> lOtherMetaTupleNames;
266 {
267 std::unique_ptr<TFile> inFile(TFile::Open(fileName.data(), "READ"));
268 TList* lKeys = inFile->GetListOfKeys();
269 if (lKeys == nullptr) {
270 ATH_MSG_ERROR("Could not get list of keys for input file: " << fileName);
271 return StatusCode::FAILURE;
272 }
273 for (const TObject* obj : *lKeys) {
274 const std::string keyName = obj->GetName();
275 // Make sure the key corresponds to a metadata ntuple but
276 // do not add the current metadata tree in the list of other trees
277 // and do not add the metadata tree handlers to the list
278 if ((keyName != METADATA_OBJECT_NAME) &&
279 (keyName.find("MetaData") != std::string::npos) &&
280 (keyName.find("MetaDataHdr") == std::string::npos)) {
281 // Make sure key corresponds to an RNTuple
282 const TKey* key = dynamic_cast<const TKey*>(obj);
283 if (key == nullptr) {
284 ATH_MSG_ERROR("Object describing \"" << keyName << "\" in file \""
285 << fileName
286 << "\" is not a TKey?");
287 return StatusCode::FAILURE;
288 }
289 const char* className = key->GetClassName();
290 static constexpr bool LOAD = kFALSE;
291 static constexpr bool SILENT = kTRUE;
292 ::TClass* cl = ::TClass::GetClass(className, LOAD, SILENT);
293 if ((cl != nullptr) && cl->InheritsFrom(ROOT::RNTuple::Class())) {
294 lOtherMetaTupleNames.insert(std::move(keyName));
295 }
296 }
297 }
298 }
299
300 // Read in the metadata from any additonal NTuples found (if any).
301 for (const std::string& tupleName : lOtherMetaTupleNames) {
302 ATH_CHECK(readEventFormatMetadata(tupleName));
303 }
304
305 // Set up the main ntuple reader.
306 m_eventReader = ROOT::RNTupleReader::Open(EVENT_RNTUPLE_NAME, fileName);
307 if (!m_eventReader) {
308 ATH_MSG_ERROR("Couldn't access RNTuple \"" << EVENT_RNTUPLE_NAME
309 << "\" in file: " << fileName);
310 return StatusCode::FAILURE;
311 }
312 ATH_MSG_DEBUG("Created RNTupleReader for \"" << EVENT_RNTUPLE_NAME
313 << "\" in file: " << fileName);
314
315 // Init the statistics collection.
317 // Update the event counter in the statistics object:
318 xAOD::ReadStats& stats = IOStats::instance().stats();
319 stats.setNEvents(stats.nEvents() + m_eventReader->GetNEntries());
320
321 // Notify the listeners that a new file was opened:
322 const TIncident beginIncident(IncidentType::BeginInputFile);
323 for (TVirtualIncidentListener* listener : m_listeners) {
324 listener->handle(beginIncident);
325 }
326 // For now implement a very simple scheme in which we claim already
327 // at the start that the entire file was processed. Since we have no way
328 // of ensuring that the user indeed does this. And we can't delay calling
329 // this function, as the user may likely close his/her output file before
330 // closing the last opened input file.
331 const TIncident endIncident(IncidentType::EndInputFile);
332 for (TVirtualIncidentListener* listener : m_listeners) {
333 listener->handle(endIncident);
334 }
335
336 // The initialisation was successful:
337 return StatusCode::SUCCESS;
338}
StatusCode initStats()
Function to initialise the statistics for all RNTuple content.
Definition REvent.cxx:1732
void add(std::string_view fileName)
Add information about a new file that got accessed.
static TFileAccessTracer & instance()
Access the singleton instance of this class.
static const ::Int_t EndInputFile
The processing of an input file has finished.
Definition TIncident.h:40
static const ::Int_t BeginInputFile
A new input file was just opened.
Definition TIncident.h:27

◆ readFrom() [2/2]

StatusCode xAOD::Experimental::REvent::readFrom ( TFile & inFile)
overridevirtualinherited

Set up the reading of an input file from TFile This method implements the interface from Event.

Implementation of interface method taking a TFile object. Forwards to the method with a string view below.

Implements xAOD::Event.

Definition at line 156 of file REvent.cxx.

156 {
157 ATH_CHECK(readFrom(inFile.GetName()));
158 return StatusCode::SUCCESS;
159}
StatusCode readFrom(TFile &inFile) override
Set up the reading of an input file from TFile This method implements the interface from Event.
Definition REvent.cxx:156

◆ record() [1/3]

template<typename T>
StatusCode xAOD::Event::record ( std::unique_ptr< T > obj,
const std::string & key )
inherited

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

◆ record() [2/3]

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

Add an output object to the event.

◆ record() [3/3]

StatusCode xAOD::Experimental::REvent::record ( void * obj,
const std::string & typeName,
const std::string & key,
bool overwrite,
bool metadata,
bool isOwner )
overrideprivatevirtualinherited

Record an object into a connected output file.

This is the function doing the heavy lifting when recording a new object into the output RNTuple.

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

Add field to RNTuple model

Implements xAOD::Event.

Definition at line 1351 of file REvent.cxx.

1356 {
1357
1358
1359 // Check if we have an output file when writing an event:
1360 if ( !hasOutput() ) {
1361 ATH_MSG_FATAL("No output output file defined. Did you forget to call writeTo(...)?" );
1362 return StatusCode::FAILURE;
1363 }
1364 assert( m_outputEventFormat != 0 );
1365
1366 ATH_MSG_DEBUG("REvent::record - key, type " << key << ", " << typeName);
1367
1368
1369 // If this is metadata, just take ownership of it. The object will only
1370 // be recorded into the output file when calling finishWriting(...).
1371 if( metadata ) {
1372 // Check whether we already have such an object:
1373 if( ( ! overwrite ) &&
1374 ( m_outputMetaObjects.find( key ) !=
1375 m_outputMetaObjects.end() ) ) {
1376 ATH_MSG_FATAL("Meta-object " << typeName << "/" << key << " already recorded" );
1377 return StatusCode::FAILURE;
1378 }
1379 // Check if we have a dictionary for this object:
1380 TClass* cl = TClass::GetClass( typeName.c_str() );
1381 if( ! cl ) {
1382 ATH_MSG_ERROR( "Didn't find dictionary for type: " << typeName );
1383 return StatusCode::FAILURE;
1384 }
1385 // Create output object manager with a holder for the object:
1386 auto outmgr = std::make_unique<ROutObjManager>( key, std::make_unique<THolder>(obj, cl, isOwner));
1387 m_outputMetaObjects[key] = std::move(outmgr);
1388 // We're done. The rest will be done later on.
1389 return StatusCode::SUCCESS;
1390 }
1391
1392 // Check if we accessed this object on the input. If yes, then this
1393 // key may not be used for recording.
1394 if( ( ! overwrite ) &&
1395 ( m_inputObjects.find( key ) != m_inputObjects.end() ) ) {
1396 ATH_MSG_FATAL( "Object " << typeName << "/" << key <<
1397 " already accessed from the input, can't be overwritten in memory" );
1398 return StatusCode::FAILURE;
1399 }
1400
1401 // Check if we need to add it to the event record:
1402 Object_t::iterator vitr = m_outputObjects.find( key );
1403 if( vitr == m_outputObjects.end() ) {
1404
1405 // Check if we have a dictionary for this object:
1406 TClass* cl = TClass::GetClass( typeName.c_str() );
1407 if( ! cl ) {
1408 ATH_MSG_ERROR( "Didn't find dictionary for type: " << typeName );
1409 return StatusCode::FAILURE;
1410 }
1411 // Check if this is a new object "type" or not:
1412 if( ! m_outputEventFormat->exists( key ) ) {
1413 m_outputEventFormat->add( EventFormatElement( key, cl->GetName(),
1414 "", getHash( key ) ) );
1415 }
1416 // Create output object manager with a holder for the object:
1417 auto outmgr = std::make_unique<ROutObjManager>( key, std::make_unique<THolder>(obj, cl, isOwner));
1418 ROutObjManager* outmgrPtr = outmgr.get();
1419 m_outputObjects[ key ] = std::move(outmgr);
1420
1421 ATH_MSG_DEBUG("REvent::record - save outObjMgr for key, type " << key << ", " << typeName);
1422
1423 // Set up the saving of all the dynamic auxiliary properties
1424 // of the object if it has any:
1425 ATH_CHECK( putAux( *outmgrPtr ) );
1426
1428 ATH_CHECK( addField(key, *outmgrPtr) );
1429
1430 // Return at this point, as we don't want to run the rest of
1431 // the function's code:
1432 return StatusCode::SUCCESS;
1433 }
1434
1435 // Access the object manager:
1436 ROutObjManager* omgr = dynamic_cast< ROutObjManager* >( vitr->second.get() );
1437 if( ! omgr ) {
1438 ATH_MSG_FATAL( "Manager object of the wrong type encountered" );
1439 return StatusCode::FAILURE;
1440 }
1441
1442 // RDS: Is the following still needed?
1443 // // Check that the type of the object matches that of the previous
1444 // // object:
1445 // if( typeName != omgr->holder()->getClass()->GetName() ) {
1446 // // This may still be, when the ROOT dictionary name differs from the
1447 // // "simple type name" known to C++. So let's get the ROOT name of the
1448 // // new type:
1449 // TClass* cl = TClass::GetClass( typeName.c_str() );
1450 // if( ( ! cl ) || ::strcmp( cl->GetName(),
1451 // omgr->holder()->getClass()->GetName() ) ) {
1452 // ATH_MSG_FATAL(
1453 // XAOD_MESSAGE( "For output key \"%s\" the previous type "
1454 // "was \"%s\", the newly requested type is "
1455 // "\"%s\"" ),
1456 // key.c_str(), omgr->holder()->getClass()->GetName(),
1457 // typeName.c_str() );
1458 // return StatusCode::FAILURE;
1459 // }
1460 // }
1461
1462 // Replace the managed object:
1463 omgr->setObject( obj );
1464
1465 // Replace the auxiliary objects:
1466 return putAux( *omgr );
1467} // record
bool hasOutput() const override
Check if an output file is connected to the object.
Definition REvent.cxx:602

◆ recordAux()

StatusCode xAOD::Experimental::REvent::recordAux ( TVirtualManager & mgr,
const std::string & key,
bool metadata )
overrideprivatevirtualinherited

Record an auxiliary store into a connected output file.

Implements xAOD::Event.

Definition at line 1469 of file REvent.cxx.

1470 {
1471
1472 // Check if the auxiliary store is a generic object.
1473 Details::IObjectManager* iomgr = dynamic_cast<Details::IObjectManager*>(&mgr);
1474 if (iomgr != nullptr) {
1475 // Record the auxiliary object using the main record function.
1476 static const bool OVERWRITE = true;
1477 static const bool IS_OWNER = true;
1478 ATH_CHECK(record(iomgr->object(), iomgr->holder()->getClass()->GetName(),
1479 key, OVERWRITE, metadata, IS_OWNER));
1480 return StatusCode::SUCCESS;
1481 }
1482
1483 // Apparently we didn't recorgnize the auxiliary store type.
1484 ATH_MSG_ERROR("Unknown auxiliary store manager type encountered");
1485 return StatusCode::FAILURE;
1486}
StatusCode record(void *obj, const std::string &typeName, const std::string &key, bool overwrite, bool metadata, bool isOwner) override
Record an object into a connected output file.
Definition REvent.cxx:1351

◆ recordMeta() [1/2]

template<typename T>
StatusCode xAOD::Event::recordMeta ( std::unique_ptr< T > obj,
const std::string & key )
inherited

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

◆ recordMeta() [2/2]

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

Add an object to the output file's metadata.

◆ recordObject()

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

Record an object in the store.

Definition at line 309 of file EventIProxyDict.cxx.

310 {
311
312 throw std::runtime_error("xAOD::Event::recordObject is not implemented");
313}

◆ recordTypeless()

StatusCode xAOD::Event::recordTypeless ( void * obj,
const std::string & typeName,
const std::string & key,
bool overwrite = false,
bool metadata = true,
bool isOwner = true )
protectedinherited

Internal function for recording an object into the output.

◆ registerKey()

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

Remember an additional mapping from key to string/CLID.

Definition at line 304 of file EventIProxyDict.cxx.

304 {
305
306 return;
307}

◆ removeListener()

StatusCode Event::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 133 of file EventCore.cxx.

133 {
134
135 // Remove the listener. Or at least try to...
136 auto itr = std::find(m_listeners.begin(), m_listeners.end(), listener);
137 if (itr == m_listeners.end()) {
138 ATH_MSG_ERROR("Listener " << static_cast<void*>(listener) << " not known");
139 return StatusCode::FAILURE;
140 }
141 m_listeners.erase(itr);
142
143 // Return gracefully:
144 return StatusCode::SUCCESS;
145}

◆ retrieve() [1/4]

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

Retrieve an output object from the event.

◆ retrieve() [3/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() [4/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).

◆ retrieveMetaInput()

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

Retrieve an input metadata object.

◆ retrieveMetaOutput() [1/2]

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

Retrieve an output metadata object.

◆ retrieveMetaOutput() [2/2]

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

Retrieve an output metadata object.

◆ REvent()

Default constructor.

Definition at line 37 of file REvent.cxx.

144: Event("xAOD::Experimental::REvent") {}

◆ setActive()

void Event::setActive ( ) const
inherited

Set this event object as the currently active one.

Definition at line 61 of file EventCore.cxx.

61 {
62
63 // The active event and current store are thread-local globals.
64 Event* nc_this ATLAS_THREAD_SAFE = const_cast<Event*>(this);
65 TActiveEvent::setEvent(static_cast<TVirtualEvent*>(nc_this));
66#ifndef XAOD_STANDALONE
67 SG::CurrentEventStore::setStore(nc_this);
68#endif // not XAOD_STANDALONE
69}
static void setEvent(TVirtualEvent *ptr)
Set the active event pointer.

◆ setAuxItemList()

void Event::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 78 of file EventCore.cxx.

79 {
80
81 // Decoded attributes.
82 std::set<std::string> attributes;
83
84 // Split up the received string using "." as the separator.
85 if (itemList.size()) {
86 std::istringstream ss(itemList);
87 std::string attr;
88 while (std::getline(ss, attr, '.')) {
89 attributes.insert(attr);
90 }
91 }
92
93 // Remember the setting.
94 m_auxItemList[containerKey] = std::move(attributes);
95}
static Double_t ss

◆ setAuxStore()

StatusCode xAOD::Experimental::REvent::setAuxStore ( const std::string & key,
Details::IObjectManager & mgr,
bool metadata )
overrideprivatevirtualinherited

Function connecting a DV object to its auxiliary store.

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

This function takes care of this.

Parameters
keyThe key (field name) of the object whose auxiliary store should be set up
mgrThe manager object of the DV container
metadataFlag specifying whether we're dealing with a metadata or event data object
Returns
The usual StatusCode types

Implements xAOD::Event.

Definition at line 1222 of file REvent.cxx.

1223 {
1224
1225 // Check if we need to do anything:
1226 if ((Details::hasAuxStore(*(mgr.holder()->getClass())) == false) &&
1227 (Details::isAuxStore(*(mgr.holder()->getClass())) == false)) {
1228 return StatusCode::SUCCESS;
1229 }
1230
1231 // Select which object container to use:
1233
1234 // Look up the auxiliary object's manager:
1235 TVirtualManager* auxMgr = nullptr;
1236 std::string auxKey;
1237 if (Details::isAuxStore(*(mgr.holder()->getClass()))) {
1238 auxMgr = &mgr;
1239 auxKey = key;
1240 } else {
1241 auto itr = objects.find(key + "Aux.");
1242 if (itr == objects.end()) {
1243 // Apparently there's no auxiliary object for this DV, so let's
1244 // give up.
1245 return StatusCode::SUCCESS;
1246 }
1247 auxMgr = itr->second.get();
1248 auxKey = key + "Aux:";
1249 }
1250
1251 // Get the aux store object.
1252 RObjectManager* omgr = dynamic_cast<RObjectManager*>(auxMgr);
1253 if (!omgr) {
1254 ATH_MSG_FATAL("Auxiliary manager for \"" << auxKey
1255 << "\" is not of the right type");
1256 return StatusCode::FAILURE;
1257 }
1258 void* p = omgr->holder()->getAs(typeid(SG::IAuxStore));
1259 SG::IAuxStore* store = reinterpret_cast<SG::IAuxStore*>(p);
1260 if (store == nullptr) {
1261 ATH_MSG_FATAL("There's a logic error in the code");
1262 return StatusCode::FAILURE;
1263 }
1264
1265 if (!metadata) {
1266 // Make sure the auxiliary object is up to date.
1267 ::Int_t readBytes = auxMgr->getEntry();
1268
1269 // Check if there is a separate auxiliary object for the dynamic
1270 // variables, which would need to be updated.
1271 const std::string dynAuxKey = auxKey + "Dynamic";
1272 auto dynAuxMgr = objects.find(dynAuxKey);
1273 if ((dynAuxMgr != objects.end()) && (readBytes || (auxMgr == &mgr))) {
1274
1275 // Tell the dynamic store object to switch to a new entry.
1276 dynAuxMgr->second->getEntry();
1277 }
1278
1279#ifndef XAOD_STANDALONE
1280 // Call toTransient on the aux store.
1281 store->toTransient (this->currentContext());
1282#endif
1283 }
1284
1285 // Stop here if we've set up an auxiliary store.
1286 if (auxMgr == &mgr) {
1287 return StatusCode::SUCCESS;
1288 }
1289
1290 // Access the auxiliary base class of the object/vector:
1291 SG::AuxVectorBase* vec = 0;
1292 SG::AuxElement* aux = 0;
1293 switch (mgr.holder()->typeKind()) {
1294 case THolder::DATAVECTOR: {
1295 void* vvec = mgr.holder()->getAs(typeid(SG::AuxVectorBase));
1296 vec = reinterpret_cast<SG::AuxVectorBase*>(vvec);
1297 } break;
1298 case THolder::AUXELEMENT: {
1299 void* vaux = mgr.holder()->getAs(typeid(SG::AuxElement));
1300 aux = reinterpret_cast<SG::AuxElement*>(vaux);
1301 } break;
1302 default:
1303 break;
1304 }
1305
1306 // Check whether index tracking is enabled for the type. If not, then
1307 // we need to fix it...
1308 if (vec && (!vec->trackIndices())) {
1309 Details::forceTrackIndices(*vec);
1310 }
1311
1312 // Check if we were successful:
1313 if ((!vec) && (!aux)) {
1314 ATH_MSG_FATAL("Couldn't access class \""
1315 << mgr.holder()->getClass()->GetName()
1316 << "\" as SG::AuxVectorBase or SG::AuxElement");
1317 return StatusCode::FAILURE;
1318 }
1319
1320 // Connect with the aux store.
1321 if (vec) {
1322 vec->setStore(store);
1323 } else if (aux) {
1324 aux->setStore(store);
1325 } else {
1326 ATH_MSG_FATAL("There's a logic error in the code");
1327 return StatusCode::FAILURE;
1328 }
1329
1330 // We succeeded:
1331 return StatusCode::SUCCESS;
1332}
std::vector< size_t > vec
@ DATAVECTOR
A DataVector container.
Definition THolder.h:105
@ AUXELEMENT
A type inheriting from SG::AuxElement.
Definition THolder.h:106
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ setUpDynamicStore()

StatusCode xAOD::Experimental::REvent::setUpDynamicStore ( RObjectManager & mgr,
ROOT::RNTupleReader & reader )
privateinherited

event uses RNTupleReader:

This function is used by connectObject(...) and connectMetaObject(...) 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
readerThe RNTuple reader to read dynamic variables from
Returns
The usual StatusCode types

Definition at line 1825 of file REvent.cxx.

1826 {
1827
1828 // The name of the field that the object is connected to.
1829 const std::string fieldName = mgr.field().GetField().GetFieldName();
1830
1831 // Check if we can call setName(...) on the object.
1832 ::TMethodCall setNameCall;
1833 setNameCall.InitWithPrototype(mgr.holder()->getClass(), "setName",
1834 "const char*");
1835 if (setNameCall.IsValid()) {
1836 // Yes, there is such a function. Let's call it with the field
1837 // name.
1838 const ::TString params = ::TString::Format("\"%s\"", fieldName.c_str());
1839 const char* charParams = params.Data();
1840 setNameCall.Execute(mgr.holder()->get(), charParams);
1841 } else {
1842 // This is weird. What sort of auxiliary container is this? :-/
1843 ATH_MSG_WARNING("Couldn't find setName(...) function for container \""
1844 << fieldName << "\" (type: "
1845 << mgr.holder()->getClass()->GetName() << ")");
1846 }
1847
1848 // Check if we can switch out the internal store of this object:
1849 static const TClass* const holderClass =
1850 TClass::GetClass(typeid(SG::IAuxStoreHolder));
1851 if (!mgr.holder()->getClass()->InheritsFrom(holderClass)) {
1852 // Nope... So let's just end the journey here.
1853 return StatusCode::SUCCESS;
1854 }
1855
1856 // Try to get the object as an IAuxStoreHolder:
1857 SG::IAuxStoreHolder* storeHolder = reinterpret_cast<SG::IAuxStoreHolder*>(
1858 mgr.holder()->getAs(typeid(SG::IAuxStoreHolder)));
1859 if (!storeHolder) {
1860 ATH_MSG_FATAL("There's a logic error in the code");
1861 return StatusCode::FAILURE;
1862 }
1863
1864 // If we read an auxiliary store, call toTransient on it.
1865 const EventContext& ctx = this->currentContext();
1866#ifndef XAOD_STANDALONE
1867 if (SG::IAuxStore* istore = dynamic_cast<SG::IAuxStore*> (storeHolder)) {
1868 istore->toTransient( ctx );
1869 }
1870#endif
1871
1872 // Create an RAuxStore instance that will read the dynamic variables
1873 // of this container. Notice that the RAuxManager doesn't own the
1874 // RAuxStore object. It will be owned by the SG::IAuxStoreHolder
1875 // object.
1876 static constexpr bool TOP_STORE = false;
1877 auto store = std::make_unique<RAuxStore>(
1878 ctx,
1879 fieldName, TOP_STORE,
1883 // This object is used to read data from the input, it needs to be
1884 // locked:
1885 store->lock();
1886
1887 // Set it up to read from the input RNTuple.
1888 ATH_CHECK(store->readFrom(reader));
1889 // Tell the auxiliary store which entry to use. This is essential for
1890 // metadata objects, and non-important for event data objects, which will
1891 // get a possibly different entry loaded in setAuxStore(...).
1892 ATH_CHECK(store->getEntry(0));
1893
1894 // Set up a manager for it.
1895 static constexpr bool SHARED_OWNER = false;
1896 m_inputObjects[fieldName + "Dynamic"] =
1897 std::make_unique<RAuxManager>(store.get(), m_entry, SHARED_OWNER);
1898
1899 // Give this object to the store holder.
1900 storeHolder->setStore(store.release());
1901
1902 // Return gracefully:
1903 return StatusCode::SUCCESS;
1904}
virtual void setStore(IAuxStore *store)=0
Give an auxiliary store object to the holder object.

◆ stringToKey()

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

Find the string corresponding to a given key.

Definition at line 289 of file EventIProxyDict.cxx.

289 {
290
291 return getHash(str);
292}

◆ transientContains() [1/2]

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

Function checking if an object is already in memory.

◆ transientContains() [2/2]

bool xAOD::Event::transientContains ( const std::string & key,
const std::type_info & ti,
bool metadata ) const
protectedinherited

Internal function checking if an object is already in memory.

◆ transientContainsMeta()

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

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

◆ writeTo()

StatusCode xAOD::Experimental::REvent::writeTo ( TFile & file)
overridevirtualinherited

Connect the object to an output file.

This function should be called to create a file for writing and setup the output RNTuple and metadata trees.

Parameters
filethe TFile to which the output is writter

Implements xAOD::Event.

Definition at line 347 of file REvent.cxx.

347 {
348
349 // Save filefor writing
351
352 ATH_MSG_DEBUG("REvent::writeTo - opened output file " << m_outputFile->GetName());
353
354 // Access the EventFormat object associated with this file:
357
358 ATH_MSG_DEBUG("REvent::writeTo - creating RNTupleModel ");
359
360 // Create new model for this file
361 m_model = ROOT::RNTupleModel::Create();
362
363 // Set output RNTuple name as model description
364 const char* rnTupleName = EVENT_RNTUPLE_NAME;
365 m_model->SetDescription(rnTupleName);
366
367 // Return gracefully:
368 return StatusCode::SUCCESS;
369}
static const TEventFormatRegistry & instance()
Access the only instance of the object in memory.
EventFormat & getEventFormat(const TFile *file) const
Access the managed EventFormat object.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

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

Map from hashed sgkey to BranchInfo.

Definition at line 392 of file Event.h.

◆ DEFAULT_KEY

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 35 of file TVirtualEvent.h.

◆ EVENT_RNTUPLE_NAME

const char *const Event::EVENT_RNTUPLE_NAME = "EventData"
staticinherited

Name of the event RNTuple.

Definition at line 78 of file Event.h.

◆ EVENT_TREE_NAME

const char *const Event::EVENT_TREE_NAME = "CollectionTree"
staticinherited

Default name of the event TTree.

Name of the event TTree.

Definition at line 77 of file Event.h.

◆ KEY_MASK

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

Mask for the keys, used mostly internally.

Definition at line 37 of file TVirtualEvent.h.

◆ m_auxItemList

std::unordered_map<std::string, std::set<std::string> > xAOD::Event::m_auxItemList
protectedinherited

Rules for selecting which auxiliary branches to write.

Definition at line 360 of file Event.h.

◆ m_branchesMutex

upgrade_mutex_t xAOD::Event::m_branchesMutex
mutableprotectedinherited

Mutex for multithread synchronization.

Definition at line 388 of file Event.h.

◆ m_ctx

EventContext xAOD::Event::m_ctx
protectedinherited

The event context associated with this event.

Definition at line 408 of file Event.h.

◆ m_entry

::Long64_t xAOD::Experimental::REvent::m_entry {}
privateinherited

The entry to look at from the input.

Definition at line 138 of file REvent.h.

138{};

◆ m_eventReader

std::unique_ptr<ROOT::RNTupleReader> xAOD::Experimental::REvent::m_eventReader
privateinherited

The main event data reader.

Definition at line 131 of file REvent.h.

◆ m_eventWriter

std::unique_ptr<ROOT::RNTupleWriter> xAOD::Experimental::REvent::m_eventWriter
privateinherited

The main event writer: RNTupleWeader.

Definition at line 144 of file REvent.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_inputEventFormat

EventFormat xAOD::Event::m_inputEventFormat
protectedinherited

Format of the current input file.

Definition at line 355 of file Event.h.

◆ m_inputMetaObjects

Object_t xAOD::Event::m_inputMetaObjects
protectedinherited

Collection of all the managed input meta-objects.

Definition at line 350 of file Event.h.

◆ m_inputMissingObjects

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

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

Definition at line 345 of file Event.h.

◆ m_inputNTupleIsMissing

bool xAOD::Experimental::REvent::m_inputNTupleIsMissing = false
privateinherited

Whether the input has an event RNTuple or not.

Definition at line 133 of file REvent.h.

◆ m_inputObjects

Object_t xAOD::Event::m_inputObjects
protectedinherited

Collection of all the managed input objects.

Definition at line 342 of file Event.h.

◆ m_listeners

std::vector<TVirtualIncidentListener*> xAOD::Event::m_listeners
protectedinherited

Listeners who should be notified when certain incidents happen.

Definition at line 363 of file Event.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_metaReader

std::unique_ptr<ROOT::RNTupleReader> xAOD::Experimental::REvent::m_metaReader
privateinherited

The metadata reader.

Definition at line 135 of file REvent.h.

◆ m_model

std::unique_ptr<ROOT::RNTupleModel> xAOD::Experimental::REvent::m_model
privateinherited

The RNTuple model used for event fields.

Definition at line 141 of file REvent.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nameRemapping

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

Container name re-mapping rules.

Definition at line 366 of file Event.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_outputEventFormat

EventFormat* xAOD::Event::m_outputEventFormat = nullptr
protectedinherited

Format of the current output file.

Definition at line 357 of file Event.h.

◆ m_outputFile

::TFile* xAOD::Experimental::REvent::m_outputFile {nullptr}
privateinherited

The output file for writing.

Definition at line 147 of file REvent.h.

147{nullptr};

◆ m_outputMetaObjects

Object_t xAOD::Event::m_outputMetaObjects
protectedinherited

Collection of all the managed output meta-objects.

Definition at line 352 of file Event.h.

◆ m_outputObjects

Object_t xAOD::Event::m_outputObjects
protectedinherited

Collection of all the managed output object.

Definition at line 347 of file Event.h.

◆ m_printEventProxyWarnings

bool xAOD::Event::m_printEventProxyWarnings = false
protectedinherited

Option to silence common warnings that seem to be harmless.

Definition at line 369 of file Event.h.

◆ METADATA_OBJECT_NAME

const char *const Event::METADATA_OBJECT_NAME = "MetaData"
staticinherited

Name of the metadata tree or RNTuple.

Definition at line 79 of file Event.h.


The documentation for this class was generated from the following file: