CMS 3D CMS Logo

DebugZMCTruth.cc
Go to the documentation of this file.
9 #include <iostream>
10 using namespace edm;
11 using namespace std;
12 using namespace reco;
13 
15 public:
17 
18 private:
19  void analyze(const Event& event, const EventSetup& setup) override;
24 };
25 
27  : src_(cfg.getParameter<InputTag>("src")),
28  srcToken_(consumes<CandidateView>(src_)),
29  genParticlesToken_(consumes<GenParticleCollection>(cfg.getParameter<InputTag>("genParticles"))),
30  matchToken_(consumes<GenParticleMatch>(cfg.getParameter<InputTag>("mcMatch"))) {}
31 
34  event.getByToken(genParticlesToken_, genParticles);
36  event.getByToken(srcToken_, src);
37  cout << ">>> event has " << src->size() << " reconstructed particles in {" << src_ << "}" << endl;
39  event.getByToken(matchToken_, match);
40  cout << ">>> Z matches: ";
41  for (unsigned int i = 0; i < src->size(); ++i) {
42  CandidateBaseRef ref = src->refAt(i);
43  GenParticleRef mc = (*match)[ref];
44  cout << (mc.isNull() ? "(no)" : "(yes)");
45  }
46  cout << endl;
47 }
48 
50 
Handle.h
DebugZMCTruth::matchToken_
EDGetTokenT< GenParticleMatch > matchToken_
Definition: DebugZMCTruth.cc:23
mps_fire.i
i
Definition: mps_fire.py:428
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
edm::EDGetTokenT< CandidateView >
edm
HLT enums.
Definition: AlignableModifier.h:19
DebugZMCTruth::DebugZMCTruth
DebugZMCTruth(const edm::ParameterSet &pset)
Definition: DebugZMCTruth.cc:26
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
EDAnalyzer.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref< GenParticleCollection >
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
GenParticle.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
DebugZMCTruth::analyze
void analyze(const Event &event, const EventSetup &setup) override
Definition: DebugZMCTruth.cc:32
GenParticleFwd.h
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
Event.h
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:57
InputTag.h
looper.cfg
cfg
Definition: looper.py:297
std
Definition: JetResolutionObject.h:76
DebugZMCTruth
Definition: DebugZMCTruth.cc:14
edm::RefToBase< Candidate >
DebugZMCTruth::srcToken_
EDGetTokenT< CandidateView > srcToken_
Definition: DebugZMCTruth.cc:21
Candidate.h
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
DebugZMCTruth::genParticlesToken_
EDGetTokenT< GenParticleCollection > genParticlesToken_
Definition: DebugZMCTruth.cc:22
edm::InputTag
Definition: InputTag.h:15
DebugZMCTruth::src_
InputTag src_
Definition: DebugZMCTruth.cc:20
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27