CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
fwlite::ObjectCountSelector< Collection > Class Template Reference

#include <EventSelectors.h>

Inheritance diagram for fwlite::ObjectCountSelector< Collection >:
fwlite::EventSelector

Public Member Functions

virtual bool accept (const fwlite::EventBase &ev) const
 
 ObjectCountSelector (const char *label, const char *instance, const char *process, const char *cut, int minNumber=1, int maxNumber=-1)
 
void setCut (const char *cut)
 
void setIgnoreExceptions (bool ignoreThem=true)
 
void setMax (int maxNumber)
 
void setMin (int minNumber)
 
 ~ObjectCountSelector ()
 
- Public Member Functions inherited from fwlite::EventSelector
 EventSelector (const char *name="", const char *title="")
 
virtual ~EventSelector ()
 

Protected Types

typedef fwlite::Handle
< Collection > 
HandleT
 

Protected Member Functions

 ObjectCountSelector (const fwlite::ObjectCountSelector< Collection > &other)
 
ObjectCountSelectoroperator= (const fwlite::ObjectCountSelector< Collection > &other)
 

Protected Attributes

std::string instance_
 
std::string label_
 
int max_
 
int min_
 
std::string process_
 
helper::ScannerBasescanner
 

Detailed Description

template<typename Collection>
class fwlite::ObjectCountSelector< Collection >

Definition at line 57 of file EventSelectors.h.

Member Typedef Documentation

template<typename Collection>
typedef fwlite::Handle<Collection> fwlite::ObjectCountSelector< Collection >::HandleT
protected

Definition at line 84 of file EventSelectors.h.

Constructor & Destructor Documentation

template<typename Collection>
fwlite::ObjectCountSelector< Collection >::ObjectCountSelector ( const char *  label,
const char *  instance,
const char *  process,
const char *  cut,
int  minNumber = 1,
int  maxNumber = -1 
)
inline

Definition at line 59 of file EventSelectors.h.

References fwlite::ObjectCountSelector< Collection >::scanner, helper::ScannerBase::setCut(), and helper::ScannerBase::setIgnoreExceptions().

60  :
62  min_(minNumber), max_(maxNumber),
64  {
65  scanner->setCut(cut);
67  }
static PFTauRenderPlugin instance
void setIgnoreExceptions(bool ignoreThem)
helper::ScannerBase * scanner
static Reflex::Type elementType(const Reflex::Type &wrapperType)
Perform the type deduction form edm::Wrapper&lt;C&gt; to C::value_type and resolves typedefs.
bool setCut(const char *cut)
Set the default cut that is applied to the events.
static std::type_info const & typeInfo()
Definition: Wrapper.h:41
template<typename Collection>
fwlite::ObjectCountSelector< Collection >::~ObjectCountSelector ( )
inline

Definition at line 68 of file EventSelectors.h.

References fwlite::ObjectCountSelector< Collection >::scanner.

68 { delete scanner; }
helper::ScannerBase * scanner
template<typename Collection>
fwlite::ObjectCountSelector< Collection >::ObjectCountSelector ( const fwlite::ObjectCountSelector< Collection > &  other)
protected

Member Function Documentation

template<typename Collection>
virtual bool fwlite::ObjectCountSelector< Collection >::accept ( const fwlite::EventBase ev) const
inlinevirtual

Implements fwlite::EventSelector.

Definition at line 69 of file EventSelectors.h.

References fwlite::Handle< T >::getByLabel(), patZpeak::handle, fwlite::ObjectCountSelector< Collection >::instance_, j, fwlite::ObjectCountSelector< Collection >::label_, fwlite::ObjectCountSelector< Collection >::max_, fwlite::ObjectCountSelector< Collection >::min_, n, fwlite::ObjectCountSelector< Collection >::process_, fwlite::ObjectCountSelector< Collection >::scanner, helper::ScannerBase::test(), and create_public_pileup_plots::vals.

Referenced by Vispa.Gui.BoxContentDialog.BoxContentDialog::apply(), and Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::apply().

69  {
70  int nfound = 0;
71  HandleT handle; // here, not as a datamember, otherwise CINT segfaults (!?)
72  handle.getByLabel(ev, label_.c_str(), instance_.c_str(), process_.c_str());
73  const Collection & vals = *handle;
74  for (size_t j = 0, n = vals.size(); j < n; ++j) {
75  if (scanner->test(&vals[j])) nfound++;
76  }
77  return (nfound >= min_ && (max_ == -1 || nfound <= max_));
78  }
helper::ScannerBase * scanner
fwlite::Handle< Collection > HandleT
bool test(const void *obj, size_t icut=0) const
tuple handle
Definition: patZpeak.py:22
int j
Definition: DBlmapReader.cc:9
template<typename Collection>
ObjectCountSelector& fwlite::ObjectCountSelector< Collection >::operator= ( const fwlite::ObjectCountSelector< Collection > &  other)
protected
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setCut ( const char *  cut)
inline

Definition at line 79 of file EventSelectors.h.

References fwlite::ObjectCountSelector< Collection >::scanner, and helper::ScannerBase::setCut().

79 { scanner->setCut(cut); }
helper::ScannerBase * scanner
bool setCut(const char *cut)
Set the default cut that is applied to the events.
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setIgnoreExceptions ( bool  ignoreThem = true)
inline

Definition at line 82 of file EventSelectors.h.

References fwlite::ObjectCountSelector< Collection >::scanner, and helper::ScannerBase::setIgnoreExceptions().

82 { scanner->setIgnoreExceptions(ignoreThem); }
void setIgnoreExceptions(bool ignoreThem)
helper::ScannerBase * scanner
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setMax ( int  maxNumber)
inline

Definition at line 81 of file EventSelectors.h.

References fwlite::ObjectCountSelector< Collection >::max_.

81 { max_ = maxNumber; }
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setMin ( int  minNumber)
inline

Member Data Documentation

template<typename Collection>
std::string fwlite::ObjectCountSelector< Collection >::instance_
protected

Definition at line 85 of file EventSelectors.h.

Referenced by fwlite::ObjectCountSelector< Collection >::accept().

template<typename Collection>
std::string fwlite::ObjectCountSelector< Collection >::label_
protected
template<typename Collection>
int fwlite::ObjectCountSelector< Collection >::max_
protected
template<typename Collection>
int fwlite::ObjectCountSelector< Collection >::min_
protected
template<typename Collection>
std::string fwlite::ObjectCountSelector< Collection >::process_
protected

Definition at line 85 of file EventSelectors.h.

Referenced by fwlite::ObjectCountSelector< Collection >::accept().

template<typename Collection>
helper::ScannerBase* fwlite::ObjectCountSelector< Collection >::scanner
protected