![]() |
ATLAS Offline Software
|
Class used internally to implement just-in-time reading. More...
Public Member Functions | |
TBranchHandle (::Bool_t staticBranch, ::Bool_t primitiveBranch, const std::type_info *ti, void *obj, SG::auxid_t auxid, const std::string *prefix) | |
Constructor. More... | |
::Int_t | getEntry () |
Get entry from the branch that was loaded with TTree::LoadTree() More... | |
::TBranch ** | branchPtr () |
Get a pointer to the branch being held. More... | |
void * | objectPtr () |
Get a pointer to the object. More... | |
void * | inputObjectPtr () |
Get a pointer to the object (or its pointer) in memory for reading. More... | |
void * | outputObjectPtr () |
Get a pointer to the object (or its pointer) in memory for writing. More... | |
const std::type_info * | typeInfo () const |
Get the type of the variable in memory. More... | |
void | reset () |
Tell the object that the branch contents need to be re-read. More... | |
Private Attributes | |
::TBranch * | m_branch |
The branch that this object is handling. More... | |
::Long64_t | m_entry |
The last entry that was loaded for this branch. More... | |
void * | m_object |
The pointer to the object in memory. More... | |
::Bool_t | m_static |
Is this a static variable in question? More... | |
::Bool_t | m_primitive |
Is this a primitive variable? More... | |
const std::type_info * | m_typeInfo |
Type info for the variable. More... | |
::Bool_t | m_needsRead |
Read status flag. More... | |
SG::auxid_t | m_auxid |
The auxiliary ID of the branch. More... | |
const std::string * | m_prefix |
Pointer to the m_prefix string of the parent object. More... | |
Class used internally to implement just-in-time reading.
This is a much simplified version of the code that we used in the D3PDReader code to read variables just in time for the users.
Definition at line 260 of file TAuxStore.h.
xAOD::TAuxStore::TBranchHandle::TBranchHandle | ( | ::Bool_t | staticBranch, |
::Bool_t | primitiveBranch, | ||
const std::type_info * | ti, | ||
void * | obj, | ||
SG::auxid_t | auxid, | ||
const std::string * | prefix | ||
) |
TBranch ** xAOD::TAuxStore::TBranchHandle::branchPtr | ( | ) |
Get a pointer to the branch being held.
No magic here.
TTree::SetBranchAddress
needs a pointer to a TBranch
pointer. This function just makes sure that we can give it such a pointer, which will stay valid during the job.
Definition at line 2039 of file TAuxStore.cxx.
Int_t xAOD::TAuxStore::TBranchHandle::getEntry | ( | ) |
Get entry from the branch that was loaded with TTree::LoadTree()
This function takes care of implementing just-in-time reading of branches for us.
Definition at line 1958 of file TAuxStore.cxx.
void * xAOD::TAuxStore::TBranchHandle::inputObjectPtr | ( | ) |
Get a pointer to the object (or its pointer) in memory for reading.
This is a tricky one.
When reading a single sub-branch of a branch that was written using an auxiliary container with direct ROOT I/O, TTree expects us to give it a simple pointer to the object that it should fill with content. But when reading a top level branch, like the dynamically created branches that we make, TTree needs to receive a pointer to a pointer.
Also, when reading a primitive type, ROOT also expects a simple pointer to the primitive variable in memory.
This function returns the correct kind of pointer for TTree::SetBranchAddress
in all situations.
TTree::SetBranchAddress
Definition at line 2069 of file TAuxStore.cxx.
void * xAOD::TAuxStore::TBranchHandle::objectPtr | ( | ) |
Get a pointer to the object.
This function is used in the implementation of the IAuxStoreIO interface.
In there we just need a simple pointer to the object, we don't care about ROOT's idiosyncracies.
Definition at line 2049 of file TAuxStore.cxx.
void * xAOD::TAuxStore::TBranchHandle::outputObjectPtr | ( | ) |
Get a pointer to the object (or its pointer) in memory for writing.
This is a slightly simplified version of GetInputObjectPtr(), for the case when we need to write a branch, and have to pass a pointer to TTree::Branch
.
In this case we don't need to be mindful of whether the variable was read as a static or dynamic variable. The only interesting thing is if the variable is of a primitive or an object type.
TTree::Branch
Definition at line 2088 of file TAuxStore.cxx.
void xAOD::TAuxStore::TBranchHandle::reset | ( | ) |
Tell the object that the branch contents need to be re-read.
After TEvent::Fill is called, the TAuxStore objects used for data writing are cleared.
Since TEvent doesn't know if the object is also used to read information or not. (If it's just used for writing, then this explicit clearing is mandatory.)
In case the user wants to continue processing the same event after the fill() call (because for instance the code is writing multiple trees), then we need to be aware that the variable needs to be re-read from the input to be in a good shape for the next write operation.
Definition at line 2114 of file TAuxStore.cxx.
const std::type_info * xAOD::TAuxStore::TBranchHandle::typeInfo | ( | ) | const |
Get the type of the variable in memory.
Definition at line 2098 of file TAuxStore.cxx.
|
private |
The auxiliary ID of the branch.
Definition at line 299 of file TAuxStore.h.
|
private |
The branch that this object is handling.
Definition at line 285 of file TAuxStore.h.
|
private |
The last entry that was loaded for this branch.
Definition at line 287 of file TAuxStore.h.
|
private |
Read status flag.
Definition at line 297 of file TAuxStore.h.
|
private |
The pointer to the object in memory.
Definition at line 289 of file TAuxStore.h.
|
private |
Pointer to the m_prefix string of the parent object.
Definition at line 301 of file TAuxStore.h.
|
private |
Is this a primitive variable?
Definition at line 293 of file TAuxStore.h.
|
private |
Is this a static variable in question?
Definition at line 291 of file TAuxStore.h.
|
private |
Type info for the variable.
Definition at line 295 of file TAuxStore.h.