CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HLTCountNumberOfObject< OColl > Class Template Reference

#include <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 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.

                                                                  :
    src_(iConfig.getParameter<edm::InputTag>("src")),
    minN_(iConfig.getParameter<int>("MinN")),
    maxN_(iConfig.getParameter<int>("MaxN"))
      {
        produces<trigger::TriggerFilterObjectWithRefs>();
      };
template<class OColl >
HLTCountNumberOfObject< OColl >::~HLTCountNumberOfObject ( ) [inline]

Definition at line 36 of file HLTCountNumberOfObject.h.

{};

Member Function Documentation

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

Reimplemented from edm::EDFilter.

Definition at line 55 of file HLTCountNumberOfObject.h.

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

Implements HLTFilter.

Definition at line 39 of file HLTCountNumberOfObject.h.

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

  {
    // The filtered object. which is put empty.
    std::auto_ptr<trigger::TriggerFilterObjectWithRefs> filterproduct (new trigger::TriggerFilterObjectWithRefs(path(),module()));

    edm::Handle<OColl> oHandle;
    iEvent.getByLabel(src_, oHandle);
    int s=oHandle->size();
    bool answer=true;
    if (minN_!=-1) answer = answer && (s>=minN_);
    if (maxN_!=-1) answer = answer && (s<=maxN_);
    LogDebug("HLTCountNumberOfObject")<<module()<<" sees: "<<s<<" objects. Filtere answer is: "<<(answer?"true":"false");

    iEvent.put(filterproduct);
    return answer;
  }

Member Data Documentation

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

Definition at line 58 of file HLTCountNumberOfObject.h.

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

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

Definition at line 58 of file HLTCountNumberOfObject.h.

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

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

Definition at line 55 of file HLTCountNumberOfObject.h.

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