PandaTree
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
panda::Element Class Referenceabstract

Base class for elements of containers. More...

#include <Element.h>

Inheritance diagram for panda::Element:
panda::Object panda::PackedTrack panda::Particle panda::Proton panda::SuperCluster panda::TPPair panda::Vertex panda::GenParticleBase panda::PackedParticle panda::ParticleM panda::ParticleP panda::PFCandBase panda::RecoVertex panda::GenParticle panda::UnpackedGenParticle panda::HLTObject panda::GenJet panda::MicroJet panda::Parton panda::SecondaryVertex panda::Tau panda::Lepton panda::Photon panda::PFCand panda::UnpackedPFCand

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...
 
Elementoperator= (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.
 
- Public Member Functions inherited from panda::Object
 Object (Object const &)
 
Objectoperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

§ Element() [1/2]

panda::Element::Element ( Element const &  src)
inline

Copy constructor.

Copy construction is similar to default construction, and involves a creation of a one-element Array.

§ Element() [2/2]

panda::Element::Element ( ArrayBase _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.

Member Function Documentation

§ book()

void panda::Element::book ( TTree &  tree,
utils::BranchList const &  = {"*"} 
)
finalvirtual

Book new branches bound to this object on the tree.

Parameters
tree
blistList of branches to book. Vetoed or unmentioned branches are not booked.

Reimplemented from panda::Object.

§ getBranchNames()

panda::utils::BranchList panda::Element::getBranchNames ( Bool_t  fullName = kTRUE,
Bool_t  direct = kFALSE 
) const
finalvirtual

Get the full list of branch names.

Parameters
fullNameIf true, prepend "(object name)."
directIf true, return only direct branches of this object (relevant only for TreeEntry)

Reimplemented from panda::Object.

§ getEntry() [1/2]

Int_t panda::Element::getEntry ( TTree &  tree,
Long64_t  entry,
Bool_t  localEntry = kFALSE 
)
finalvirtual

Read an entry from an input tree.

Parameters
treeTree to get the entry from.
entryEntry number in the input tree.
localEntryIf 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).

Returns
Number of bytes read.

Reimplemented from panda::Object.

§ getEntry() [2/2]

Int_t panda::Element::getEntry ( UInt_t  treeId,
Long64_t  entry,
Bool_t  localEntry = kFALSE 
)
finalvirtual

Read an entry from an input tree.

Parameters
treeIdIndex of the tree in the inputBranches_ vector.
entryEntry number in the input tree.
localEntryIf 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).

Returns
Number of bytes read.

Reimplemented from panda::Object.

§ setAddress()

UInt_t panda::Element::setAddress ( TTree &  tree,
utils::BranchList const &  = {"*"},
Bool_t  setStatus = kTRUE 
)
finalvirtual

Bind the tree branches to the elements of this object.

Parameters
tree
blistList of branches to bind. Vetoed or unmentioned branches are not bound.
setStatusIf true, set the status of the branch to true before binding.
Returns
Index of the bound tree in the inputBranches_ vector.

Reimplemented from panda::Object.

§ setStatus()

void panda::Element::setStatus ( TTree &  tree,
utils::BranchList const &   
)
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.

Parameters
tree
blistList 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.


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