2#ifndef XAODROOTACCESS_EVENT_H
3#define XAODROOTACCESS_EVENT_H
21#include <unordered_map>
40 implements<IProxyDict>;
86 virtual StatusCode
readFrom(TFile& inFile) = 0;
93 const std::string& itemList);
104 const std::string& newName);
121 virtual ::Int_t
getEntry(::Long64_t entry, ::Int_t getall = 0) = 0;
141 template <
typename T>
144 template <
typename T>
148 template <
typename T>
149 StatusCode
keys(std::vector<std::string>& vkeys,
bool metadata)
const;
152 template <
typename T>
153 StatusCode
retrieve(
const T*& obj,
const std::string& key);
155 template <
typename T>
156 StatusCode
retrieve(T*& obj,
const std::string& key);
159 template <
typename T>
160 StatusCode
record(T* obj,
const std::string& key);
162 template <
typename T>
163 StatusCode
record(std::unique_ptr<T> obj,
const std::string& key);
166 StatusCode
copy(
const std::string& pattern =
".*");
174 template <
typename T>
177 template <
typename T>
181 template <
typename T>
182 StatusCode
metaKeys(std::vector<std::string>& vkeys)
const;
185 template <
typename T>
189 template <
typename T>
192 template <
typename T>
196 template <
typename T>
200 template <
typename T>
201 StatusCode
recordMeta(std::unique_ptr<T> obj,
const std::string& key);
213 const std::string&
getName(
const void* obj)
const override;
223 bool silent)
override;
243 std::vector<const SG::DataProxy*>
proxies()
const override;
259 const std::string& key,
bool allowMods,
260 bool returnExisting)
override;
263 const std::string&
name()
const override;
269 const std::string& key,
bool overwrite =
false,
270 bool metadata =
true,
bool isOwner =
true);
281 virtual StatusCode
getNames(
const std::string& targetClassName,
282 std::vector<std::string>& vkeys,
283 bool metadata =
false)
const = 0;
290 virtual StatusCode
connectAux(
const std::string& prefix,
bool standalone) = 0;
294 bool standalone) = 0;
302 virtual StatusCode
record(
void* obj,
const std::string& typeName,
303 const std::string& key,
bool overwrite,
304 bool metadata,
bool isOwner) = 0;
312 void*
getOutputObject(
const std::string& key,
const std::type_info& ti,
313 bool metadata)
const;
315 const void*
getInputObject(
const std::string& key,
const std::type_info& ti,
316 bool silent,
bool metadata);
318 bool contains(
const std::string& key,
const std::type_info& ti,
322 bool metadata)
const;
326 std::unordered_map<std::string, std::unique_ptr<TVirtualManager>>;
uint32_t CLID
The Class ID type.
Define macros for attributes used to control the static checker.
Lock object for taking out upgradable locks.
Class mimicking the AthMessaging class from the offline software.
Helper object for holding something through a THolder.
Manager for EDM objects created by ROOT.
StatusCode removeListener(TVirtualIncidentListener *listener)
Remove an incident listener object.
virtual bool hasInput() const =0
Check if an input file is connected to the object.
StatusCode record(std::unique_ptr< T > obj, const std::string &key)
Add an output object to the event, explicitly taking ownership of it.
StatusCode addListener(TVirtualIncidentListener *listener)
Register an incident listener object.
virtual StatusCode connectAux(const std::string &prefix, bool standalone)=0
Function setting up access to a set of auxiliary branches.
StatusCode retrieve(T *&obj, const std::string &key)
Retrieve an output object from the event.
EventFormat m_inputEventFormat
Format of the current input file.
const std::string & name() const override
Get the name of the instance.
std::set< std::string > m_inputMissingObjects
Objects that have been asked for, but were found to be missing in the current input.
virtual StatusCode readFrom(TFile &inFile)=0
Read from a new file - only needed for the second+ files.
StatusCode retrieveMetaInput(const T *&obj, const std::string &key)
Retrieve an input metadata object.
virtual StatusCode getNames(const std::string &targetClassName, std::vector< std::string > &vkeys, bool metadata=false) const =0
Function determining the list keys associated with a type name.
bool transientContains(const std::string &key) const
Function checking if an object is already in memory.
const EventFormat * outputEventFormat() const
Get information about the output objects.
const std::string * keyToString(SG::sgkey_t key) const override
Find the string corresponding to a given key.
virtual StatusCode recordAux(TVirtualManager &mgr, const std::string &key, bool metadata)=0
Record an auxiliary store into a connected output file.
virtual bool hasOutput() const =0
Check if an output file is connected to the object.
void registerKey(SG::sgkey_t key, const std::string &str, CLID clid) override
Remember an additional mapping from key to string/CLID.
bool contains(const std::string &key, const std::type_info &ti, bool metadata)
Internal function checking if an object is in the input.
void clearListeners()
Remove all listeners from the object.
static std::unique_ptr< Event > createAndReadFrom(TFile &file)
static method to create an Event object and readFrom a file, given by a TFile.
StatusCode recordMeta(T *obj, const std::string &key)
Add an object to the output file's metadata.
void clearNameRemap()
Clear the current name re-mapping.
const EventFormat * inputEventFormat() const
Get information about the input objects.
virtual StatusCode record(void *obj, const std::string &typeName, const std::string &key, bool overwrite, bool metadata, bool isOwner)=0
Record an object into a connected output file.
bool contains(const std::string &key)
Function checking if an object is available from the store.
SG::sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the string corresponding to a given key.
std::vector< const SG::DataProxy * > proxies() const override
return the list of all current proxies in store
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.
upgrade_mutex_t m_branchesMutex
Mutex for multithread synchronization.
virtual StatusCode connectObject(const std::string &key, bool silent)=0
Function setting up access to a particular object.
AthContainers_detail::upgrading_lock< upgrade_mutex_t > upgrading_lock_t
Lock type for multithread synchronization.
StatusCode addNameRemap(const std::string &onfile, const std::string &newName)
Add a name re-mapping rule.
StatusCode metaKeys(std::vector< std::string > &vkeys) const
Provide a list of all metadata object keys associated with a specific type.
const std::string & getName(const void *obj) const override
Function returning the key describing a known object.
SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
Object_t m_inputObjects
Collection of all the managed input objects.
void setAuxItemList(const std::string &containerKey, const std::string &itemList)
Configure which dynamic variables to write out for a given store.
static const char *const METADATA_OBJECT_NAME
Name of the metadata tree or RNTuple.
virtual ~Event()
Virtual destructor.
static const char *const EVENT_TREE_NAME
Default name of the event TTree.
StatusCode copy(const std::string &pattern=".*")
Copy an object directly from the input to the output.
SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override
Record an object in the store.
std::string dump()
Function creating a user-readable dump of the current input.
void printProxyWarnings(bool value=true)
Enable warnings associated with broken element links.
virtual::Long64_t getEntries() const =0
Get how many entries are available from the current input file(s)
Event(std::string_view name)
Constructor with a name.
bool m_printEventProxyWarnings
Option to silence common warnings that seem to be harmless.
SG::sgkey_t getKey(const void *obj) const override
Function returning the hash describing a known object.
std::unordered_map< std::string, std::unique_ptr< TVirtualManager > > Object_t
Definition of the internal data structure type.
void * getOutputObject(SG::sgkey_t key, const std::type_info &ti) override
Function for retrieving an output object in a non-template way.
StatusCode addToStore(CLID id, SG::DataProxy *proxy) override
Add a new proxy to the store.
StatusCode retrieveMetaOutput(T *&obj, const std::string &key)
Retrieve an output metadata object.
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.
const BranchInfo * getBranchInfo(SG::sgkey_t sgkey) const
Get the object describing one object/branch.
StatusCode record(T *obj, const std::string &key)
Add an output object to the event.
bool transientContainsMeta(const std::string &key) const
Function checking if a meta-object is already in memory.
const xAOD::EventFormatElement * getEventFormatElement(SG::sgkey_t sgkey) const
Get the metadata object for a given "SG key".
void printNameRemap() const
Print the current name re-mapping rules.
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.
StatusCode keys(std::vector< std::string > &vkeys, bool metadata) const
Provide a list of all data object keys associated with a specific type.
virtual StatusCode connectMetaAux(const std::string &prefix, bool standalone)=0
Function setting up access to a set of auxiliary branches for a metadata object.
StatusCode retrieveMetaOutput(const T *&obj, const std::string &key)
Retrieve an output metadata object.
StatusCode retrieve(const T *&obj, const std::string &key)
Retrieve either an input or an output object from the event.
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.
void setActive() const
Set this event object as the currently active one.
SG::sgkey_t getHash(const std::string &key) const override
Function returning the hash describing an object name.
static const char *const EVENT_RNTUPLE_NAME
Name of the event RNTuple.
std::unordered_map< std::string, std::string > m_nameRemapping
Container name re-mapping rules.
Object_t m_inputMetaObjects
Collection of all the managed input meta-objects.
std::unordered_map< std::string, std::set< std::string > > m_auxItemList
Rules for selecting which auxiliary branches to write.
EventFormat * m_outputEventFormat
Format of the current output file.
bool transientContains(const std::string &key, const std::type_info &ti, bool metadata) const
Internal function checking if an object is already in memory.
virtual::Int_t getEntry(::Long64_t entry, ::Int_t getall=0)=0
Function loading a given entry of the input TTree.
Object_t m_outputObjects
Collection of all the managed output object.
SG::SGKeyMap< BranchInfo > m_branches ATLAS_THREAD_SAFE
Map from hashed sgkey to BranchInfo.
void printIOStats() const
Function printing the I/O statistics of the current process.
bool containsMeta(const std::string &key)
Function checking if a meta-object is available from the store.
AthContainers_detail::upgrade_mutex upgrade_mutex_t
Mutex type for multithread synchronization.
std::vector< TVirtualIncidentListener * > m_listeners
Listeners who should be notified when certain incidents happen.
SG::DataProxy * proxy(const void *const pTransient) const override
get proxy for a given data object address in memory
Object_t m_outputMetaObjects
Collection of all the managed output meta-objects.
Base interface for getting objects out of the input file.
Class providing an interface for classes listening to xAOD incidents.
Interface class for the "manager classes".
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
std::unordered_map< sgkey_t, T > SGKeyMap
A map using sgkey_t as a key.
implements< IProxyDict > IProxyDictBase
IProxyDict base class to use in a specific build environment
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
EventFormat_v1 EventFormat
Definition of the current event format version.
Helper struct used by the IProxyDict code.
std::unique_ptr< SG::DataProxy > m_proxy
Data proxy describing this branch/object.
const ::TClass * m_class
Dictionary describing this branch/object.