57 if (
params.exists(
"ignoreParticleIDs"))
61 (
params.exists(
"isMiniAOD") ?
params.getParameter<
bool>(
"isMiniAOD") : (
inTag.
label() ==
"packedGenParticles"));
65 <<
"Partonic final state not supported for MiniAOD. Falling back to the stable particle selection.";
69 produces<reco::CandidatePtrVector>();
108 std::vector<unsigned int>::const_iterator
pos =
115 std::vector<unsigned int>::const_iterator
pos =
121 InputGenJetsParticleSelector::ParticleVector::const_iterator
pos =
std::lower_bound(
p.begin(),
p.end(), particle);
122 if (
pos ==
p.end() || *
pos != particle)
123 throw cms::Exception(
"CorruptedData") <<
"reco::GenEvent corrupted: Unlisted particles" 127 return pos -
p.begin();
137 for (
unsigned int i = 0;
i <
npart; ++
i) {
155 for (
unsigned int i = 0;
i <
npart; ++
i) {
175 int id = particle->
pdgId();
191 for (
unsigned int i = 0;
i < nMo; ++
i) {
218 auto selected_ = std::make_unique<reco::CandidatePtrVector>();
229 if (iter->status() !=
238 std::map<const reco::Candidate *, size_t> particlePtrIdxMap;
242 particlePtrIdxMap[&*iter] = (iter -
genParticles->begin());
251 for (
unsigned int i = 0;
i <
size;
i++) {
255 if (particle->
status() == 1)
285 selected_->push_back(
genParticles->ptrAt(particlePtrIdxMap[particle]));
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
edm::EDGetTokenT< reco::CandidateView > input_genpartcoll_token_
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
static bool isHadron(int pdgId)
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
virtual int status() const =0
status word
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > excludeFromResonancePids
bool isIgnored(int pdgId) const
Log< level::Error, false > LogError
bool isParton(int pdgId) const
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &evtSetup) const override
bool hasPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
void setIgnoredParticles(const std::vector< unsigned int > &particleIDs)
virtual size_type numberOfDaughters() const =0
number of daughters
edm::EDGetTokenT< reco::CandidateView > input_prunedgenpartcoll_token_
std::vector< bool > ParticleBitmap
virtual int pdgId() const =0
PDG identifier.
static bool isResonance(int pdgId)
int testPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
static void invalidateTree(InputGenJetsParticleSelector::ParticleBitmap &invalid, const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
InputGenJetsParticleSelector()
std::vector< unsigned int > ignoreParticleIDs
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::InputTag prunedInTag
std::vector< const reco::Candidate * > ParticleVector
void setExcludeFromResonancePids(const std::vector< unsigned int > &particleIDs)
~InputGenJetsParticleSelector() override
bool isExcludedFromResonance(int pdgId) const
ResonanceState fromResonance(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const