Main Page
Namespaces
Classes
Package Documentation
CommonTools
UtilAlgos
interface
AssociatedVariableCollectionSelector.h
Go to the documentation of this file.
1
#ifndef CommonTools_UtilAlgos_AssociatedVariableCollectionSelector_h
2
#define CommonTools_UtilAlgos_AssociatedVariableCollectionSelector_h
3
/* \class AssociatedVariableCollectionSelector
4
*
5
* \author Luca Lista, INFN
6
*
7
* \version $Id: AssociatedVariableCollectionSelector.h,v 1.2 2010/02/20 20:55:13 wmtan Exp $
8
*
9
*/
10
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
11
#include "
FWCore/Utilities/interface/InputTag.h
"
12
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
13
#include "
FWCore/Framework/interface/Event.h
"
14
#include "
DataFormats/Common/interface/Handle.h
"
15
#include "
CommonTools/UtilAlgos/interface/SelectionAdderTrait.h
"
16
#include "
CommonTools/UtilAlgos/interface/StoreContainerTrait.h
"
17
#include "
CommonTools/UtilAlgos/interface/ParameterAdapter.h
"
18
#include "
DataFormats/Common/interface/getRef.h
"
19
20
namespace
reco
{
21
namespace
modules
{
22
template
<
typename
S>
struct
AssociatedVariableCollectionSelectorEventSetupInit
;
23
}
24
}
25
26
template
<
typename
InputCollection
,
typename
VarCollection,
typename
Selector
,
27
typename
OutputCollection =
typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type
,
28
typename
StoreContainer =
typename ::helper::StoreContainerTrait<OutputCollection>::type
,
29
typename
RefAdder =
typename ::helper::SelectionAdderTrait<InputCollection, StoreContainer>::type
>
30
class
AssociatedVariableCollectionSelector
{
31
public
:
32
typedef
InputCollection
collection
;
33
typedef
StoreContainer
container
;
34
typedef
Selector
selector
;
35
typedef
typename
container::const_iterator
const_iterator
;
36
AssociatedVariableCollectionSelector
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&& iC) :
37
varToken_(iC.consumes<VarCollection>(cfg.
template
getParameter<
edm
::InputTag>(
"var"
))),
38
select_(
reco
::
modules
::
make
<
Selector
>(cfg, iC)) { }
39
const_iterator
begin
()
const
{
return
selected_.begin(); }
40
const_iterator
end
()
const
{
return
selected_.end(); }
41
void
select
(
const
edm::Handle<InputCollection>
&
c
,
const
edm::Event
& evt,
const
edm::EventSetup
&) {
42
selected_.clear();
43
edm::Handle<VarCollection>
var
;
44
evt.
getByToken
(varToken_, var);
45
for
(
size_t
idx
= 0;
idx
< c->size(); ++
idx
) {
46
if
(select_((*c)[
idx
], (*var)[
edm::getRef
(c,idx)]))
47
addRef_(selected_, c, idx);
48
}
49
}
50
private
:
51
edm::EDGetTokenT<VarCollection>
varToken_
;
52
container
selected_
;
53
selector
select_
;
54
RefAdder
addRef_
;
55
friend
class
reco::modules::AssociatedVariableCollectionSelectorEventSetupInit
<
AssociatedVariableCollectionSelector
>;
56
};
57
58
59
#include "
CommonTools/UtilAlgos/interface/EventSetupInitTrait.h
"
60
61
namespace
reco
{
62
namespace
modules
{
63
template
<
typename
S>
64
struct
AssociatedVariableCollectionSelectorEventSetupInit {
65
static
void
init
(
S
&
s
,
const
edm::Event
& evt,
const
edm::EventSetup
& es) {
66
typedef
typename
EventSetupInit<typename S::selector>::type
ESI;
67
ESI::init
(s.select_, evt, es);
68
}
69
};
70
71
template
<
typename
I,
typename
V,
typename
S,
typename
O,
typename
C,
typename
R>
72
struct
EventSetupInit
<AssociatedVariableCollectionSelector<
I
, V,
S
, O,
C
,
R
> > {
73
typedef
AssociatedVariableCollectionSelectorEventSetupInit<AssociatedVariableCollectionSelector<I, V, S, O, C, R>
>
type
;
74
};
75
}
76
}
77
78
#endif
79
edm::getRef
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition:
getRef.h:28
type
type
Definition:
HCALResponse.h:21
JetChargeProducer_cfi.var
var
Definition:
JetChargeProducer_cfi.py:4
SelectionAdderTrait.h
AssociatedVariableCollectionSelector::varToken_
edm::EDGetTokenT< VarCollection > varToken_
Definition:
AssociatedVariableCollectionSelector.h:51
AssociatedVariableCollectionSelector::end
const_iterator end() const
Definition:
AssociatedVariableCollectionSelector.h:40
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:460
AssociatedVariableCollectionSelector
Definition:
AssociatedVariableCollectionSelector.h:30
AssociatedVariableCollectionSelector::selector
Selector selector
Definition:
AssociatedVariableCollectionSelector.h:34
Event.h
alignCSCRings.s
s
Definition:
alignCSCRings.py:91
EnergyCorrector.c
c
Definition:
EnergyCorrector.py:43
edm::Handle
Definition:
AssociativeIterator.h:47
init
int init
Definition:
HydjetWrapper.h:67
reco::modules::make
S make(const edm::ParameterSet &cfg)
Definition:
ParameterAdapter.h:24
AssociatedVariableCollectionSelector::addRef_
RefAdder addRef_
Definition:
AssociatedVariableCollectionSelector.h:54
reco::modules::AssociatedVariableCollectionSelectorEventSetupInit::init
static void init(S &s, const edm::Event &evt, const edm::EventSetup &es)
Definition:
AssociatedVariableCollectionSelector.h:65
HiRegionalRecoMuon_cff.InputCollection
InputCollection
Definition:
HiRegionalRecoMuon_cff.py:20
AssociatedVariableCollectionSelector::AssociatedVariableCollectionSelector
AssociatedVariableCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
AssociatedVariableCollectionSelector.h:36
edm::EDGetTokenT< VarCollection >
AssociatedVariableCollectionSelector::begin
const_iterator begin() const
Definition:
AssociatedVariableCollectionSelector.h:39
ParameterSet.h
AssociatedVariableCollectionSelector::const_iterator
container::const_iterator const_iterator
Definition:
AssociatedVariableCollectionSelector.h:35
reco::modules::NoEventSetupInit
take no action (default)
Definition:
EventSetupInitTrait.h:19
dttmaxenums::R
Definition:
DTTMax.h:28
AssociatedVariableCollectionSelector::select_
selector select_
Definition:
AssociatedVariableCollectionSelector.h:53
patCaloMETCorrections_cff.C
C
Definition:
patCaloMETCorrections_cff.py:45
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
Exhume::I
const std::complex< double > I
Definition:
I.h:8
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition:
svgfig.py:520
edm::EventSetup
Definition:
EventSetup.h:44
Selector
Functor that operates on <T>
Definition:
Selector.h:24
looper.cfg
cfg
Definition:
looper.py:293
AssociatedVariableCollectionSelector::selected_
container selected_
Definition:
AssociatedVariableCollectionSelector.h:52
training_settings.idx
idx
Definition:
training_settings.py:16
reco::modules::EventSetupInit
Definition:
EventSetupInitTrait.h:35
reco::modules::EventSetupInit< AssociatedVariableCollectionSelector< I, V, S, O, C, R > >::type
AssociatedVariableCollectionSelectorEventSetupInit< AssociatedVariableCollectionSelector< I, V, S, O, C, R > > type
Definition:
AssociatedVariableCollectionSelector.h:73
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:43
edm
HLT enums.
Definition:
AlignableModifier.h:17
StoreContainerTrait.h
InputTag.h
ParameterAdapter.h
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:66
AssociatedVariableCollectionSelector::collection
InputCollection collection
Definition:
AssociatedVariableCollectionSelector.h:32
AssociatedVariableCollectionSelector::container
StoreContainer container
Definition:
AssociatedVariableCollectionSelector.h:33
ConsumesCollector.h
getRef.h
EventSetupInitTrait.h
reco::modules::AssociatedVariableCollectionSelectorEventSetupInit
Definition:
AssociatedVariableCollectionSelector.h:22
AssociatedVariableCollectionSelector::select
void select(const edm::Handle< InputCollection > &c, const edm::Event &evt, const edm::EventSetup &)
Definition:
AssociatedVariableCollectionSelector.h:41
edm::ConsumesCollector
Definition:
ConsumesCollector.h:39
Handle.h
modules
Definition:
ZHLTMatchFilter.cc:17
Generated for CMSSW Reference Manual by
1.8.11