cafe::SelectUserObjects< T > Class Template Reference
[CAF Environment (Cafe)]

#include <SelectUserObjects.hpp>

Inheritance diagram for cafe::SelectUserObjects< T >:

cafe::Processor List of all members.

Detailed Description

template<class T>
class cafe::SelectUserObjects< T >

Select objects based on a user defined cut.

The cut is supplied by the user by overriding the virtual selectObject(const T& obj) method.

To use this class, inherit from it, passing the desired object type to the base class:

class MySelector : public SelectUserObjects<TMBJet> {

Then override the selectObject(const TMBJet& obj) method. The user can also override two more methods (which do nothing by default):

void before(Collection<T>& from); void after(Collection<T>& accepted, Collection<T>& rejected);

Configuration options:

Definition at line 55 of file SelectUserObjects.hpp.

Public Member Functions

 SelectUserObjects (const char *name)
void inputFileOpened (TFile *file)
 Called for every new input file that was opened.

void inputFileClosing (TFile *file)
 Called for every input file that is about to be closed.

bool processEvent (cafe::Event &event)
 Called for every event.

const std::string & treeName () const
 ClassDef (SelectUserObjects, 0)

Protected Member Functions

virtual bool selectObject (const T &obj)=0
 Abstract select method to be overridden by user.

virtual void before (Collection< T > &from)
 Called before the actual selection starts.

virtual void after (Collection< T > &accepted, Collection< T > &rejected)
 Called after the selection is done.

void addVariable (const std::string &name)
 Add variables to branch for the partial read.


Protected Attributes

std::string _fromBranch
Event const * _event
Variables _vars

Private Attributes

std::string _toBranch
std::string _toRejectedBranch
std::string _treeName
bool _loadAll
TTree * _tree
TClonesArray * _result
TClonesArray * _resultRejected
TBranch * _branch
TBranch * _branchRejected


Constructor & Destructor Documentation

template<class T>
cafe::SelectUserObjects< T >::SelectUserObjects const char *  name  ) 
 

Definition at line 103 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_fromBranch, cafe::SelectUserObjects< T >::_loadAll, cafe::SelectUserObjects< T >::_toBranch, cafe::SelectUserObjects< T >::_toRejectedBranch, cafe::SelectUserObjects< T >::_treeName, cafe::SelectUserObjects< T >::_vars, cafe::Variables::add(), cafe::Config::get(), cafe::Config::getVString(), cafe::Processor::name(), and cafe::Processor::out().


Member Function Documentation

template<class T>
void cafe::SelectUserObjects< T >::addVariable const std::string &  name  )  [inline, protected]
 

Add variables to branch for the partial read.

Definition at line 77 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_vars, and cafe::Variables::add().

template<class T>
void cafe::SelectUserObjects< T >::after Collection< T > &  accepted,
Collection< T > &  rejected
[protected, virtual]
 

Called after the selection is done.

Definition at line 208 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::processEvent().

template<class T>
void cafe::SelectUserObjects< T >::before Collection< T > &  from  )  [protected, virtual]
 

Called before the actual selection starts.

E.g. the input can be sorted here.

Definition at line 203 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::processEvent().

template<class T>
cafe::SelectUserObjects< T >::ClassDef SelectUserObjects< T >  ,
 

template<class T>
void cafe::SelectUserObjects< T >::inputFileClosing TFile *  file  )  [virtual]
 

Called for every input file that is about to be closed.

Reimplemented from cafe::Processor.

Definition at line 190 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_branch, cafe::SelectUserObjects< T >::_branchRejected, cafe::SelectUserObjects< T >::_tree, and cafe::SelectUserObjects< T >::_treeName.

template<class T>
void cafe::SelectUserObjects< T >::inputFileOpened TFile *  file  )  [virtual]
 

Called for every new input file that was opened.

Reimplemented from cafe::Processor.

Definition at line 154 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_branch, cafe::SelectUserObjects< T >::_branchRejected, cafe::SelectUserObjects< T >::_fromBranch, cafe::SelectUserObjects< T >::_result, cafe::SelectUserObjects< T >::_resultRejected, cafe::SelectUserObjects< T >::_toBranch, cafe::SelectUserObjects< T >::_toRejectedBranch, cafe::SelectUserObjects< T >::_tree, cafe::SelectUserObjects< T >::_treeName, cafe::Processor::err(), cafe::Processor::fullName(), and cafe::Processor::name().

template<class T>
bool cafe::SelectUserObjects< T >::processEvent cafe::Event event  )  [virtual]
 

Called for every event.

Reimplemented from cafe::Processor.

Definition at line 213 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_event, cafe::SelectUserObjects< T >::_fromBranch, cafe::SelectUserObjects< T >::_loadAll, cafe::SelectUserObjects< T >::_result, cafe::SelectUserObjects< T >::_resultRejected, cafe::SelectUserObjects< T >::_vars, cafe::SelectUserObjects< T >::after(), cafe::SelectUserObjects< T >::before(), cafe::Collection< T >::begin(), cafe::Collection< T >::end(), and cafe::SelectUserObjects< T >::selectObject().

template<class T>
virtual bool cafe::SelectUserObjects< T >::selectObject const T &  obj  )  [protected, pure virtual]
 

Abstract select method to be overridden by user.

Each object for which this method returns true will be put into the result branch, rejected objected will be put in the rejected object branch

Referenced by cafe::SelectUserObjects< T >::processEvent().

template<class T>
const std::string& cafe::SelectUserObjects< T >::treeName  )  const [inline]
 

Definition at line 61 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_treeName.


Member Data Documentation

template<class T>
TBranch* cafe::SelectUserObjects< T >::_branch [private]
 

Definition at line 91 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileClosing(), and cafe::SelectUserObjects< T >::inputFileOpened().

template<class T>
TBranch* cafe::SelectUserObjects< T >::_branchRejected [private]
 

Definition at line 92 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileClosing(), and cafe::SelectUserObjects< T >::inputFileOpened().

template<class T>
Event const* cafe::SelectUserObjects< T >::_event [protected]
 

Definition at line 80 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::processEvent().

template<class T>
std::string cafe::SelectUserObjects< T >::_fromBranch [protected]
 

Definition at line 79 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileOpened(), cafe::SelectUserObjects< T >::processEvent(), and cafe::SelectUserObjects< T >::SelectUserObjects().

template<class T>
bool cafe::SelectUserObjects< T >::_loadAll [private]
 

Definition at line 87 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::processEvent(), and cafe::SelectUserObjects< T >::SelectUserObjects().

template<class T>
TClonesArray* cafe::SelectUserObjects< T >::_result [private]
 

Definition at line 89 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileOpened(), and cafe::SelectUserObjects< T >::processEvent().

template<class T>
TClonesArray* cafe::SelectUserObjects< T >::_resultRejected [private]
 

Definition at line 90 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileOpened(), and cafe::SelectUserObjects< T >::processEvent().

template<class T>
std::string cafe::SelectUserObjects< T >::_toBranch [private]
 

Definition at line 84 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileOpened(), and cafe::SelectUserObjects< T >::SelectUserObjects().

template<class T>
std::string cafe::SelectUserObjects< T >::_toRejectedBranch [private]
 

Definition at line 85 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileOpened(), and cafe::SelectUserObjects< T >::SelectUserObjects().

template<class T>
TTree* cafe::SelectUserObjects< T >::_tree [private]
 

Definition at line 88 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileClosing(), and cafe::SelectUserObjects< T >::inputFileOpened().

template<class T>
std::string cafe::SelectUserObjects< T >::_treeName [private]
 

Definition at line 86 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::inputFileClosing(), cafe::SelectUserObjects< T >::inputFileOpened(), cafe::SelectUserObjects< T >::SelectUserObjects(), and cafe::SelectUserObjects< T >::treeName().

template<class T>
Variables cafe::SelectUserObjects< T >::_vars [protected]
 

Definition at line 81 of file SelectUserObjects.hpp.

Referenced by cafe::SelectUserObjects< T >::addVariable(), cafe::SelectUserObjects< T >::processEvent(), and cafe::SelectUserObjects< T >::SelectUserObjects().


The documentation for this class was generated from the following file:
Generated on Thu Apr 3 04:14:28 2008 for CAF by doxygen 1.3.4