#include <EventSelectors.h>
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 () | |
Protected Types | |
typedef fwlite::Handle < Collection > | HandleT |
Protected Member Functions | |
ObjectCountSelector (const fwlite::ObjectCountSelector< Collection > &other) | |
ObjectCountSelector & | operator= (const fwlite::ObjectCountSelector< Collection > &other) |
Protected Attributes | |
std::string | instance_ |
std::string | label_ |
int | max_ |
int | min_ |
std::string | process_ |
helper::ScannerBase * | scanner |
Definition at line 57 of file EventSelectors.h.
typedef fwlite::Handle<Collection> fwlite::ObjectCountSelector< Collection >::HandleT [protected] |
Definition at line 84 of file EventSelectors.h.
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().
: label_(label), instance_(instance), min_(minNumber), max_(maxNumber), scanner(new helper::ScannerBase(helper::Parser::elementType(edm::TypeWithDict(HandleT::TempWrapT::typeInfo())))) { scanner->setCut(cut); scanner->setIgnoreExceptions(true); }
fwlite::ObjectCountSelector< Collection >::~ObjectCountSelector | ( | ) | [inline] |
Definition at line 68 of file EventSelectors.h.
References fwlite::ObjectCountSelector< Collection >::scanner.
{ delete scanner; }
fwlite::ObjectCountSelector< Collection >::ObjectCountSelector | ( | const fwlite::ObjectCountSelector< Collection > & | other | ) | [protected] |
virtual bool fwlite::ObjectCountSelector< Collection >::accept | ( | const fwlite::EventBase & | ev | ) | const [inline, virtual] |
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.
{ int nfound = 0; HandleT handle; // here, not as a datamember, otherwise CINT segfaults (!?) handle.getByLabel(ev, label_.c_str(), instance_.c_str(), process_.c_str()); const Collection & vals = *handle; for (size_t j = 0, n = vals.size(); j < n; ++j) { if (scanner->test(&vals[j])) nfound++; } return (nfound >= min_ && (max_ == -1 || nfound <= max_)); }
ObjectCountSelector& fwlite::ObjectCountSelector< Collection >::operator= | ( | const fwlite::ObjectCountSelector< Collection > & | other | ) | [protected] |
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().
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().
{ scanner->setIgnoreExceptions(ignoreThem); }
void fwlite::ObjectCountSelector< Collection >::setMax | ( | int | maxNumber | ) | [inline] |
Definition at line 81 of file EventSelectors.h.
References fwlite::ObjectCountSelector< Collection >::max_.
{ max_ = maxNumber; }
void fwlite::ObjectCountSelector< Collection >::setMin | ( | int | minNumber | ) | [inline] |
Definition at line 80 of file EventSelectors.h.
References fwlite::ObjectCountSelector< Collection >::min_, and CosmicsPD_Skims::minNumber.
std::string fwlite::ObjectCountSelector< Collection >::instance_ [protected] |
Definition at line 85 of file EventSelectors.h.
Referenced by fwlite::ObjectCountSelector< Collection >::accept().
std::string fwlite::ObjectCountSelector< Collection >::label_ [protected] |
Definition at line 85 of file EventSelectors.h.
Referenced by fwlite::ObjectCountSelector< Collection >::accept().
int fwlite::ObjectCountSelector< Collection >::max_ [protected] |
Definition at line 86 of file EventSelectors.h.
Referenced by fwlite::ObjectCountSelector< Collection >::accept(), and fwlite::ObjectCountSelector< Collection >::setMax().
int fwlite::ObjectCountSelector< Collection >::min_ [protected] |
Definition at line 86 of file EventSelectors.h.
Referenced by fwlite::ObjectCountSelector< Collection >::accept(), and fwlite::ObjectCountSelector< Collection >::setMin().
std::string fwlite::ObjectCountSelector< Collection >::process_ [protected] |
Definition at line 85 of file EventSelectors.h.
Referenced by fwlite::ObjectCountSelector< Collection >::accept().
helper::ScannerBase* fwlite::ObjectCountSelector< Collection >::scanner [protected] |
Definition at line 87 of file EventSelectors.h.
Referenced by fwlite::ObjectCountSelector< Collection >::accept(), fwlite::ObjectCountSelector< Collection >::ObjectCountSelector(), fwlite::ObjectCountSelector< Collection >::setCut(), fwlite::ObjectCountSelector< Collection >::setIgnoreExceptions(), and fwlite::ObjectCountSelector< Collection >::~ObjectCountSelector().