PandaTree
|
Base class for elements of containers. More...
#include <Element.h>
Classes | |
struct | datastore |
class | StoreManager |
Singleton class for bookkeeping of Elements constructed as singlets. More... | |
Public Types | |
typedef ArrayBase | array_type |
typedef CollectionBase | collection_type |
Public Member Functions | |
Element ()=delete | |
Disabled default constructor. | |
Element (datastore &, UInt_t) | |
Standard constructor. | |
Element (Element const &src) | |
Copy constructor. More... | |
Element & | operator= (Element const &) |
void | setStatus (TTree &, utils::BranchList const &blist) final |
Set status of branches to true (matching branch) or false (vetoed branch) More... | |
utils::BranchList | getStatus (TTree &) const final |
Get status of branches in the tree. | |
utils::BranchList | getBranchNames (Bool_t fullName=kTRUE, Bool_t=kFALSE) const final |
Get the full list of branch names. More... | |
UInt_t | setAddress (TTree &, utils::BranchList const &blist={"*"}, Bool_t setStatus=kTRUE) final |
Bind the tree branches to the elements of this object. More... | |
void | book (TTree &, utils::BranchList const &blist={"*"}) final |
Book new branches bound to this object on the tree. More... | |
Int_t | getEntry (TTree &tree, Long64_t entry, Bool_t localEntry=kFALSE) final |
Read an entry from an input tree. More... | |
Int_t | getEntry (UInt_t treeId, Long64_t entry, Bool_t localEntry=kFALSE) final |
Read an entry from an input tree. More... | |
void | init () final |
Reset the object state. | |
char const * | getName () const final |
Name of this object. | |
void | setName (char const *) final |
Set object name. | |
![]() | |
Object (Object const &) | |
Object & | operator= (Object const &) |
virtual Int_t | fill (TTree &tree) |
Fill a tree. More... | |
virtual void | print (std::ostream &out=std::cout, UInt_t level=1) const |
Print the object content. | |
virtual void | dump (std::ostream &=std::cout) const |
Dump the object content. | |
Static Public Member Functions | |
static char const * | typeName () |
Protected Member Functions | |
Element (ArrayBase *) | |
Ctor for singlet instantiation. More... | |
virtual void | doBook_ (TTree &, TString const &, utils::BranchList const &)=0 |
virtual void | doInit_ ()=0 |
Static Protected Attributes | |
static StoreManager | gStore |
Base class for elements of containers.
Element is the base class of objects that are elements of containers (Array = fixed size and Collection = dynamic size). All deriving class of Element must have a member class named datastore (which derives from Element::datastore) where arrays of plain-old-data types and vectors of objects are held. This big chunk of memory is in turn owned by a Container, which also holds an array of Elements. Individual "data members" of a Element-derived class are references to the elements of their associated datastore, linked by the Container. By construction, the standard usage of the Element object is therefore to define a container first and to fetch from it as an element. However, it is also possible to use a Element class as a singlet. This operation is rather expensive as every singlet instantiation of a Element will create a one-element Array in memory in the back end.
Note on destructors: The actual destructor of the is called only if the Element is instantiated as a singlet. In the Container environment, the memory allocated for this object is directly deallocated without calling ~(Object). If subclasses need to make some calls at the destruction time of the object, they must be implemented in the destructor() function.
|
inline |
Copy constructor.
Copy construction is similar to default construction, and involves a creation of a one-element Array.
|
protected |
Ctor for singlet instantiation.
When a derived class is instantiated as a singlet, the object must create a new one-element Array and set its references to the element of the array. This array is controlled by a global StoreManager instance.
|
finalvirtual |
Book new branches bound to this object on the tree.
tree | |
blist | List of branches to book. Vetoed or unmentioned branches are not booked. |
Reimplemented from panda::Object.
|
finalvirtual |
Get the full list of branch names.
fullName | If true, prepend "(object name)." |
direct | If true, return only direct branches of this object (relevant only for TreeEntry) |
Reimplemented from panda::Object.
|
finalvirtual |
Read an entry from an input tree.
tree | Tree to get the entry from. |
entry | Entry number in the input tree. |
localEntry | If true, entry must be the local entry number of the current tree (i.e. return value of LoadTree) |
If localEntry is false, calls tree.LoadEntry(entry).
Reimplemented from panda::Object.
|
finalvirtual |
Read an entry from an input tree.
treeId | Index of the tree in the inputBranches_ vector. |
entry | Entry number in the input tree. |
localEntry | If true, entry must be the local entry number of the current tree (i.e. return value of LoadTree) |
If localEntry is false, calls tree.LoadEntry(entry).
Reimplemented from panda::Object.
|
finalvirtual |
Bind the tree branches to the elements of this object.
tree | |
blist | List of branches to bind. Vetoed or unmentioned branches are not bound. |
setStatus | If true, set the status of the branch to true before binding. |
Reimplemented from panda::Object.
|
finalvirtual |
Set status of branches to true (matching branch) or false (vetoed branch)
Sets the status of the branch to true (branch is in the list) or false (branch is vetoed in the list). Branches not mentioned in the branch list are untouched.
tree | |
blist | List of branches. The status of a branch is set to true (false) if BranchName::in(blist) (BranchName::vetoed(blist)) evaluates to true for the branch. |
Reimplemented from panda::Object.