Main Page
Namespaces
Classes
Package Documentation
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
{
class
Event
; }
24
25
template
<
typename
InputCollection
,
typename
Selector
,
26
typename
StoreContainer = std::vector<const typename InputCollection::value_type *>,
27
typename
RefAdder =
typename
helper::SelectionAdderTrait<InputCollection, StoreContainer>::type
>
28
class
ObjectPairCollectionSelector
{
29
public
:
30
typedef
InputCollection
collection
;
31
32
private
:
33
typedef
const
typename
InputCollection::value_type
*
reference
;
34
typedef
StoreContainer
container
;
35
typedef
typename
container::const_iterator
const_iterator
;
36
37
public
:
38
ObjectPairCollectionSelector
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&& iC) :
39
select_(
reco
::
modules
::
make
<
Selector
>(cfg)) { }
40
const_iterator
begin
()
const
{
return
selected_.begin(); }
41
const_iterator
end
()
const
{
return
selected_.end(); }
42
void
select
(
const
edm::Handle<InputCollection>
&
c
,
const
edm::Event
&,
const
edm::EventSetup
&) {
43
unsigned
int
s
= c->size();
44
std::vector<bool>
v
(s,
false
);
45
for
(
unsigned
int
i
= 0;
i
<
s
; ++
i
)
46
for
(
unsigned
int
j =
i
+ 1; j <
s
; ++j) {
47
if
(select_((*c)[
i
], (*c)[j]))
48
v[
i
] = v[j] =
true
;
49
}
50
selected_.clear();
51
for
(
unsigned
int
i
= 0;
i
<
s
; ++
i
)
52
if
(v[
i
])
53
addRef_(selected_, c, i);
54
}
55
56
private
:
57
Selector
select_
;
58
StoreContainer
selected_
;
59
RefAdder
addRef_
;
60
};
61
62
#endif
63
ObjectPairCollectionSelector::selected_
StoreContainer selected_
Definition:
ObjectPairCollectionSelector.h:58
ObjectPairCollectionSelector
Definition:
ObjectPairCollectionSelector.h:28
SelectionAdderTrait.h
mps_fire.i
i
Definition:
mps_fire.py:269
ObjectPairCollectionSelector::container
StoreContainer container
Definition:
ObjectPairCollectionSelector.h:34
alignCSCRings.s
s
Definition:
alignCSCRings.py:91
EnergyCorrector.c
c
Definition:
EnergyCorrector.py:43
edm::Handle
Definition:
AssociativeIterator.h:48
EventSetup.h
reco::modules::make
S make(const edm::ParameterSet &cfg)
Definition:
ParameterAdapter.h:29
HiRegionalRecoMuon_cff.InputCollection
InputCollection
Definition:
HiRegionalRecoMuon_cff.py:20
findQualityFiles.v
v
Definition:
findQualityFiles.py:177
ObjectPairCollectionSelector::select_
Selector select_
Definition:
ObjectPairCollectionSelector.h:57
ObjectPairCollectionSelector::reference
const InputCollection::value_type * reference
Definition:
ObjectPairCollectionSelector.h:33
ParameterSet.h
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
ObjectPairCollectionSelector::end
const_iterator end() const
Definition:
ObjectPairCollectionSelector.h:41
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
edm::EventSetup
Definition:
EventSetup.h:52
Selector
Functor that operates on <T>
Definition:
Selector.h:24
looper.cfg
cfg
Definition:
looper.py:294
ObjectPairCollectionSelector::addRef_
RefAdder addRef_
Definition:
ObjectPairCollectionSelector.h:59
ObjectPairCollectionSelector::collection
InputCollection collection
Definition:
ObjectPairCollectionSelector.h:30
Event
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:43
edm
HLT enums.
Definition:
AlignableModifier.h:17
helper::SelectionAdderTrait
Definition:
SelectionAdderTrait.h:81
ParameterAdapter.h
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:70
ConsumesCollector.h
ObjectPairCollectionSelector::begin
const_iterator begin() const
Definition:
ObjectPairCollectionSelector.h:40
ObjectPairCollectionSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
Definition:
ObjectPairCollectionSelector.h:42
ObjectPairCollectionSelector::ObjectPairCollectionSelector
ObjectPairCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
ObjectPairCollectionSelector.h:38
edm::ConsumesCollector
Definition:
ConsumesCollector.h:39
ObjectPairCollectionSelector::const_iterator
container::const_iterator const_iterator
Definition:
ObjectPairCollectionSelector.h:35
modules
Definition:
ZHLTMatchFilter.cc:17
Generated for CMSSW Reference Manual by
1.8.11