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> struct SingleElementCollectionSelectorEventSetupInit;
24  }
25 }
26 namespace edm {
27  class Event;
28  class EventSetup;
29 }
30 
31 template<typename InputCollection, typename Selector,
37  typedef StoreContainer container;
38  typedef Selector selector;
39  typedef typename container::const_iterator const_iterator;
41  select_(reco::modules::make<Selector>(cfg, iC)) { }
42  const_iterator begin() const { return selected_.begin(); }
43  const_iterator end() const { return selected_.end(); }
45  selected_.clear();
46  for(size_t idx = 0; idx < c->size(); ++ idx) {
47  if(select_((*c)[idx]))
48  addRef_(selected_, c, idx);
49  }
50  }
51 private:
52  container selected_;
53  selector select_;
54  RefAdder addRef_;
56 };
57 
59 
60 namespace reco {
61  namespace modules {
62  template<typename S>
63  struct SingleElementCollectionSelectorEventSetupInit {
64  static void init(S & s, const edm::Event & ev, const edm::EventSetup& es) {
65  typedef typename EventSetupInit<typename S::selector>::type ESI;
66  ESI::init(s.select_, ev, es);
67  }
68  };
69 
70  template<typename I, typename S, typename O, typename C, typename R>
71  struct EventSetupInit<SingleElementCollectionSelector<I, S, O, C, R> > {
73  };
74  }
75 }
76 
77 #endif
78 
type
Definition: HCALResponse.h:21
int init
Definition: HydjetWrapper.h:67
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:24
SingleElementCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
SingleElementCollectionSelectorEventSetupInit< SingleElementCollectionSelector< I, S, O, C, R > > type
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
fixed size matrix
HLT enums.
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)