CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ptHatFilter.cc
Go to the documentation of this file.
1 // Name: ptHatFilter.cc
2 // Description: Filter events in a range of Monte Carlo ptHat.
3 // Author: R. Harris
4 // Date: 28 - October - 2008
11 #include <TFile.h>
12 #include <cmath>
13 using namespace edm;
14 using namespace reco;
15 using namespace std;
18 {
19  ptHatLowerCut = cfg.getParameter<double> ("ptHatLowerCut");
20  ptHatUpperCut = cfg.getParameter<double> ("ptHatUpperCut");
21 }
24 {
25  totalEvents=0;
26  acceptedEvents=0;
27 }
28 
31 }
32 
35 {
36 
37  bool result = false;
38  totalEvents++;
39  edm::Handle< double > genEventScale;
40  evt.getByLabel("genEventScale", genEventScale );
41  double pt_hat = *genEventScale;
42  if(pt_hat>ptHatLowerCut && pt_hat<ptHatUpperCut)
43  {
44  acceptedEvents++;
45  result = true;
46  }
47  return result;
48 }
51 {
52  std::cout << "Total Events = " << totalEvents << std::endl;
53  std::cout << "Accepted Events = " << acceptedEvents << std::endl;
54 }
T getParameter(std::string const &) const
virtual void beginJob()
Definition: ptHatFilter.cc:23
tuple cfg
Definition: looper.py:293
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ptHatFilter(const edm::ParameterSet &)
Definition: ptHatFilter.cc:17
virtual void endJob()
Definition: ptHatFilter.cc:50
tuple result
Definition: query.py:137
virtual ~ptHatFilter()
Definition: ptHatFilter.cc:30
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
virtual bool filter(edm::Event &e, edm::EventSetup const &iSetup)
Definition: ptHatFilter.cc:34
tuple cout
Definition: gather_cfg.py:121