CMS 3D CMS Logo

HLTEventNumberFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTEventNumberFilter
4 // Class: HLTEventNumberFilter
5 //
13 //
14 // Original Author: Martin Grunewald
15 // Created: Tue Jan 22 13:55:00 CET 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <string>
22 #include <iostream>
23 #include <memory>
24 
25 // user include files
26 #include "HLTEventNumberFilter.h"
29 
30 //
31 // constructors and destructor
32 //
34 {
35  //now do what ever initialization is needed
36 
37  period_ = iConfig.getParameter<unsigned int>("period") ;
38  invert_ = iConfig.getParameter<bool>("invert") ;
39 }
40 
41 
43 {
44 
45  // do anything here that needs to be done at desctruction time
46  // (e.g. close files, deallocate resources etc.)
47 
48 }
49 
50 void
53  desc.add<int>("period",4096);
54  desc.add<bool>("invert",true);
55  descriptions.add("hltEventNumberFilter",desc);
56 }
57 
58 //
59 // member functions
60 //
61 
62 // ------------ method called on each new Event ------------
63 bool
65 {
66  using namespace edm;
67 
68  if (iEvent.isRealData()) {
69  bool accept(false);
70  if (period_!=0) accept = ( ( (iEvent.id().event())%period_ ) == 0 );
71  if (invert_) accept = !accept;
72  return accept;
73  } else {
74  return true;
75  }
76 
77 }
78 
79 // declare this class as a framework plugin
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
bool isRealData() const
Definition: EventBase.h:62
bool filter(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool invert_
if invert_=true, invert that event accept decision
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLTEventNumberFilter(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
unsigned int period_
accept the event if its event number is a multiple of period_