CMS 3D CMS Logo

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 }
bool filter(edm::Event &e, edm::EventSetup const &iSetup) override
Definition: ptHatFilter.cc:34
T getParameter(std::string const &) const
ptHatFilter(const edm::ParameterSet &)
Definition: ptHatFilter.cc:17
~ptHatFilter() override
Definition: ptHatFilter.cc:30
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
fixed size matrix
HLT enums.
void beginJob() override
Definition: ptHatFilter.cc:23
void endJob() override
Definition: ptHatFilter.cc:50