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