CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NJetsMC.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: NJetsMC
4 // Class: NJetsMC
5 //
13 //
14 // Original Author: "Nathaniel Odell"
15 // Created: Thu Aug 12 09:24:46 CDT 2010
16 // $Id: FourJetMC.cc,v 1.1 2011/03/10 17:02:32 rofierzy Exp $
17 // then moved to more general N-jets purpose in GeneratorInterface/GenFilters
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
29 
31 
34 
36 
37 #include "TROOT.h"
38 #include "TH1F.h"
39 #include "TFile.h"
40 #include "TSystem.h"
41 #include <iostream>
42 
43 using namespace edm;
44 using namespace std;
45 using namespace reco;
46 
47 //
48 // class declaration
49 //
50 
51 class NJetsMC : public edm::EDFilter
52 {
53 public:
54  explicit NJetsMC(const edm::ParameterSet&);
55  ~NJetsMC();
56 
57 private:
58  virtual void beginJob() ;
59  virtual bool filter(edm::Event&, const edm::EventSetup&);
60  virtual void endJob() ;
61 
62  // ----------member data ---------------------------
63 
65  Int_t njets_;
66  double minpt_;
67 
68 };
69 
71  GenHandle_(iConfig.getUntrackedParameter<InputTag>("GenTag")),
72  njets_(iConfig.getParameter<int32_t>("Njets")),
73  minpt_(iConfig.getParameter<double>("MinPt"))
74 {
75 }
76 
77 
79 {
80 }
81 
83 {
84  using namespace edm;
85 
87  iEvent.getByLabel(GenHandle_, GenJets);
88 
89  Int_t count = 0;
90  bool result = false;
91 
92  for(GenJetCollection::const_iterator iJet = GenJets->begin(); iJet != GenJets->end(); ++iJet)
93  {
94  reco::GenJet myJet = reco::GenJet(*iJet);
95 
96  if(myJet.pt() > minpt_) ++count;
97  }
98 
99  if( count >= njets_ )
100  result = true;
101 
102  return result;
103 }
104 
106 {
107 }
108 
110 {
111 }
112 
113 //define this as a plug-in
virtual void endJob()
Definition: NJetsMC.cc:109
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::InputTag GenHandle_
Definition: NJetsMC.cc:64
~NJetsMC()
Definition: NJetsMC.cc:78
void beginJob()
Definition: Breakpoints.cc:15
int iEvent
Definition: GenABIO.cc:243
tuple result
Definition: query.py:137
Jets made from MC generator particles.
Definition: GenJet.h:25
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
tuple GenJets
Definition: jetmet_cfg.py:40
virtual void beginJob()
Definition: NJetsMC.cc:105
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
virtual double pt() const
transverse momentum
double minpt_
Definition: NJetsMC.cc:66
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition: NJetsMC.cc:82
Int_t njets_
Definition: NJetsMC.cc:65
NJetsMC(const edm::ParameterSet &)
Definition: NJetsMC.cc:70