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

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

Select objects based on a user defined cut. More...

#include <SelectUserObjects.hpp>

Inheritance diagram for cafe::SelectUserObjects< T >:

cafe::Processor List of all members.

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.

 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.


Private Attributes

std::string _fromBranch
std::string _toBranch
std::string _toRejectedBranch
std::string _treeName
TTree * _tree
TClonesArray * _result
TClonesArray * _resultRejected
TBranch * _branch
TBranch * _branchRejected
Variables _vars

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 51 of file SelectUserObjects.hpp.


Constructor & Destructor Documentation

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

Definition at line 95 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_fromBranch, cafe::SelectUserObjects< T >::_toBranch, cafe::SelectUserObjects< T >::_toRejectedBranch, cafe::SelectUserObjects< T >::_treeName, cafe::SelectUserObjects< T >::_vars, 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 72 of file SelectUserObjects.hpp.

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

Called after the selection is done.

Reimplemented in caf_util::ApplyJES, caf_util::EMJetMatching, and caf_util::MuonSelector.

Definition at line 183 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.

Reimplemented in caf_util::BTagJetSelector, caf_util::ElectronSelector, caf_util::JetSelector, caf_util::MuonSelector, and caf_util::VertexSelector.

Definition at line 178 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 165 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 133 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.

Reimplemented in caf_util::ApplyJES, caf_util::BTagJetSelector, caf_util::ElectronSelector, caf_util::EMJetMatching, caf_util::JetSelector, caf_util::MuonSelector, caf_util::TauSelector, and caf_util::VertexSelector.

Definition at line 188 of file SelectUserObjects.hpp.

References cafe::SelectUserObjects< T >::_fromBranch, 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(), cafe::EventBase::getCollection(), 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

Implemented in caf_util::ApplyJES, caf_util::BTagJetSelector, caf_util::ElectronSelector, caf_util::EMJetMatching, caf_util::JetSelector, caf_util::MuonSelector, caf_util::TauSelector, and caf_util::VertexSelector.

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


Member Data Documentation

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

Definition at line 82 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 83 of file SelectUserObjects.hpp.

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

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

Definition at line 75 of file SelectUserObjects.hpp.

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

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

Definition at line 80 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 81 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 76 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 77 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 79 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 78 of file SelectUserObjects.hpp.

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

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

Reimplemented in caf_util::ApplyJES, caf_util::BTagJetSelector, caf_util::EMJetMatching, and caf_util::JetSelector.

Definition at line 84 of file SelectUserObjects.hpp.

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


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