CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Prescaler.cc
Go to the documentation of this file.
1 
7 
8 namespace edm {
9  class Prescaler : public EDFilter {
10  public:
11  explicit Prescaler(ParameterSet const&);
12  virtual ~Prescaler();
13 
14  static void fillDescriptions(ConfigurationDescriptions& descriptions);
15  virtual bool filter(Event& e, EventSetup const& c);
16  void endJob();
17 
18  private:
19  int count_;
20  int n_; // accept one in n
21  int offset_; // with offset, ie. sequence of events does not have to start at first event
22  };
23 
25  count_(),
26  n_(ps.getParameter<int>("prescaleFactor")),
27  offset_(ps.getParameter<int>("prescaleOffset")) {
28  }
29 
31  }
32 
34  ++count_;
35  return count_ % n_ == offset_ ? true : false;
36  }
37 
39  }
40 
41  void
44  desc.add<int>("prescaleFactor")->setComment("Accept one event every N events");
45  desc.add<int>("prescaleOffset")->setComment("The first event to accept should be the Mth one. Choose 'prescaleFactor'=1 to accept the first event from the source.");
46  descriptions.add("preScaler", desc);
47  }
48 }
49 
50 using edm::Prescaler;
Prescaler(ParameterSet const &)
Definition: Prescaler.cc:24
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: Prescaler.cc:42
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual ~Prescaler()
Definition: Prescaler.cc:30
void endJob()
Definition: Prescaler.cc:38
virtual bool filter(Event &e, EventSetup const &c)
Definition: Prescaler.cc:33
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)