CMS 3D CMS Logo

HLTCountNumberOfObject< OColl > Class Template Reference

Description: templated EDFilter to count the number of object in a given collection, using View. More...

#include <HLTrigger/special/interface/HLTCountNumberOfObject.h>

Inheritance diagram for HLTCountNumberOfObject< OColl >:

HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 HLTCountNumberOfObject (const edm::ParameterSet &iConfig)
 ~HLTCountNumberOfObject ()

Private Member Functions

virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()
virtual bool filter (edm::Event &iEvent, const edm::EventSetup &)

Private Attributes

int maxN_
int minN_
edm::InputTag src_


Detailed Description

template<class OColl>
class HLTCountNumberOfObject< OColl >

Description: templated EDFilter to count the number of object in a given collection, using View.

Author:
Jean-Roch Vlimant

Definition at line 26 of file HLTCountNumberOfObject.h.


Constructor & Destructor Documentation

template<class OColl>
HLTCountNumberOfObject< OColl >::HLTCountNumberOfObject ( const edm::ParameterSet iConfig  )  [inline, explicit]

Definition at line 28 of file HLTCountNumberOfObject.h.

00028                                                                   :
00029     src_(iConfig.getParameter<edm::InputTag>("src")),
00030     minN_(iConfig.getParameter<int>("MinN")),
00031     maxN_(iConfig.getParameter<int>("MaxN"))
00032       {
00033         produces<trigger::TriggerFilterObjectWithRefs>();
00034       };
  

template<class OColl>
HLTCountNumberOfObject< OColl >::~HLTCountNumberOfObject (  )  [inline]

Definition at line 36 of file HLTCountNumberOfObject.h.

00036 {};


Member Function Documentation

template<class OColl>
virtual void HLTCountNumberOfObject< OColl >::beginJob ( const edm::EventSetup  )  [inline, private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 39 of file HLTCountNumberOfObject.h.

00039 {};

template<class OColl>
virtual void HLTCountNumberOfObject< OColl >::endJob ( void   )  [inline, private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 56 of file HLTCountNumberOfObject.h.

00056 {};

template<class OColl>
virtual bool HLTCountNumberOfObject< OColl >::filter ( edm::Event iEvent,
const edm::EventSetup  
) [inline, private, virtual]

Implements HLTFilter.

Definition at line 40 of file HLTCountNumberOfObject.h.

References edm::Event::getByLabel(), LogDebug, HLTCountNumberOfObject< OColl >::maxN_, HLTCountNumberOfObject< OColl >::minN_, module(), path(), edm::Event::put(), s, and HLTCountNumberOfObject< OColl >::src_.

00041   {
00042     // The filtered object. which is put empty.
00043     std::auto_ptr<trigger::TriggerFilterObjectWithRefs> filterproduct (new trigger::TriggerFilterObjectWithRefs(path(),module()));
00044 
00045     edm::Handle<OColl> oHandle;
00046     iEvent.getByLabel(src_, oHandle);
00047     int s=oHandle->size();
00048     bool answer=true;
00049     if (minN_!=-1) answer = answer && (s>=minN_);
00050     if (maxN_!=-1) answer = answer && (s<=maxN_);
00051     LogDebug("HLTCountNumberOfObject")<<module()<<" sees: "<<s<<" objects. Filtere answer is: "<<(answer?"true":"false");
00052 
00053     iEvent.put(filterproduct);
00054     return answer;
00055   }


Member Data Documentation

template<class OColl>
int HLTCountNumberOfObject< OColl >::maxN_ [private]

Definition at line 59 of file HLTCountNumberOfObject.h.

Referenced by HLTCountNumberOfObject< OColl >::filter().

template<class OColl>
int HLTCountNumberOfObject< OColl >::minN_ [private]

Definition at line 59 of file HLTCountNumberOfObject.h.

Referenced by HLTCountNumberOfObject< OColl >::filter().

template<class OColl>
edm::InputTag HLTCountNumberOfObject< OColl >::src_ [private]

Definition at line 56 of file HLTCountNumberOfObject.h.

Referenced by HLTCountNumberOfObject< OColl >::filter().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:24:26 2009 for CMSSW by  doxygen 1.5.4