CMS 3D CMS Logo

AssociatedVariableCollectionSelector.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_AssociatedVariableCollectionSelector_h
2 #define CommonTools_UtilAlgos_AssociatedVariableCollectionSelector_h
3 /* \class AssociatedVariableCollectionSelector
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: AssociatedVariableCollectionSelector.h,v 1.2 2010/02/20 20:55:13 wmtan Exp $
8  *
9  */
20 
21 namespace reco {
22  namespace modules {
23  template <typename S>
25  }
26 } // namespace reco
27 
28 template <typename InputCollection,
29  typename VarCollection,
30  typename Selector,
35 public:
37  typedef StoreContainer container;
38  typedef Selector selector;
39  typedef typename container::const_iterator const_iterator;
41  : varToken_(iC.consumes<VarCollection>(cfg.template getParameter<edm::InputTag>("var"))),
42  select_(reco::modules::make<Selector>(cfg, iC)) {}
43  const_iterator begin() const { return selected_.begin(); }
44  const_iterator end() const { return selected_.end(); }
45  void select(const edm::Handle<InputCollection>& c, const edm::Event& evt, const edm::EventSetup&) {
46  selected_.clear();
48  evt.getByToken(varToken_, var);
49  for (size_t idx = 0; idx < c->size(); ++idx) {
50  if (select_((*c)[idx], (*var)[edm::getRef(c, idx)]))
52  }
53  }
54 
55 private:
59  RefAdder addRef_;
61 };
62 
64 
65 namespace reco {
66  namespace modules {
67  template <typename S>
68  struct AssociatedVariableCollectionSelectorEventSetupInit {
69  static void init(S& s, const edm::Event& evt, const edm::EventSetup& es) {
70  typedef typename EventSetupInit<typename S::selector>::type ESI;
71  ESI::init(s.select_, evt, es);
72  }
73  };
74 
75  template <typename I, typename V, typename S, typename O, typename C, typename R>
79  };
80  } // namespace modules
81 } // namespace reco
82 
83 #endif
cms::cuda::V
cudaStream_t T uint32_t const T *__restrict__ const uint32_t *__restrict__ uint32_t int cudaStream_t V
Definition: HistoContainer.h:99
Handle.h
Selector
Functor that operates on <T>
Definition: Selector.h:22
init
int init
Definition: HydjetWrapper.h:64
SelectionAdderTrait.h
StoreContainerTrait.h
modules
Definition: ZHLTMatchFilter.cc:17
edm::EDGetTokenT< VarCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
AssociatedVariableCollectionSelector
Definition: AssociatedVariableCollectionSelector.h:34
getRef.h
AssociatedVariableCollectionSelector::end
const_iterator end() const
Definition: AssociatedVariableCollectionSelector.h:44
AssociatedVariableCollectionSelector::begin
const_iterator begin() const
Definition: AssociatedVariableCollectionSelector.h:43
reco::modules::AssociatedVariableCollectionSelectorEventSetupInit::init
static void init(S &s, const edm::Event &evt, const edm::EventSetup &es)
Definition: AssociatedVariableCollectionSelector.h:69
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
AssociatedVariableCollectionSelector::selector
Selector selector
Definition: AssociatedVariableCollectionSelector.h:38
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
AssociatedVariableCollectionSelector::container
StoreContainer container
Definition: AssociatedVariableCollectionSelector.h:37
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
alignCSCRings.s
s
Definition: alignCSCRings.py:92
Exhume::I
const std::complex< double > I
Definition: I.h:8
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
AssociatedVariableCollectionSelector::varToken_
edm::EDGetTokenT< VarCollection > varToken_
Definition: AssociatedVariableCollectionSelector.h:56
AssociatedVariableCollectionSelector::selected_
container selected_
Definition: AssociatedVariableCollectionSelector.h:57
edm::ParameterSet
Definition: ParameterSet.h:47
reco::modules::NoEventSetupInit
take no action (default)
Definition: EventSetupInitTrait.h:19
Event.h
reco::modules::EventSetupInit< AssociatedVariableCollectionSelector< I, V, S, O, C, R > >::type
AssociatedVariableCollectionSelectorEventSetupInit< AssociatedVariableCollectionSelector< I, V, S, O, C, R > > type
Definition: AssociatedVariableCollectionSelector.h:78
edm::getRef
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
AssociatedVariableCollectionSelector::AssociatedVariableCollectionSelector
AssociatedVariableCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition: AssociatedVariableCollectionSelector.h:40
AssociatedVariableCollectionSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &evt, const edm::EventSetup &)
Definition: AssociatedVariableCollectionSelector.h:45
edm::EventSetup
Definition: EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
reco::modules::make
S make(const edm::ParameterSet &cfg)
Definition: ParameterAdapter.h:21
InputTag.h
looper.cfg
cfg
Definition: looper.py:297
AssociatedVariableCollectionSelector::const_iterator
container::const_iterator const_iterator
Definition: AssociatedVariableCollectionSelector.h:39
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
AssociatedVariableCollectionSelector::collection
InputCollection collection
Definition: AssociatedVariableCollectionSelector.h:36
gen::C
C
Definition: PomwigHadronizer.cc:78
reco::modules::AssociatedVariableCollectionSelectorEventSetupInit
Definition: AssociatedVariableCollectionSelector.h:24
SimL1EmulatorRepack_GT2_cff.InputCollection
InputCollection
Definition: SimL1EmulatorRepack_GT2_cff.py:16
S
Definition: CSCDBL1TPParametersExtended.h:16
ParameterAdapter.h
ConsumesCollector.h
AssociatedVariableCollectionSelector::select_
selector select_
Definition: AssociatedVariableCollectionSelector.h:58
ParameterSet.h
edm::Event
Definition: Event.h:73
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition: HLTTauReferences_cfi.py:92
dttmaxenums::R
Definition: DTTMax.h:29
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
AssociatedVariableCollectionSelector::addRef_
RefAdder addRef_
Definition: AssociatedVariableCollectionSelector.h:59