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 and not (motherid.isHadron() and pk.
mother(0)->
status() == 2)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
virtual size_t numberOfMothers() const
number of mothers
#define DEFINE_FWK_MODULE(type)
def setup(process, global_tag, zero_tesla=False)
virtual int status() const final
status word
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 Point & vertex() const
vertex position
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual size_t numberOfMothers() const
number of mothers
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
virtual size_t numberOfDaughters() const
number of daughters
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual int pdgId() const final
PDG identifier.
virtual const LorentzVector & p4() const
four-momentum Lorentz vecto r
Abs< T >::type abs(const T &t)
virtual void setVertex(const Point &vertex)
set vertex
void addMother(const typename mothers::value_type &)
add a daughter via a reference
virtual int pdgId() const
PDG identifier.
virtual double y() const final
rapidity
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
const reco::GenStatusFlags & statusFlags() const
virtual const reco::Candidate * mother(size_type) const
return mother at a given position (throws an exception)
virtual int charge() const
electric charge
virtual const Point & vertex() const =0
vertex position
void resetMothers(const edm::ProductID &id)
set mother product ID
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...