CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

NJetsMCEta Class Reference

Inheritance diagram for NJetsMCEta:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

edm::InputTag GenHandle_
double maxeta_
double mineta_
double minpt_
Int_t njets_
vector< TLorentzVector * > * pjet

Detailed Description

Definition at line 61 of file NJetsMCEta.cc.


Constructor & Destructor Documentation

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

Definition at line 83 of file NJetsMCEta.cc.

                                                    :
  GenHandle_(iConfig.getUntrackedParameter<InputTag>("GenTag")),
  njets_(iConfig.getParameter<int32_t>("Njets")),
  minpt_(iConfig.getParameter<double>("MinPt")),
  maxeta_(iConfig.getParameter<double>("MaxEta")),
  mineta_(iConfig.getParameter<double>("MinEta"))
{
}
NJetsMCEta::~NJetsMCEta ( )

Definition at line 93 of file NJetsMCEta.cc.

{
}

Member Function Documentation

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

Reimplemented from edm::EDFilter.

Definition at line 133 of file NJetsMCEta.cc.

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

Reimplemented from edm::EDFilter.

Definition at line 137 of file NJetsMCEta.cc.

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

Implements edm::EDFilter.

Definition at line 97 of file NJetsMCEta.cc.

References abs, prof2calltree::count, reco::Candidate::energy(), reco::Candidate::eta(), GenHandle_, jetmet_cfg::GenJets, edm::Event::getByLabel(), metsig::jet, maxeta_, mineta_, minpt_, mysortPt, njets_, reco::Candidate::phi(), pjet, reco::Candidate::pt(), query::result, and python::multivaluedict::sort().

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

   Int_t count = 0;
   bool result = false;

 

   for(GenJetCollection::const_iterator iJet = GenJets->begin(); iJet != GenJets->end(); ++iJet)
     {
       const reco::Candidate* myJet = &(*iJet); 
       TLorentzVector *dummy = new TLorentzVector(0,0,0,0);
       dummy->SetPtEtaPhiE(myJet->pt(),myJet->eta(),myJet->energy(),myJet->phi());
       jet.push_back(dummy);
     }

   pjet = &jet ;

   sort (pjet->begin(), pjet->end(), mysortPt);
 
   if(pjet->size()>0 && pjet->at(0)->Pt() > minpt_ && abs(pjet->at(0)->Eta()) < maxeta_ && abs(pjet->at(0)->Eta()) > mineta_) ++count;
   if(pjet->size()>1 && pjet->at(1)->Pt() > minpt_ && abs(pjet->at(1)->Eta()) < maxeta_ && abs(pjet->at(1)->Eta()) > mineta_) ++count;


   if( count >= njets_ )
      result = true;

   return result;
}

Member Data Documentation

Definition at line 73 of file NJetsMCEta.cc.

Referenced by filter().

double NJetsMCEta::maxeta_ [private]

Definition at line 76 of file NJetsMCEta.cc.

Referenced by filter().

double NJetsMCEta::mineta_ [private]

Definition at line 77 of file NJetsMCEta.cc.

Referenced by filter().

double NJetsMCEta::minpt_ [private]

Definition at line 75 of file NJetsMCEta.cc.

Referenced by filter().

Int_t NJetsMCEta::njets_ [private]

Definition at line 74 of file NJetsMCEta.cc.

Referenced by filter().

vector<TLorentzVector*>* NJetsMCEta::pjet [private]

Definition at line 79 of file NJetsMCEta.cc.

Referenced by filter().