CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HLTTrackWithHits Class Reference

#include <HLTTrackWithHits.h>

Inheritance diagram for HLTTrackWithHits:
HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

int maxN_
int MinBPX_
int MinFPX_
int minN_
int MinPXL_
edm::InputTag src_

Detailed Description

Description: templated EDFilter to count the number of tracks with a given hit requirement

Author:
Jean-Roch Vlimant

Definition at line 27 of file HLTTrackWithHits.h.


Constructor & Destructor Documentation

HLTTrackWithHits::HLTTrackWithHits ( const edm::ParameterSet iConfig) [inline, explicit]

Definition at line 29 of file HLTTrackWithHits.h.

                                                            :
    src_(iConfig.getParameter<edm::InputTag>("src")),
    minN_(iConfig.getParameter<int>("MinN")),
    maxN_(iConfig.getParameter<int>("MaxN")),
    MinBPX_(iConfig.getParameter<int>("MinBPX")),
    MinFPX_(iConfig.getParameter<int>("MinFPX")),
    MinPXL_(iConfig.getParameter<int>("MinPXL"))
      {
        produces<trigger::TriggerFilterObjectWithRefs>();
      };
HLTTrackWithHits::~HLTTrackWithHits ( ) [inline]

Definition at line 40 of file HLTTrackWithHits.h.

{};

Member Function Documentation

virtual void HLTTrackWithHits::endJob ( void  ) [inline, private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 66 of file HLTTrackWithHits.h.

{};
virtual bool HLTTrackWithHits::filter ( edm::Event iEvent,
const edm::EventSetup  
) [inline, private, virtual]

Implements HLTFilter.

Definition at line 43 of file HLTTrackWithHits.h.

References submit::answer, prof2calltree::count, edm::Event::getByLabel(), reco::TrackBase::hitPattern(), i, LogDebug, maxN_, MinBPX_, MinFPX_, minN_, MinPXL_, module(), reco::HitPattern::numberOfValidPixelBarrelHits(), reco::HitPattern::numberOfValidPixelEndcapHits(), reco::HitPattern::numberOfValidPixelHits(), path(), edm::Event::put(), asciidump::s, and src_.

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

    edm::Handle<reco::TrackCollection> oHandle;
    iEvent.getByLabel(src_, oHandle);
    int s=oHandle->size();
    int count=0;
    for (int i=0;i!=s;++i){
      const reco::Track & track = (*oHandle)[i];
      const reco::HitPattern & hits = track.hitPattern();
      if ( MinBPX_>0 && hits.numberOfValidPixelBarrelHits() >= MinBPX_ ) count++; continue;
      if ( MinFPX_>0 && hits.numberOfValidPixelEndcapHits() >= MinFPX_ ) count++; continue;
      if ( MinPXL_>0 && hits.numberOfValidPixelHits() >= MinPXL_ ) count++; continue;
    }
      
    bool answer=(count>=minN_ && count<=maxN_);
    LogDebug("HLTTrackWithHits")<<module()<<" sees: "<<s<<" objects. Only: "<<count<<" satisfy the hit requirement. Filter answer is: "<<(answer?"true":"false")<<std::endl;

    iEvent.put(filterproduct);
    return answer;
  }

Member Data Documentation

int HLTTrackWithHits::maxN_ [private]

Definition at line 69 of file HLTTrackWithHits.h.

Referenced by filter().

Definition at line 69 of file HLTTrackWithHits.h.

Referenced by filter().

Definition at line 69 of file HLTTrackWithHits.h.

Referenced by filter().

int HLTTrackWithHits::minN_ [private]

Definition at line 69 of file HLTTrackWithHits.h.

Referenced by filter().

Definition at line 69 of file HLTTrackWithHits.h.

Referenced by filter().

Definition at line 66 of file HLTTrackWithHits.h.

Referenced by filter().