CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VectorInputSource.h
Go to the documentation of this file.
1 #ifndef FWCore_Sources_VectorInputSource_h
2 #define FWCore_Sources_VectorInputSource_h
3 
4 /*----------------------------------------------------------------------
5 VectorInputSource: Abstract interface for vector input sources.
6 ----------------------------------------------------------------------*/
7 
9 
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 namespace edm {
15  class EventPrincipal;
16  struct InputSourceDescription;
17  class LuminosityBlockID;
18  class ParameterSet;
20  public:
21  explicit VectorInputSource(ParameterSet const& pset, InputSourceDescription const& desc);
22  virtual ~VectorInputSource();
23 
24  template<typename T>
25  size_t loopRandom(size_t number, T eventOperator);
26  template<typename T>
27  size_t loopSequential(size_t number, T eventOperator);
28  template<typename T>
29  size_t loopRandomWithID(LuminosityBlockID const& id, size_t number, T eventOperator);
30  template<typename T>
31  size_t loopSequentialWithID(LuminosityBlockID const& id, size_t number, T eventOperator);
32  template<typename T, typename Collection>
33  size_t loopSpecified(Collection const& events, T eventOperator);
34 
35  void dropUnwantedBranches(std::vector<std::string> const& wantedBranches);
36 
37  private:
38 
39  virtual EventPrincipal* readOneRandom() = 0;
41  virtual EventPrincipal* readOneSequential() = 0;
43  virtual EventPrincipal* readOneSpecified(EventID const& event) = 0;
44 
45  virtual void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches) = 0;
46  };
47 
48  template<typename T>
49  size_t VectorInputSource::loopRandom(size_t number, T eventOperator) {
50  size_t i = 0U;
51  for(; i < number; ++i) {
53  if(!ep) break;
54  eventOperator(*ep);
55  }
56  return i;
57  }
58 
59  template<typename T>
60  size_t VectorInputSource::loopSequential(size_t number, T eventOperator) {
61  size_t i = 0U;
62  for(; i < number; ++i) {
64  if(!ep) break;
65  eventOperator(*ep);
66  }
67  return i;
68  }
69 
70  template<typename T>
71  size_t VectorInputSource::loopRandomWithID(LuminosityBlockID const& id, size_t number, T eventOperator) {
72  size_t i = 0U;
73  for(; i < number; ++i) {
75  if(!ep) break;
76  eventOperator(*ep);
77  }
78  return i;
79  }
80 
81  template<typename T>
82  size_t VectorInputSource::loopSequentialWithID(LuminosityBlockID const& id, size_t number, T eventOperator) {
83  size_t i = 0U;
84  for(; i < number; ++i) {
86  if(!ep) break;
87  eventOperator(*ep);
88  }
89  return i;
90  }
91 
92  template<typename T, typename Collection>
93  size_t VectorInputSource::loopSpecified(Collection const& events, T eventOperator) {
94  size_t i = 0U;
95  for(typename Collection::const_iterator it = events.begin(), itEnd = events.end(); it != itEnd; ++it) {
97  if(!ep) break;
98  eventOperator(*ep);
99  ++i;
100  }
101  return i;
102  }
103 }
104 #endif
size_t loopRandomWithID(LuminosityBlockID const &id, size_t number, T eventOperator)
int i
Definition: DBlmapReader.cc:9
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
size_t loopRandom(size_t number, T eventOperator)
virtual EventPrincipal * readOneSpecified(EventID const &event)=0
virtual EventPrincipal * readOneRandomWithID(LuminosityBlockID const &id)=0
size_t loopSequential(size_t number, T eventOperator)
virtual EventPrincipal * readOneSequentialWithID(LuminosityBlockID const &id)=0
virtual EventPrincipal * readOneRandom()=0
size_t loopSpecified(Collection const &events, T eventOperator)
virtual EventPrincipal * readOneSequential()=0
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
VectorInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
size_t loopSequentialWithID(LuminosityBlockID const &id, size_t number, T eventOperator)
tuple events
Definition: patZpeak.py:19
virtual void dropUnwantedBranches_(std::vector< std::string > const &wantedBranches)=0
long double T