1 #include "MergedGenParticleProducer.hh"
9 #include "HepPDT/ParticleID.hh"
12 input_pruned_ = consumes<edm::View<reco::GenParticle>>(
config.getParameter<
edm::InputTag>(
"inputPruned"));
13 input_packed_ = consumes<edm::View<pat::PackedGenParticle>>(
config.getParameter<
edm::InputTag>(
"inputPacked"));
15 produces<reco::GenParticleCollection>();
24 event.getByToken(input_pruned_, pruned_handle);
27 event.getByToken(input_packed_, packed_handle);
31 std::map<pat::PackedGenParticle const*, reco::GenParticle const*> st1_dup_map;
35 std::map<reco::Candidate const*, std::size_t> pruned_idx_map;
37 for (
unsigned int i = 0;
i < pruned_handle->size(); ++
i) {
39 pruned_idx_map[&
src] =
i;
40 if (
src.status() != 1)
49 unsigned found_matches = 0;
50 for (
unsigned j = 0;
j < packed_handle->size(); ++
j) {
52 if (pks.pdgId() != pk.
pdgId()
or pks.p4() != pk.
p4())
55 st1_dup_map[&pk] = &
src;
57 if (found_matches > 1) {
58 edm::LogWarning(
"MergedGenParticleProducer") <<
"Found multiple packed matches for: " <<
i <<
"\t" <<
src.pdgId()
59 <<
"\t" <<
src.pt() <<
"\t" <<
src.y() <<
"\n";
60 }
else if (found_matches == 0 &&
std::abs(
src.y()) < 6.0) {
62 <<
"unmatched status 1: " <<
i <<
"\t" <<
src.pdgId() <<
"\t" <<
src.pt() <<
"\t" <<
src.y() <<
"\n";
68 unsigned int nPhotonsFromPrunedHadron = 0;
69 for (
unsigned int j = 0;
j < packed_handle->size(); ++
j) {
71 if (isPhotonFromPrunedHadron(pk))
72 ++nPhotonsFromPrunedHadron;
76 const unsigned int n =
77 pruned_handle->size() + (packed_handle->size() - st1_dup_map.size()) + nPhotonsFromPrunedHadron;
81 for (
unsigned i = 0;
i < pruned_handle->size(); ++
i) {
97 for (
unsigned i = 0,
idx = pruned_handle->size();
i < packed_handle->size(); ++
i) {
99 if (st1_dup_map.count(&pk))
105 if (isPhotonFromPrunedHadron(pk)) {
145 if (not(motherid.isHadron() and pk.
mother(0)->
status() == 2))