src
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
ObjectPairCollectionSelector::selected_
StoreContainer selected_
Definition:
ObjectPairCollectionSelector.h:61
ObjectPairCollectionSelector
Definition:
ObjectPairCollectionSelector.h:31
mps_fire.i
i
Definition:
mps_fire.py:429
SelectionAdderTrait.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
ObjectPairCollectionSelector::container
StoreContainer container
Definition:
ObjectPairCollectionSelector.h:37
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
edm::Handle
Definition:
AssociativeIterator.h:50
EventSetup.h
reco::modules::make
S make(const edm::ParameterSet &cfg)
Definition:
ParameterAdapter.h:21
findQualityFiles.v
v
Definition:
findQualityFiles.py:179
ObjectPairCollectionSelector::select_
Selector select_
Definition:
ObjectPairCollectionSelector.h:60
ObjectPairCollectionSelector::reference
const InputCollection::value_type * reference
Definition:
ObjectPairCollectionSelector.h:36
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:35
ParameterSet.h
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
SimL1EmulatorRepack_Full_cff.InputCollection
InputCollection
Definition:
SimL1EmulatorRepack_Full_cff.py:97
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
edm::EventSetup
Definition:
EventSetup.h:56
ObjectPairCollectionSelector::begin
const_iterator begin() const
Definition:
ObjectPairCollectionSelector.h:43
Selector
Functor that operates on <T>
Definition:
Selector.h:22
looper.cfg
cfg
Definition:
looper.py:296
ObjectPairCollectionSelector::addRef_
RefAdder addRef_
Definition:
ObjectPairCollectionSelector.h:62
ObjectPairCollectionSelector::collection
InputCollection collection
Definition:
ObjectPairCollectionSelector.h:33
Event
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:46
edm
HLT enums.
Definition:
AlignableModifier.h:19
ObjectPairCollectionSelector::end
const_iterator end() const
Definition:
ObjectPairCollectionSelector.h:44
helper::SelectionAdderTrait
Definition:
SelectionAdderTrait.h:80
ParameterAdapter.h
edm::ParameterSet
Definition:
ParameterSet.h:48
edm::Event
Definition:
Event.h:73
ConsumesCollector.h
ObjectPairCollectionSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
Definition:
ObjectPairCollectionSelector.h:45
ObjectPairCollectionSelector::ObjectPairCollectionSelector
ObjectPairCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
ObjectPairCollectionSelector.h:41
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
ObjectPairCollectionSelector::const_iterator
container::const_iterator const_iterator
Definition:
ObjectPairCollectionSelector.h:38
modules
Definition:
modules.py:1
Generated for CMSSW Reference Manual by
1.8.14