Main Page
Namespaces
Classes
Package Documentation
ElectroWeakAnalysis
ZMuMu
plugins
DebugZMCTruth.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
2
#include "
FWCore/Utilities/interface/InputTag.h
"
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
DataFormats/Common/interface/Handle.h
"
6
#include "
DataFormats/Candidate/interface/Candidate.h
"
7
#include "
DataFormats/HepMCCandidate/interface/GenParticle.h
"
8
#include "
DataFormats/HepMCCandidate/interface/GenParticleFwd.h
"
9
#include <iostream>
10
using namespace
edm
;
11
using namespace
std
;
12
using namespace
reco
;
13
14
class
DebugZMCTruth
:
public
edm::EDAnalyzer
{
15
public
:
16
DebugZMCTruth
(
const
edm::ParameterSet
&
pset
);
17
private
:
18
virtual
void
analyze
(
const
Event
&
event
,
const
EventSetup
&
setup
)
override
;
19
InputTag
src_
;
20
EDGetTokenT<CandidateView>
srcToken_
;
21
EDGetTokenT<GenParticleCollection>
genParticlesToken_
;
22
EDGetTokenT<GenParticleMatch>
matchToken_
;
23
};
24
25
DebugZMCTruth::DebugZMCTruth
(
const
ParameterSet
&
cfg
) :
26
src_(cfg.getParameter<
InputTag
>(
"src"
)),
27
srcToken_(consumes<
CandidateView
>(src_)),
28
genParticlesToken_(consumes<
GenParticleCollection
>(cfg.getParameter<
InputTag
>(
"genParticles"
))),
29
matchToken_(consumes<
GenParticleMatch
>(cfg.getParameter<
InputTag
>(
"mcMatch"
))) {
30
}
31
32
33
void
DebugZMCTruth::analyze
(
const
Event
&
event
,
const
EventSetup
&
setup
) {
34
Handle<GenParticleCollection>
genParticles
;
35
event
.getByToken(
genParticlesToken_
, genParticles);
36
Handle<CandidateView>
src
;
37
event
.getByToken(
srcToken_
, src);
38
cout
<<
">>> event has "
<< src->
size
() <<
" reconstructed particles in {"
<<
src_
<<
"}"
<<endl;
39
Handle<GenParticleMatch>
match
;
40
event
.getByToken(
matchToken_
, match);
41
cout
<<
">>> Z matches: "
;
42
for
(
unsigned
int
i
= 0;
i
< src->
size
(); ++
i
) {
43
CandidateBaseRef
ref = src->
refAt
(
i
);
44
GenParticleRef
mc
= (*match)[ref];
45
cout
<< (mc.
isNull
() ?
"(no)"
:
"(yes)"
);
46
}
47
cout
<< endl;
48
}
49
50
#include "
FWCore/Framework/interface/MakerMacros.h
"
51
52
DEFINE_FWK_MODULE
(
DebugZMCTruth
);
53
CaloTowersParam_cfi.mc
mc
Definition:
CaloTowersParam_cfi.py:7
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition:
GenParticleFwd.h:10
mps_fire.i
i
Definition:
mps_fire.py:156
Vispa.Share.Profiling.analyze
def analyze(function, filename, filter=None)
Definition:
Profiling.py:11
edm::Ref< GenParticleCollection >
GenParticle.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:47
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
GeneralSetup.setup
def setup(process, global_tag, zero_tesla=False)
Definition:
GeneralSetup.py:1
edm::View::size
size_type size() const
std
Definition:
JetResolutionObject.h:76
DebugZMCTruth::analyze
virtual void analyze(const Event &event, const EventSetup &setup) override
Definition:
DebugZMCTruth.cc:33
edm::EDGetTokenT< CandidateView >
edm::RefToBase< Candidate >
ParameterSet.h
edm::View::refAt
RefToBase< value_type > refAt(size_type i) const
Candidate.h
edm::Association
Definition:
Association.h:18
edm::View
Definition:
CaloClusterFwd.h:14
DebugZMCTruth::DebugZMCTruth
DebugZMCTruth(const edm::ParameterSet &pset)
Definition:
DebugZMCTruth.cc:25
DebugZMCTruth::src_
InputTag src_
Definition:
DebugZMCTruth.cc:19
GenParticleFwd.h
edm::EventSetup
Definition:
EventSetup.h:44
DebugZMCTruth
Definition:
DebugZMCTruth.cc:14
GenHFHadronMatcher_cfi.genParticles
genParticles
Definition:
GenHFHadronMatcher_cfi.py:4
looper.cfg
cfg
Definition:
looper.py:293
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition:
Ref.h:250
edm::EDAnalyzer
Definition:
EDAnalyzer.h:27
EDAnalyzer.h
DebugZMCTruth::genParticlesToken_
EDGetTokenT< GenParticleCollection > genParticlesToken_
Definition:
DebugZMCTruth.cc:21
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:35
DebugZMCTruth::srcToken_
EDGetTokenT< CandidateView > srcToken_
Definition:
DebugZMCTruth.cc:20
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:43
edm
HLT enums.
Definition:
AlignableModifier.h:17
edm::InputTag
Definition:
InputTag.h:15
InputTag.h
edm::ParameterSet
Definition:
ParameterSet.h:36
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
gather_cfg.cout
cout
Definition:
gather_cfg.py:145
edm::Event
Definition:
Event.h:66
DebugZMCTruth::matchToken_
EDGetTokenT< GenParticleMatch > matchToken_
Definition:
DebugZMCTruth.cc:22
event
Definition:
event.py:1
Handle.h
Generated for CMSSW Reference Manual by
1.8.11