3 #include "MergedGenParticleProducer.hh"
11 #include "HepPDT/ParticleID.hh"
15 input_packed_ = consumes<edm::View<pat::PackedGenParticle>>(
config.getParameter<
edm::InputTag>(
"inputPacked"));
17 produces<reco::GenParticleCollection>();
26 event.getByToken(input_pruned_, pruned_handle);
29 event.getByToken(input_packed_, packed_handle);
33 std::map<pat::PackedGenParticle const*, reco::GenParticle const*> st1_dup_map;
37 std::map<reco::Candidate const*, std::size_t> pruned_idx_map;
39 for (
unsigned int i = 0;
i < pruned_handle->size(); ++
i) {
41 pruned_idx_map[&
src] =
i;
51 unsigned found_matches = 0;
52 for (
unsigned j = 0;
j < packed_handle->size(); ++
j) {
54 if (pks.pdgId() != pk.
pdgId()
or pks.p4() != pk.
p4())
57 st1_dup_map[&pk] = &
src;
59 if (found_matches > 1) {
60 edm::LogWarning(
"MergedGenParticleProducer") <<
"Found multiple packed matches for: " <<
i <<
"\t" << src.
pdgId()
61 <<
"\t" << src.
pt() <<
"\t" << src.
y() <<
"\n";
62 }
else if (found_matches == 0 &&
std::abs(src.
y()) < 6.0) {
64 <<
"unmatched status 1: " <<
i <<
"\t" << src.
pdgId() <<
"\t" << src.
pt() <<
"\t" << src.
y() <<
"\n";
70 unsigned int nPhotonsFromPrunedHadron = 0;
71 for (
unsigned int j = 0;
j < packed_handle->size(); ++
j) {
73 if (isPhotonFromPrunedHadron(pk))
74 ++nPhotonsFromPrunedHadron;
78 const unsigned int n =
79 pruned_handle->size() + (packed_handle->size() - st1_dup_map.size()) + nPhotonsFromPrunedHadron;
80 auto cands = std::make_unique<reco::GenParticleCollection>(
n);
83 for (
unsigned i = 0;
i < pruned_handle->size(); ++
i) {
99 for (
unsigned i = 0, idx = pruned_handle->size();
i < packed_handle->size(); ++
i) {
101 if (st1_dup_map.count(&pk))
107 if (isPhotonFromPrunedHadron(pk)) {
146 HepPDT::ParticleID motherid(pk.
mother(0)->
pdgId());
147 if (not(motherid.isHadron() and pk.
mother(0)->
status() == 2))
const Point & vertex() const override
vertex position
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
double y() const final
rapidity
double pt() const final
transverse momentum
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
#define DEFINE_FWK_MODULE(type)
int charge() const override
electric charge
virtual int status() const =0
status word
size_t numberOfDaughters() const override
number of daughters
int status() const final
status word
size_t numberOfMothers() const override
number of mothers
void setVertex(const Point &vertex) override
set vertex
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
int pdgId() const final
PDG identifier.
void resetDaughters(const edm::ProductID &id)
set daughters product ID
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
size_t numberOfMothers() const override
number of mothers
bool isDirectHadronDecayProduct() const
Abs< T >::type abs(const T &t)
int pdgId() const override
PDG identifier.
virtual const Point & vertex() const =0
vertex position
void addMother(const typename mothers::value_type &)
add a daughter via a reference
virtual int pdgId() const =0
PDG identifier.
T getParameter(std::string const &) const
const reco::GenStatusFlags & statusFlags() const
tuple config
parse the configuration file
const reco::Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
Log< level::Warning, false > LogWarning
void resetMothers(const edm::ProductID &id)
set mother product ID
void setP4(const LorentzVector &p4) final
set 4-momentum
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector