PandaTree
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
panda::ReaderObject Class Reference

Base class for objects that can be linked to an input tree directly. More...

#include <ReaderObject.h>

Inheritance diagram for panda::ReaderObject:
panda::Object panda::ContainerBase panda::Singlet panda::TreeEntry panda::ArrayBase panda::CollectionBase panda::GenReweight panda::HLTBits panda::Met panda::MetFilters panda::Recoil panda::EventBase panda::Run

Public Member Functions

 ReaderObject (ReaderObject const &src)
 
ReaderObjectoperator= (ReaderObject const &)
 
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) override
 Read an entry from an input tree. More...
 
virtual void unlink (TTree &)
 Unlink from a tree.
 
void updateBranchArray (TTree &)
 
- Public Member Functions inherited from panda::Object
 Object (Object const &)
 
Objectoperator= (Object const &)
 
virtual void setStatus (TTree &tree, utils::BranchList const &)
 Set status of branches to true (matching branch) or false (vetoed branch) More...
 
virtual utils::BranchList getStatus (TTree &) const
 Get status of branches in the tree.
 
virtual utils::BranchList getBranchNames (Bool_t fullName=kTRUE, Bool_t direct=kFALSE) const
 Get the full list of branch names. More...
 
virtual UInt_t setAddress (TTree &tree, utils::BranchList const &={"*"}, Bool_t setStatus=kTRUE)
 Bind the tree branches to the elements of this object. More...
 
virtual void book (TTree &tree, utils::BranchList const &={"*"})
 Book new branches bound to this object on the tree. More...
 
virtual Int_t fill (TTree &tree)
 Fill a tree. More...
 
virtual void init ()
 Reset the object state.
 
virtual char const * getName () const
 Name of this object.
 
virtual void setName (char const *)
 Set object name.
 
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.
 

Protected Types

typedef std::vector< TBranch * > BranchArray
 
typedef std::pair< TTree *, BranchArray > BranchMapping
 List of branches linked with this object in the tree.
 

Protected Member Functions

UInt_t registerInput_ (TTree &)
 

Protected Attributes

std::vector< BranchMappinginputBranches_
 List of list of input branches. More...
 

Detailed Description

Base class for objects that can be linked to an input tree directly.

Member Function Documentation

§ getEntry() [1/2]

Int_t panda::ReaderObject::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::ReaderObject::getEntry ( UInt_t  treeId,
Long64_t  entry,
Bool_t  localEntry = kFALSE 
)
overridevirtual

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.

Reimplemented in panda::TreeEntry.

Member Data Documentation

§ inputBranches_

std::vector<BranchMapping> panda::ReaderObject::inputBranches_
protected

List of list of input branches.

With vector<BranchMapping> implementation, we will be serially searching for a tree whenever getEntry(tree, entry) is called. Alternative would be to use a map<TTree*, BranchArray> to make use of binary-tree lookup. However most of the time we will be dealing with one input tree, and at most a few input trees, that the map implementation actually won't make sense.


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