CMS 3D CMS Logo

SingleElementCollectionRefSelector.h
Go to the documentation of this file.
1 #ifndef RecoAlgos_SingleElementCollectionRefSelector_h
2 #define RecoAlgos_SingleElementCollectionRefSelector_h
3 
21 
22 namespace reco {
23  namespace modules {
25  }
26 }
27 namespace edm {
28  class Event;
29  class EventSetup;
30 }
31 
32 template<typename InputType, typename Selector,
33  typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<edm::View<InputType> >::type,
35  typename RefAdder = typename ::helper::SelectionAdderTrait<edm::View<InputType>, StoreContainer>::type>
38  typedef InputCollection collection;
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->refAt(idx))) addRef_(selected_, c, idx);
50  }
51  }
52 private:
53  container selected_;
54  selector select_;
55  RefAdder addRef_;
57 };
58 
60 
61 namespace reco {
62  namespace modules {
63  template<typename S>
64  struct SingleElementCollectionRefSelectorEventSetupInit {
65  static void init(S & s, const edm::Event & ev, const edm::EventSetup& es) {
66  typedef typename EventSetupInit<typename S::selector>::type ESI;
67  ESI::init(s.select_, ev, es);
68  }
69  };
70 
71  template<typename I, typename S, typename O, typename C, typename R>
72  struct EventSetupInit<SingleElementCollectionRefSelector<I, S, O, C, R> > {
74  };
75  }
76 }
77 
78 #endif
79 
type
Definition: HCALResponse.h:21
SingleElementCollectionRefSelectorEventSetupInit< SingleElementCollectionRefSelector< I, S, O, C, R > > type
InputType
Definition: InputType.h:5
S make(const edm::ParameterSet &cfg)
bool ev
take no action (default)
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
const std::complex< double > I
Definition: I.h:8
Functor that operates on <T>
Definition: Selector.h:24
SingleElementCollectionRefSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
fixed size matrix
HLT enums.
static void init(S &s, const edm::Event &ev, const edm::EventSetup &es)