CommonTools
UtilAlgos
interface
SingleElementCollectionSelector.h
Go to the documentation of this file.
1
#ifndef RecoAlgos_SingleElementCollectionSelector_h
2
#define RecoAlgos_SingleElementCollectionSelector_h
3
15
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
16
#include "
CommonTools/UtilAlgos/interface/SelectionAdderTrait.h
"
17
#include "
CommonTools/UtilAlgos/interface/StoreContainerTrait.h
"
18
#include "
CommonTools/UtilAlgos/interface/ParameterAdapter.h
"
19
#include "
CommonTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h
"
20
21
namespace
reco
{
22
namespace
modules
{
23
template
<
typename
S>
24
struct
SingleElementCollectionSelectorEventSetupInit
;
25
}
26
}
// namespace reco
27
namespace
edm
{
28
class
Event
;
29
class
EventSetup
;
30
}
// namespace edm
31
32
template
<
typename
InputCollection
,
33
typename
Selector
,
34
typename
OutputCollection
=
typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type
,
35
typename
StoreContainer =
typename ::helper::StoreContainerTrait<OutputCollection>::type
,
36
typename
RefAdder =
typename ::helper::SelectionAdderTrait<InputCollection, StoreContainer>::type
>
37
struct
SingleElementCollectionSelector
{
38
typedef
InputCollection
collection
;
39
typedef
StoreContainer
container
;
40
typedef
Selector
selector
;
41
typedef
typename
container::const_iterator
const_iterator
;
42
SingleElementCollectionSelector
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&& iC)
43
:
select_
(
reco
::
modules
::
make
<
Selector
>(
cfg
, iC)) {}
44
const_iterator
begin
()
const
{
return
selected_
.begin(); }
45
const_iterator
end
()
const
{
return
selected_
.end(); }
46
void
select
(
const
edm::Handle<InputCollection>
&
c
,
const
edm::Event
&,
const
edm::EventSetup
&) {
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_
;
58
friend
struct
reco::modules::SingleElementCollectionSelectorEventSetupInit
<
SingleElementCollectionSelector
>;
59
};
60
61
#include "
CommonTools/UtilAlgos/interface/EventSetupInitTrait.h
"
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
> > {
75
typedef
SingleElementCollectionSelectorEventSetupInit<SingleElementCollectionSelector<I, S, O, C, R>
>
type
;
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:46
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:296
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:97
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:56
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
Generated for CMSSW Reference Manual by
1.8.16