Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

cafe::EventBase Class Reference
[CAF Environment (Cafe)]

CAF tree independent part of Event. More...

#include <EventBase.hpp>

Inheritance diagram for cafe::EventBase:

cafe::Event List of all members.

Public Member Functions

 EventBase ()
virtual ~EventBase ()
TTree * getTree () const
 Get current TTree.

int getCookie () const
 Get current cookie (== tree number).

 ClassDef (EventBase, 0)
Access to branches in the tree.
template<typename T> const T * get (const std::string &branchName, const Variables &vars=cafe::detail::empty) const
 Return a pointer to the object corresponding to branch 'branchName'.

template<typename T> Collection< T > getCollection (const std::string &branchName, const Variables &vars=cafe::detail::empty) const
 Return a Collection<T> corresponding to the TClonesArray in 'branchName'.

const TClonesArray * getClonesArray (const std::string &branchName, const Variables &vars=cafe::detail::empty) const
 Return the TClonesArray for the given branch.

bool readBranch (const std::string &branchName)
 Read this branch if not already in memory.

void setBranchAddresses (TTree *tree)
 Called when the tree changes.

bool setPartialRead (bool allow)
 Allow/Disallow partial reading of objects.

bool getPartialRead () const
 Get partial read flag.

Access to intermediate values stored in Event.
template<typename T> void put (const std::string &key, const T &value)
 Store arbitrary value with key.

void clear (const std::string &key)
template<typename T> bool get (const std::string &key, T &value) const
 Retrieve arbitrary value with key.

void clear ()
 Clear any values kept in the event store.

Tagging
void tag (const std::string &name)
 Tag the event with 'name'.

template<typename ITER> void tag (ITER from, ITER to)
 Tag the events with all tags in the list 'C' can be any STL container.

bool hasTag (const std::string &name) const
 Check if event is tagged with 'name'.

bool hasTag (const char *name) const
 Check if event is tagged with 'name'.

template<typename C> bool hasTag (const C &c) const
 Check if event has any of the tags in the list 'C' can be any STL container.

void untag (const std::string &name)
 Remove tag with 'name'.

template<typename ITER> void untag (ITER from, ITER to)
 Remove all of the tags in the list 'C' can be any STL container.


Private Types

typedef std::map< std::string,
BaseHolder * > 
Map
typedef std::map< std::string,
BranchHolderBase * > 
BranchMap

Private Attributes

Map _map
TTree * _tree
BranchMap _branches
std::set< std::string > _tags
int _cookie
bool _partial_read

Detailed Description

CAF tree independent part of Event.

This class provides three generic services:

  1. Access to an arbitrary branch in the associated TTree
  2. Access to an intermediate store for arbitrary values
  3. Tagging of events.

Definition at line 34 of file EventBase.hpp.


Member Typedef Documentation

typedef std::map<std::string,BranchHolderBase*> cafe::EventBase::BranchMap [private]
 

Definition at line 198 of file EventBase.hpp.

typedef std::map<std::string, BaseHolder*> cafe::EventBase::Map [private]
 

Definition at line 182 of file EventBase.hpp.


Constructor & Destructor Documentation

cafe::EventBase::EventBase  ) 
 

Definition at line 15 of file EventBase.cpp.

cafe::EventBase::~EventBase  )  [virtual]
 

Definition at line 22 of file EventBase.cpp.


Member Function Documentation

cafe::EventBase::ClassDef EventBase  ,
 

Reimplemented in cafe::Event.

void cafe::EventBase::clear  ) 
 

Clear any values kept in the event store.

Definition at line 64 of file EventBase.cpp.

References _map, _tags, cafe::Stat::eventEnd(), and STAT.

void cafe::EventBase::clear const std::string &  key  )  [inline]
 

Definition at line 345 of file EventBase.hpp.

References _map.

Referenced by cafe::EventMultiSplitter::processPermutation(), and cafe::RunController::processTree().

template<typename T>
bool cafe::EventBase::get const std::string &  key,
T &  value
const
 

Retrieve arbitrary value with key.

Definition at line 354 of file EventBase.hpp.

References _map, and cafe::EventBase::Holder< T >::value().

template<typename T>
const T * cafe::EventBase::get const std::string &  branchName,
const Variables vars = cafe::detail::empty
const
 

Return a pointer to the object corresponding to branch 'branchName'.

If the branch does not exist, return 0.

Definition at line 257 of file EventBase.hpp.

References _branches, _cookie, _partial_read, _tree, cafe::EventBase::BranchHolder< T >::getObject(), and cafe::EventBase::BranchHolder< T >::setBranchAddress().

Referenced by caf_util::VertexSelector::processEvent(), caf_util::TopologicalSelector::processEvent(), caf_util::TauSelector::processEvent(), cafe::StatGWeight::processEvent(), cafe::Stat::processEvent(), cafe::SelectObjects::processEvent(), caf_util::ResSelector::processEvent(), caf_util::ReComputeMET::processEvent(), caf_util::METSelector::processEvent(), caf_util::JetSelector::processEvent(), cafe::Hist3D::processEvent(), cafe::Hist2D::processEvent(), cafe::Hist1D::processEvent(), caf_util::EventQuality::processEvent(), caf_util::ElectronSelector::processEvent(), and caf_util::BTagJetSelector::processEvent().

const TClonesArray * cafe::EventBase::getClonesArray const std::string &  branchName,
const Variables vars = cafe::detail::empty
const
 

Return the TClonesArray for the given branch.

Definition at line 107 of file EventBase.cpp.

References _branches, _cookie, _partial_read, _tree, cafe::EventBase::BranchHolder< T >::getObject(), and cafe::EventBase::BranchHolder< T >::setBranchAddress().

Referenced by caf_util::ResSelector::processEvent(), and cafe::Hist1D::processEvent().

template<typename T>
Collection< T > cafe::EventBase::getCollection const std::string &  branchName,
const Variables vars = cafe::detail::empty
const
 

Return a Collection<T> corresponding to the TClonesArray in 'branchName'.

If the branch does not exist, return an empty Collection<T>.

Definition at line 269 of file EventBase.hpp.

References _branches, _cookie, _partial_read, _tree, cafe::EventBase::BranchHolder< T >::getObject(), and cafe::EventBase::BranchHolder< T >::setBranchAddress().

Referenced by caf_util::EMJetMatching::after(), caf_util::ApplyJES::after(), caf_util::TRefFinder::FindTrack(), caf_util::TRefFinder::FindVertex(), caf_util::TopologicalSelector::processEvent(), cafe::SelectUserObjects< T >::processEvent(), caf_util::ReComputeMET::processEvent(), caf_util::JetSelector::processEvent(), and caf_util::VertexSelector::selectObject().

int cafe::EventBase::getCookie  )  const
 

Get current cookie (== tree number).

Definition at line 102 of file EventBase.cpp.

References _cookie.

Referenced by cafe::SelectBranches::SelectBranches().

bool cafe::EventBase::getPartialRead  )  const
 

Get partial read flag.

Definition at line 59 of file EventBase.cpp.

References _partial_read.

TTree * cafe::EventBase::getTree  )  const
 

Get current TTree.

Definition at line 97 of file EventBase.cpp.

References _tree.

Referenced by cafe::Write::processEvent(), cafe::SelectObjects::processEvent(), cafe::EventList::processEvent(), and cafe::SelectBranches::SelectBranches().

template<typename C>
bool cafe::EventBase::hasTag const C &  c  )  const
 

Check if event has any of the tags in the list 'C' can be any STL container.

Definition at line 372 of file EventBase.hpp.

References _tags.

bool cafe::EventBase::hasTag const char *  name  )  const
 

Check if event is tagged with 'name'.

Definition at line 87 of file EventBase.cpp.

References _tags.

bool cafe::EventBase::hasTag const std::string &  name  )  const
 

Check if event is tagged with 'name'.

Definition at line 82 of file EventBase.cpp.

References _tags.

Referenced by cafe::EventList::processEvent(), and cafe::StatSample::tagged().

template<typename T>
void cafe::EventBase::put const std::string &  key,
const T &  value
 

Store arbitrary value with key.

The value must be copy constructible and assignable. If you store primitive types, make sure to tell it exactly which type you mean, e.g.:

event.put("MyValue", (int )5); int x; event.get("MyValue", x);

If you store a pointer, the pointer will be deleted at the end of the current event processing.

If you want the pointer to be preserved, call the method like this:

SomePointer *ptr = ...; event.put("MyName", keep(ptr));

where 'keep' is defined in the 'cafe' namespace.

Note that the entry "MyName" in the Event is still cleared at the end of the current event processing.

Definition at line 340 of file EventBase.hpp.

References _map.

Referenced by caf_util::TopologicalSelector::processEvent(), cafe::Stat::processEvent(), caf_util::ResSelector::processEvent(), and caf_util::METSelector::processEvent().

bool cafe::EventBase::readBranch const std::string &  branchName  ) 
 

Read this branch if not already in memory.

Definition at line 39 of file EventBase.cpp.

References _branches, _tree, and cafe::EventBase::BranchHolderBase::readBranch().

Referenced by cafe::Write::processEvent().

void cafe::EventBase::setBranchAddresses TTree *  tree  ) 
 

Called when the tree changes.

Set addresses for reading Branches.

Definition at line 28 of file EventBase.cpp.

References _branches, _cookie, and _tree.

Referenced by cafe::Selector::Init(), and cafe::RunController::processTree().

bool cafe::EventBase::setPartialRead bool  allow  ) 
 

Allow/Disallow partial reading of objects.

Returns old value. Default is true.

Definition at line 52 of file EventBase.cpp.

References _partial_read.

Referenced by cafe::RunController::Run().

template<typename ITER>
void cafe::EventBase::tag ITER  from,
ITER  to
 

Tag the events with all tags in the list 'C' can be any STL container.

Definition at line 385 of file EventBase.hpp.

References tag().

void cafe::EventBase::tag const std::string &  name  ) 
 

Tag the event with 'name'.

Definition at line 77 of file EventBase.cpp.

References _tags.

Referenced by cafe::Stat::processEvent(), cafe::Select::processEvent(), caf_util::JetSelector::processEvent(), cafe::If::processEvent(), cafe::Fork::processEvent(), cafe::Controller::processEvent(), and tag().

template<typename ITER>
void cafe::EventBase::untag ITER  from,
ITER  to
 

Remove all of the tags in the list 'C' can be any STL container.

Definition at line 395 of file EventBase.hpp.

References untag().

void cafe::EventBase::untag const std::string &  name  ) 
 

Remove tag with 'name'.

Definition at line 92 of file EventBase.cpp.

References _tags.

Referenced by cafe::If::processEvent(), cafe::Fork::processEvent(), cafe::Controller::processEvent(), and untag().


Member Data Documentation

BranchMap cafe::EventBase::_branches [mutable, private]
 

Definition at line 217 of file EventBase.hpp.

Referenced by get(), getClonesArray(), getCollection(), readBranch(), and setBranchAddresses().

int cafe::EventBase::_cookie [private]
 

Definition at line 219 of file EventBase.hpp.

Referenced by get(), getClonesArray(), getCollection(), getCookie(), and setBranchAddresses().

Map cafe::EventBase::_map [private]
 

Definition at line 183 of file EventBase.hpp.

Referenced by clear(), get(), and put().

bool cafe::EventBase::_partial_read [private]
 

Definition at line 220 of file EventBase.hpp.

Referenced by get(), getClonesArray(), getCollection(), getPartialRead(), and setPartialRead().

std::set<std::string> cafe::EventBase::_tags [private]
 

Definition at line 218 of file EventBase.hpp.

Referenced by clear(), hasTag(), tag(), and untag().

TTree* cafe::EventBase::_tree [private]
 

Definition at line 216 of file EventBase.hpp.

Referenced by get(), getClonesArray(), getCollection(), getTree(), readBranch(), and setBranchAddresses().


The documentation for this class was generated from the following files:
Generated on Tue Mar 28 10:13:10 2006 for CAF by doxygen 1.3.4