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)) {
140 HepPDT::ParticleID motherid(pk.
mother(0)->
pdgId());
141 if (not (motherid.isHadron() and pk.
mother(0)->
status() == 2))
return true;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
virtual size_t numberOfMothers() const
number of mothers
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)
virtual int status() const =0
status word
virtual double y() const final
rapidity
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 final
status word
virtual const Point & vertex() const
vertex position
virtual size_t numberOfMothers() const
number of mothers
bool isDirectHadronDecayProduct() const
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 const LorentzVector & p4() const
four-momentum Lorentz vecto r
Abs< T >::type abs(const T &t)
virtual const Point & vertex() const =0
vertex position
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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 int pdgId() const =0
PDG identifier.
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
const reco::GenStatusFlags & statusFlags() const
virtual int pdgId() const final
PDG identifier.
virtual const reco::Candidate * mother(size_type) const
return mother at a given position (throws an exception)
virtual int charge() const
electric charge
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) ...
virtual double pt() const final
transverse momentum
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector