CMS 3D CMS Logo

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:
55  container selected_;
56  selector select_;
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>
74  struct EventSetupInit<SingleElementCollectionSelector<I, S, O, C, R> > {
76  };
77  } // namespace modules
78 } // namespace reco
79 
80 #endif
type
Definition: HCALResponse.h:21
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 <T>
Definition: Selector.h:22
SingleElementCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
SingleElementCollectionSelectorEventSetupInit< SingleElementCollectionSelector< I, S, O, C, R > > type
fixed size matrix
HLT enums.
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)