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

bool accept (const fwlite::EventBase &ev) const override
 
 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 () override
 
- Public Member Functions inherited from fwlite::EventSelector
 EventSelector (const char *name="", const char *title="")
 
 ~EventSelector () override
 

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

Member Typedef Documentation

◆ HandleT

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

Definition at line 95 of file EventSelectors.h.

Constructor & Destructor Documentation

◆ ObjectCountSelector() [1/2]

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

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

68  : label_(label),
70  min_(minNumber),
71  max_(maxNumber),
72  scanner(
74  scanner->setCut(cut);
76  }
static PFTauRenderPlugin instance
void setIgnoreExceptions(bool ignoreThem)
helper::ScannerBase * scanner
char const * label
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:43

◆ ~ObjectCountSelector()

template<typename Collection>
fwlite::ObjectCountSelector< Collection >::~ObjectCountSelector ( )
inlineoverride

Definition at line 77 of file EventSelectors.h.

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

77 { delete scanner; }
helper::ScannerBase * scanner

◆ ObjectCountSelector() [2/2]

template<typename Collection>
fwlite::ObjectCountSelector< Collection >::ObjectCountSelector ( const fwlite::ObjectCountSelector< Collection > &  other)
protected

Member Function Documentation

◆ accept()

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

Implements fwlite::EventSelector.

Definition at line 78 of file EventSelectors.h.

References makeMEIFBenchmarkPlots::ev, patZpeak::handle, fwlite::ObjectCountSelector< Collection >::instance_, dqmiolumiharvest::j, fwlite::ObjectCountSelector< Collection >::label_, fwlite::ObjectCountSelector< Collection >::max_, fwlite::ObjectCountSelector< Collection >::min_, dqmiodumpmetadata::n, contentValuesCheck::nfound, fwlite::ObjectCountSelector< Collection >::process_, fwlite::ObjectCountSelector< Collection >::scanner, and helper::ScannerBase::test().

Referenced by esMonitoring.FDJsonServer::handle_accept().

78  {
79  int nfound = 0;
80  HandleT handle; // here, not as a datamember, otherwise CINT segfaults (!?)
81  handle.getByLabel(ev, label_.c_str(), instance_.c_str(), process_.c_str());
82  const Collection &vals = *handle;
83  for (size_t j = 0, n = vals.size(); j < n; ++j) {
84  if (scanner->test(&vals[j]))
85  nfound++;
86  }
87  return (nfound >= min_ && (max_ == -1 || nfound <= max_));
88  }
helper::ScannerBase * scanner
bool test(const void *obj, size_t icut=0) const
fwlite::Handle< Collection > HandleT

◆ operator=()

template<typename Collection>
ObjectCountSelector& fwlite::ObjectCountSelector< Collection >::operator= ( const fwlite::ObjectCountSelector< Collection > &  other)
protected

◆ setCut()

template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setCut ( const char *  cut)
inline

Definition at line 89 of file EventSelectors.h.

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

89 { scanner->setCut(cut); }
helper::ScannerBase * scanner
bool setCut(const char *cut)
Set the default cut that is applied to the events.

◆ setIgnoreExceptions()

template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setIgnoreExceptions ( bool  ignoreThem = true)
inline

Definition at line 92 of file EventSelectors.h.

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

92 { scanner->setIgnoreExceptions(ignoreThem); }
void setIgnoreExceptions(bool ignoreThem)
helper::ScannerBase * scanner

◆ setMax()

template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setMax ( int  maxNumber)
inline

◆ setMin()

template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setMin ( int  minNumber)
inline

Member Data Documentation

◆ instance_

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

Definition at line 96 of file EventSelectors.h.

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

◆ label_

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

◆ max_

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

◆ min_

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

◆ process_

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

Definition at line 96 of file EventSelectors.h.

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

◆ scanner

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