CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SingleElementCollectionSelector.h
Go to the documentation of this file.
1 #ifndef RecoAlgos_SingleElementCollectionSelector_h
2 #define RecoAlgos_SingleElementCollectionSelector_h
3 
20 
21 namespace reco {
22  namespace modules {
23  template <typename S>
25  }
26 } // namespace reco
27 namespace edm {
28  class Event;
29  class EventSetup;
30 } // namespace edm
31 
32 template <typename InputCollection,
33  typename Selector,
39  typedef StoreContainer container;
40  typedef Selector selector;
41  typedef typename container::const_iterator const_iterator;
43  : select_(reco::modules::make<Selector>(cfg, iC)) {}
44  const_iterator begin() const { return selected_.begin(); }
45  const_iterator end() const { return selected_.end(); }
47  selected_.clear();
48  for (size_t idx = 0; idx < c->size(); ++idx) {
49  if (select_((*c)[idx]))
50  addRef_(selected_, c, idx);
51  }
52  }
53 
54 private:
57  RefAdder addRef_;
59 };
60 
62 
63 namespace reco {
64  namespace modules {
65  template <typename S>
66  struct SingleElementCollectionSelectorEventSetupInit {
67  static void init(S& s, const edm::Event& ev, const edm::EventSetup& es) {
68  typedef typename EventSetupInit<typename S::selector>::type ESI;
69  ESI::init(s.select_, ev, es);
70  }
71  };
72 
73  template <typename I, typename S, typename O, typename C, typename R>
76  };
77  } // namespace modules
78 } // namespace reco
79 
80 #endif
const edm::EventSetup & c
tuple cfg
Definition: looper.py:296
int init
Definition: HydjetWrapper.h:64
S make(const edm::ParameterSet &cfg)
bool ev
take no action (default)
static void init(S &s, const edm::Event &ev, const edm::EventSetup &es)
const std::complex< double > I
Definition: I.h:8
Functor that operates on &lt;T&gt;
Definition: Selector.h:22
SingleElementCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
SingleElementCollectionSelectorEventSetupInit< SingleElementCollectionSelector< I, S, O, C, R > > type
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)