CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

NJetsMC Class Reference

#include <NJetsMC.cc>

Inheritance diagram for NJetsMC:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 NJetsMC (const edm::ParameterSet &)
 ~NJetsMC ()

Private Member Functions

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

Private Attributes

edm::InputTag GenHandle_
double minpt_
Int_t njets_

Detailed Description

Description: Filter for DPS MC generation.

Implementation: [Notes on implementation]

Definition at line 51 of file NJetsMC.cc.


Constructor & Destructor Documentation

NJetsMC::NJetsMC ( const edm::ParameterSet iConfig) [explicit]

Definition at line 70 of file NJetsMC.cc.

                                              :
  GenHandle_(iConfig.getUntrackedParameter<InputTag>("GenTag")),
  njets_(iConfig.getParameter<int32_t>("Njets")),
  minpt_(iConfig.getParameter<double>("MinPt"))
{
}
NJetsMC::~NJetsMC ( )

Definition at line 78 of file NJetsMC.cc.

{
}

Member Function Documentation

void NJetsMC::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 105 of file NJetsMC.cc.

{
}
void NJetsMC::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 109 of file NJetsMC.cc.

{
}
bool NJetsMC::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 82 of file NJetsMC.cc.

References prof2calltree::count, GenHandle_, jetmet_cfg::GenJets, edm::Event::getByLabel(), minpt_, njets_, reco::LeafCandidate::pt(), and query::result.

{
   using namespace edm;
   
   Handle<reco::GenJetCollection> GenJets;
   iEvent.getByLabel(GenHandle_, GenJets);

   Int_t count = 0;
   bool result = false;

   for(GenJetCollection::const_iterator iJet = GenJets->begin(); iJet != GenJets->end(); ++iJet)
     {
       reco::GenJet myJet = reco::GenJet(*iJet);

       if(myJet.pt() > minpt_) ++count;
     }

   if( count >= njets_ )
      result = true;

   return result;
}

Member Data Documentation

Definition at line 64 of file NJetsMC.cc.

Referenced by filter().

double NJetsMC::minpt_ [private]

Definition at line 66 of file NJetsMC.cc.

Referenced by filter().

Int_t NJetsMC::njets_ [private]

Definition at line 65 of file NJetsMC.cc.

Referenced by filter().