CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SelectZmumuevents.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SelectZmumuevents
4 // Class: SelectZmumuevents
5 //
13 //
14 // Original Author: Tomasz Maciej Frueboes
15 // Created: Fri Dec 18 14:29:14 CET 2009
16 // $Id: SelectZmumuevents.cc,v 1.1 2010/03/17 16:14:10 fruboes Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
32 
35 //
36 // class declaration
37 //
38 
40  public:
41  explicit SelectZmumuevents(const edm::ParameterSet&);
43 
44  private:
45  virtual void beginJob() ;
46  virtual bool filter(edm::Event&, const edm::EventSetup&);
47  virtual void endJob() ;
48 
49  // ----------member data ---------------------------
50  double _etaMax;
51  double _ptMin;
53 };
54 
55 //
56 // constants, enums and typedefs
57 //
58 
59 //
60 // static data member definitions
61 //
62 
63 //
64 // constructors and destructor
65 //
67  : _etaMax(iConfig.getUntrackedParameter<double>("etaMax")),
68  _ptMin(iConfig.getUntrackedParameter<double>("ptMin")),
69  _pfColl(iConfig.getUntrackedParameter<edm::InputTag>("pfCol"))
70 {
71 
72 }
73 
74 
76 {
77 
78  // do anything here that needs to be done at desctruction time
79  // (e.g. close files, deallocate resources etc.)
80 }
81 
82 
83 //
84 // member functions
85 //
86 
87 // ------------ method called on each new Event ------------
88 bool
90 {
91  using namespace edm;
93  iEvent.getByLabel(_pfColl, genParts);
94 
95  int cnt = 0;
96  for( edm::View<reco::Candidate>::const_iterator it = genParts->begin(); it != genParts->end(); it++ )
97  {
98  if (std::abs(it->pdgId()) == 13
99  && std::abs(it->eta()) < _etaMax
100  && it->pt() > _ptMin )
101  {
102  ++cnt;
103  }
104  }
105 
106  return cnt>1;
107 }
108 
109 // ------------ method called once each job just before starting event loop ------------
110 void
112 {
113 }
114 
115 // ------------ method called once each job just after ending the event loop ------------
116 void
118 }
119 
120 //define this as a plug-in
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
#define abs(x)
Definition: mlp_lapack.h:159
virtual bool filter(edm::Event &, const edm::EventSetup &)
virtual void endJob()
SelectZmumuevents(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:243
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag _pfColl
virtual void beginJob()