1 #include "MergedGenParticleProducer.hh" 9 #include "HepPDT/ParticleID.hh" 14 input_packed_ = consumes<edm::View<pat::PackedGenParticle>>(
config.getParameter<
edm::InputTag>(
"inputPacked"));
16 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;
42 if (src.
status() != 1)
continue;
50 unsigned found_matches = 0;
51 for (
unsigned j = 0; j < packed_handle->size(); ++j) {
53 if ( pks.pdgId() != pk.
pdgId()
or pks.p4() != pk.
p4() )
continue;
55 st1_dup_map[&pk] = &
src;
57 if (found_matches > 1) {
58 edm::LogWarning(
"MergedGenParticleProducer") <<
"Found multiple packed matches for: " <<
i <<
"\t" << src.
pdgId() <<
"\t" << src.
pt() <<
"\t" << src.
y() <<
"\n";
60 else if (found_matches == 0 &&
std::abs(src.
y()) < 6.0) {
61 edm::LogWarning(
"MergedGenParticleProducer") <<
"unmatched status 1: " <<
i <<
"\t" << src.
pdgId() <<
"\t" << src.
pt() <<
"\t" << src.
y() <<
"\n";
67 unsigned int nPhotonsFromPrunedHadron = 0;
68 for (
unsigned int j = 0; j < packed_handle->size(); ++j) {
70 if (isPhotonFromPrunedHadron(pk)) ++nPhotonsFromPrunedHadron;
74 const unsigned int n = pruned_handle->size() + (packed_handle->size() - st1_dup_map.size()) + nPhotonsFromPrunedHadron;
78 for (
unsigned i = 0;
i < pruned_handle->size(); ++
i) {
94 for (
unsigned i = 0,
idx = pruned_handle->size();
i < packed_handle->size(); ++
i) {
96 if (st1_dup_map.count(&pk))
continue;
101 if (isPhotonFromPrunedHadron(pk)) {
141 if (not (motherid.isHadron() and pk.
mother(0)->
status() == 2))
return true;
const reco::Candidate * mother(size_type) const override
return mother at a given position (throws an exception)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
#define DEFINE_FWK_MODULE(type)
size_t numberOfMothers() const override
number of mothers
def setup(process, global_tag, zero_tesla=False)
double pt() const final
transverse momentum
double y() const final
rapidity
void setVertex(const Point &vertex) override
set vertex
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
void resetDaughters(const edm::ProductID &id)
set daughters product ID
virtual int status() const =0
status word
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
bool isDirectHadronDecayProduct() const
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Abs< T >::type abs(const T &t)
const LorentzVector & p4() const override
four-momentum Lorentz vecto r
void addMother(const typename mothers::value_type &)
add a daughter via a reference
int pdgId() const override
PDG identifier.
int charge() const override
electric charge
size_t numberOfDaughters() const override
number of daughters
const Point & vertex() const override
vertex position
const reco::GenStatusFlags & statusFlags() const
int status() const final
status word
virtual const Point & vertex() const =0
vertex position
void resetMothers(const edm::ProductID &id)
set mother product ID
size_t numberOfMothers() const override
number of mothers
void setP4(const LorentzVector &p4) final
set 4-momentum
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...