CommonTools
UtilAlgos
interface
ObjectPairCollectionSelector.h
Go to the documentation of this file.
1
#ifndef RecoAlgos_ObjectPairCollectionSelector_h
2
#define RecoAlgos_ObjectPairCollectionSelector_h
3
16
#include "
FWCore/Framework/interface/EventSetup.h
"
17
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
#include "
CommonTools/UtilAlgos/interface/SelectionAdderTrait.h
"
20
#include "
CommonTools/UtilAlgos/interface/ParameterAdapter.h
"
21
#include <vector>
22
23
namespace
edm
{
24
class
Event
;
25
}
26
27
template
<
typename
InputCollection
,
28
typename
Selector
,
29
typename
StoreContainer = std::vector<const typename InputCollection::value_type *>,
30
typename
RefAdder =
typename
helper::SelectionAdderTrait<InputCollection, StoreContainer>::type
>
31
class
ObjectPairCollectionSelector
{
32
public
:
33
typedef
InputCollection
collection
;
34
35
private
:
36
typedef
const
typename
InputCollection::value_type
*
reference
;
37
typedef
StoreContainer
container
;
38
typedef
typename
container::const_iterator
const_iterator
;
39
40
public
:
41
ObjectPairCollectionSelector
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&&iC)
42
:
select_
(
reco
::
modules
::
make
<
Selector
>(
cfg
)) {}
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
&,
const
edm::EventSetup
&) {
46
unsigned
int
s
=
c
->size();
47
std::vector<bool>
v
(
s
,
false
);
48
for
(
unsigned
int
i
= 0;
i
<
s
; ++
i
)
49
for
(
unsigned
int
j
=
i
+ 1;
j
<
s
; ++
j
) {
50
if
(
select_
((*
c
)[
i
], (*
c
)[
j
]))
51
v
[
i
] =
v
[
j
] =
true
;
52
}
53
selected_
.clear();
54
for
(
unsigned
int
i
= 0;
i
<
s
; ++
i
)
55
if
(
v
[
i
])
56
addRef_
(
selected_
,
c
,
i
);
57
}
58
59
private
:
60
Selector
select_
;
61
StoreContainer
selected_
;
62
RefAdder
addRef_
;
63
};
64
65
#endif
Selector
Functor that operates on <T>
Definition:
Selector.h:22
mps_fire.i
i
Definition:
mps_fire.py:355
SelectionAdderTrait.h
helper::SelectionAdderTrait
Definition:
SelectionAdderTrait.h:80
modules
Definition:
ZHLTMatchFilter.cc:17
ObjectPairCollectionSelector::ObjectPairCollectionSelector
ObjectPairCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
ObjectPairCollectionSelector.h:41
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
findQualityFiles.v
v
Definition:
findQualityFiles.py:179
edm::Handle
Definition:
AssociativeIterator.h:50
ObjectPairCollectionSelector::addRef_
RefAdder addRef_
Definition:
ObjectPairCollectionSelector.h:62
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
ObjectPairCollectionSelector::begin
const_iterator begin() const
Definition:
ObjectPairCollectionSelector.h:43
ObjectPairCollectionSelector::select_
Selector select_
Definition:
ObjectPairCollectionSelector.h:60
Event
edm::ParameterSet
Definition:
ParameterSet.h:36
ObjectPairCollectionSelector::reference
const typedef InputCollection::value_type * reference
Definition:
ObjectPairCollectionSelector.h:36
ObjectPairCollectionSelector
Definition:
ObjectPairCollectionSelector.h:31
edm::EventSetup
Definition:
EventSetup.h:57
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
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
ObjectPairCollectionSelector::collection
InputCollection collection
Definition:
ObjectPairCollectionSelector.h:33
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
ObjectPairCollectionSelector::end
const_iterator end() const
Definition:
ObjectPairCollectionSelector.h:44
EventSetup.h
SimL1EmulatorRepack_GT2_cff.InputCollection
InputCollection
Definition:
SimL1EmulatorRepack_GT2_cff.py:16
ParameterAdapter.h
ObjectPairCollectionSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
Definition:
ObjectPairCollectionSelector.h:45
ConsumesCollector.h
ParameterSet.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
edm::Event
Definition:
Event.h:73
ObjectPairCollectionSelector::container
StoreContainer container
Definition:
ObjectPairCollectionSelector.h:37
ObjectPairCollectionSelector::selected_
StoreContainer selected_
Definition:
ObjectPairCollectionSelector.h:61
edm::ConsumesCollector
Definition:
ConsumesCollector.h:39
ObjectPairCollectionSelector::const_iterator
container::const_iterator const_iterator
Definition:
ObjectPairCollectionSelector.h:38
Generated for CMSSW Reference Manual by
1.8.16