CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunLumiSelector.h
Go to the documentation of this file.
1 #ifndef Analysis_AnalysisFilters_interface_RunLumiSelector_h
2 #define Analysis_AnalysisFilters_interface_RunLumiSelector_h
3 
6 
9 
10 #include <vector>
11 #include <string>
12 
13 // make a selector for this selection
15 public:
17 
18  RunLumiSelector( edm::ParameterSet const & params ) {
19 
20  push_back("RunLumi");
21 
22  if ( params.exists("lumisToProcess") ) {
23  lumis_ = params.getUntrackedParameter<std::vector<edm::LuminosityBlockRange> > ("lumisToProcess");
24  set("RunLumi" );
25  }
26  else {
27  lumis_.clear();
28  set("RunLumi", false);
29  }
30 
31  retInternal_ = getBitTemplate();
32  }
33 
34  bool operator() ( edm::EventBase const & ev, pat::strbitset & ret ) {
35 
36  if ( !ignoreCut("RunLumi") ) {
37  bool goodLumi = false;
38  for ( std::vector<edm::LuminosityBlockRange>::const_iterator lumisBegin = lumis_.begin(),
39  lumisEnd = lumis_.end(), ilumi = lumisBegin;
40  ilumi != lumisEnd; ++ilumi ) {
41  if ( ev.id().run() >= ilumi->startRun() && ev.id().run() <= ilumi->endRun() &&
42  ev.id().luminosityBlock() >= ilumi->startLumi() && ev.id().luminosityBlock() <= ilumi->endLumi() ) {
43  goodLumi = true;
44  break;
45  }
46  }
47  if ( goodLumi ) passCut(ret, "RunLumi" );
48  } else {
49  passCut(ret, "RunLumi");
50  }
51 
52  setIgnored(ret);
53  return (bool)ret;
54  }
55 
57 
58 private:
59 
60  std::vector<edm::LuminosityBlockRange> lumis_;
61 
62 };
63 
64 #endif
RunNumber_t run() const
Definition: EventID.h:42
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::LuminosityBlockRange > lumis_
bool operator()(edm::EventBase const &ev, pat::strbitset &ret)
bool exists(std::string const &parameterName) const
checks if a parameter exists
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
RunLumiSelector(edm::ParameterSet const &params)
A selector of events.
Definition: EventSelector.h:15
edm::EventID id() const
Definition: EventBase.h:56