CommonTools
UtilAlgos
interface
AssociationMapOneToOne2Association.h
Go to the documentation of this file.
1
#ifndef CommonTools_UtilAlgos_AssociationMapOneToOne2Association_h
2
#define CommonTools_UtilAlgos_AssociationMapOneToOne2Association_h
3
/* \class AssociationMapOneToOne2Association
4
*
5
* \author Luca Lista, INFN
6
*
7
* \version $Id: AssociationMapOneToOne2Association.h,v 1.2 2010/02/20 20:55:14 wmtan Exp $
8
*/
9
10
#include "
DataFormats/Common/interface/AssociationMap.h
"
11
#include "
DataFormats/Common/interface/OneToOne.h
"
12
#include "
DataFormats/Common/interface/Association.h
"
13
#include "
FWCore/Framework/interface/EDProducer.h
"
14
#include "
FWCore/Utilities/interface/InputTag.h
"
15
16
template
<
typename
CKey,
typename
CVal>
17
class
AssociationMapOneToOne2Association
:
public
edm::EDProducer
{
18
public
:
19
AssociationMapOneToOne2Association
(
const
edm::ParameterSet
&);
20
21
private
:
22
typedef
edm::AssociationMap<edm::OneToOne<CKey, CVal>
>
am_t
;
23
typedef
edm::Association<CVal>
as_t
;
24
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
25
edm::EDGetTokenT<am_t>
am_
;
26
};
27
28
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
29
#include "
FWCore/Framework/interface/Event.h
"
30
#include "
DataFormats/Common/interface/Handle.h
"
31
#include "
CommonTools/UtilAlgos/interface/ParameterAdapter.h
"
32
#include "
DataFormats/Common/interface/CloneTrait.h
"
33
34
template
<
typename
CKey,
typename
CVal>
35
AssociationMapOneToOne2Association<CKey, CVal>::AssociationMapOneToOne2Association
(
const
edm::ParameterSet
&
cfg
)
36
: am_(consumes<
am_t
>(
cfg
.
template
getParameter<
edm
::
InputTag
>(
"src"
))) {
37
produces<as_t>();
38
}
39
40
template
<
typename
CKey,
typename
CVal>
41
void
AssociationMapOneToOne2Association<CKey, CVal>::produce
(
edm::Event
& evt,
const
edm::EventSetup
&) {
42
using namespace
edm
;
43
using namespace
std
;
44
Handle<am_t>
am;
45
evt.
getByToken
(am_, am);
46
47
unique_ptr<as_t> as(
new
as_t
);
48
typename
as_t::Filler
filler
(*as);
49
filler
.fill();
50
size_t
size
= am->size();
51
vector<int>
indices
;
52
indices
.reserve(
size
);
53
for
(
typename
am_t::const_iterator
i
= am->begin();
i
!= am->end(); ++
i
) {
54
indices
.push_back(
i
->val.key());
55
}
56
filler
.insert(am->refProd().key,
indices
.begin(),
indices
.end());
57
evt.
put
(
std::move
(as));
58
}
59
60
#endif
bTagCombinedSVVariables_cff.indices
indices
Definition:
bTagCombinedSVVariables_cff.py:67
AssociationMapOneToOne2Association::am_t
edm::AssociationMap< edm::OneToOne< CKey, CVal > > am_t
Definition:
AssociationMapOneToOne2Association.h:22
Handle.h
mps_fire.i
i
Definition:
mps_fire.py:428
edm::Association::Filler
Definition:
Association.h:78
EDProducer.h
AssociationMapOneToOne2Association::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
AssociationMapOneToOne2Association.h:41
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
AssociationMap.h
AssociationMapOneToOne2Association::as_t
edm::Association< CVal > as_t
Definition:
AssociationMapOneToOne2Association.h:23
AssociationMapOneToOne2Association::AssociationMapOneToOne2Association
AssociationMapOneToOne2Association(const edm::ParameterSet &)
Definition:
AssociationMapOneToOne2Association.h:35
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:85964
OneToOne.h
Association.h
edm::Handle
Definition:
AssociativeIterator.h:50
CloneTrait.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:531
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
edm::AssociationMap
Definition:
AssociationMap.h:48
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
edm::Association
Definition:
Association.h:18
edm::EventSetup
Definition:
EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition:
svgfig.py:521
AssociationMapOneToOne2Association
Definition:
AssociationMapOneToOne2Association.h:17
InputTag.h
looper.cfg
cfg
Definition:
looper.py:297
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
AssociationMapOneToOne2Association::am_
edm::EDGetTokenT< am_t > am_
Definition:
AssociationMapOneToOne2Association.h:25
edm::EDProducer
Definition:
EDProducer.h:35
ParameterAdapter.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::AssociationMap::const_iterator
const iterator
Definition:
AssociationMap.h:76
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Generated for CMSSW Reference Manual by
1.8.16