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 private:
18  void analyze(const Event& event, const EventSetup& setup) override;
23 };
24 
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 
35  event.getByToken(genParticlesToken_, genParticles);
37  event.getByToken(srcToken_, src);
38  cout << ">>> event has " << src->size() << " reconstructed particles in {" << src_ << "}" <<endl;
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 
51 
53 
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
size_type size() const
void analyze(const Event &event, const EventSetup &setup) override
RefToBase< value_type > refAt(size_type i) const
DebugZMCTruth(const edm::ParameterSet &pset)
bool isNull() const
Checks for null.
Definition: Ref.h:250
EDGetTokenT< GenParticleCollection > genParticlesToken_
EDGetTokenT< CandidateView > srcToken_
fixed size matrix
HLT enums.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
EDGetTokenT< GenParticleMatch > matchToken_
Definition: event.py:1