Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
PhysicsTools
HepMCCandAlgos
interface
MCTruthCompositeMatcher.h
Go to the documentation of this file.
1
#ifndef HepMCCandAlgos_MCTruthCompositeMatcher
2
#define HepMCCandAlgos_MCTruthCompositeMatcher
3
/* \class MCTruthCompositeMatcher
4
*
5
* \author Luca Lista, INFN
6
*
7
*/
8
#include "
FWCore/Framework/interface/EDProducer.h
"
9
#include "
FWCore/Utilities/interface/InputTag.h
"
10
#include "PhysicsTools/HepMCCandAlgos/interface/MCCandMatcher.h"
11
12
template
<
typename
C1,
typename
C2 = C1>
13
class
MCTruthCompositeMatcher
:
public
edm::EDProducer
{
14
public
:
15
explicit
MCTruthCompositeMatcher
(
const
edm::ParameterSet
& );
16
~MCTruthCompositeMatcher
();
17
private
:
18
typedef
typename
CandMatcher<C1, C2>::map_type
map_type
;
19
edm::InputTag
src_
;
20
std::vector<edm::InputTag>
matchMaps_
;
21
void
produce
(
edm::Event
& ,
const
edm::EventSetup
& );
22
};
23
24
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
25
#include "
FWCore/Framework/interface/Event.h
"
26
#include "
DataFormats/Common/interface/Handle.h
"
27
28
template
<
typename
C1,
typename
C2>
29
MCTruthCompositeMatcher<C1, C2>::MCTruthCompositeMatcher
(
const
edm::ParameterSet
& cfg ) :
30
src_( cfg.
template
getParameter<edm::InputTag>(
"src"
) ),
31
matchMaps_( cfg.
template
getParameter<std::vector<edm::InputTag> >(
"matchMaps"
) ) {
32
produces<map_type>();
33
}
34
35
template
<
typename
C1,
typename
C2>
36
MCTruthCompositeMatcher<C1, C2>::~MCTruthCompositeMatcher
() {
37
}
38
39
template
<
typename
C1,
typename
C2>
40
void
MCTruthCompositeMatcher<C1, C2>::produce
(
edm::Event
& evt ,
const
edm::EventSetup
& ) {
41
typedef
typename
CandMatcher<C1, C2>::reference_type
reference_type;
42
Handle<C1>
cands;
43
evt.
getByLabel
(src_, cands);
44
45
size_t
nMaps = matchMaps_.size();
46
std::vector<const map_type *> maps;
47
maps.reserve( nMaps );
48
for
(
size_t
i
= 0;
i
!= nMaps; ++
i
) {
49
Handle<map_type>
matchMap;
50
evt.
getByLabel
( matchMaps_[
i
], matchMap );
51
maps.push_back( & * matchMap );
52
}
53
MCCandMatcher<C1, C2>
match
( maps );
54
auto_ptr<map_type> matchMap(
new
map_type
);
55
for
(
size_t
i
= 0;
i
!= cands->size(); ++
i
) {
56
const
typename
C1::value_type
& cand = ( * cands )[
i
];
57
reference_type mc(
match
( cand ));
58
if
( mc.isNonnull() ) {
59
matchMap->insert( reference_type( cands,
i
), mc );
60
}
61
}
62
63
evt.
put
( matchMap );
64
}
65
66
#endif
i
int i
Definition:
DBlmapReader.cc:9
MCTruthCompositeMatcher
Definition:
MCTruthCompositeMatcher.h:13
MCTruthCompositeMatcher::matchMaps_
std::vector< edm::InputTag > matchMaps_
Definition:
MCTruthCompositeMatcher.h:20
Event.h
Handle
MCTruthCompositeMatcher::src_
edm::InputTag src_
Definition:
MCTruthCompositeMatcher.h:19
Handle.h
MCTruthCompositeMatcher::MCTruthCompositeMatcher
MCTruthCompositeMatcher(const edm::ParameterSet &)
Definition:
MCTruthCompositeMatcher.h:29
edm::EDProducer
Definition:
EDProducer.h:21
MCTruthCompositeMatcher::map_type
CandMatcher< C1, C2 >::map_type map_type
Definition:
MCTruthCompositeMatcher.h:18
MCTruthCompositeMatcher::~MCTruthCompositeMatcher
~MCTruthCompositeMatcher()
Definition:
MCTruthCompositeMatcher.h:36
ParameterSet.h
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:85
edm::AssociationMap
Definition:
AssociationMap.h:21
edm::EventSetup
Definition:
EventSetup.h:44
cond::ecalcond::value_type
Container::value_type value_type
Definition:
EcalChannelStatusPyWrapper.cc:33
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:356
EDProducer.h
edm::InputTag
Definition:
InputTag.h:12
InputTag.h
edm::ParameterSet
Definition:
ParameterSet.h:35
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:6
MCTruthCompositeMatcher::produce
void produce(edm::Event &, const edm::EventSetup &)
Definition:
MCTruthCompositeMatcher.h:40
edm::Event
Definition:
Event.h:50
CandMatcherBase::reference_type
map_type::key_type reference_type
concrete candidate reference type
Definition:
CandMatcher.h:27
svgfig.template
def template
Definition:
svgfig.py:520
Generated for CMSSW Reference Manual by
1.8.5