Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
MetTreeProducer.var
def var
Definition:
MetTreeProducer.py:3
SelectionAdderTrait.h
looper.cfg
tuple cfg
Definition:
looper.py:237
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:446
AssociatedVariableCollectionSelector
Definition:
AssociatedVariableCollectionSelector.h:30
AssociatedVariableCollectionSelector::selector
Selector selector
Definition:
AssociatedVariableCollectionSelector.h:34
Event.h
edmConvertToStreamModule.modules
list modules
Definition:
edmConvertToStreamModule.py:120
edm::Handle
Definition:
AssociativeIterator.h:47
init
int init
Definition:
HydjetWrapper.h:62
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
funct::C
C
Definition:
Factorize.h:141
Handle.h
AssociatedVariableCollectionSelector::AssociatedVariableCollectionSelector
AssociatedVariableCollectionSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
AssociatedVariableCollectionSelector.h:36
dt_dqm_sourceclient_common_cff.reco
tuple reco
Definition:
dt_dqm_sourceclient_common_cff.py:107
EnergyCorrector.c
tuple c
Definition:
EnergyCorrector.py:43
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
Exhume::I
const std::complex< double > I
Definition:
I.h:8
edm::EventSetup
Definition:
EventSetup.h:44
Selector
Functor that operates on <T>
Definition:
Selector.h:24
AssociatedVariableCollectionSelector::selected_
container selected_
Definition:
AssociatedVariableCollectionSelector.h:52
customizeTrackingMonitorSeedNumber.idx
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
Definition:
customizeTrackingMonitorSeedNumber.py:15
reco::Selector
Definition:
Expressions.h:20
reco::modules::EventSetupInit
Definition:
EventSetupInitTrait.h:35
alignCSCRings.s
list s
Definition:
alignCSCRings.py:91
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
StoreContainerTrait.h
InputTag.h
ParameterAdapter.h
edm::ParameterSet
Definition:
ParameterSet.h:35
edm::Event
Definition:
Event.h:59
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
svgfig.template
def template
Definition:
svgfig.py:520
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:32
Generated for CMSSW Reference Manual by
1.8.5