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 
4 #ifndef __GCCXML__
6 #endif
9 
12 
13 #include <vector>
14 #include <string>
15 
16 // make a selector for this selection
18 public:
20 
21 #ifndef __GCCXML__
23  RunLumiSelector( params )
24  {}
25 #endif
26 
27  RunLumiSelector( edm::ParameterSet const & params ) {
28 
29  push_back("RunLumi");
30 
31  if ( params.exists("lumisToProcess") ) {
32  lumis_ = params.getUntrackedParameter<std::vector<edm::LuminosityBlockRange> > ("lumisToProcess");
33  set("RunLumi" );
34  }
35  else {
36  lumis_.clear();
37  set("RunLumi", false);
38  }
39 
40  retInternal_ = getBitTemplate();
41  }
42 
44 
45  if ( !ignoreCut("RunLumi") ) {
46  bool goodLumi = false;
47  for ( std::vector<edm::LuminosityBlockRange>::const_iterator lumisBegin = lumis_.begin(),
48  lumisEnd = lumis_.end(), ilumi = lumisBegin;
49  ilumi != lumisEnd; ++ilumi ) {
50  if ( ev.id().run() >= ilumi->startRun() && ev.id().run() <= ilumi->endRun() &&
51  ev.id().luminosityBlock() >= ilumi->startLumi() && ev.id().luminosityBlock() <= ilumi->endLumi() ) {
52  goodLumi = true;
53  break;
54  }
55  }
56  if ( goodLumi ) passCut(ret, "RunLumi" );
57  } else {
58  passCut(ret, "RunLumi");
59  }
60 
61  setIgnored(ret);
62  return (bool)ret;
63  }
64 
66 
67 private:
68 
69  std::vector<edm::LuminosityBlockRange> lumis_;
70 
71 };
72 
73 #endif
RunNumber_t run() const
Definition: EventID.h:39
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
bool ev
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
RunLumiSelector(edm::ParameterSet const &params, edm::ConsumesCollector &&iC)
RunLumiSelector(edm::ParameterSet const &params)
A selector of events.
Definition: EventSelector.h:16
edm::EventID id() const
Definition: EventBase.h:60