Tool for accessing xAOD files outside of Athena. More...
#include <TEvent.h>
Public Types | |
enum | EAuxMode { kBranchAccess = 0, kClassAccess = 1, kAthenaAccess = 2, kUndefinedAccess = 3 } |
Auxiliary store "mode". More... | |
Public Member Functions | |
TEvent (EAuxMode mode=kUndefinedAccess) | |
Default constructor. | |
TEvent (::TFile *file, EAuxMode mode=kUndefinedAccess) | |
Constructor connecting the object to an input TFile. | |
TEvent (::TTree *tree, EAuxMode mode=kUndefinedAccess) | |
Constructor connecting the objects to an input TTree/TChain. | |
~TEvent () | |
Destructor. | |
EAuxMode | auxMode () const |
Get what auxiliary access mode the object was constructed with. | |
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. | |
Setup functions | |
TReturnCode | readFrom (::TFile *file, Bool_t useTreeCache=kTRUE, const char *treeName=EVENT_TREE_NAME) |
Connect the object to a new input file. | |
TReturnCode | readFrom (::TTree *tree, Bool_t useTreeCache=kTRUE) |
Connect the object to a new input tree/chain. | |
TReturnCode | writeTo (::TFile *file, Int_t autoFlush=200, const char *treeName=EVENT_TREE_NAME) |
Connect the object to an output file. | |
TReturnCode | finishWritingTo (::TFile *file) |
Finish writing to an output file. | |
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. | |
TReturnCode | addListener (TVirtualIncidentListener *listener) |
Register an incident listener object. | |
TReturnCode | removeListener (TVirtualIncidentListener *listener) |
Remove an incident listener object. | |
void | clearListeners () |
Remove all listeners from the object. | |
TReturnCode | 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. | |
Event data accessor/modifier functions | |
template<typename T > | |
::Bool_t | contains (const std::string &key) |
Function checking if an object is available from the store. | |
template<typename T > | |
::Bool_t | transientContains (const std::string &key) const |
Function checking if an object is already in memory. | |
template<typename T > | |
TReturnCode | retrieve (const T *&obj, const std::string &key) |
Retrieve either an input or an output object from the event. | |
template<typename T > | |
TReturnCode | retrieve (T *&obj, const std::string &key) |
Retrieve an output object from the event. | |
template<typename T > | |
TReturnCode | record (T *obj, const std::string &key,::Int_t basketSize=32000,::Int_t splitLevel=0) |
Add an output object to the event. | |
template<typename T > | |
TReturnCode | record (std::unique_ptr< T > obj, const std::string &key,::Int_t basketSize=32000,::Int_t splitLevel=0) |
Add an output object to the event, explicitly taking ownership of it. | |
SG::IAuxStore * | recordAux (const std::string &key, SG::IAuxStoreHolder::AuxStoreType type=SG::IAuxStoreHolder::AST_ContainerStore, Int_t basketSize=32000, Int_t splitLevel=0) |
Add an auxiliary store object to the output. | |
TReturnCode | copy (const std::string &key,::Int_t basketSize=32000,::Int_t splitLevel=0) |
Copy an object directly from the input to the output. | |
TReturnCode | copy (::Int_t basketSize=32000,::Int_t splitLevel=0) |
Copy all (ROOT readable) objects directly from the input to the output. | |
Metadata accessor/modifier functions | |
template<typename T > | |
::Bool_t | containsMeta (const std::string &key) |
Function checking if a meta-object is available from the store. | |
template<typename T > | |
::Bool_t | transientContainsMeta (const std::string &key) const |
Function checking if a meta-object is already in memory. | |
template<typename T > | |
TReturnCode | retrieveMetaInput (const T *&obj, const std::string &key) |
Retrieve an input metadata object. | |
template<typename T > | |
TReturnCode | retrieveMetaOutput (const T *&obj, const std::string &key) |
Retrieve an output metadata object. | |
template<typename T > | |
TReturnCode | retrieveMetaOutput (T *&obj, const std::string &key) |
Retrieve an output metadata object. | |
template<typename T > | |
TReturnCode | recordMeta (T *obj, const std::string &key,::Int_t basketSize=32000,::Int_t splitLevel=1) |
Add an object to the output file's metadata. | |
template<typename T > | |
TReturnCode | recordMeta (std::unique_ptr< T > obj, const std::string &key,::Int_t basketSize=32000,::Int_t splitLevel=1) |
Persistent data accessor/modifier functions | |
::Long64_t | getEntries () const |
Get how many entries are available from the current input file(s). | |
::Int_t | getEntry (::Long64_t entry,::Int_t getall=0) |
Function loading a given entry of the input TTree. | |
::Long64_t | getFiles () const |
Get how many files are available on the currently defined input. | |
::Int_t | getFile (::Long64_t file,::Int_t getall=0) |
Load the first event for a given file from the input TChain. | |
::Int_t | fill () |
Function filling one event into the output tree. | |
const EventFormat * | inputEventFormat () const |
Get information about the input objects. | |
const EventFormat * | outputEventFormat () const |
Get information about the output objects. | |
Protected Types | |
typedef std::map< std::string, TVirtualManager * > | Object_t |
Definition of the internal data structure type. | |
typedef std::vector < TVirtualIncidentListener * > | Listener_t |
Definition of the structure type holding on to listeners. | |
Protected Member Functions | |
TReturnCode | initStats () |
Function to initialise the statistics for all Tree content. | |
void * | getOutputObject (const std::string &key, const std::type_info &ti,::Bool_t metadata=kFALSE) const |
Function for retrieving an output object in a non-template way. | |
const void * | getInputObject (const std::string &key, const std::type_info &ti,::Bool_t silent=kFALSE,::Bool_t metadata=kFALSE) |
Function for retrieving an input object in a non-template way. | |
TReturnCode | record (void *obj, const std::string &typeName, const std::string &key,::Int_t basketSize,::Int_t splitLevel,::Bool_t overwrite=kFALSE,::Bool_t metadata=kFALSE,::Bool_t isOwner=kTRUE) |
Internal function for recording an object into the output. | |
TReturnCode | record (TAuxStore *store, const std::string &key,::Int_t basketSize,::Int_t splitLevel,::Bool_t ownsStore=kFALSE) |
Internal function for adding an auxiliary store object to the output. | |
TReturnCode | connectBranch (const std::string &key,::Bool_t silent=kFALSE) |
Function setting up access to a particular branch. | |
TReturnCode | connectMetaBranch (const std::string &key,::Bool_t silent=kFALSE) |
Function setting up access to a branch in the metadata tree. | |
TReturnCode | connectAux (const std::string &prefix,::Bool_t standalone) |
Function setting up access to a set of auxiliary branches. | |
TReturnCode | connectMetaAux (const std::string &prefix,::Bool_t standalone) |
TReturnCode | setUpDynamicStore (TObjectManager &mgr,::TTree *tree) |
TReturnCode | setAuxStore (TObjectManager &mgr,::Bool_t metadata=kFALSE) |
Function connecting a DV object to its auxiliary store. | |
TReturnCode | putAux (::TTree &outTree, TVirtualManager &mgr,::Int_t basketSize=32000,::Int_t splitLevel=0,::Bool_t metadata=kFALSE) |
Function saving the dynamically created auxiliary properties. | |
::Bool_t | contains (const std::string &key, const std::type_info &ti,::Bool_t metadata=kFALSE) |
Internal function checking if an object is in the input. | |
::Bool_t | transientContains (const std::string &key, const std::type_info &ti,::Bool_t metadata=kFALSE) const |
Internal function checking if an object is already in memory. | |
Static Protected Member Functions | |
::Bool_t | hasAuxStore (const TObjectManager &mgr) |
Function checking if a given object may have an auxiliary store. | |
::Bool_t | isAuxStore (const TObjectManager &mgr) |
Function checking if a given object may be an auxiliary store. | |
::Bool_t | isStandalone (const TObjectManager &mgr) |
Function checking if an object is standalone (not a container). | |
Protected Attributes | |
EAuxMode | m_auxMode |
The auxiliary access mode. | |
::TTree * | m_inTree |
The tree that we are reading from. | |
::Bool_t | m_inTreeMissing |
::TChain * | m_inChain |
The (optional) chain provided as input. | |
TChainStateTracker * | m_inChainTracker |
Optional object for tracking the state changes of an input TChain. | |
::Int_t | m_inTreeNumber |
The number of the currently open tree in the input chain. | |
::TTree * | m_inMetaTree |
Pointer to the metadata tree in the input file. | |
::Long64_t | m_entry |
The entry to look at from the input tree. | |
::TTree * | m_outTree |
The tree that we are writing to. | |
Object_t | m_inputObjects |
Collection of all the managed input objects. | |
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 |
Format of the current output file. | |
std::map< std::string, std::set< std::string > > | m_auxItemList |
Rules for selecting which auxiliary branches to write. | |
Listener_t | m_listeners |
Listeners who should be notified when certain incidents happen. | |
std::map< std::string, std::string > | m_nameRemapping |
Container name re-mapping rules. | |
Static Protected Attributes | |
static const ::Int_t | CACHE_SIZE = 30000000 |
Size of a possible TTreeCache (30 MB). | |
static const char * | EVENT_TREE_NAME = "CollectionTree" |
Name of the event tree. | |
static const char * | METADATA_TREE_NAME = "MetaData" |
Name of the metadata tree. | |
Friends | |
class | xAOD::TEventBranch |
class | xAOD::TMetaBranch |
class | xAOD::TFileMerger |
class | xAOD::TTreeMgr |
friend::TTree * | MakeTransientTree (TEvent &, const char *) |
Functions implementing the TVirtualEvent interface | |
| |
virtual uint32_t | getHash (const std::string &key) const |
Function returning the hash describing an object name. | |
virtual uint32_t | getKey (const void *obj) const |
Function returning the hash describing a known object. | |
virtual const std::string & | getName (const void *obj) const |
Function returning the key describing a known object. | |
virtual const std::string & | getName (uint32_t hash) const |
Function returning the key describing a known object. | |
virtual void * | getOutputObject (uint32_t key, const std::type_info &ti) |
Function for retrieving an output object in a non-template way. | |
virtual const void * | getInputObject (uint32_t key, const std::type_info &ti, bool silent=false) |
Function for retrieving an input object in a non-template way. |
Tool for accessing xAOD files outside of Athena.
Proper access to xAOD files in ROOT (outside of Athena) needs to be done through such an object. It takes care of reading and writing xAOD files together with their file format metadata, setting up smart pointers correctly, etc.
For a detailed description of the usage of this class, see: <Link to be added here...>
Auxiliary store "mode".
kBranchAccess |
Access auxiliary data branch-by-branch. |
kClassAccess |
Access auxiliary data using the aux containers. |
kAthenaAccess |
Access containers/objects like Athena does. |
kUndefinedAccess |
Undefined, to be selected by the object. |
TReturnCode xAOD::TEvent::addListener | ( | TVirtualIncidentListener * | listener | ) |
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.
listener | Pointer to the object that should be notified |
TReturnCode xAOD::TEvent::addNameRemap | ( | const std::string & | onfile, | |
const std::string & | newName | |||
) |
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).
onfile | The name of the container as it was saved into the input file | |
newName | The alias with which the object/container should be accessible |
Save the new name association:
TEvent::EAuxMode xAOD::TEvent::auxMode | ( | ) | const |
Get what auxiliary access mode the object was constructed with.
void xAOD::TEvent::clearListeners | ( | ) |
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.
void xAOD::TEvent::clearNameRemap | ( | ) |
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.
TReturnCode xAOD::TEvent::connectAux | ( | const std::string & | prefix, | |
::Bool_t | standalone | |||
) | [protected] |
Function setting up access to a set of auxiliary branches.
This function is used internally to connect an auxiliary object to the input. Based on the configuration of the object it will either use TAuxStore, or the EDM object that was used to write the auxiliary information in Athena.
prefix | The prefix (main branch name) of the auxiliary data | |
standalone | Type of the auxiliary store that should be created |
kTRUE
if the connection was successful, or kFALSE
if it was not TReturnCode xAOD::TEvent::connectBranch | ( | const std::string & | key, | |
::Bool_t | silent = kFALSE | |||
) | [protected] |
Function setting up access to a particular branch.
This is one of the more important functions of the class. It connects the event object to a given branch of the input TTree.
The type that is read in to memory is not actually determined by the type written to the tree itself, but from the xAOD::EventFormat object. Which is there to make it possible to possibly use ROOT read rules in the future to read a different type than what's on disk.
Everything else is fairly basic ROOT stuff, the code just has to make sure that the memory management is set up correctly for the created object.
key | The name of the branch to connect to | |
silent | Set to kTRUE to make the code fail silently in case the branch can't be connected to |
kTRUE
if the connection was successful, or kFALSE
if it was not TReturnCode xAOD::TEvent::connectMetaAux | ( | const std::string & | prefix, | |
::Bool_t | standalone | |||
) | [protected] |
Function setting up access to a set of auxiliary branches for a metadata object
This function is used internally to connect an auxiliary metadata object to the input. Based on the configuration of the object it will either use TAuxStore, or the EDM object that was used to write the auxiliary information in Athena.
prefix | The prefix (main branch name) of the auxiliary data | |
standalone | Type of the auxiliary store that should be created |
TReturnCode xAOD::TEvent::connectMetaBranch | ( | const std::string & | key, | |
::Bool_t | silent = kFALSE | |||
) | [protected] |
Function setting up access to a branch in the metadata tree.
This is the function doing the heavy lifting with creating metadata objects in memory out of the payload of the input file.
key | The key (branch name) of the metadata object to retrieve | |
silent | Set to kTRUE to make the code fail silently in case the branch can't be connected to |
Bool_t xAOD::TEvent::contains | ( | const std::string & | key, | |
const std::type_info & | ti, | |||
::Bool_t | metadata = kFALSE | |||
) | [protected] |
Internal function checking if an object is in the input.
Created a non-template version of the call internally to be able to use it from xAOD::MakeTransientTree.
key | The key to check | |
ti | The type of the object to check | |
metadata | Flag deciding whether we are looking for a metadata object or not |
kTRUE
if such an object is held by the event object at the moment, kFALSE
otherwise Bool_t xAOD::TEvent::contains | ( | const std::string & | key | ) | [inline] |
Function checking if an object is available from the store.
This function works pretty much like StoreGateSvc::contains. It can be used to check if an object with a given type having a given key can be retrieved from the event.
key | The key (branch name) of the object |
kTRUE
if the object is available, kFALSE
otherwise Bool_t xAOD::TEvent::containsMeta | ( | const std::string & | key | ) | [inline] |
Function checking if a meta-object is available from the store.
This function works pretty much like StoreGateSvc::contains for metadata objects. It can be used to check if a metadata object with a given type having a given key can be (const) retrieved.
key | The key (branch name) of the metadata object |
kTRUE
if the object is available, kFALSE
otherwise TReturnCode xAOD::TEvent::copy | ( | ::Int_t | basketSize = 32000 , |
|
::Int_t | splitLevel = 0 | |||
) |
Copy all (ROOT readable) objects directly from the input to the output.
This function is here to make it easy to write code that skims an input file into an output file without applying any modification to the events.
basketSize | Optional size for the basket associated with the output branch | |
splitLevel | Optional split level of the output branch |
xAOD::TReturnCode::kSuccess
if the copy was successful, or xAOD::TReturnCode::kFailure
if not TReturnCode xAOD::TEvent::copy | ( | const std::string & | key, | |
::Int_t | basketSize = 32000 , |
|||
::Int_t | splitLevel = 0 | |||
) |
Copy an object directly from the input to the output.
This function can be used to easily copy a given object/container to the output, without modifying the contents of it. It only needs to be called on the interface object/container, the copying of the auxiliary data is done automatically, and is steered by the SetAuxItemList function.
key | The key (branch name) of the object/container to copy | |
basketSize | Optional size for the basket associated with the output branch | |
splitLevel | Optional split level of the output branch |
std::string xAOD::TEvent::dump | ( | ) |
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.
Int_t xAOD::TEvent::fill | ( | ) |
Function filling one event into the output tree.
This function needs to be called by the user at the end of processing each event that is meant to be written out.
TReturnCode xAOD::TEvent::finishWritingTo | ( | ::TFile * | file | ) |
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.
file | The file that the event data is written to |
kTRUE
if successful, kFALSE
otherwise Long64_t xAOD::TEvent::getEntries | ( | ) | const |
Get how many entries are available from the current input file(s).
Int_t xAOD::TEvent::getEntry | ( | ::Long64_t | entry, | |
::Int_t | getall = 0 | |||
) |
Function loading a given entry of the input TTree.
This function is used to move to looking at a new entry from the input tree. It doesn't do any I/O operation at this point, it just remembers which entry the objects should be loaded from later on.
Unless one calls the function with getall==1
. In that case all input is force-read. This is necessary when writing out an event that was processed in a load-on-request manner.
entry | The entry from the input tree to load | |
getall | Parameter deciding if partial reading should be used or not. |
Int_t xAOD::TEvent::getFile | ( | ::Long64_t | file, | |
::Int_t | getall = 0 | |||
) |
Load the first event for a given file from the input TChain.
This function can be used to iterate over the input files specified for the object. It should be most useful for collecting metadata about a set of input files, if there's no regular event loop done to process them.
file | The file number to load | |
getall | If set to 1, all connected branches are loaded |
Long64_t xAOD::TEvent::getFiles | ( | ) | const |
Get how many files are available on the currently defined input.
This function can be used to get the number of input files that the object currently knows about. This is meant to be used to collect the metadata from each of the input files, or to access the metadata using a transient tree. (xAOD::TMetaTree)
uint32_t xAOD::TEvent::getHash | ( | const std::string & | key | ) | const [virtual] |
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
key | String key to turn into a hash |
Implements xAOD::TVirtualEvent.
const void * xAOD::TEvent::getInputObject | ( | const std::string & | key, | |
const std::type_info & | ti, | |||
::Bool_t | silent = kFALSE , |
|||
::Bool_t | metadata = kFALSE | |||
) | [protected] |
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.
key | The key (branch name) of the object to retrieve | |
ti | The type as which the object is to be retrieved | |
silent | Set to kTRUE to make the code fail silently in case the object can't be retrieved | |
metadata | Flag deciding whether we're looking for a metadata or event data object |
const void * xAOD::TEvent::getInputObject | ( | uint32_t | key, | |
const std::type_info & | ti, | |||
bool | silent = false | |||
) | [protected, virtual] |
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.
key | The hashed key of the input object | |
ti | The type description of the object requested | |
silent | Switch for being silent about failures or not |
Implements xAOD::TVirtualEvent.
uint32_t xAOD::TEvent::getKey | ( | const void * | obj | ) | const [virtual] |
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.
obj | Pointer to the object that we want to look up |
Implements xAOD::TVirtualEvent.
const std::string & xAOD::TEvent::getName | ( | uint32_t | hash | ) | const [virtual] |
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.
hash | The hashed key for the container/object |
Implements xAOD::TVirtualEvent.
const std::string & xAOD::TEvent::getName | ( | const void * | obj | ) | const [virtual] |
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.
obj | Pointer to the object that we want to look up |
Implements xAOD::TVirtualEvent.
void * xAOD::TEvent::getOutputObject | ( | const std::string & | key, | |
const std::type_info & | ti, | |||
::Bool_t | metadata = kFALSE | |||
) | const [protected] |
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.
key | The key (branch name) of the object to retrieve | |
ti | The type as which the object is to be retrieved | |
metadata | Flag deciding whether we're looking for a metadata or event data object |
void * xAOD::TEvent::getOutputObject | ( | uint32_t | key, | |
const std::type_info & | ti | |||
) | [protected, virtual] |
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.
key | The hashed key of the output object | |
ti | The type description of the object requested |
Implements xAOD::TVirtualEvent.
Bool_t xAOD::TEvent::hasAuxStore | ( | const TObjectManager & | mgr | ) | [static, protected] |
Function checking if a given object may have an auxiliary store.
Since the code needs to check in a few places whether a given object has an auxiliary store, and as this check may change slightly over time, it seemed to be a good idea to outsource this check into this function.
mgr | The manager of the object that should be checked |
kTRUE
if the object can have an auxiliary store, kFALSE
otherwise TReturnCode xAOD::TEvent::initStats | ( | ) | [protected] |
Function to initialise the statistics for all Tree content.
This function is used internally to initialise the reading of an input file. It prepares the "monitoring information" in memory that gets filled while the code is running, with information about xAOD I/O.
TReturnCode::kSuccess
if the function is successful, or TReturnCode::kFaulure
if not const EventFormat * xAOD::TEvent::inputEventFormat | ( | ) | const |
Get information about the input objects.
This function makes it possible for the user to investigate the contents of the input file that the object is currently connected to.
Notice that this doesn't necessarily mean that all the objects for which metadata is stored, would necessarily be part of the input TTree that this object is connected to.
Bool_t xAOD::TEvent::isAuxStore | ( | const TObjectManager & | mgr | ) | [static, protected] |
Function checking if a given object may be an auxiliary store.
This function is used to decide if a given object is an auxiliary store type or not.
mgr | The manager of the object that should be checked |
kTRUE
if the object is an auxiliary store, kFALSE
if it is not Bool_t xAOD::TEvent::isStandalone | ( | const TObjectManager & | mgr | ) | [static, protected] |
Function checking if an object is standalone (not a container).
This function is used to figure out while setting up the reading of the TTree in kBranchAccess mode, what to tell the underlying TAuxStore object, what kind of store it needs to be. It's done in pretty much the same way in which hasAuxStore(...) decides if the object in question can have an auxiliary store.
mgr | The manager of the object that should be checked |
kTRUE
if the object is a standalone one, kFALSE
if it is a container const EventFormat * xAOD::TEvent::outputEventFormat | ( | ) | const |
Get information about the output objects.
This function makes it possible for the user to investigate the content that is being written to the output file.
Notice that this doesn't necessarily mean that all the objects for which metadata is stored, would necessarily be part of the output TTree that this object is connected to.
void xAOD::TEvent::printIOStats | ( | ) | const |
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.
void xAOD::TEvent::printNameRemap | ( | ) | const |
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.
TReturnCode xAOD::TEvent::putAux | ( | ::TTree & | outTree, | |
TVirtualManager & | vmgr, | |||
::Int_t | basketSize = 32000 , |
|||
::Int_t | splitLevel = 0 , |
|||
::Bool_t | metadata = kFALSE | |||
) | [protected] |
Function saving the dynamically created auxiliary properties.
This function is used internally to set up the writing of the auxiliary store variables that were dynamically created on an object. (And not statically defined to be part of that object.)
outTree | The TTree to put the auxiliary branches into | |
mgr | The object manager of the output object | |
basketSize | Size of the buffer associated with the branches | |
splitLevel | The split level to use for the created branches | |
metadata | Flag specifying whether the info written is metadata or not |
kTRUE
if the setup was successful, or kFALSE
if it was not TReturnCode xAOD::TEvent::readFrom | ( | ::TTree * | tree, | |
Bool_t | useTreeCache = kTRUE | |||
) |
Connect the object to a new input tree/chain.
This version of the function sets up the object to readin information from a tree/chain. Using it with a TTree pointer makes not much sense, but using it with a TChain pointer could be a very valid usage mode.
tree | The pointer to a TTree or a TChain | |
useTreeCache | Flag for switching TTreeCache usage on/off |
kTRUE
if successful, kFALSE
when not TReturnCode xAOD::TEvent::readFrom | ( | ::TFile * | file, | |
Bool_t | useTreeCache = kTRUE , |
|||
const char * | treeName = EVENT_TREE_NAME | |||
) |
Connect the object to a new input file.
This function takes care of connecting the event object to a new input file. It reads in the metadata of the input file needed for reading the file.
file | Pointer to the file being read | |
useTreeCache | Flag for turning on/off the usage of TTreeCache | |
treeName | Name of the input tree |
kTRUE
if successful, kFALSE
otherwise TReturnCode xAOD::TEvent::record | ( | TAuxStore * | store, | |
const std::string & | key, | |||
::Int_t | basketSize, | |||
::Int_t | splitLevel, | |||
::Bool_t | ownsStore = kFALSE | |||
) | [protected] |
Internal function for adding an auxiliary store object to the output.
This function is used internally when copying an object with its auxiliary store from the input file, and branch access mode is activated for the event object.
The assumption is that the store object already knows what prefix it should be using. The key parameter only specifies under what ID the object should be handled in the output object list.
store | The store object to connect to the output | |
key | The "key" with which to record the object | |
basketSize | The basket size of the output branches | |
splitLevel | The split level of the output branches |
kTRUE
if the operation was successful, or kFALSE
if it was not TReturnCode xAOD::TEvent::record | ( | void * | obj, | |
const std::string & | typeName, | |||
const std::string & | key, | |||
::Int_t | basketSize, | |||
::Int_t | splitLevel, | |||
::Bool_t | overwrite = kFALSE , |
|||
::Bool_t | metadata = kFALSE , |
|||
::Bool_t | isOwner = kTRUE | |||
) | [protected] |
Internal function for recording an object into the output.
This is the function doing the heavy lifting when recording a new object into the output tree/file. It makes sure that the object is saved together with all of its dynamic auxiliary data if it has any.
obj | A typeless pointer to the object that we want to record | |
typeName | The type name of the output object | |
key | The key (branch name) of the object to record | |
basketSize | The basket size of the output branch | |
splitLevel | The split level of the output branch | |
overwrite | Flag selecting if it is allowed to overwrite an already existing object (used internally) | |
metadata | Flag selecting if we are writing an event or a metadata object | |
isOwner | Flag selecting if we should take ownership of the object or not |
kTRUE
if the operation was successful, or kFALSE
if it was not TReturnCode xAOD::TEvent::record | ( | std::unique_ptr< T > | obj, | |
const std::string & | key, | |||
::Int_t | basketSize = 32000 , |
|||
::Int_t | splitLevel = 0 | |||
) | [inline] |
Add an output object to the event, explicitly taking ownership of it.
This function is used to add an object to the output. As the interface clearly states, the function takes posession of the object given to it. Since the user must give up ownership of the object in order to call this function, it doesn't even need to be said that the user must not delete the object by hand after calling this function.
obj | Smart pointer to the object to tbe added to the event | |
key | The key (branch name) to give the object | |
basketSize | Basket size for the branch created from the object | |
splitLevel | The split level of the branch to create |
kTRUE
if the operation was successful, kFALSE
if it wasn't TReturnCode xAOD::TEvent::record | ( | T * | obj, | |
const std::string & | key, | |||
::Int_t | basketSize = 32000 , |
|||
::Int_t | splitLevel = 0 | |||
) | [inline] |
Add an output object to the event.
This function can be used to add an object to the output. The function takes posession of the object, so the user code must not delete an object that was added to an event.
obj | Pointer to the object to be added to the event | |
key | The key (branch name) to give the object | |
basketSize | Basket size for the branch created from the object | |
splitLevel | The split level of the branch to create |
kTRUE
if the operation was successful, kFALSE
if it wasn't TReturnCode xAOD::TEvent::recordMeta | ( | std::unique_ptr< T > | obj, | |
const std::string & | key, | |||
::Int_t | basketSize = 32000 , |
|||
::Int_t | splitLevel = 1 | |||
) | [inline] |
Add an object to the output file's metadata, explicitly taking ownership of it
This function can be used to add a metadata object to the output. As the interface clearly states, the function takes posession of the object given to it. So it's not even worth mentioning that the user must not delete the object after giving it to this function.
obj | Smart pointer to the object to be added to the output metadata | |
key | The key (branch name) to give the object | |
basketSize | Basket size for the branch created from the object | |
splitLevel | The split level of the branch to create |
kTRUE
if the operation was successful, kFALSE
if it wasn't TReturnCode xAOD::TEvent::recordMeta | ( | T * | obj, | |
const std::string & | key, | |||
::Int_t | basketSize = 32000 , |
|||
::Int_t | splitLevel = 1 | |||
) | [inline] |
Add an object to the output file's metadata.
This function can be used to add a metadata object to the output. The function takes posession of the object, so the user code must not delete an object that was added to the output.
obj | Pointer to the object to be added to the output metadata | |
key | The key (branch name) to give the object | |
basketSize | Basket size for the branch created from the object | |
splitLevel | The split level of the branch to create |
kTRUE
if the operation was successful, kFALSE
if it wasn't TReturnCode xAOD::TEvent::removeListener | ( | TVirtualIncidentListener * | listener | ) |
Remove an incident listener object.
This function allows us to remove a listener when for instance a metadata tool is deleted during a job.
listener | Pointer to the listener that should be removed |
TReturnCode xAOD::TEvent::retrieve | ( | T *& | obj, | |
const std::string & | key | |||
) | [inline] |
Retrieve an output object from the event.
This function can be used to retrieve an object from the output list. Since only output objects are considered, the function returns a non-const object, allowing downstream code to modify an object that was put into the event somewhere upstream.
obj | The pointer that will be set to the object requested | |
key | The key (branch name) of the object |
kTRUE
if the operation was successful, kFALSE
if it wasn't TReturnCode xAOD::TEvent::retrieve | ( | const T *& | obj, | |
const std::string & | key | |||
) | [inline] |
Retrieve either an input or an output object from the event.
This function needs to be used when retrieving an object either from the input or the output object list. The returned object can not be modified.
obj | The pointer that will be set to the object requested | |
key | The key (branch name) of the object |
kTRUE
if the operation was successful, kFALSE
if it wasn't TReturnCode xAOD::TEvent::retrieveMetaInput | ( | const T *& | obj, | |
const std::string & | key | |||
) | [inline] |
Retrieve an input metadata object.
This function can be used to retrieve an object from the input metadata list.
obj | The pointer that will be set to the object requested | |
key | The key (branch name) of the object |
TReturnCode xAOD::TEvent::retrieveMetaOutput | ( | T *& | obj, | |
const std::string & | key | |||
) | [inline] |
Retrieve an output metadata object.
This function can be used to retrieve an object from the output metadata list.
obj | The pointer that will be set to the object requested | |
key | The key (branch name) of the object |
TReturnCode xAOD::TEvent::retrieveMetaOutput | ( | const T *& | obj, | |
const std::string & | key | |||
) | [inline] |
Retrieve an output metadata object.
This function can be used to retrieve an object from the output metadata list.
obj | The pointer that will be set to the object requested | |
key | The key (branch name) of the object |
void xAOD::TEvent::setActive | ( | ) | const |
Set this event object as the currently active one.
Setting TEvent objects happens automatically when reading a file, but when writing a file from scratch, the code doesn't necessarily know which TEvent object a given smart pointer should "belong to". This function helps the user with setting this up.
void xAOD::TEvent::setAuxItemList | ( | const std::string & | containerKey, | |
const std::string & | itemList | |||
) |
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.
containerKey | The name of the auxiliary container in question | |
itemList | The variable list according to the ... formatting rules |
TReturnCode xAOD::TEvent::setAuxStore | ( | TObjectManager & | mgr, | |
::Bool_t | metadata = kFALSE | |||
) | [protected] |
Function connecting a DV object to its auxiliary store.
Every time a DataVector is read in from the input for a new TTree entry, one needs to re-connect it with its auxiliary store. This function takes care of this.
mgr | The manager object of the DV container | |
metadata | Flag specifying whether we're dealing with a metadata or event data object |
kTRUE
if the setup was successful, or kFALSE
if it was not TReturnCode xAOD::TEvent::setUpDynamicStore | ( | TObjectManager & | mgr, | |
::TTree * | tree | |||
) | [protected] |
Function adding dynamic variable reading capabilities to an auxiliary store object
This function is used by connectBranch(...) and connectMetaBranch(...) to set up auxiliary store type objects correctly for accessing dynamic variables from the input file.
mgr | The object manager of the auxiliary store object | |
tree | The tree to read dynamic variables from |
TReturnCode
types Bool_t xAOD::TEvent::transientContains | ( | const std::string & | key, | |
const std::type_info & | ti, | |||
::Bool_t | metadata = kFALSE | |||
) | const [protected] |
Internal function checking if an object is already in memory.
Internal function checking if an object of a given type, with a given key is held in memory by the event object. It's this function doing the heavy lifting for the public template function.
key | The key/branch name of the object | |
ti | The type description of the object | |
metadata | Flag deciding whether we are looking for a metadata object or not |
kTRUE
if such a modifiable object is held by the event object at the moment, kFALSE
otherwise Bool_t xAOD::TEvent::transientContains | ( | const std::string & | key | ) | const [inline] |
Function checking if an object is already in memory.
This function works pretty much like StoreGateSvc::transientContains. It doesn't try to do any I/O operations, it just checks if an object of a given type, with a given key, is already in memory.
key | The key (branch name) of the object |
kTRUE
if the object is already in memory, kFALSE
otherwise Bool_t xAOD::TEvent::transientContainsMeta | ( | const std::string & | key | ) | const [inline] |
Function checking if a meta-object is already in memory.
This function works pretty much like StoreGateSvc::transientContains for metadata objects. It doesn't try to do any I/O operations, it just checks if an object of a given type, with a given key, can be retrieved in non-const mode.
key | The key (branch name) of the metadata object |
kTRUE
if the object is available for modifications, kFALSE
otherwise TReturnCode xAOD::TEvent::writeTo | ( | ::TFile * | file, | |
Int_t | autoFlush = 200 , |
|||
const char * | treeName = EVENT_TREE_NAME | |||
) |
Connect the object to an output file.
This function should be called on a file opened be the user, before any event processing would occur. It sets up the output event tree.
file | The file that the event data should be written to | |
autoFlush | The auto-flush setting to use on the output TTree | |
treeName | Name of the output event tree |
kTRUE
if successful, kFALSE
otherwise ::Bool_t xAOD::TEvent::m_inTreeMissing [protected] |
Internal status flag showing that an input file is open, but it doesn't contain an event tree