CommonTools
UtilAlgos
interface
SingleElementCollectionRefSelector.h
Go to the documentation of this file.
1
#ifndef RecoAlgos_SingleElementCollectionRefSelector_h
2
#define RecoAlgos_SingleElementCollectionRefSelector_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
#include "
DataFormats/Common/interface/View.h
"
21
22
namespace
reco
{
23
namespace
modules
{
24
template
<
typename
S>
25
struct
SingleElementCollectionRefSelectorEventSetupInit
;
26
}
27
}
// namespace reco
28
namespace
edm
{
29
class
Event
;
30
class
EventSetup
;
31
}
// namespace edm
32
33
template
<
typename
InputType
,
34
typename
Selector
,
35
typename
OutputCollection
= typename ::helper::SelectedOutputCollectionTrait<edm::View<InputType> >
::type
,
36
typename
StoreContainer =
typename ::helper::StoreContainerTrait<OutputCollection>::type
,
37
typename
RefAdder = typename ::helper::SelectionAdderTrait<edm::View<InputType>, StoreContainer>
::type
>
38
struct
SingleElementCollectionRefSelector
{
39
typedef
edm::View<InputType>
InputCollection
;
40
typedef
InputCollection
collection
;
41
typedef
StoreContainer
container
;
42
typedef
Selector
selector
;
43
typedef
typename
container::const_iterator
const_iterator
;
44
SingleElementCollectionRefSelector
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&& iC)
45
:
select_
(
reco
::
modules
::
make
<
Selector
>(
cfg
, iC)) {}
46
const_iterator
begin
()
const
{
return
selected_
.begin(); }
47
const_iterator
end
()
const
{
return
selected_
.end(); }
48
void
select
(
const
edm::Handle<InputCollection>
&
c
,
const
edm::Event
&,
const
edm::EventSetup
&) {
49
selected_
.clear();
50
for
(
size_t
idx
= 0;
idx
<
c
->size(); ++
idx
) {
51
if
(
select_
(
c
->refAt(
idx
)))
52
addRef_
(
selected_
,
c
,
idx
);
53
}
54
}
55
56
private
:
57
container
selected_
;
58
selector
select_
;
59
RefAdder
addRef_
;
60
friend
struct
reco::modules::SingleElementCollectionRefSelectorEventSetupInit
<
SingleElementCollectionRefSelector
>;
61
};
62
63
#include "
CommonTools/UtilAlgos/interface/EventSetupInitTrait.h
"
64
65
namespace
reco
{
66
namespace
modules
{
67
template
<
typename
S>
68
struct
SingleElementCollectionRefSelectorEventSetupInit {
69
static
void
init
(
S
&
s
,
const
edm::Event
&
ev
,
const
edm::EventSetup
& es) {
70
typedef
typename
EventSetupInit<typename S::selector>::type
ESI;
71
ESI::init
(
s
.select_,
ev
, es);
72
}
73
};
74
75
template
<
typename
I,
typename
S,
typename
O,
typename
C,
typename
R>
76
struct
EventSetupInit
<
SingleElementCollectionRefSelector
<
I
,
S
, O,
C
,
R
> > {
77
typedef
SingleElementCollectionRefSelectorEventSetupInit<SingleElementCollectionRefSelector<I, S, O, C, R>
>
type
;
78
};
79
}
// namespace modules
80
}
// namespace reco
81
82
#endif
Selector
Functor that operates on <T>
Definition:
Selector.h:22
init
int init
Definition:
HydjetWrapper.h:64
SelectionAdderTrait.h
StoreContainerTrait.h
SingleElementCollectionRefSelector::collection
InputCollection collection
Definition:
SingleElementCollectionRefSelector.h:40
modules
Definition:
ZHLTMatchFilter.cc:17
edm
HLT enums.
Definition:
AlignableModifier.h:19
SingleElementCollectionRefSelector::addRef_
RefAdder addRef_
Definition:
SingleElementCollectionRefSelector.h:59
SingleElementCollectionRefSelector::container
StoreContainer container
Definition:
SingleElementCollectionRefSelector.h:41
SingleElementCollectionRefSelector::select_
selector select_
Definition:
SingleElementCollectionRefSelector.h:58
reco::modules::EventSetupInit< SingleElementCollectionRefSelector< I, S, O, C, R > >::type
SingleElementCollectionRefSelectorEventSetupInit< SingleElementCollectionRefSelector< I, S, O, C, R > > type
Definition:
SingleElementCollectionRefSelector.h:77
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
edm::InputType
InputType
Definition:
InputType.h:5
heavyIonCSV_trainingSettings.idx
idx
Definition:
heavyIonCSV_trainingSettings.py:5
SingleElementCollectionRefSelector::InputCollection
edm::View< InputType > InputCollection
Definition:
SingleElementCollectionRefSelector.h:39
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
Exhume::I
const std::complex< double > I
Definition:
I.h:8
Event
edm::View
Definition:
CaloClusterFwd.h:14
edm::ParameterSet
Definition:
ParameterSet.h:47
SingleElementCollectionRefSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
Definition:
SingleElementCollectionRefSelector.h:48
reco::modules::NoEventSetupInit
take no action (default)
Definition:
EventSetupInitTrait.h:19
type
type
Definition:
SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition:
SiPixelGainCalibHelper.h:39
edm::EventSetup
Definition:
EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:31
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
gen::C
C
Definition:
PomwigHadronizer.cc:78
SingleElementCollectionRefSelector::selected_
container selected_
Definition:
SingleElementCollectionRefSelector.h:57
SingleElementCollectionRefSelector::SingleElementCollectionRefSelector
SingleElementCollectionRefSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
SingleElementCollectionRefSelector.h:44
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
reco::modules::SingleElementCollectionRefSelectorEventSetupInit
Definition:
SingleElementCollectionRefSelector.h:25
S
Definition:
CSCDBL1TPParametersExtended.h:16
SingleElementCollectionRefSelector::end
const_iterator end() const
Definition:
SingleElementCollectionRefSelector.h:47
ParameterAdapter.h
ConsumesCollector.h
EventSetup
View.h
edm::Event
Definition:
Event.h:73
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition:
HLTTauReferences_cfi.py:92
SingleElementCollectionRefSelector::begin
const_iterator begin() const
Definition:
SingleElementCollectionRefSelector.h:46
dttmaxenums::R
Definition:
DTTMax.h:29
SingleElementCollectionRefSelector::selector
Selector selector
Definition:
SingleElementCollectionRefSelector.h:42
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
SingleElementCollectionRefSelector::const_iterator
container::const_iterator const_iterator
Definition:
SingleElementCollectionRefSelector.h:43
reco::modules::SingleElementCollectionRefSelectorEventSetupInit::init
static void init(S &s, const edm::Event &ev, const edm::EventSetup &es)
Definition:
SingleElementCollectionRefSelector.h:69
SingleElementCollectionRefSelector
Definition:
SingleElementCollectionRefSelector.h:38
Generated for CMSSW Reference Manual by
1.8.16