CMS 3D CMS Logo

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 TNamed

List of all members.

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)
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]
template<typename Collection>
fwlite::ObjectCountSelector< Collection >::~ObjectCountSelector ( ) [inline]

Definition at line 68 of file EventSelectors.h.

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

{ delete 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 [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, and helper::ScannerBase::test().

                                                                 {
                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_));
            }
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]
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setIgnoreExceptions ( bool  ignoreThem = true) [inline]
template<typename Collection>
void fwlite::ObjectCountSelector< Collection >::setMax ( int  maxNumber) [inline]

Definition at line 81 of file EventSelectors.h.

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

{ 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]

Definition at line 85 of file EventSelectors.h.

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

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]