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]))
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
Selector
Functor that operates on <T>
Definition: Selector.h:22
init
int init
Definition: HydjetWrapper.h:64
SingleElementCollectionSelector::addRef_
RefAdder addRef_
Definition: SingleElementCollectionSelector.h:57
SelectionAdderTrait.h
StoreContainerTrait.h
SingleElementCollectionSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
Definition: SingleElementCollectionSelector.h:46
SingleElementCollectionSelector::const_iterator
container::const_iterator const_iterator
Definition: SingleElementCollectionSelector.h:41
modules
Definition: MuonCleanerBySegments.cc:35
reco::modules::SingleElementCollectionSelectorEventSetupInit
Definition: SingleElementCollectionSelector.h:24
edm
HLT enums.
Definition: AlignableModifier.h:19
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
SelectedOutputCollectionTrait.h
reco::modules::EventSetupInit
Definition: EventSetupInitTrait.h:33
EventSetupInitTrait.h
edm::Handle
Definition: AssociativeIterator.h:50
SingleElementCollectionSelector::end
const_iterator end() const
Definition: SingleElementCollectionSelector.h:45
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
SingleElementCollectionSelector
Definition: SingleElementCollectionSelector.h:37
alignCSCRings.s
s
Definition: alignCSCRings.py:92
Exhume::I
const std::complex< double > I
Definition: I.h:8
SingleElementCollectionSelector::select_
selector select_
Definition: SingleElementCollectionSelector.h:56
Event
reco::modules::SingleElementCollectionSelectorEventSetupInit::init
static void init(S &s, const edm::Event &ev, const edm::EventSetup &es)
Definition: SingleElementCollectionSelector.h:67
SingleElementCollectionSelector::SingleElementCollectionSelector
SingleElementCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition: SingleElementCollectionSelector.h:42
edm::ParameterSet
Definition: ParameterSet.h:47
SingleElementCollectionSelector::container
StoreContainer container
Definition: SingleElementCollectionSelector.h:39
reco::modules::NoEventSetupInit
take no action (default)
Definition: EventSetupInitTrait.h:19
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
edm::EventSetup
Definition: EventSetup.h:58
reco::modules::make
S make(const edm::ParameterSet &cfg)
Definition: ParameterAdapter.h:21
looper.cfg
cfg
Definition: looper.py:297
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
reco::modules::EventSetupInit< SingleElementCollectionSelector< I, S, O, C, R > >::type
SingleElementCollectionSelectorEventSetupInit< SingleElementCollectionSelector< I, S, O, C, R > > type
Definition: SingleElementCollectionSelector.h:75
gen::C
C
Definition: PomwigHadronizer.cc:78
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
SingleElementCollectionSelector::selected_
container selected_
Definition: SingleElementCollectionSelector.h:55
SimL1EmulatorRepack_GT2_cff.InputCollection
InputCollection
Definition: SimL1EmulatorRepack_GT2_cff.py:16
S
Definition: CSCDBL1TPParametersExtended.h:16
ParameterAdapter.h
ConsumesCollector.h
EventSetup
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::Event
Definition: Event.h:73
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition: HLTTauReferences_cfi.py:92
dttmaxenums::R
Definition: DTTMax.h:29
SingleElementCollectionSelector::collection
InputCollection collection
Definition: SingleElementCollectionSelector.h:38
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
SingleElementCollectionSelector::begin
const_iterator begin() const
Definition: SingleElementCollectionSelector.h:44
SingleElementCollectionSelector::selector
Selector selector
Definition: SingleElementCollectionSelector.h:40