CMS 3D CMS Logo

StopAfterNEvents.cc
Go to the documentation of this file.
4 
6 public:
8  ~StopAfterNEvents() override = default;
9 
10 private:
11  bool filter(edm::Event&, edm::EventSetup const&) override;
12  const int nMax_;
13  int n_;
14  const bool verbose_;
15 };
16 
17 #include <iostream>
18 
19 using namespace std;
20 using namespace edm;
21 
23  : nMax_(pset.getParameter<int>("maxEvents")), n_(0), verbose_(pset.getUntrackedParameter<bool>("verbose", false)) {}
24 
26  if (n_ < 0)
27  return true;
28  n_++;
29  bool ret = n_ <= nMax_;
30  if (verbose_)
31  edm::LogInfo("StopAfterNEvents") << ">>> filtering event" << n_ << "/" << nMax_ << "(" << (ret ? "true" : "false")
32  << ")" << endl;
33  return ret;
34 }
35 
37 
StopAfterNEvents(const edm::ParameterSet &)
ret
prodAgent to be discontinued
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool filter(edm::Event &, edm::EventSetup const &) override
Log< level::Info, false > LogInfo
HLT enums.
~StopAfterNEvents() override=default