CMS 3D CMS Logo

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 59 of file EventSelectors.h.

Member Typedef Documentation

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

Definition at line 86 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 61 of file EventSelectors.h.

62  :
66  {
67  scanner->setCut(cut);
69  }
static PFTauRenderPlugin instance
void setIgnoreExceptions(bool ignoreThem)
helper::ScannerBase * scanner
static edm::TypeWithDict elementType(const edm::TypeWithDict &wrapperType)
Perform the type deduction form edm::Wrapper<C> 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:37
template<typename Collection>
fwlite::ObjectCountSelector< Collection >::~ObjectCountSelector ( )
inline

Definition at line 70 of file EventSelectors.h.

70 { 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 71 of file EventSelectors.h.

References fwlite::Handle< T >::getByLabel(), cmsBatch::handle, gen::n, and create_public_pileup_plots::vals.

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

71  {
72  int nfound = 0;
73  HandleT handle; // here, not as a datamember, otherwise CINT segfaults (!?)
74  handle.getByLabel(ev, label_.c_str(), instance_.c_str(), process_.c_str());
75  const Collection & vals = *handle;
76  for (size_t j = 0, n = vals.size(); j < n; ++j) {
77  if (scanner->test(&vals[j])) nfound++;
78  }
79  return (nfound >= min_ && (max_ == -1 || nfound <= max_));
80  }
helper::ScannerBase * scanner
fwlite::Handle< Collection > HandleT
bool test(const void *obj, size_t icut=0) const
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 81 of file EventSelectors.h.

81 { 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 84 of file EventSelectors.h.

84 { scanner->setIgnoreExceptions(ignoreThem); }
void setIgnoreExceptions(bool ignoreThem)
helper::ScannerBase * scanner
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setMax ( int  maxNumber)
inline
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 87 of file EventSelectors.h.

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

Definition at line 88 of file EventSelectors.h.

template<typename Collection>
int fwlite::ObjectCountSelector< Collection >::min_
protected

Definition at line 88 of file EventSelectors.h.

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

Definition at line 87 of file EventSelectors.h.

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

Definition at line 89 of file EventSelectors.h.